/* Feetle Reverse: on top of style.css, so the board, keyboard and tools match the daily and Unlimited */
main { overflow-x: hidden; }   /* the shake and the side numbers never bring a sideways scrollbar */

/* each move row: normal 66px tiles, centered like the other modes, with the steps-to-go number hanging off the right */
#board .row { position: relative; }
.togo { position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: center;
  line-height: 1; color: var(--muted); font-weight: 700; white-space: nowrap; }
.togo b { font-size: 1.25rem; }
.togo small { font-size: .62rem; margin-top: 2px; }
.togo.under { color: #5fbf73; }   /* at or under par */
.togo.over { color: var(--bad); }   /* over par */
.togo.solved b { font-size: .9rem; color: #5fbf73; }

/* the hidden word: the last row of the ladder, dashed until found */
#goal { display: flex; gap: 8px; justify-content: center; margin-top: 8px; padding-top: 8px; width: fit-content; margin-inline: auto; position: relative; }
#goal::before { content: ""; position: absolute; top: 0; left: 0; right: 0; border-top: 1px dashed var(--line2); }   /* the dashed line above it (a separate line so it can grow in on load) */
#goal.line-in::before { animation: line-grow .3s ease-out both; animation-delay: var(--line-delay, 0s); }
@keyframes line-grow { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }   /* fades in as it rises into place, like the boxes */
html.reduce-motion #goal.line-in::before { animation: none; }
@media (prefers-reduced-motion: reduce) { #goal.line-in::before { animation: none; } }
#goal .tile { border-style: dashed; color: var(--muted); }
#goal .tile.g { border-style: solid; color: #fff; }

/* Wordle-style colors, Feetle version */
.tile.g, .key.g, .example span.g { background: #3f7a4c; border-color: #3f7a4c; color: #fff; }   /* right letter, right spot: green */
.tile.y, .key.y, .example span.y { background: #b39a36; border-color: #b39a36; color: #fff; }   /* in the word, wrong spot: muted olive gold */
.tile.x { background: #3a3a3a; border-color: #3a3a3a; color: var(--fg); }
/* first-visit walkthrough (#coach in reverse.html) */
.example span.x { background: #3a3a3a; border-color: #3a3a3a; }
.example span.dash { border-style: dashed; color: var(--muted); }
#coach .coach-step { text-align: center; }
#coach .coach-n { margin: 0 0 4px; font-size: .75rem; color: var(--muted); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
#coach .coach-ex { margin: 10px 0; }
#coach .coach-hint { font-size: .85rem; color: var(--muted); }
#coach .coach-nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin-top: 12px; }   /* Next always dead center; Back in the left column when shown */
#coach #coachBack { grid-column: 1; justify-self: start; }
#coach #coachNext { grid-column: 2; min-width: 120px; }
.key.x { background: #2c2c2c; color: #777; }

/* word guesses, small, under the ladder */
#wguesses { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 14px; }
#wguesses:empty { display: none; }
#wguesses .label { color: var(--muted); font-size: .8rem; font-weight: 600; }
#wguesses .tile { width: 34px; height: 34px; font-size: 1rem; }

#tools .primary { margin: 0; position: relative; }   /* relative: for the (Spacebar) key hint */
#tools .primary[hidden] { display: none; }
.rv-answer { color: var(--muted); font-size: .8rem; text-align: center; margin-bottom: 12px; }
.rv-answer summary { cursor: pointer; }
.rv-answer b { color: var(--fg); letter-spacing: .05em; }

/* win popup */
#result { text-align: center; width: min(360px, calc(100vw - 32px)); box-sizing: border-box; }   /* one steady width, a little roomier */
/* the 👍 👎 follow-up buttons and the share buttons: same size, lined up, with clear space between the two rows */
#result .rate { margin-bottom: 6px; }
#result .rate-btns .primary, #result .share-btns .primary { margin: 0; padding: 8px 10px; flex: 0 0 9.5em; box-sizing: border-box; white-space: nowrap; }
#result .share-btns { margin-top: 20px; gap: 10px; }
#result .rv-score { font-size: 3rem; font-weight: 800; margin: 4px 0 0; line-height: 1; }
#result .rv-score.under { color: #5fbf73; }
#result .rv-score.over { color: var(--bad); }
#result .rv-verdict { font-weight: 700; margin-top: 4px; }
#result .rv-path { color: var(--muted); font-size: .85rem; letter-spacing: .03em; }
#result .primary { margin-top: 10px; }
#result .rv-points { font-weight: 700; color: var(--accent); }
#result .rv-points.muted, .muted { color: var(--muted); font-weight: 400; font-size: .85rem; }
#result .rv-next { color: var(--muted); font-size: .8rem; }

/* Reverse leaderboard */
#rvBoard h3 { margin: 14px 0 6px; font-size: .95rem; color: var(--muted); }
.rv-board { list-style: none; margin: 0; padding: 0; }
.rv-board li { display: flex; gap: 10px; padding: 6px 10px; border-radius: 6px; }
.rv-board li:nth-child(odd) { background: rgba(255,255,255,.04); }
.rv-board li.mine { outline: 2px solid var(--accent); }
.rv-board li.gap { justify-content: center; color: var(--muted); background: none; padding: 0; }
.rv-board .n { width: 2ch; text-align: right; color: var(--muted); }
.rv-board .name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.rv-board .pts { font-weight: 700; }


/* local testing only: "New puzzle (testing)" */
.rv-devnew { display: block; margin: 8px auto 4px; padding: 6px 12px; font: inherit; font-size: .85rem; color: var(--muted); background: transparent; border: 1px dashed var(--line2); border-radius: 8px; cursor: pointer; }
.rv-devnew:hover { color: var(--fg); border-color: var(--accent); }
.rv-devnew[hidden] { display: none; }

/* How to play: the color names in their tile colors */
.c-g { color: #5fa86e; }   /* in the popup and the menu's How to play page */
.c-y { color: #cdb44f; }

/* page load: the entry row, then the hidden-word row, fade in box by box (delays set in reverse.js load) */
.tile.tile-in { animation: diffIn .5s ease-out both; }   /* same fade as the daily's start row (style.css .row.enter) */
html.reduce-motion .tile.tile-in { animation: none; }
@media (prefers-reduced-motion: reduce) { .tile.tile-in { animation: none; } }
#board .entry { position: relative; }   /* holds the DUTT easter egg button (egg.js) */

/* under par: the wave up the board (waveBoard in celebrate.js), green to match Reverse */
.tile.wave.green { animation: wave-green .42s ease-out; }
@keyframes wave-green { 0% { background: #4fae62; color: #fff; border-color: #4fae62; box-shadow: 0 0 14px #6fdc84; } 100% { } }
/* page load (reverse.js): "Word guesses" rises in like the dashed line above the hidden word; Guess the word pans up last */
#wguesses .label.label-in { animation: line-grow .3s ease-out both; }
#guessMode.pan-up { animation: pan-up .45s ease-out both; }
@keyframes pan-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
html.reduce-motion :is(#wguesses .label.label-in, #guessMode.pan-up) { animation: none; }
@media (prefers-reduced-motion: reduce) { :is(#wguesses .label.label-in, #guessMode.pan-up) { animation: none; } }
#wguesses .mini-row .tile:nth-child(3) { margin-left: -1px; }   /* the middle gap drew a pixel wider than the others: pulled in 1px (trial) */
/* opening a game (reverse.js): the keyboard's coloured letters start plain, then fade into green / gold / grey */
#keyboard .key { transition: background-color .45s ease-out, color .45s ease-out, border-color .45s ease-out; }   /* same as the line under the logo */
#keyboard.keys-plain .key:is(.g, .y, .x) { background: var(--key); color: var(--fg); border-color: transparent; }

/* phones (reverse.js): the bar above the keyboard. Left: "Word guesses", the guessed words, the red message under them.
   Right: Guess the word. The game area above keeps only the path and the hidden word */
#tools.rv-bar { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "guesses button" "message button"; align-items: center; column-gap: 12px; row-gap: 4px; width: 100%; max-width: 359px; margin: 6px auto 0; padding: 0 8px; box-sizing: border-box; }
#tools.rv-bar #wguesses { grid-area: guesses; margin: 0; align-items: flex-start; }
#tools.rv-bar #message { grid-area: message; margin: 0; min-height: 0; text-align: left; font-size: .9rem; }
#tools.rv-bar #guessMode { grid-area: button; justify-self: end; }
#tools.rv-bar #wguesses:empty + #message:empty { display: none; }   /* nothing on the left yet: just the button */
/* phones: bigger word-guess boxes; Guess the word smaller, its gold box just big enough for the words (no Spacebar hint: no keyboard key on a phone) */
#tools.rv-bar #wguesses .tile { width: calc(38px * var(--fit, 1)); height: calc(38px * var(--fit, 1)); font-size: calc(1.1rem * var(--fit, 1)); }
#tools.rv-bar #guessMode { width: auto; padding: 9px 14px; font-size: .9rem; line-height: 1.1; white-space: nowrap; }
#tools.rv-bar #guessMode .key-hint { display: none; }
/* phones: before any word guess, the left of the bar says so (in the label's style) instead of being empty */
#tools.rv-bar #wguesses:empty { display: flex; }
#tools.rv-bar #wguesses:empty::before { content: "Guess the word first"; color: var(--muted); font-size: .8rem; font-weight: 600; }
/* "Guess the word first" sits level with the middle of the button (spans both rows of the bar while there's no message) */
#tools.rv-bar:has(#message:empty) #wguesses:empty { grid-row: 1 / 3; align-self: center; }

/* phones: the red message under the guesses is the same size as "Word guesses" */
#tools.rv-bar #message { font-size: .8rem; }
/* phones: once Guess the word is gone, its place says why: "That's it: …" or "Out of guesses…" */
#tools.rv-bar .rv-status { grid-area: button; justify-self: end; margin: 0; max-width: 170px; text-align: right; font-size: .8rem; font-weight: 600; color: var(--accent); }
#tools.rv-bar .rv-status.bad { color: var(--bad); }
#tools.rv-bar .rv-status[hidden] { display: none; }
/* phones: Guess the word in the same text size as "Guess the word first", and a little smaller */
#tools.rv-bar #guessMode { font-size: .8rem; padding: 7px 11px; }
/* the status in the button's place: one sentence per line ("Out of guesses." / "Find it with your moves"), centred top to bottom */
#tools.rv-bar .rv-status { white-space: pre-line; align-self: center; line-height: 1.3; }

/* phones: the status in the button's place is centred (each sentence on its own line) */
#tools.rv-bar .rv-status { text-align: center; justify-self: center; }
/* phones: the left of the bar points at the button ("Guess the word → first"); the button just says "Guess", a bit bigger,
   level with the text beside it */
#tools.rv-bar #wguesses:empty::before { content: "Guess the word first \2192"; }
#tools.rv-bar #guessMode { font-size: .9rem; padding: 8px 18px; align-self: center; }
/* phones: the text side of the bar pans up like the button (reverse.js) */
#tools.rv-bar #wguesses.pan-up { animation: pan-up .45s ease-out both; }
html.reduce-motion #tools.rv-bar #wguesses.pan-up { animation: none; }
@media (prefers-reduced-motion: reduce) { #tools.rv-bar #wguesses.pan-up { animation: none; } }

/* phones: the bar's status fades in with the word guesses when the page opens; the solved line there is a link to the results */
#tools.rv-bar .rv-status.fade-in { animation: subIn .45s ease-out both; }
html.reduce-motion #tools.rv-bar .rv-status.fade-in { animation: none; }
@media (prefers-reduced-motion: reduce) { #tools.rv-bar .rv-status.fade-in { animation: none; } }
#tools.rv-bar .rv-status.win-link { color: var(--fg); cursor: pointer; -webkit-tap-highlight-color: transparent; user-select: none; }   /* like the other modes' win line (style.css #message.win-link) */
#tools.rv-bar .rv-status.win-link:hover { opacity: .85; } #tools.rv-bar .rv-status.win-link:focus:not(:focus-visible) { outline: none; } #tools.rv-bar .rv-status.win-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
