/* FiraGO (bBox Type), SIL Open Font License 1.1. Original files, unchanged; license in fonts/OFL.txt */
@font-face { font-family: "FiraGO"; font-weight: 350; font-display: swap; src: url("fonts/FiraGO-Book.woff2") format("woff2"); }
@font-face { font-family: "FiraGO"; font-weight: 400; font-display: swap; src: url("fonts/FiraGO-Regular.woff2") format("woff2"); }
@font-face { font-family: "FiraGO"; font-weight: 500; font-display: swap; src: url("fonts/FiraGO-Medium.woff2") format("woff2"); }

/* Football Crosswords — shared look for every puzzle and the home page.
   Same colours and fonts as Guess the Player. Change something here and every crossword changes with it. */
:root {
  --accent: #006aff;
  --accent-soft: #e3efff;
  --ink: #10233d;
  --muted: #3d5573;
  --border: #cfe0f5;
  --bg: #f7fbff;
  --card: #ffffff;
  --green: #d9f5e3;
  --green-ink: #13693a;
  --grey: #eef0f4;
  --red: #fde4e1;
  --red-ink: #b3261e;
  --cols: 9; /* set by crossword.js from the puzzle's size */
  --cell: min(46px, calc((100vw - 34px - var(--cols) * 2px) / var(--cols)));
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "FiraGO", system-ui, sans-serif;
  font-weight: 350;
  line-height: 1.5;
}

main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 32px 16px 48px;
}
main.narrow { max-width: 640px; }

h1 { font-weight: 500; font-size: 40px; line-height: 1.1; margin: 0 0 8px; }
h1 em { font-style: normal; }

/* Home pages: English <-> Georgian switch, top right */
/* (the home pages load crossword.css?v=2 so phones fetch this new version instead of an old saved copy) */

.back { display: inline-block; color: var(--accent); text-decoration: none; font-size: 14px; margin-bottom: 12px; }
@media (min-width: 641px) and (hover: hover){.back:hover{ text-decoration: underline; }}

