:root {
  --menu-surface: rgba(20, 22, 28, 0.9);
  --green:  #45c98e;
  --green2: #39a474;
  --yellow: #b59f3b;
}

/* ─── AMBIENT GLOW BEHIND LOGO ─────────────────────── */
#screen-main-menu {
  overflow: hidden;
}
#screen-main-menu::before {
  content: '';
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 340px;
  height: 340px;
  background: radial-gradient(ellipse at center,
    rgba(69, 201, 142, 0.13) 0%,
    rgba(69, 201, 142, 0.04) 55%,
    transparent 72%);
  pointer-events: none;
  z-index: 0;
  animation: glow-breathe 5s ease-in-out infinite;
}

@keyframes glow-breathe {
  0%, 100% { opacity: 0.7; transform: translateX(-50%) scale(1); }
  50%       { opacity: 1;   transform: translateX(-50%) scale(1.12); }
}

.menu-content {
  position: relative;
  z-index: 1;
  padding: 0 20px 28px;
  gap: 0;
}

/* ─── LOGO TILES ────────────────────────────────────── */
.logo-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
}

.title-tile-row {
  display: flex;
  gap: 7px;
}

.title-tile {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, rgba(255,255,255,0.16) 0%, rgba(255,255,255,0.04) 100%);
  border: 1px solid rgba(255,255,255,0.2);
  font-family: var(--font-main, 'Inter', sans-serif);
  font-size: 1.9rem;
  font-weight: 800;
  color: #f0f0f0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.15);
  transform: translateY(-60px);
  opacity: 0;
  animation: lc-drop 400ms cubic-bezier(0.19, 1, 0.22, 1) forwards;
  animation-delay: var(--drop-delay, 0ms);
}

.title-tile.core {
  border-color: rgba(69, 201, 142, 0.7);
  color: var(--green);
  box-shadow: 0 8px 28px rgba(69, 201, 142, 0.25), 0 8px 24px rgba(0,0,0,0.5), inset 0 1px 0 rgba(69,201,142,0.2);
}

@keyframes lc-drop {
  0%   { transform: translateY(-60px); opacity: 0; }
  100% { transform: translateY(0);     opacity: 1; }
}

/* ─── PLAY CTA ──────────────────────────────────────── */
.play-cta-btn {
  width: 100%;
  max-width: 340px;
  height: 58px;
  margin: 0 0 18px;
  border-radius: 16px;
  border: 1px solid rgba(69, 201, 142, 0.65);
  background: linear-gradient(160deg,
    rgba(69, 201, 142, 0.38) 0%,
    rgba(57, 164, 116, 0.22) 100%);
  color: #fff;
  font-weight: 900;
  letter-spacing: 0.12em;
  font-size: 1.2rem;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 0 0 rgba(69,201,142,0.3), 0 6px 20px rgba(0,0,0,0.45);
  animation: cta-pulse 3.5s ease-in-out infinite;
  transition: transform 0.15s, box-shadow 0.15s;
}
.play-cta-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 55%);
  pointer-events: none;
}
.play-cta-btn:hover  { transform: translateY(-2px); }
.play-cta-btn:active { transform: translateY(1px); animation: none;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4); }

@keyframes cta-pulse {
  0%, 100% { box-shadow: 0 0 0   0   rgba(69,201,142,0.25), 0 6px 20px rgba(0,0,0,0.45); }
  50%       { box-shadow: 0 0 28px 4px rgba(69,201,142,0.35), 0 6px 20px rgba(0,0,0,0.45); }
}

/* ─── MENU BUTTONS GRID ─────────────────────────────── */
.menu-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  width: 100%;
  max-width: 340px;
}

.menu-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 14px;
  color: rgba(255,255,255,0.75);
  padding: 14px 8px 12px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: auto;
  min-height: 70px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.18s, border-color 0.18s, transform 0.15s, color 0.18s;
  position: relative;
  overflow: hidden;
}
.menu-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(255,255,255,0.06) 0%, transparent 60%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s;
}
.menu-btn:hover  { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.2);
  color: #fff; transform: translateY(-2px); }
.menu-btn:hover::before { opacity: 1; }
.menu-btn:active { transform: translateY(0); background: rgba(255,255,255,0.05); }

.menu-btn .icon {
  font-size: 20px;
  color: var(--green);
  opacity: 0.9;
  line-height: 1;
}

.menu-button-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.menu-button-row .menu-btn {
  width: 100%;
  grid-column: auto;
  flex-direction: column;
  height: auto;
}

