/* Palette and type from DESIGN.md section 7. */

:root {
  --board-green: #00A650;
  --tile-white: #F7F7F2;
  --category-gold: #F2C230;
  --studio-navy: #1B2A6B;
  --ink: #12121A;
  --slab: Rockwell, "Roboto Slab", "Bookman Old Style", Georgia, serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: #0B0E1F;
  color: var(--tile-white);
  font-family: var(--slab);
  -webkit-font-smoothing: antialiased;
}

body[data-role="main"] { overflow: hidden; }

.fatal {
  padding: 3rem;
  color: #FF7A7A;
  font-size: 1.25rem;
  line-height: 1.5;
}

/* ------------------------------------------------------------ the two views */

.stage {
  display: flex;
  width: 200vw;
  height: 100vh;
  transition: transform 0.55s cubic-bezier(0.6, 0.05, 0.2, 1);
}

.stage.show-wheel { transform: translateX(-100vw); }

.view {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.edge {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 0;
  padding: 1rem;
  color: var(--category-gold);
  font-size: 2.8rem;
  line-height: 1;
  opacity: 0.45;
  cursor: pointer;
  transition: opacity 0.2s;
}
.edge:hover { opacity: 1; }
.edge-right { right: 1.5rem; }
.edge-left { left: 1.5rem; }

/* ------------------------------------------------------------------- board */

.board {
  --tile: min(5.6vw, 11vh);
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--tile));
  gap: 5px;
  padding: 1.1rem;
  background: var(--board-green);
  border: 5px solid #04331B;
  border-radius: 4px;
  box-shadow: 0 1.4rem 3rem rgba(0, 0, 0, 0.55);
}

.cell {
  width: var(--tile);
  height: var(--tile);
  display: grid;
  place-items: center;
}

.cell.blank {
  background: var(--board-green);
  border: 1px solid rgba(0, 0, 0, 0.18);
}

.cell.tile {
  background: var(--tile-white);
  border: 1px solid #C7C7BC;
  color: var(--ink);
  font-size: calc(var(--tile) * 0.6);
  font-weight: 700;
  backface-visibility: hidden;
}

.cell.tile.punct { color: #4A4A55; }

@keyframes flip-in {
  from { transform: rotateX(90deg); }
  to   { transform: rotateX(0deg); }
}

.cell.flip { animation: flip-in 0.3s ease-out; }

.category {
  margin-top: 1.4rem;
  padding: 0.55rem 2.4rem;
  background: var(--category-gold);
  color: var(--studio-navy);
  font-size: clamp(1rem, 2vw, 1.9rem);
  letter-spacing: 0.2em;
  border-radius: 2px;
}

/* ------------------------------------------------------------------- wheel */

.wheel { width: min(74vh, 74vw); }
.wheel-svg { width: 100%; height: auto; display: block; }

.wedge-label {
  font-family: var(--slab);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-anchor: middle;
  pointer-events: none;
}

.spin {
  margin-top: 1.6rem;
  padding: 0.8rem 3.4rem;
  background: var(--category-gold);
  color: var(--studio-navy);
  font-family: var(--slab);
  font-size: clamp(1.1rem, 2.2vw, 1.8rem);
  font-weight: 700;
  letter-spacing: 0.28em;
  border: 0;
  border-radius: 3px;
  cursor: pointer;
}
.spin:active { transform: translateY(2px); }

/* -------------------------------------------------------------- the card */

.card {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(84vw, 1000px);
  padding: 2.2rem 2.8rem;
  background: var(--tile-white);
  border: 6px solid var(--category-gold);
  box-shadow: 0 2rem 5rem rgba(0, 0, 0, 0.6);
  cursor: pointer;
  z-index: 5;
}

.card-head {
  display: flex;
  justify-content: space-between;
  color: var(--studio-navy);
  font-size: clamp(0.85rem, 1.5vw, 1.3rem);
  letter-spacing: 0.24em;
}

.card-text {
  margin: 1.2rem 0 0;
  color: var(--ink);
  font-size: clamp(1.3rem, 3.2vw, 2.9rem);
  line-height: 1.25;
}

.card-shout {
  margin: 0;
  text-align: center;
  color: var(--studio-navy);
  font-size: clamp(2.4rem, 7.5vw, 6.5rem);
  letter-spacing: 0.1em;
}

/* ------------------------------------------------------------- admin page */

.admin {
  max-width: 60rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 5rem;
}

/* The page says nothing in prose, so a lost connection is a red bar rather
   than a sentence. Without it a dead button looks exactly like a live one. */
body.offline::before {
  content: '';
  position: fixed;
  inset: 0 0 auto 0;
  height: 5px;
  background: #B0431F;
  z-index: 10;
}

.admin-category {
  margin: 0;
  color: var(--category-gold);
  font-size: clamp(0.95rem, 2.4vw, 1.2rem);
  letter-spacing: 0.2em;
}

.admin-answer {
  margin: 0.6rem 0 2.4rem;
  font-size: clamp(1.9rem, 5.5vw, 3.6rem);
  letter-spacing: 0.05em;
  line-height: 1.15;
  word-break: break-word;
}

.keys { display: flex; flex-wrap: wrap; gap: 0.65rem; }

.key {
  position: relative;
  width: 4.6rem;
  height: 4.6rem;
  background: var(--tile-white);
  color: var(--ink);
  font-family: var(--slab);
  font-size: 2rem;
  font-weight: 700;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.key.done {
  background: #23232D;
  color: #62626F;
  border-color: #33333F;
}

/* The cursor ring replaces the browser's focus ring. It has to read at a
   glance on a small display, so it is thick, gold, and lifts the key. */
.key:focus { outline: none; }

.key.cursor {
  outline: 4px solid var(--category-gold);
  outline-offset: 3px;
  transform: translateY(-3px);
  box-shadow: 0 0.5rem 1.2rem rgba(242, 194, 48, 0.3);
  scroll-margin: 5rem;
}

.key.cursor.done {
  background: #33333F;
  color: #A8A8B8;
}

.key-count {
  position: absolute;
  top: 0.25rem;
  right: 0.4rem;
  font-size: 0.75rem;
  color: #B0431F;
}

.key.done .key-count { color: #62626F; }

/* The control page runs on a phone and on the glasses, so the targets grow
   and the letters go five across rather than wrapping unpredictably. */
@media (max-width: 34rem) {
  .admin { padding: 1.5rem 1rem 3rem; }
  .keys { gap: 0.5rem; }
  .key {
    width: calc((100% - 2rem) / 5);
    height: 4rem;
    font-size: 1.6rem;
  }
}
