/* ================= ANA MENU ================= */
/* Centered with auto margins (not justify-content) so a short screen scrolls instead of cutting the title */
#screen-menu { justify-content: flex-start; position: relative; padding: 64px 20px 20px; overflow-y: auto; }
#screen-menu #menu-center { margin: auto 0; }
#menu-topbar {
  position: absolute; top: 18px; left: 16px; right: 16px;
  display: flex; justify-content: space-between; align-items: center;
}
#signin-chip {
  display: flex; align-items: center; gap: 8px;
  background: rgba(var(--fg-rgb),0.12);
  border: none;
  border-radius: 20px; padding: 7px 14px 7px 10px;
  color: var(--fg); font-size: 12px; font-weight: 700;
}
#signin-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: #ff5252; flex-shrink:0; }
#google-btn-wrap { display: flex; justify-content: center; min-height: 44px; margin: 6px 0 4px; }
.signin-note { display: block; text-align: center; font-size: 13px; opacity: 0.8; margin: 6px 0; color: inherit; }
#signin-chip.signed-in .dot { background: #4ecb71; }
.menu-topbar-right { display: flex; gap: 8px; }
#help-btn { width: 30px; height: 30px; border-radius: 50%; border: none; background: rgba(var(--fg-rgb),0.15); color: var(--fg); font-weight: 900; font-size: 15px; }
#menu-center { display: flex; flex-direction: column; align-items: center; gap: 12px; }
#menu-title {
  font-size: 42px; font-weight: 900; color: var(--fg); letter-spacing: 3px;
  text-shadow: 0 4px 14px rgba(0,0,0,0.4);
  text-align: center; line-height: 1.1;
}
#menu-sub { color: rgba(var(--fg-rgb),0.6); font-size: 12px; margin-bottom: 20px; letter-spacing: 2px; }
.menu-btn {
  width: min(84vw, 320px);
  padding: 16px 20px;
  border-radius: 18px;
  border: none;
  font-size: 17px; font-weight: 800; letter-spacing: 1px;
  color: #fff;
  background: linear-gradient(145deg, #5b3bd6, #3a1ea0);
  box-shadow: 0 5px 0 rgba(0,0,0,0.3), 0 4px 10px rgba(0,0,0,0.25);
  transition: transform 0.12s, box-shadow 0.12s;
}
.menu-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,0.3); }
.menu-btn.secondary { background: linear-gradient(145deg, #342a5c, #241a44); }
.menu-btn.ghost { background: rgba(255,255,255,0.08); box-shadow: none; opacity: 0.85; }

/* ================= HARITA (SEVIYE SECIMI) ================= */
#screen-map { flex-direction: column; align-items: stretch; }
.sub-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; color: var(--fg); flex-shrink: 0;
  width: min(100%, 560px); margin: 0 auto; /* stays next to the content on wide screens */
}
.sub-title { font-weight: 800; letter-spacing: 2px; font-size: 14px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; border: none;
  background: rgba(var(--fg-rgb),0.15); color: var(--fg); font-size: 18px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
/* Back button: a soft round chip with a drawn chevron (same everywhere) */
.icon-btn.back {
  width: 40px; height: 40px; cursor: pointer;
  background: rgba(var(--fg-rgb),0.1);
  box-shadow: inset 0 0 0 1px rgba(var(--fg-rgb),0.14), 0 2px 6px rgba(0,0,0,0.08);
  transition: transform 0.12s, background 0.15s;
}
.icon-btn.back svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; transform: translateX(-1px); }
.icon-btn.back:hover { background: rgba(var(--fg-rgb),0.16); }
.icon-btn.back:active { transform: scale(0.9); }
/* On a panel (multiplayer lobby / results) the back button sits in the top-left corner */
.mp-panel { position: relative; }
.mp-panel .icon-btn.back { position: absolute; top: 12px; left: 12px; color: inherit; }
#level-grid {
  flex: 1; width: min(100%, 520px); margin: 0 auto; overflow-y: auto;
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 10px; padding: 8px 14px 30px 14px;
  align-content: start;
}
.level-card {
  min-width: 0;
  padding: 9px 4px 8px;
  border-radius: 16px;
  border: none;
  background: linear-gradient(145deg, #5b3bd6, #3a1ea0);
  box-shadow: 0 5px 0 rgba(0,0,0,0.3), 0 4px 10px rgba(0,0,0,0.25);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 3px;
  color: #fff;
  transition: transform 0.12s, box-shadow 0.12s;
  position: relative;
}
.level-card:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,0.3); }
.level-card.locked {
  background: linear-gradient(145deg, #40405a, #2a2a3c);
  box-shadow: 0 5px 0 rgba(0,0,0,0.2);
  color: rgba(255,255,255,0.45);
}
.level-card .level-num { font-size: 24px; font-weight: 900; line-height: 1; }
.level-card .level-lock { font-size: 20px; line-height: 1.2; }
/* Topic name: two lines at most, so every card keeps the same height. */
.level-card .level-topic {
  width: 100%; height: 2.5em;
  font-size: 10.5px; font-weight: 700; line-height: 1.25; text-align: center;
  opacity: 0.85; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}
.level-card .level-stars { display: flex; gap: 1px; margin-top: 1px; }
.level-card .level-stars .star { font-size: 21px; line-height: 1; color: rgba(255,255,255,0.25); }
.level-card .level-stars .star.filled { color: #ffd93d; text-shadow: 0 0 6px rgba(255,217,61,0.8); }

/* ================= AYARLAR ================= */
#screen-settings { flex-direction: column; align-items: stretch; }
.settings-list { width: min(100%, 560px); margin: 0 auto; padding: 10px 18px 24px 18px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; flex: 1; }
.settings-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: rgba(var(--fg-rgb),0.07);
  border-radius: 14px; padding: 14px 16px;
  color: var(--fg);
}
.settings-row-title { font-size: 14px; font-weight: 700; }
.settings-row-sub { font-size: 11px; opacity: 0.6; margin-top: 2px; max-width: 220px; }
.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; background: rgba(255,255,255,0.25);
  border-radius: 14px; transition: background 0.2s; cursor: pointer;
}
.switch .slider::before {
  content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform 0.2s;
}
.switch input:checked + .slider { background: #4ecb71; }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* ================= MODALLAR ================= */
.modal-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.6);
  align-items: center; justify-content: center;
  padding: 24px;
}
.modal-overlay.show { display: flex; }
.modal-box {
  max-height: calc(100% - 4px); overflow-y: auto;
  background: linear-gradient(165deg, #2a1958, #1a0f38);
  border-radius: 20px;
  padding: 24px 22px;
  width: min(90vw, 360px);
  color: #fff;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  animation: popin 0.3s ease-out;
}
.modal-box h3 { margin: 0 0 10px 0; font-size: 19px; }
.modal-box p { font-size: 13.5px; line-height: 1.5; opacity: 0.85; margin: 0 0 18px 0; }
.modal-close-btn {
  width: 100%; padding: 13px; border-radius: 14px; border: none;
  background: rgba(255,255,255,0.1); color: #fff; font-weight: 700; font-size: 14px;
  margin-top: 8px;
}
