/* KIS Word Rush: the light field (STYLE.md), for the pages read for minutes at a time: the hub,
   the teacher page and the control screen. The colours and type come from theme.css, which every
   page loads first; nothing here defines a colour of its own except tints of those tokens. */
* { box-sizing: border-box; }
/* A hidden element stays hidden whatever its own display rule says (a button is inline-flex). */
[hidden] { display: none !important; }
html { font-family: var(--font); font-size: 17px; }
body { margin: 0; background: var(--card); color: var(--card-ink); }
main { max-width: 44rem; margin: 0 auto; padding: 1rem; }
main.wide { max-width: 84rem; }

/* The crest and the page title, top left. */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.masthead { display: flex; align-items: center; gap: 0.6rem; }
.masthead .crest { height: 32px; width: auto; }
.masthead.hub .crest { height: 64px; }
h1 { font-size: 1.6rem; font-weight: 800; color: var(--field); margin: 0; }
h2 { font-size: 1.3rem; font-weight: 800; color: var(--field); margin: 1.2rem 0 0.6rem; }
h3 { font-size: 1.05rem; font-weight: 700; color: var(--field); margin: 1rem 0 0.4rem; }
.page-role { color: #666; margin: 0.4rem 0 1rem; }

/* Every change of state slides up and fades in, quickly (STYLE.md, Movement). */
.state, .screen { animation: arrive var(--motion); }
@keyframes arrive { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
section.state { margin: 1rem 0; }

/* Buttons: flat, chunky, a darker bottom edge that goes on press. */
button, .button { font: inherit; font-weight: 700; padding: 0.6rem 1.1rem; border-radius: var(--radius-button);
  border: 2px solid var(--field); background: #fff; color: var(--field); cursor: pointer; min-height: 2.7rem;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .12); text-decoration: none; display: inline-flex; align-items: center;
  justify-content: center; gap: 0.4rem; }
button.primary, .button.primary { background: var(--field); color: var(--ink-on-field);
  box-shadow: inset 0 -4px 0 var(--field-deep); }
button:active, .button:active { box-shadow: none; transform: translateY(2px); }
button.small, .button.small { min-height: 2rem; padding: 0.25rem 0.6rem; font-size: 0.85rem; }
button.quiet { border-color: transparent; background: transparent; box-shadow: none; text-decoration: underline; }
/* Faded means inactive (doctrine, amendment 2): a faded thing is never clickable. */
button:disabled, .faded { opacity: 0.4; pointer-events: none; }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin: 0.8rem 0; }

/* Forms. */
label { display: block; font-weight: 700; margin: 0.8rem 0 0.2rem; }
input[type="text"], select, textarea { font: inherit; width: 100%; padding: 0.5rem 0.6rem; border: 2px solid #d6cfe6;
  border-radius: var(--radius-button); background: #fff; color: var(--card-ink); }
input[type="text"]:focus, select:focus, textarea:focus { outline: none; border-color: var(--field); }
textarea { min-height: 4.5rem; resize: vertical; }
.advanced-toggle { margin-top: 1rem; }
[data-ssui-advanced] { border-left: 4px solid #e4ddf1; padding-left: 0.8rem; margin-top: 0.4rem; }

/* Cards on the light field. */
.card { background: #fff; border: 1px solid #e4ddf1; border-radius: var(--radius-card); box-shadow: 0 2px 6px rgba(0, 0, 0, .08);
  padding: 0.8rem 1rem; }
.refusal { color: #a3261e; font-weight: 700; }
.signed-in-as { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; color: #666; }
.environment { font-size: 0.8rem; color: #777; }

/* The hub's list of games. */
.games { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6rem; }
.games li { padding: 0.9rem 1rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem; }
.games .title { font-weight: 800; color: var(--field); font-size: 1.1rem; }

/* Status pills. */
.pill { display: inline-block; border-radius: 999px; padding: 0.15rem 0.7rem; font-size: 0.8rem; font-weight: 700;
  background: #efeaf7; color: var(--field); white-space: nowrap; }
.pill.approved { background: var(--correct); color: #fff; }
.pill.generated { background: var(--answer-blue); color: #fff; }
.pill.failed { background: var(--wrong); color: #fff; }
.pill.waiting { background: var(--accent); color: #fff; }

/* The Wordy Switch and the help it shows. */
#ssui-wordy-toggle { font-size: 0.85rem; padding: 0.3rem 0.7rem; min-height: 0; }
.ssui-help { font-size: 0.85rem; color: #6b6480; margin: 0.2rem 0 0.6rem; font-weight: 600; }
:root[data-ssui-mode="simple"] .ssui-help { display: none; }

/* The sign-in screens (owner, 2026-11-04): everything centred, across and down. */
main[data-state="starting"], main[data-state="signed-out"], main[data-state="not-member"], main[data-state="not-teacher"] {
  min-height: 100vh; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
main[data-state="starting"] .topbar, main[data-state="signed-out"] .topbar,
main[data-state="not-member"] .topbar, main[data-state="not-teacher"] .topbar { flex-direction: column; }

/* Every other screen (owner, 2026-11-04): the headings and the top matter centred; lists,
   tables and forms stay left-aligned for reading. */
.topbar { justify-content: center; }
.masthead { justify-content: center; text-align: center; }
h1, h2, .page-role { text-align: center; }
.signed-in-as { justify-content: center; }

/* The hub's join line: the game's title above the button (decision 36). */
.game-title { font-weight: 800; color: var(--field); text-align: center; margin: 0.4rem 0; }

/* The control screen's sign-out warning (owner, 2026-11-06). */
.sign-out-dialog { max-width: 30rem; border: 2px solid var(--field); padding: 1.2rem 1.4rem; }
.sign-out-dialog::backdrop { background: rgba(30, 10, 60, .55); }
.sign-out-dialog .big-line { font-size: 1.3rem; font-weight: 800; color: var(--field); margin: 0 0 0.4rem; }
