/* 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: #1a1b22;
  --muted: #5b6070;
  --border: #c5dcf0;
  --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: "Inter Tight", "Noto Sans Georgian", system-ui, sans-serif;
  line-height: 1.5;
}

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

h1 { font-weight: 400; font-size: 40px; line-height: 1.1; margin: 0 0 8px; }
h1 em { font-family: "Instrument Serif", "Noto Serif Georgian", serif; font-style: italic; }

/* 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) */
.lang-switch { float: right; margin: 8px 0 0 16px; display: flex; gap: 6px; align-items: baseline;
  font-size: 14px; font-family: "Inter Tight", "Noto Sans Georgian", system-ui, sans-serif; color: var(--muted); }
.lang-switch [aria-current] { color: var(--ink); font-weight: 600; }
.lang-switch a { color: var(--muted); text-decoration: none; }
.lang-switch a:hover { color: var(--accent); text-decoration: underline; }
.lang-switch .sep { opacity: .5; }

.back { display: inline-block; color: var(--accent); text-decoration: none; font-size: 14px; margin-bottom: 12px; }
.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: 600; 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: 500; 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: 600; 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; }
button {
  font: inherit; font-weight: 500; padding: 12px 20px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--card); color: var(--ink); cursor: pointer;
}
button:hover { border-color: var(--accent); color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
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: 500; }
.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) h1 em { font-family: inherit; font-style: normal; }
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: 600; 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;
}
.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: 600; }
.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: 600; color: var(--muted); width: 72px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.chip { padding: 6px 12px; font-size: 14px; font-weight: 500; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.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: 14px 16px; color: var(--ink); text-decoration: none;
}
.list a:hover { border-color: var(--accent); }
.list .name { font-weight: 600; font-size: 17px; }
.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: 600; padding: 2px 8px; border-radius: 999px; }
.level-easy { background: var(--green); color: var(--green-ink); }
.level-medium { background: var(--accent-soft); color: var(--accent); }
.level-hard { background: #fff1c2; color: #7a5a00; }
.level-very-hard { background: var(--red); color: var(--red-ink); }
@media (max-width: 560px) {
  .filter-group { gap: 6px; }
  .filter-label { width: 100%; }                 /* label above its buttons on phones */
  .chip { padding: 6px 10px; font-size: 13px; }
}

/* ---- 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; }

/* ---- 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;
}
.next-card:hover { border-color: var(--accent); }
.next-card .name { font-weight: 600; }
.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: 600; }

/* ---- 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: 600; margin-right: 4px; }
.reset { margin-left: auto; padding: 0; border: 0; background: none; font-size: 13px; color: var(--muted); text-decoration: underline; }
.reset:hover { color: var(--accent); }
.reset.confirm { color: var(--red-ink); font-weight: 600; }
.status { font-size: 13px; font-weight: 600; color: var(--green-ink); }
.status.progress { color: var(--muted); font-weight: 500; }
.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: 500; 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: 500; color: var(--accent); }
.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 18px;
  border: 1.5px solid var(--accent); border-radius: 14px; background: #fff; color: inherit; text-decoration: none;
}
.daily-card:hover { box-shadow: 0 2px 12px rgba(0, 106, 255, .12); }
.daily-card .kicker { font-size: 13px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.daily-card .name { font-weight: 600; 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?" under the buttons, closed until tapped */
.howto { font-size: 14px; color: var(--muted); }
.howto summary { cursor: pointer; color: var(--accent); width: fit-content; list-style: none; }
.howto summary::-webkit-details-marker { display: none; }
.howto summary::before { content: "▸ "; }
.howto[open] summary::before { content: "▾ "; }
.howto ul { margin: 8px 0 0; padding: 12px 14px 12px 30px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; line-height: 1.5; }
.howto li + li { margin-top: 4px; }
.howto b { color: var(--ink); font-weight: 600; }
body.typing .howto { 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: 600; 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: 600; }
.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; }
