/* Mobile View for Chicken Road - Pixel Matched with Screenshot */
:root {
  --bg: #141619;
  --card-bg: #23252a;
  --input-bg: #2e3137;
  --btn-sub: #383c44;
  --border: #353941;
  --text: #ffffff;
  --text-muted: #9ba1ad;
  --green: #22c55e;
  --green-hover: #16a34a;
  --green-shadow: rgba(34, 197, 94, 0.35);
  --gold: #f59e0b;
  --gold-hover: #d97706;
  --red: #ef4444;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: #0d0f12;
  color: var(--text);
  font-family: 'DM Sans', 'Noto Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* App Mobile Shell Container */
.cr-shell {
  width: 100%;
  max-width: 480px;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.7);
}

/* Top Header Bar */
.cr-topbar {
  height: 52px;
  padding: 0 16px;
  background: #181a1e;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  z-index: 20;
}

.cr-logo-wrap {
  display: flex;
  align-items: center;
  font-weight: 900;
  letter-spacing: -0.01em;
  font-size: 1.15rem;
}

.cr-logo-chicken {
  color: #ffffff;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.cr-logo-2 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ff3344;
  font-size: 1.35rem;
  font-weight: 900;
  margin: 0 2px;
  text-shadow: 0 0 10px rgba(255, 51, 68, 0.5);
  transform: scale(1.05);
}

.cr-logo-road {
  color: #ffffff;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.cr-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Balance Pill */
.cr-balance-pill {
  display: flex;
  align-items: center;
  background: #2e3137;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.cr-coin-tag {
  font-size: 9px;
  font-weight: 900;
  color: #1a1c20;
  background: #ffffff;
  border-radius: 999px;
  padding: 1px 5px;
  margin-left: 6px;
  letter-spacing: 0.04em;
}

/* Menu Button */
.cr-menu-btn {
  background: transparent;
  border: none;
  color: #9ba1ad;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.15s ease;
}

.cr-menu-btn:hover, .cr-menu-btn:active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.cr-menu-icon {
  width: 24px;
  height: 24px;
}

/* Sub-header Live Wins Bar (Overlay) */
.cr-subbar {
  position: absolute;
  top: 54px;
  left: 0;
  right: 0;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 700;
  z-index: 15;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(20, 22, 26, 0.85) 0%, rgba(20, 22, 26, 0.3) 70%, transparent 100%);
}

.cr-live-wins {
  display: flex;
  align-items: center;
  gap: 5px;
}

.cr-sub-muted {
  color: #94a3b8;
  font-weight: 600;
}

.cr-player-dot {
  font-size: 9px;
}

.cr-player-name {
  color: #f1f5f9;
  font-weight: 700;
}

.cr-win-amount {
  color: #22c55e;
  font-weight: 800;
}

.cr-online-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(15, 23, 42, 0.45);
  padding: 3px 8px;
  border-radius: 6px;
  backdrop-blur-sm: 4px;
}

.cr-online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e;
}

.cr-online-count {
  color: #ffffff;
  font-weight: 800;
}

/* Stage Canvas */
.cr-stage {
  flex: 1;
  position: relative;
  overflow: hidden;
  width: 100%;
  background: #404246;
}

#game {
  width: 100%;
  height: 100%;
  display: block;
}

/* Toast Message */
.cr-toast {
  position: absolute;
  top: 48px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.94);
  color: #ffffff;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  z-index: 25;
  pointer-events: none;
  animation: crToastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.cr-toast.win {
  border-color: #22c55e;
  color: #86efac;
}

.cr-toast.lose {
  border-color: #ef4444;
  color: #fca5a5;
}