.intro {
  color: var(--muted);
  margin: 0 0 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.meta { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.count { color: var(--muted); font-size: 14px; }
.timer { font-weight: 500; font-size: 20px; font-variant-numeric: tabular-nums; }

/* ---- Puzzle page ---- */
.board { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 28px; align-items: start; }
@media (max-width: 760px) { .board { grid-template-columns: minmax(0, 1fr); gap: 20px; } }
.play { display: flex; flex-direction: column; gap: 12px; width: min-content; max-width: 100%; } /* as wide as the grid */

.clue-bar {
  display: flex; gap: 10px; align-items: baseline;
  background: var(--accent-soft); border-radius: 10px;
  padding: 10px 14px; min-height: 64px; font-size: 15px;
}
.clue-bar b { color: var(--accent); white-space: nowrap; }

.grid {
  display: grid; grid-template-columns: repeat(var(--cols), var(--cell)); grid-auto-rows: var(--cell);
  gap: 2px; width: max-content;
}
.cell { position: relative; border-radius: 6px; }          /* empty square: no box at all */
.cell.open { background: var(--card); border: 1px solid var(--border); }
.cell.open.inword { background: var(--accent-soft); }
.cell.open.active { background: var(--accent); border-color: var(--accent); }
.cell.open.solved { background: var(--green); border-color: var(--green); }
.cell.open.solved.inword { background: var(--green); }
.cell.open.solved.active { background: var(--accent); }
.cell.wrong { background: var(--red) !important; border-color: var(--red-ink) !important; }
.num { position: absolute; top: 1px; left: 3px; font-size: calc(var(--cell) * .22); line-height: 1; font-weight: 400; color: var(--muted); pointer-events: none; }
.cell.active .num { color: #fff; }
.cell input {
  width: 100%; height: 100%; border: 0; background: transparent; text-align: center; padding: calc(var(--cell) * .1) 0 0;
  font-family: inherit; font-weight: 500; font-size: calc(var(--cell) * .5); text-transform: uppercase;
  color: var(--ink); caret-color: transparent; cursor: pointer; border-radius: 6px;
}
.cell input:focus { outline: none; }
.cell.active input { color: #fff; }
.cell.active input:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.cell.solved input { color: var(--green-ink); }
.cell.active.solved input { color: #fff; }
.cell.wrong input { color: var(--red-ink); }
/* A full word that isn't right yet: light red (not as strong as Check letters) */
.cell.open.wordwrong:not(.solved):not(.active) { background: #fdeeee; border-color: #f2c4c4; }
/* Typed a different letter on a fixed square of a solved word: quick red flash */
@keyframes bump { 0%, 60% { background: var(--red); border-color: var(--red-ink); transform: scale(1.08); } 100% { transform: none; } }
.cell.open.bump { animation: bump .9s ease-out; }
/* Auto-check switch when on */
.actions button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions-break { display: none; }
button {
  font: inherit; font-weight: 400; padding: 12px 20px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--card); color: var(--ink); cursor: pointer;
}
@media (min-width: 641px) and (hover: hover){button:hover{ border-color: var(--accent); color: var(--accent); }}
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (min-width: 641px) and (hover: hover){button.primary:hover{ color: #fff; opacity: .9; }}
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.result { background: var(--green); color: var(--green-ink); border-radius: 14px; padding: 12px 16px; font-weight: 400; }
.result p { margin: 0; }

.clues { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; min-width: 0; }
@media (max-width: 960px) { .clues { grid-template-columns: minmax(0, 1fr); } }
/* Georgian words are long: one wide clue column (Across above Down) instead of two narrow ones */
html:lang(ka) .clues { grid-template-columns: minmax(0, 1fr); }
/* Georgian has no real italic (the browser would just slant the letters), so titles stay upright */
html:lang(ka) .clues li { overflow-wrap: anywhere; }
.clues section { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 12px 8px 4px; min-width: 0; }
.clues h3 { font-size: 15px; font-weight: 500; margin: 0 8px 6px; }
.clues ol { list-style: none; margin: 0; padding: 0; }
.clues li {
  display: grid; grid-template-columns: 1.8em minmax(0, 1fr); gap: 4px;
  padding: 8px; border-radius: 10px; cursor: pointer; font-size: 14px;
}
@media (min-width: 641px) and (hover: hover){.clues li:hover{ background: var(--grey); }}
.clues li.current { background: var(--accent-soft); }
.clues li.done { color: var(--muted); }
.clues li.done .text { text-decoration: line-through; text-decoration-color: var(--border); }
.clues li .n { font-weight: 500; }
.len { color: var(--muted); font-size: 13px; white-space: nowrap; }
.legend { color: var(--muted); font-size: 13px; margin-top: 24px; }

/* ---- Home page: filters + list ---- */
.filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.filter-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filter-label { font-size: 13px; font-weight: 350; color: var(--muted); width: 70px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.chip { padding: 6px 16px; font-size: 14px; font-weight: 350; border-color: #b9cfe9; border-radius: 20px; color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }
@media (min-width: 641px) and (hover: hover){.chip[aria-pressed="true"]:hover{ color: #fff; }}
.shown { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
.empty { color: var(--muted); background: var(--card); border: 1px dashed var(--border); border-radius: 14px; padding: 16px; margin: 0; }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.list a {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px; color: var(--ink); text-decoration: none;
}
@media (min-width: 641px) and (hover: hover){.list a:hover{ border-color: var(--accent); }}
.list .name { font-weight: 500; font-size: 18px; }
.list .size { display: none; } /* the design cards show name, level and a short description only */
.list .meta-line { display: flex; align-items: center; gap: 8px; }
.list .size { color: var(--muted); font-size: 14px; }
.list .about { flex-basis: 100%; color: var(--muted); font-size: 14px; }
.level { font-size: 12px; font-weight: 400; padding: 3px 10px; border-radius: 10px; }
.level-easy { background: #dcf4e7; color: #0b5230; }
.level-medium { background: #e3efff; color: #0a3f8f; }
.level-hard { background: #ffeadb; color: #7a3300; }
.level-very-hard { background: #10233d; color: #fff; }
@media (max-width: 560px) {
  .filter-group { gap: 6px; }
  .filter-label { width: 100%; }                 /* label above its buttons on phones */
  .chip { padding: 6px 14px; font-size: 14px; }
}

/* ---- Sharing ---- */
.result { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.share-note { margin: 0; font-size: 13px; color: var(--muted); white-space: pre-line; overflow-wrap: anywhere; }
.result .share-note { color: var(--green-ink); }
.result[hidden] { display: none; }
.result-next { display: none; }

/* ---- Play another (after finishing) ---- */
.next[hidden] { display: none; }
.next h3 { margin: 4px 0 8px; font-size: 15px; }
.next-list { display: flex; flex-direction: column; gap: 8px; }
.next-card {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 12px 14px; color: var(--ink); text-decoration: none;
}
@media (min-width: 641px) and (hover: hover){.next-card:hover{ border-color: var(--accent); }}
.next-card .name { font-weight: 500; }
.next-card .meta-line { display: flex; align-items: center; gap: 8px; }
.next-card .size { color: var(--muted); font-size: 13px; }
.all-done { margin: 0 0 4px; font-weight: 500; }

/* ---- Home page: your stats + solved ticks ---- */
.stats-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin: 0 0 20px;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px; font-size: 14px; color: var(--muted); }
.stat b { color: var(--ink); font-weight: 500; margin-right: 4px; }
.reset { margin-left: auto; padding: 0; border: 0; background: none; font-size: 13px; color: var(--muted); text-decoration: underline; }
@media (min-width: 641px) and (hover: hover){.reset:hover{ color: var(--accent); }}
.reset.confirm { color: var(--red-ink); font-weight: 500; }
.status { font-size: 13px; font-weight: 500; color: var(--green-ink); }
.status.progress { color: var(--muted); font-weight: 400; }
.list a.is-solved { border-color: var(--green); }

/* ---- Home page list: topic sections. Grid on computers, swipe rows on phones ---- */
.topic-group h2 { font-size: 18px; margin: 22px 0 10px; display: flex; align-items: baseline; gap: 8px; }
.topic-group h2 span { font-size: 13px; font-weight: 400; color: var(--muted); }
.topic-group .list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.topic-group .list li { min-width: 0; }
.topic-group .list a { height: 100%; box-sizing: border-box; flex-direction: column; flex-wrap: nowrap; align-items: flex-start; justify-content: flex-start; gap: 6px; }
.topic-group .list .about { flex-basis: auto; width: 100%; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 560px) {
  .topic-group .list {
    display: flex; flex-direction: row; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
    margin: 0 -16px; padding: 0 16px 4px; scroll-padding: 0 16px;
  }
  .topic-group .list::-webkit-scrollbar { display: none; }
  .topic-group .list li { flex: 0 0 80%; scroll-snap-align: start; }
}
.topic-group .list .meta-line { flex-wrap: wrap; row-gap: 4px; }
.topic-group .list .size, .topic-group .list .status { white-space: nowrap; }
.see-all { margin-left: auto; padding: 0; border: 0; background: none; font-size: 14px; font-weight: 400; color: var(--accent); }
@media (min-width: 641px) and (hover: hover){.see-all:hover{ color: var(--accent); text-decoration: underline; }}
@media (min-width: 561px) { .see-all { display: none; } } /* computers already show every card */
@media (max-width: 560px) {
  .one-topic .topic-group .list { flex-direction: column; overflow: visible; margin: 0; padding: 0; }
  .one-topic .topic-group .list li { flex: none; }
}

/* ---- Phone typing mode (crossword.js adds body.typing while a square is focused on a touch screen) ---- */
.clue-spacer { height: 0; }
body.typing .back, body.typing h1, body.typing .intro, body.typing .legend { display: none; }
body.typing .clue-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20; margin: 0;
  border-radius: 0 0 14px 14px; box-shadow: 0 2px 10px rgba(0, 0, 0, .08);
}

/* ---- Daily crossword card on the home page ---- */
.daily-card {
  display: flex; flex-direction: column; gap: 6px; margin: 0 0 18px; padding: 16px;
  border: 1.5px solid var(--accent); border-radius: 16px; background: #fff; color: inherit; text-decoration: none;
}
@media (min-width: 641px) and (hover: hover){.daily-card:hover{ box-shadow: 0 2px 12px rgba(0, 106, 255, .12); }}
.daily-card .kicker { font-size: 13px; font-weight: 500; color: #0057d1; }
.daily-card .name { font-weight: 500; font-size: 19px; }
.daily-card .meta-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.daily-card .cta { color: var(--accent); }

/* "How to play" row under the puzzle, closed until tapped (same look as the Top 5 rules) */
.below { max-width: 1000px; margin: 0 auto; padding: 8px 16px 48px; }
.howto { margin-top: 24px; border-top: 1px solid var(--border); font-size: 14px; line-height: 1.55; color: var(--muted); }
.howto summary { cursor: pointer; padding: 14px 0; font-size: 15px; font-weight: 500; color: var(--ink); list-style: none; display: flex; justify-content: space-between; align-items: center; }
.howto summary::-webkit-details-marker { display: none; }
.howto summary::after { content: "+"; font-size: 20px; font-weight: 350; color: var(--muted); }
.howto[open] summary::after { content: "−"; }
.howto ul { margin: 0 0 8px; padding: 0 0 0 18px; }
.howto li + li { margin-top: 4px; }
.howto b { color: var(--ink); font-weight: 500; }
/* "Play more crosswords": same topic and difficulty */
.more { margin-top: 16px; }
.more h2 { font-size: 18px; font-weight: 500; margin: 0 0 10px; }
.more[hidden] { display: none; }
.more .next-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.more .next-card { padding: 14px 16px; }
body.typing .below { display: none; }

/* ---- Win popup ---- */
.win { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(26, 27, 34, .45); animation: win-fade .2s ease-out; }
.win[hidden] { display: none; }
.win-card { position: relative; width: 100%; max-width: 360px; background: var(--card); border-radius: 18px;
  padding: 28px 22px 22px; text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); animation: win-pop .35s cubic-bezier(.2, 1.4, .4, 1); }
.win-cup { width: 64px; height: 64px; margin: 0 auto 12px; animation: win-bounce 1s ease-in-out .3s 2; }
.win-card h2 { font-size: 26px; font-weight: 500; margin: 0 0 8px; }
.win-card p { color: var(--muted); margin: 0 0 14px; line-height: 1.45; }
.win-card .win-perfect { color: var(--green-ink); background: var(--green); border-radius: 10px; padding: 8px 10px; font-weight: 500; }
.win-card button { display: block; width: 100%; margin-top: 8px; }
.win-card .win-x { position: absolute; top: 8px; right: 8px; width: 36px; height: 36px; margin: 0; padding: 0;
  border: 0; background: transparent; font-size: 26px; line-height: 1; color: var(--muted); }
.win-cup svg { display: block; width: 100%; height: 100%; }
.confetti { position: fixed; top: -40px; border-radius: 3px; z-index: 60; pointer-events: none; animation: confetti-fall 2.6s ease-in forwards; }
@keyframes win-fade { from { opacity: 0; } }
@keyframes win-pop { from { transform: scale(.8); opacity: 0; } }
@keyframes win-bounce { 50% { transform: translateY(-8px) scale(1.06); } }
@keyframes confetti-fall { to { transform: translateY(110vh) rotate(540deg); } }

/* ---- Page loading ---- */
/* Each puzzle page has a plain-text copy of the clues (for Google) that shows for a moment
   before the game loads. It looked squeezed, one word per line, so we hide it: the game
   builds its own clue list a moment later. */
#crossword > main > .clues { display: none; }


/* ---- Home: daily card as a row on computers (as in the Home-desktop board) ---- */
@media (min-width: 641px) {
  .daily-card { padding: 18px 22px; display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 16px; row-gap: 4px; }
  .daily-card .kicker, .daily-card .name { grid-column: 1; }
  .daily-card .meta-line { grid-column: 2; grid-row: 1 / span 2; gap: 14px; }
  .daily-card .name { font-size: 20px; }
  .daily-card .cta { font-size: 15px; font-weight: 500; color: #0057d1; margin-left: 0 !important; }
}

/* ---- Home heading as in the board: 44px on computers, 28px on phones, no divider, the intro right under it ---- */
main.home h1 { font-size: 44px; line-height: 1.15; margin: 0 0 6px; color: var(--head, #0a3f8f); }
main.home .intro { font-size: 17px; margin: 0 0 20px; padding: 0; border: 0; }
.daily-card .status.cta { margin-left: auto; }
@media (max-width: 640px) {
  main.home h1 { font-size: 28px; margin-bottom: 4px; }
  main.home .intro { font-size: 15px; line-height: 1.45; margin-bottom: 14px; }
  .daily-card .meta-line { justify-content: space-between; }
}

/* ---- Puzzle page: the right-hand column (buttons, how to play, clues) ---- */
.side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

/* ---- Puzzle page on a computer: everything fits one screen, no page scrolling ----
   The grid gets the whole height under the game tabs (squares are sized from the screen height; --rows comes from crossword.js).
   Title, timer, clue, buttons and the clue lists live in the right-hand column. A long clue list scrolls inside its own box. */
@media (min-width: 761px) {
  :root { --nav-h: 46px; --cell: max(22px, min(56px, calc((100dvh - var(--nav-h) - 52px) / var(--rows) - 2px), calc(640px / var(--cols) - 2px))); }
  /* a slimmer game-tab bar on puzzle pages gives the squares more height */
  body:has(#crossword) .games-nav { padding-top: 6px; }
  body:has(#crossword) .games-nav a { padding: 7px 14px; }
  body:has(#crossword) .top-right { top: 14px; }
  #crossword > main {
    display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto;
    column-gap: 28px; row-gap: 8px; align-items: start;
    height: calc(100dvh - var(--nav-h)); padding: 22px 16px 14px; overflow: hidden;
  }
  .board { display: contents; } /* the grid column and the right-hand column become direct parts of the page grid */
  .play { grid-column: 1; grid-row: 1 / 5; gap: 0; }
  #crossword > main > .back { grid-column: 2; grid-row: 1; margin: 0; font-size: 13px; justify-self: start; }
  #crossword > main > h1 { grid-column: 2; grid-row: 2; margin: 0; font-size: 28px; line-height: 1.2; align-self: end; }
  #crossword > main > .meta { grid-column: 2; grid-row: 1; margin: 0; gap: 14px; justify-self: end; align-self: center; align-items: baseline; } /* same row as the back link, so a long title never collides with it */
  #crossword > main > .intro { display: none; } /* still in the page for Google; the "How to play" box covers it */
  .side { grid-column: 2; grid-row: 3; align-self: stretch; min-height: 0; overflow: hidden; gap: 10px; }
  #crossword > main > .legend { grid-column: 2; grid-row: 4; margin: 0; font-size: 12px; }
  .actions { gap: 6px 8px; align-items: center; }
  .actions button { padding: 8px 14px; font-size: 14px; }
  /* main buttons in the first line; the rarely used ones sit below as quiet text buttons */
  .actions .actions-break { display: block; order: 1; flex-basis: 100%; height: 0; }
  .actions .quiet { order: 2; border-color: transparent; background: none; color: var(--muted); padding: 3px 8px; font-size: 13px; }
  @media (min-width: 641px) and (hover: hover){.actions .quiet:hover{ color: var(--accent); background: var(--accent-soft); }}
  .actions .quiet[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
  .actions .quiet:first-of-type { margin-left: -8px; }
  /* the open clue is highlighted in the list, so the separate clue bar is not needed here (it stays on phones) */
  .board > .clue-bar { display: none; }
  .clues { flex: 1 1 auto; min-height: 0; overflow-y: auto; align-content: stretch; grid-template-rows: minmax(0, 1fr); }
  .clues section { overflow-y: auto; }
  html:lang(ka) .clues { grid-template-rows: none; }
  html:lang(ka) .clues section { overflow: visible; }
  /* Georgian: Across and Down are stacked, so the whole list is one framed, scrolling box */
  html:lang(ka) .clues { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 4px 0; }
  html:lang(ka) .clues section { border: 0; border-radius: 0; background: none; padding: 8px 8px 0; }
  html:lang(ka) .clues section + section { border-top: 1px solid var(--border); margin-top: 6px; }
  .clues li { padding: 6px 8px; }
  .clues h3 { margin-bottom: 2px; }
  .num { font-size: max(8px, calc(var(--cell) * .22)); }
}
@media (max-width: 760px) {
  .board { gap: 12px; }
  .side { margin-top: 8px; }
}

/* ---- Phone: the page is one fixed screen above the keyboard. Only the clue list and, for tall puzzles, the grid box scroll inside themselves ---- */
@media (max-width: 760px) {
  html:has(body.phone-play) { overflow: hidden; overscroll-behavior: none; }
  body.phone-play { --kbh: 255px; /* about the height of the phone keyboard with its small toolbar */
    /* squares never get smaller than 28px for the height; a tall puzzle then scrolls inside its own box instead of shrinking */
    --cell: min(46px, calc((100vw - 32px) / var(--cols) - 2px), max(28px, calc((100dvh - 156px - var(--kbh)) / var(--rows) - 2px)));
    position: fixed; top: 0; left: 0; right: 0; height: var(--vvh, 100dvh); overflow: hidden; display: flex; flex-direction: column; overscroll-behavior: none; }
  body.phone-play.kb-open, body.phone-play.typing { padding-bottom: 0; }
  body.phone-play .topbar { display: none; }
  body.phone-play #crossword { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  body.phone-play #crossword > main { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr); column-gap: 10px; row-gap: 6px; padding-top: 10px; padding-bottom: 6px; align-items: center; }
  /* one slim row: arrow back, title, progress and time */
  body.phone-play #crossword > main > .back { grid-column: 1; grid-row: 1; margin: 0; font-size: 0; line-height: 0; padding: 4px 6px 4px 0; }
  body.phone-play #crossword > main > .back::before { content: "\2190"; font-size: 22px; line-height: 1; }
  body.phone-play #crossword > main > h1 { grid-column: 2; grid-row: 1; font-size: 18px; line-height: 1.2; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body.phone-play #crossword > main > .meta { grid-column: 3; grid-row: 1; margin: 0; gap: 8px; align-items: baseline; }
  body.phone-play .meta .count { display: none; }
  body.phone-play .meta .play-count { color: var(--muted); font-size: 13px; white-space: nowrap; }
  body.phone-play .meta .timer { font-size: 16px; }
  body.phone-play #crossword > main > .intro, body.phone-play #crossword > main > .legend, body.phone-play .below { display: none; }
  /* board = clue box, grid box, buttons, clue list. Only the grid box and the clue list can scroll; the clue list gets what is left */
  body.phone-play .board { grid-column: 1 / -1; grid-row: 2; align-self: stretch; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
  body.phone-play .clue-bar { flex: none; width: 100%; box-sizing: border-box; height: auto; min-height: 64px; padding: 6px 12px; font-size: 14px; line-height: 1.3; align-items: flex-start; }
  body.phone-play .play { flex: 0 1 auto; min-height: 96px; width: 100%; max-width: none; margin: 0; overflow: auto; overscroll-behavior: contain; display: block; scrollbar-width: none; }
  body.phone-play .play::-webkit-scrollbar { display: none; }
  body.phone-play .grid { margin: 0 auto; }
  /* iPhone Safari zooms the whole page when it focuses a field whose text is smaller than 16px, and the page then stays zoomed and shifted. Squares are small, so the letter is never below 16px. */
  body.phone-play .cell input { font-size: max(16px, calc(var(--cell) * .5)); }
  body.phone-play .clue-spacer { display: none; }
  body.phone-play .side { display: contents; }
  body.phone-play .actions { flex: none; gap: 4px 6px; justify-content: center; }
  body.phone-play .actions .quiet:first-of-type { margin-left: 0; }
  body.phone-play .actions button { padding: 7px 10px; font-size: 13px; }
  body.phone-play .actions .actions-break { display: block; order: 1; flex-basis: 100%; height: 0; }
  body.phone-play .actions .quiet { order: 2; border-color: transparent; background: none; color: var(--muted); padding: 3px 3px; font-size: 12px; }
  body.phone-play .actions .quiet[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
  body.phone-play .share-note, body.phone-play .result { flex: none; }
  body.phone-play .result-next { display: inline-block; }
  body.phone-play .clues { flex: 1 1 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
}
/* ---- Phone: our own keyboard (test version, opt-in with ?kb=own). It sits at the bottom of the fixed screen and takes space only while typing ---- */
@media (max-width: 760px) {
  body.phone-play.own-kb { --kbh: 255px; }
  body.own-kb .cell, body.own-kb .grid { touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
  body.phone-play #kb { display: none; flex: none; flex-direction: column; gap: 11px; padding: 12px 8px max(10px, env(safe-area-inset-bottom)); background: #e0e1e7; border-radius: 14px 14px 0 0; -webkit-user-select: none; user-select: none; }
  body.phone-play.typing #kb { display: flex; }
  /* With our own keyboard nothing needs the clue bar pinned to the top, so it stays in the page and never covers the grid */
  body.phone-play.own-kb.typing .clue-bar { position: static; transform: none !important; border-radius: 10px; box-shadow: none; }
  .bar-back { display: none; }
  /* while typing, keep the crossword title in the top row so you know which crossword this is */
  body.phone-play.own-kb.typing #crossword > main > h1 { display: block; font-size: 15px; font-weight: 500; color: var(--muted); }
  body.phone-play.typing .bar-back { display: flex; align-items: center; justify-content: center; flex: none; width: 34px; height: 34px; margin: -4px 0 0 -6px; border-radius: 50%; color: var(--accent); }
  body.phone-play.typing .bar-back:active { background: #cfe0f5; }
  #kb .kbr { display: flex; justify-content: center; gap: 6px; }
  #kb button { flex: 1 1 0; max-width: 40px; height: 44px; padding: 0 0 2px; border: 0; border-radius: 6px; background: #fff; color: var(--ink); font: 400 21px/1 "FiraGO", system-ui, sans-serif; box-shadow: 0 1px 0 #9a9ca4; touch-action: manipulation; -webkit-tap-highlight-color: transparent; cursor: pointer; }
  #kb button:active { background: #d4d6dd; }
  #kb .fk { flex: 0 0 50px; max-width: 50px; display: flex; align-items: center; justify-content: center; padding: 0; }
  #kb .fk[aria-pressed="true"] { background: var(--ink); color: #fff; }
  #kb .ctl button { max-width: none; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 6px; font-size: 13px; font-weight: 500; color: #0a3f8f; }
  body.phone-play.own-kb.typing .actions, body.phone-play.own-kb.typing .share-note { display: none; }
  #kb .kbtop { flex: none; display: flex; align-items: center; gap: 2px; margin: -6px 0 -2px; }
  #kb .kbscroll { flex: 1 1 auto; min-width: 0; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-right: 22px; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 26px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 26px), transparent); }
  #kb .kbscroll::-webkit-scrollbar { display: none; }
  #kb .kba { flex: none; max-width: none; height: 30px; padding: 0 11px; border-radius: 15px; background: #fff; box-shadow: none; border: 1px solid #b9cfe9; font: 400 12.5px/1 "FiraGO", system-ui, sans-serif; color: var(--ink); white-space: nowrap; }
  #kb .kba.main { background: #006aff; border-color: #006aff; color: #fff; }
  #kb .kba[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
  #kb .kbx { flex: 0 0 38px; max-width: none; height: 30px; padding: 0; background: none; box-shadow: none; display: flex; align-items: center; justify-content: center; color: #3d5573; }
  #kb .kbl { position: relative; height: 164px; overflow-y: auto; -webkit-overflow-scrolling: touch; margin: 0 -2px; background: #fff; border-radius: 8px; padding: 0 8px 6px; }
  #kb .kbl h4 { margin: 0; padding: 10px 2px 4px; font: 600 11px/1 "FiraGO", system-ui, sans-serif; color: #3d5573; letter-spacing: .04em; text-transform: uppercase; }
  #kb .kbl .ci { display: flex; gap: 8px; align-items: flex-start; flex: none; width: 100%; max-width: none; height: auto; min-height: 38px; padding: 8px 6px; margin: 0; border-radius: 8px; background: none; box-shadow: none; text-align: left; font: 400 14px/1.3 "FiraGO", system-ui, sans-serif; color: var(--ink); }
  #kb .kbl .ci b { flex: 0 0 22px; color: #006aff; font-weight: 600; }
  #kb .kbl .ci.cur { background: #e3efff; }
  #kb .kbl .ci.done { color: #14975a; }
  #kb .ctl .on { background: #e3efff; }
  #kb .ctl .w1 { flex: 0 0 64px; }
  #kb .ctl .w2 { flex: 0 0 52px; }
}
@media (pointer: coarse) { .cell.active input:focus-visible { outline: none; } } /* the dark ring around the selected square stuck out of the grid on phones */
