/* ── Button polish (site-wide audit): visible in every theme, no clipping, even rows, room to breathe ── */

/* Spell: the Hint button was pale yellow on white */
.small-btn.hint { color: #92400e; background: rgba(234, 179, 8, 0.14); border-color: rgba(202, 138, 4, 0.55); }
[data-mode="dark"] .small-btn.hint { color: #fde047; background: rgba(250, 204, 21, 0.12); border-color: rgba(250, 204, 21, 0.45); }

/* Difficulty bar: unselected levels get an edge so they read as buttons */
.diff-btn:not(.active) { background: var(--card-bg); border: 1px solid var(--card-border); color: var(--text-secondary); }
.diff-btn { border: 1px solid transparent; }

/* Share window: room under "Ask to make it public" */
.ml-public-btn { margin-bottom: 6px; }

/* Buttons that never set a text colour fell back to the browser's black, unreadable on dark themes
   (sound button, ✕ close, POS and Syn/Ant answers). Zero specificity: any button that sets its own colour wins. */
:where(button) { color: var(--text); }

/* Text on the theme accent: white, except in themes whose accent is light (cyan, green, tan, orange, sky blue) */
:root { --on-blue: #fff; }
[data-theme="slate"], [data-theme="neon"], [data-theme="retro"], [data-theme="coffee"], [data-theme="halloween"] { --on-blue: #0b0b12; }

.study-chip.on,
.chess-nav-btn.undo,
.chess-ply.current,
.duel-code span,
.home-announcement-icon,
.acct-tab.on,
.restart-btn,
.icon-badge,
.live-brand .live-pill,
.live-icon,
.live-timer-small,
.live-letter,
.page-tab.on,
.tab-btn.active,
.next-btn,
.score-end .restart-btn,
.fc-nav-btn.primary,
.match-tile.selected,
.spelling-submit,
.jq-done-btn,
.lb-switch-btn.active,
.name-submit-btn,
.jq-type-submit,
.dino-start-btn,
.speedrun-start-btn,
.name-submit-btn .btn-label-a,
#challenge-code-btn .btn-label-a,
#name-submit-btn .btn-label-a { color: var(--on-blue); }
.study-chip.all.on, .live-primary, .dino-start-btn.live-primary { color: var(--on-blue); }

/* Dark and Midnight: unselected menu labels, "← Games" and text links were a little faint */
.nav-item:not(.active) { color: var(--text-secondary); color: color-mix(in srgb, var(--text) 76%, var(--body-bg)); }
.nav-item:not(.active):hover { color: var(--text); }
#game-chrome-back, .game-chrome-back { color: var(--text) !important; background: var(--card-bg); border: 1px solid var(--card-border) !important; }
[data-mode="dark"] .acct-link, [data-mode="dark"] .acct-note a { color: var(--text); }
/* Dark themes: the selected menu item keeps the accent as its highlight, with a light label on top */
[data-mode="dark"] .nav-item.active { color: var(--text); background: color-mix(in srgb, var(--blue) 34%, var(--card-bg)); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--blue) 60%, transparent); }

/* Share window: Copy code / Copy link side by side, same height */
.ml-share-actions > button { height: 40px; box-sizing: border-box; display: inline-flex; align-items: center; gap: 6px; padding: 0 16px; }
.ml-share-actions .ico { width: 15px; height: 15px; }
/* the plain filled button follows the theme accent */
.pub-add-btn { background: var(--blue); box-shadow: 0 3px 0 var(--blue-dark, #1d4ed8); color: var(--on-blue); }
.pub-add-btn:hover:not(:disabled) { background: var(--blue-dark, #1d4ed8); }
.pub-card .pub-add-btn:not(:disabled), #dash-practice { background: #2563eb; box-shadow: 0 3px 0 #1d4ed8; color: #fff; } /* on the always-dark Study and Home screens */

/* Phones: pop-ups sit above the bottom tabs, so nothing at the bottom of a window hides behind them */
@media (max-width: 899px) {
  .modal-overlay:not(.as-page) { z-index: 1150; }
  .nav-items { gap: 4px; }
}

/* Friend requests: a notification at the top of the screen (js/friends.js; can be turned off in Settings) */
.top-notes { position: fixed; top: calc(14px + var(--sat, 0px)); left: 50%; transform: translateX(-50%); z-index: 1300; width: min(520px, calc(100% - 24px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
html.nav-compact .top-notes { top: calc(var(--nav-top-room) - 6px); }
@media (min-width: 900px) { html.has-nav:not(.nav-compact):not(.nav-off) .top-notes { left: calc(50% + var(--nav-w) / 2); } }
.top-note {
  pointer-events: auto; position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px 12px;
  padding: 12px 40px 12px 14px; border-radius: 16px; background: var(--body-bg); color: var(--text);
  border: 1px solid var(--card-border); border-left: 4px solid #22c55e; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.3);
  animation: topNoteIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.top-note.out { animation: topNoteOut 0.25s ease both; }
@keyframes topNoteIn { from { opacity: 0; transform: translateY(-18px) scale(0.97); } }
@keyframes topNoteOut { to { opacity: 0; transform: translateY(-12px); } }
.top-note-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: rgba(34, 197, 94, 0.15); color: #16a34a; }
.top-note-icon .ico { width: 20px; height: 20px; }
.top-note-text { display: flex; flex-direction: column; gap: 2px; font-size: 14px; line-height: 1.35; min-width: 0; }
.top-note-tag { font: 700 10px var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: #16a34a; }
.top-note-btns { display: flex; gap: 6px; }
.top-note-btns > button { height: 34px; box-sizing: border-box; padding: 0 14px; font-size: 12px; margin: 0; }
.top-note-btns .home-lb-btn { color: var(--text); border-color: var(--card-border); background: var(--card-bg); }
.top-note-close { position: absolute; top: 8px; right: 8px; appearance: none; border: 0; background: transparent; color: var(--text-secondary); cursor: pointer; padding: 4px; display: grid; place-items: center; border-radius: 8px; }
.top-note-close .ico { width: 14px; height: 14px; }
.top-note-close:hover { color: var(--text); background: var(--card-bg); }
@media (max-width: 520px) { .top-note { grid-template-columns: auto 1fr; } .top-note-btns { grid-column: 1 / -1; justify-content: flex-end; } }
/* Friends menu: Challenge to chess */
.fr-chess { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.fr-chess svg, .fr-chess .ico { width: 14px; height: 14px; }
@media (max-width: 480px) { .fr-row { flex-wrap: wrap; } .fr-chess { order: 5; margin-left: 17px; } }
.top-note-btns > button { min-height: 0 !important; line-height: 1; display: inline-flex; align-items: center; }

/* Game Limits: a game the teacher turned off */
.game-hub-card.locked { cursor: not-allowed; border-style: dashed !important; }
.game-hub-card.locked > .game-hub-icon, .game-hub-card.locked > .game-hub-title { opacity: 0.45; filter: grayscale(1); } /* the entrance animation keeps the card itself opaque */
.game-hub-card.locked:hover { transform: none !important; box-shadow: none !important; }
.game-hub-card.locked .game-hub-desc { display: inline-flex; align-items: center; gap: 4px; color: #dc2626; font-weight: 700; }
.game-hub-card.locked .game-hub-desc .ico { width: 12px; height: 12px; }
.game-locked { text-align: center; padding: 30px 16px; max-width: 460px; margin: 0 auto; }
.game-locked h2 { font-family: var(--font-serif); font-size: 26px; margin: 4px 0 8px; color: var(--text); }
.game-locked p { color: var(--text-secondary); line-height: 1.55; margin: 0 0 18px; }
.game-locked .next-btn { width: auto; padding: 12px 22px; }

/* Friends → Challenge to chess: pick the unit */
.cp-modal { max-width: 480px; }
.cp-group { font: 700 11px var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-secondary); margin: 6px 0 8px; }
.cp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-bottom: 12px; }
.cp-option { position: relative; cursor: pointer; }
.cp-option input { position: absolute; opacity: 0; pointer-events: none; }
.cp-card {
  display: flex; flex-direction: column; gap: 2px; height: 100%; box-sizing: border-box; padding: 12px 14px; border-radius: 14px;
  background: var(--card-bg); border: 2px solid var(--card-border); border-left: 5px solid var(--c); color: var(--text); transition: border-color 0.15s, box-shadow 0.15s;
}
.cp-card strong { font-family: var(--font-serif); font-size: 17px; }
.cp-card small { font: 11px var(--font-mono); color: var(--text-secondary); }
.cp-option:hover .cp-card { border-color: color-mix(in srgb, var(--blue) 45%, var(--card-border)); }
.cp-option input:checked + .cp-card { border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 22%, transparent); }
.cp-option input:focus-visible + .cp-card { outline: 2px solid var(--blue); outline-offset: 2px; }
.cp-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.cp-actions > button { height: 40px; box-sizing: border-box; display: inline-flex; align-items: center; gap: 6px; padding: 0 16px; margin: 0; }
.cp-actions svg { width: 15px; height: 15px; }
.cp-actions .home-lb-btn { color: var(--text); border-color: var(--card-border); background: var(--card-bg); }

/* Settings → Lexify App */
.install-note { display: block; margin: 0 0 10px; line-height: 1.5; }
.install-note .ico { display: inline-block; width: 16px; height: 16px; vertical-align: -3px; margin-right: 6px; color: var(--blue); }
#settings-install { width: 100%; justify-content: center; }

/* Settings → Notifications on this device */
.sysnote-head { margin: 16px 0 2px; font-size: 13px; font-weight: 700; color: var(--text); }
.sysnote-status { display: block; font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.sysnote-note { display: flex; align-items: flex-start; gap: 8px; margin: 6px 0 0; line-height: 1.5; font-size: 12px; }
.sysnote-note .ico { width: 15px; height: 15px; flex: none; margin-top: 2px; }
.sysnote-types { margin-left: 14px; padding-left: 12px; border-left: 2px solid var(--card-border, rgba(0,0,0,0.1)); }

/* ── Readable on every screen: no small scroll boxes, no squeezed rows, no tiny labels on phones ── */
/* Teacher tiles open full screen: their lists grow with the page instead of scrolling in a small box */
.t-card.open .t-list, .t-card.open .t-list.tall, .t-card.open .acct-roster { max-height: none; overflow: visible; }
.chess-moves { max-height: 150px; }
.chess-friends { max-height: min(360px, 50vh); }
/* Typing boxes start big enough to see what you write */
#fb-message { min-height: 140px; }
#ml-paste-text { min-height: 170px; }
#teacher-ann-input { min-height: 90px; }

@media (max-width: 640px) {
  /* Pop-ups use most of the phone's screen */
  .modal-overlay:not(.as-page) .modal { max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }

  /* Friends: the name keeps its room; "Challenge to chess" goes on its own line */
  .fr-row { flex-wrap: wrap; row-gap: 8px; }
  .fr-row .fr-name { flex: 1 1 80px; }
  .fr-chess { order: 5; flex: 1 1 100%; justify-content: center; margin-left: 0; }

  /* Small labels: at least 11px */
  .home-announcement-label, .home-notif-tag, .next-test-tag, .top-note-tag, .wotd-tag, .acct-tile-label,
  .next-test-count span, .dash-tile span, .mem-stat span, .tagline, .lb-switch-btn, .lb-date, .lb-unit,
  .theme-swatch-label, .fc-sa-label, .browse-sa-label, .word-row-pos, .speedrun-info-label, .chess-mode-label,
  .jeopardy-hint, .ml-kind-btn small { font-size: 11px !important; }
  .next-test-cum, .game-hub-desc { font-size: 11.5px !important; }
  .jeopardy-cat-header { font-size: 10px !important; } /* inside small game tiles */
  .tagline { letter-spacing: 2px; }
  /* Theme names under the swatches get a column each, wide enough for "Thanksgiving" */
  .theme-picker { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 12px 4px; }
  .theme-swatch { min-width: 0; width: auto; }
  .theme-swatch-label { white-space: nowrap; }
}