/* ─── SCREEN TRANSITIONS ────────────────────────────── */
@keyframes screen-in {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.screen:not(.hidden) {
  animation: screen-in 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ─── PLAY MODES SCREEN ─────────────────────────────── */
.play-hub-content {
  justify-content: flex-start;
  padding-top: 12px;
  overflow-y: auto;
}

.mode-cards-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 480px;
  padding: 4px 16px 20px;
}

/* stagger entrance */
.mode-card:nth-child(1) { animation-delay: 40ms; }
.mode-card:nth-child(2) { animation-delay: 100ms; }
.mode-card:nth-child(3) { animation-delay: 160ms; }
.mode-card:nth-child(4) { animation-delay: 220ms; }
.mode-card:nth-child(5) { animation-delay: 280ms; }

.mode-card {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 16px;
  padding: 15px 16px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 15px;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.18s, border-color 0.18s, transform 0.18s;
  animation: screen-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.mode-card::after {
  content: '›';
  margin-left: auto;
  font-size: 1.5rem;
  line-height: 1;
  color: rgba(255,255,255,0.2);
  flex-shrink: 0;
  transition: color 0.18s, transform 0.18s;
}

.mode-card:hover {
  background: rgba(69, 201, 142, 0.08);
  border-color: rgba(69, 201, 142, 0.28);
  transform: translateX(4px);
  box-shadow: none;
}
.mode-card:hover::after {
  color: var(--green);
  transform: translateX(3px);
}
.mode-card:active {
  transform: translateX(2px);
  background: rgba(69, 201, 142, 0.05);
}

.mode-icon {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: rgba(69, 201, 142, 0.13);
  border: 1px solid rgba(69, 201, 142, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--green);
  flex-shrink: 0;
}

/* per-mode icon tints */
.mode-card:nth-child(1) .mode-icon { /* Tutorial */
  background: rgba(181, 159, 59, 0.13);
  border-color: rgba(181, 159, 59, 0.25);
  color: var(--yellow);
}
.mode-card:nth-child(4) .mode-icon { /* Hard */
  background: rgba(235, 77, 75, 0.13);
  border-color: rgba(235, 77, 75, 0.25);
  color: #eb4d4b;
}
.mode-card:nth-child(5) .mode-icon { /* Number Core / Other */
  background: rgba(99, 140, 235, 0.13);
  border-color: rgba(99, 140, 235, 0.25);
  color: #638ceb;
}

.mode-card.rogue-card .mode-icon { /* Rogue Dungeon - Bluish Purple */
  background: rgba(129, 140, 248, 0.13);
  border-color: rgba(129, 140, 248, 0.25);
  color: #818cf8;
}

.mode-card h3 {
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #fff;
  margin: 0 0 3px;
  text-transform: uppercase;
}
.mode-card p {
  font-size: 0.73rem;
  color: rgba(255,255,255,0.42);
  margin: 0;
  line-height: 1.35;
}
.mode-card:hover h3 { color: #fff; }

/* ─── DIFFICULTY PICKER ─────────────────────────────── */
.mode-difficulty-picker {
  position: absolute;
  inset: 0;
  background: rgba(6, 10, 18, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 220;
  animation: screen-in 0.2s ease both;
}

.mode-difficulty-card {
  width: min(400px, 92vw);
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.14);
  background: linear-gradient(160deg, rgba(24,30,42,0.98) 0%, rgba(14,18,26,0.98) 100%);
  padding: 22px 18px 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
  text-align: center;
}

.mode-difficulty-card h3 {
  margin: 0 0 6px;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.mode-difficulty-card p {
  margin: 0 0 16px;
  color: rgba(255,255,255,0.55);
  font-size: 0.85rem;
}

.mode-difficulty-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.mode-difficulty-btn {
  min-height: 80px;
  border-radius: 14px;
  border: 1px solid rgba(69, 201, 142, 0.3);
  background: rgba(69, 201, 142, 0.1);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.05em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.mode-difficulty-btn:hover {
  background: rgba(69, 201, 142, 0.2);
  border-color: rgba(69, 201, 142, 0.55);
  transform: translateY(-2px);
}
.mode-difficulty-btn:active { transform: translateY(0); }

.mode-difficulty-btn small {
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255,255,255,0.65);
}

.mode-difficulty-cancel {
  width: 100%;
}

/* ─── BACK / NAV BUTTONS ────────────────────────────── */
.apps-btn .back-label,
.back-btn .back-label {
  margin-left: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* Apps button — exits to portfolio, muted */
.apps-btn {
  color: rgba(255,255,255,0.45) !important;
  font-size: 13px !important;
}
.apps-btn i { font-size: 11px !important; }
.apps-btn:hover { color: rgba(255,255,255,0.75) !important; }

/* In-game back button — white, slightly larger */
.back-btn {
  color: rgba(255,255,255,0.82) !important;
  font-size: 14px !important;
}
.back-btn i { font-size: 12px !important; }

/* ─── COOKIE CONSENT ────────────────────────────────── */
.cookie-consent {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1100;
  padding: 10px 14px;
  background: rgba(5, 9, 16, 0.96);
  border-top: 1px solid rgba(255,255,255,0.1);
}
.cookie-consent.hidden { display: none; }

.cookie-consent-inner {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.cookie-copy h3 { margin: 0 0 4px; }
.cookie-copy p  { margin: 0; opacity: 0.75; font-size: 0.85rem; }

.cookie-actions { display: flex; gap: 10px; }

.cookie-btn {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid rgba(255,255,255,0.22);
  background: transparent;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.cookie-btn.primary {
  border-color: rgba(69, 201, 142, 0.75);
  background: rgba(69, 201, 142, 0.2);
}

/* ─── DICTIONARY UI ─────────────────────────────────── */
.dictionary-search-input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: white;
  font-family: inherit;
  font-size: 14px;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}
.dictionary-search-input:focus {
  border-color: rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.08);
}

.dictionary-sort-select {
  padding: 10px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: white;
  font-family: inherit;
  font-size: 14px;
  border-radius: 8px;
  outline: none;
  cursor: pointer;
}
.dictionary-sort-select option { background: #111; color: white; }

.dictionary-filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
}
.dictionary-chip {
  padding: 5px 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.55);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}
.dictionary-chip:hover { background: rgba(255,255,255,0.1); color: white; }
.dictionary-chip.active { background: white; color: black; border-color: white; }

/* ─── RESPONSIVE ────────────────────────────────────── */
@media (max-width: 400px) {
  .title-tile { width: 44px; height: 44px; font-size: 1.6rem; border-radius: 10px; }
  .play-cta-btn { height: 52px; font-size: 1.05rem; }
  .menu-btn { min-height: 64px; font-size: 0.63rem; }
  .mode-difficulty-options { grid-template-columns: 1fr; }
  .cookie-consent-inner { flex-direction: column; align-items: flex-start; }
}
