/* Chalk Ladder: one phone-height board; word tiles centre, chalk keyboard at the ledge. */
.frame { height: 100%; }
.board { height: 100%; }

.view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 16px 16px;
}
h1 { font-size: clamp(42px, 13vw, 64px); line-height: .95; letter-spacing: .5px; }
h2 { font-size: 28px; line-height: 1.05; }

.topbar { display: flex; justify-content: space-between; align-items: center; }
.topbar a { font: 700 18px var(--font-display); color: var(--chalk-dim); text-decoration: none; }

.example {
  font-family: var(--font-display);
  font-size: 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}
.example b { color: var(--chalk-yellow); font-weight: 700; }
.example i { font-style: normal; color: var(--chalk-dim); font-size: 18px; }

.rules { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; counter-reset: r; }
.rules li { display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: baseline; color: var(--chalk-dim); line-height: 1.45; }
.rules li::before { content: counter(r); counter-increment: r; font-family: var(--font-display); font-weight: 700; color: var(--chalk-yellow); font-size: 20px; }

.btns { display: grid; gap: 10px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.note { font-size: 13px; }

.challenge-card {
  border: 2px dashed var(--chalk-yellow);
  border-radius: 12px;
  padding: 14px;
  display: grid;
  gap: 10px;
}
.challenge-card .display { font-size: 24px; color: var(--chalk-yellow); }

label.field { display: grid; gap: 6px; font-size: 13px; color: var(--chalk-dim); }
input[type=text] {
  font: 400 18px var(--font-body);
  color: var(--chalk);
  background: var(--board-deep);
  border: 2px solid var(--board-line);
  border-radius: 8px;
  padding: 10px 12px;
  width: 100%;
}

/* Play view */
.hud { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-variant-numeric: tabular-nums; }
.hud .stat { display: grid; gap: 2px; }
.hud .stat b { font-family: var(--font-display); font-size: 30px; line-height: 1; }
.hud .stat span { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--chalk-dim); }
.hud .stat.right { text-align: right; }
.timerbar { height: 6px; border-radius: 3px; background: var(--board-deep); overflow: hidden; }
.timerbar i { display: block; height: 100%; width: 100%; background: var(--chalk); transform-origin: left; transition: background .3s; }
.timerbar.low i { background: var(--chalk-pink); }

.turn { text-align: center; font-family: var(--font-display); font-size: 24px; color: var(--chalk-yellow); min-height: 1.2em; }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 360px; width: 100%; margin: 4px auto 0; }
.tile {
  appearance: none;
  aspect-ratio: 1;
  max-width: 100%;
  border: 2px dashed rgba(241,239,230,.45);
  border-radius: 12px 16px 11px 15px;
  background: rgba(0,0,0,.08);
  color: var(--chalk);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(40px, 13vw, 62px);
  line-height: 1;
  text-transform: uppercase;
  cursor: pointer;
  position: relative;
  transition: transform .15s, border-color .15s, color .15s;
}
.tile.sel { border: 3px solid var(--chalk-yellow); color: var(--chalk-yellow); transform: translateY(-4px); }
.tile.hint::after { content: ""; position: absolute; inset: -6px; border: 2px solid var(--chalk-green); border-radius: 50%; animation: pulse 1s ease-in-out infinite; }
.tile.new { animation: pop .35s ease-out; color: var(--chalk-green); }
@keyframes pop { 0% { transform: scale(.6); opacity: .2 } 70% { transform: scale(1.08) } 100% { transform: scale(1) } }
@keyframes pulse { 50% { opacity: .35 } }
.tiles.shake { animation: shake .35s; }
@keyframes shake { 20%,60% { transform: translateX(-8px) } 40%,80% { transform: translateX(8px) } }

.msg { text-align: center; min-height: 1.5em; font-weight: 700; color: var(--chalk-dim); }
.msg.bad { color: var(--chalk-pink); }
.msg.good { color: var(--chalk-green); }

.chain {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 19px;
  color: var(--chalk-dim);
  text-transform: uppercase;
  min-height: 1.4em;
}
.chain span:not(:last-child)::after { content: "→"; margin-left: 8px; font-family: var(--font-body); font-size: 14px; opacity: .6; }
.chain span:last-child { color: var(--chalk); }

.spacer { flex: 1; }
.kbd { display: grid; gap: 6px; padding-bottom: 4px; }
.kbd .krow { display: flex; justify-content: center; gap: 5px; }
.key {
  appearance: none;
  flex: 1 1 0;
  max-width: 44px;
  min-width: 0;
  height: 48px;
  border: 0;
  border-radius: 7px;
  background: rgba(241,239,230,.14);
  color: var(--chalk);
  font: 700 19px var(--font-body);
  text-transform: uppercase;
  cursor: pointer;
}
.key:active { background: rgba(241,239,230,.3); }
.kbd.off .key { opacity: .45; }
.actions { display: flex; gap: 8px; }
.actions .btn { flex: 1; justify-content: center; font-size: 15px; padding: 10px; }

/* "Time's up, watch an ad for more time?" panel over the board */
.continue {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: rgba(20, 32, 25, .92);
  padding: 24px;
}
.continue > div { display: grid; gap: 12px; width: 100%; max-width: 340px; text-align: center; }
.continue .display { font-size: 34px; color: var(--chalk-yellow); }

/* End view */
.score-big { font-family: var(--font-display); font-weight: 700; font-size: 96px; line-height: .9; color: var(--chalk-yellow); }
.verdict { font-family: var(--font-display); font-size: 26px; padding-bottom: 10px; }
.score-row { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.missed { font-size: 14px; }
.missed b { font-family: var(--font-display); font-size: 17px; color: var(--chalk); text-transform: uppercase; letter-spacing: .03em; }
.sharebox { display: grid; gap: 10px; border-top: 2px dashed var(--board-line); padding-top: 16px; }

@media (max-height: 640px) {
  .key { height: 40px; }
  .view { gap: 12px; padding-top: 12px; }
  .frieze { display: none; }
}