@keyframes crToastIn {
  from { opacity: 0; transform: translate(-50%, -10px) scale(0.92); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

/* Bottom Control Panel */
.cr-panel {
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  padding: 14px 16px calc(14px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.45);
  z-index: 20;
}

/* Row 1: Bet Amount & Min / Max */
.cr-bet-row {
  display: flex;
  align-items: center;
  background: var(--input-bg);
  border-radius: 12px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.cr-minmax-btn {
  background: var(--btn-sub);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.cr-minmax-btn:active {
  transform: scale(0.95);
  background: #464b54;
}

.cr-minmax-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.cr-bet-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

#bet-input {
  width: 100%;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 1.15rem;
  font-weight: 900;
  text-align: center;
  outline: none;
  font-family: inherit;
}

#bet-input:disabled {
  opacity: 0.6;
}

/* Row 2: Preset Chips */
.cr-presets-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.cr-preset-chip {
  background: var(--input-bg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 8px 4px;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.cr-preset-chip:active {
  transform: scale(0.95);
  background: var(--btn-sub);
}

.cr-preset-chip.is-active {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
}

.cr-preset-chip:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.cr-chip-etb {
  font-size: 8px;
  font-weight: 900;
  color: #141619;
  background: #ffffff;
  border-radius: 999px;
  padding: 1px 4px;
}

/* Row 3: Difficulty Dropdown */
.cr-diff-wrap {
  position: relative;
  width: 100%;
}

.cr-diff-btn {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 11px 16px;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.12s ease;
}

.cr-diff-btn:active {
  background: var(--btn-sub);
}

.cr-diff-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.cr-diff-arrow {
  width: 18px;
  height: 18px;
  color: #9ba1ad;
  transition: transform 0.2s ease;
}

.cr-diff-wrap.is-open .cr-diff-arrow {
  transform: rotate(180deg);
}

.cr-diff-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #202227;
  border: 1px solid #3c4049;
  border-radius: 12px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.65);
  z-index: 50;
  animation: crPopUp 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.cr-diff-menu.hidden {
  display: none;
}

@keyframes crPopUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.cr-diff-item {
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 10px 12px;
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  cursor: pointer;
  transition: all 0.12s ease;
}

.cr-diff-item:hover, .cr-diff-item:active {
  background: rgba(255, 255, 255, 0.08);
}

.cr-diff-item.is-selected {
  background: rgba(34, 197, 94, 0.16);
  color: #86efac;
}

.cr-diff-sub {
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 500;
  margin-top: 2px;
}

/* Row 4: Primary Action Buttons */
.cr-action-row {
  width: 100%;
}

.cr-play-btn {
  width: 100%;
  min-height: 52px;
  background: var(--green);
  color: #ffffff;
  border: none;
  border-radius: 14px;
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 6px 20px var(--green-shadow);
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cr-play-btn:hover {
  background: var(--green-hover);
}

.cr-play-btn:active {
  transform: scale(0.98);
  box-shadow: 0 2px 10px var(--green-shadow);
}

.cr-play-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.cr-play-btn.hidden {
  display: none !important;
}

/* In-Play Action Group (Cash Out & Go) */
.cr-inplay-group {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 8px;
  width: 100%;
}

.cr-inplay-group.hidden {
  display: none !important;
}

.cr-cashout-btn {
  min-height: 52px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  border: none;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.15;
  transition: all 0.15s ease;
}

.cr-cashout-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.cr-cashout-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
  background: #3a3d45;
}

.cr-cashout-val {
  font-size: 0.78rem;
  font-weight: 800;
  opacity: 0.95;
}

.cr-go-btn {
  min-height: 52px;
  background: var(--green);
  color: #ffffff;
  border: none;
  border-radius: 14px;
  font-size: 1.2rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 6px 18px var(--green-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.cr-go-btn:hover {
  background: var(--green-hover);
}

.cr-go-btn:active {
  transform: scale(0.98);
}

.cr-go-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.cr-go-icon {
  font-size: 1.25rem;
  transition: transform 0.15s ease;
}

.cr-go-btn:active .cr-go-icon {
  transform: translateX(3px);
}

/* Slide-out Menu / Drawer */
.cr-menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  justify-content: flex-end;
}

.cr-menu-backdrop.hidden {
  display: none;
}

.cr-drawer {
  width: min(320px, 85%);
  height: 100%;
  background: #1e2025;
  border-left: 1px solid #33373e;
  padding: 20px;
  display: flex;
  flex-direction: column;
  animation: crSlideIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes crSlideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.cr-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 14px;
  margin-bottom: 16px;
}

.cr-drawer-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
}

.cr-close-btn {
  background: #2b2e35;
  border: none;
  color: #9ba1ad;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
}

.cr-drawer-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cr-menu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #26282f;
  border-radius: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  text-decoration: none;
  color: #ffffff;
}

.cr-clickable {
  cursor: pointer;
}

.cr-clickable:hover {
  background: #2e313a;
}

.cr-switch-btn {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
  border: 1px solid #22c55e;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 6px 12px;
  cursor: pointer;
}

.cr-toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.cr-toggle-switch input { display: none; }

.cr-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #40444c;
  transition: 0.2s;
  border-radius: 24px;
}

.cr-slider:before {
  position: absolute;
  content: '';
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
}

input:checked + .cr-slider {
  background-color: #22c55e;
}

input:checked + .cr-slider:before {
  transform: translateX(20px);
}

.cr-arrow {
  font-size: 1.2rem;
  color: #9ba1ad;
}

/* How to Play Modal */
.cr-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.cr-modal-backdrop.hidden {
  display: none;
}

.cr-rules-card {
  width: min(390px, 100%);
  background: #202227;
  border: 1px solid #383c44;
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75);
}

.cr-rules-card h3 {
  margin: 0 0 14px;
  font-size: 1.15rem;
  font-weight: 800;
}

.cr-rules-card ol {
  margin: 0 0 20px;
  padding-left: 20px;
  line-height: 1.6;
  font-size: 0.88rem;
  color: #cbd5e1;
}

.cr-rules-card li {
  margin-bottom: 8px;
}
