/*! supertwentyplus licence: (c) 2026 Supertwentyplus Pte. Ltd. All rights reserved. Proprietary, not open source.
   Use only as provided on supertwentyplus.com (free or by subscription, under its Terms). Copying, reuse or hosting elsewhere,
   in whole or in part, needs a written licence: supertwentyplus@gmail.com. See LICENSE.txt at the site root. */
/* Daily Crossword */
.dcw-app { --dcw-pad: clamp(18px, 3vw, 28px); gap: 16px; padding: var(--dcw-pad); }
/* Phones: the panel runs edge to edge so the grid gets every pixel of width */
@media (max-width: 599px) {
  .dcw-app { --dcw-pad: 8px; margin-left: calc(clamp(16px, 4vw, 32px) * -1); margin-right: calc(clamp(16px, 4vw, 32px) * -1); border-left: 0; border-right: 0; border-radius: 0; }
  .dcw-top { padding: 4px 4px 0; }
}
.dcw-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 20px; }
.dcw-levels { max-width: 100%; }
.dcw-levels button { padding: 0 13px; }
@media (max-width: 599px) {
  .dcw-top { flex-direction: column; align-items: stretch; }
  .dcw-levels { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); align-self: stretch; }
  .dcw-levels { border-radius: 22px; }
  .dcw-levels button { grid-column: span 2; }
  .dcw-levels button[data-level^="cryptic"] { grid-column: span 3; }
  .dcw-levels button { padding: 0 2px; font-size: 14px; min-height: 40px; }
  .dcw-top .dcw-stats { flex-wrap: nowrap; justify-content: space-between; gap: 8px; font-size: 14px; }
  .dcw-stats .dcw-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
  .dcw-stats .dcw-menu-btn, .dcw-stats .dcw-pause { flex: none; min-height: 36px; padding: 0 12px; }
}
.dcw-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 15px; color: var(--ink-2); }
.dcw-title { font-weight: 600; color: var(--ink); }
.dcw-time strong { font: 700 17px var(--font-mono); color: var(--ink); font-variant-numeric: tabular-nums; }
.dcw-pause { min-height: 40px; padding: 0 14px; background: var(--surface); border: 1.5px solid var(--ink); border-radius: 999px; color: var(--ink); font-weight: 600; cursor: pointer; }

/* Play area, mobile first: the grid at full width, the tools, then Across and Down side by side.
   With a mouse and keyboard the clue bar sits above the grid. On touch screens the clue bar and
   letter keys form a dock that stays at the bottom of the screen while the puzzle is in view. */
.dcw-play { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "bar" "board" "tools" "lists" "hint"; gap: 12px; }
.dcw-board-wrap { grid-area: board; }
.dcw-tools { grid-area: tools; }
.dcw-lists { grid-area: lists; }
.dcw-dock { display: contents; }
.dcw-clue-bar { grid-area: bar; }
.dcw-hint { grid-area: hint; margin: 0; }
@media (min-width: 900px) {
  .dcw-play { grid-template-columns: minmax(0, max(380px, min(620px, calc(100vh - 170px)))) minmax(0, 1fr); grid-template-areas: "bar lists" "board lists" "tools lists" "hint lists"; grid-template-rows: auto auto auto 1fr; gap: 12px 24px; }
  .dcw-lists { align-self: stretch; contain: size; min-height: 0; }
  .dcw-list { overflow: auto; overscroll-behavior: contain; min-height: 0; }
  .dcw-list h2 { position: sticky; top: 0; z-index: 1; background: var(--surface); }
}
body.dcw-touch .dcw-play { grid-template-areas: "board" "tools" "lists" "dock"; }

body.dcw-touch .dcw-dock { grid-area: dock; display: flex; flex-direction: column; gap: 6px; position: sticky; bottom: 0; z-index: 4; margin: 0 calc(var(--dcw-pad) * -1); padding: 6px var(--dcw-pad) calc(6px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -8px 18px rgba(22, 35, 63, .10); }
/* Tablets on their side: the dock sits under the clue lists, beside the grid */
@media (min-width: 900px) {
  body.dcw-touch .dcw-play { grid-template-columns: minmax(0, max(380px, min(600px, calc(100vh - 200px)))) minmax(340px, 1fr); grid-template-areas: "board lists" "board dock" "tools dock"; grid-template-rows: 1fr auto auto; }
  body.dcw-touch .dcw-dock { position: static; margin: 0; padding: 0; border: 0; box-shadow: none; background: none; }
}
/* Current clue bar */
.dcw-clue-bar { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: stretch; min-height: 52px; background: var(--ink); color: var(--surface); border-radius: var(--btn-radius); overflow: hidden; }
.dcw-bar-btn { display: grid; place-items: center; padding: 0; background: transparent; border: 0; color: inherit; font-size: 22px; cursor: pointer; }
.dcw-bar-btn:hover { background: rgba(255, 255, 255, .12); }
.dcw-bar-text { display: flex; align-items: center; gap: 8px; padding: 6px 4px; background: transparent; border: 0; color: inherit; font: 500 16px/1.3 var(--font-body); text-align: left; cursor: pointer; }
.dcw-bar-num { flex: none; font-weight: 700; white-space: nowrap; opacity: .85; }
.dcw-bar-btn:focus-visible, .dcw-bar-text:focus-visible { outline: 3px solid var(--mark-bg, #FFE066); outline-offset: -3px; }
body.dcw-touch .dcw-clue-bar { min-height: 46px; grid-template-columns: 40px minmax(0, 1fr) 40px; }
body.dcw-touch .dcw-bar-text { font-size: 15px; }

/* Grid */
.dcw-board-wrap { position: relative; width: 100%; }
.dcw-grid { --cw: 32px; display: grid; width: 100%; max-width: 720px; margin: 0 auto; border: 2px solid var(--ink); border-radius: 4px; background: var(--ink); gap: 1px; touch-action: manipulation; user-select: none; -webkit-user-select: none; outline: none; }
.dcw-grid:focus-visible { box-shadow: 0 0 0 3px var(--focus); }
.dcw-cell { position: relative; aspect-ratio: 1; min-width: 0; background: var(--surface); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.dcw-cell.is-block { background: var(--ink); cursor: default; }
.dcw-num { position: absolute; top: 1px; left: 2px; font: 600 calc(var(--cw) * .28)/1 var(--font-body); color: var(--ink-2); pointer-events: none; }
.dcw-letter { position: absolute; inset: 0; display: grid; place-items: center; padding-top: calc(var(--cw) * .12); font: 700 calc(var(--cw) * .56)/1 var(--font-display); color: var(--ink); text-transform: uppercase; pointer-events: none; }
.dcw-cell.in-word { background: #DCE8FF; }
.dcw-cell.is-sel { background: #FFD84D; }
.dcw-cell.is-wrong .dcw-letter { color: #C0291A; }
.dcw-cell.is-wrong::after { content: ""; position: absolute; left: 12%; right: 12%; top: 50%; border-top: 2px solid #C0291A; transform: rotate(-35deg); pointer-events: none; }
.dcw-cell.is-revealed .dcw-letter { color: #1E5FC4; }
.dcw-cell.is-revealed::before { content: ""; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 calc(var(--cw) * .26) calc(var(--cw) * .26) 0; border-color: transparent #1E5FC4 transparent transparent; pointer-events: none; }
.dcw-cell.is-ok .dcw-letter { color: #12704F; }
.dcw-grid.is-paused .dcw-letter { visibility: hidden; }
.dcw-grid.is-done .dcw-cell:not(.is-block) { background: #E3F3EC; }
.dcw-paused { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: color-mix(in srgb, var(--surface) 92%, transparent); border-radius: 4px; }
.dcw-paused[hidden] { display: none; }
.dcw-paused p { font: 800 26px var(--font-display); }

/* Tools */
.dcw-tools { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.dcw-menu { position: relative; }
.dcw-menu summary, .dcw-tool { display: flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 6px; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--btn-radius); color: var(--ink); font-size: 14px; font-weight: 600; cursor: pointer; list-style: none; text-align: center; }
.dcw-menu summary::-webkit-details-marker { display: none; }
.dcw-menu summary::after { content: ""; width: 7px; height: 7px; margin-left: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.dcw-menu[open] summary { border-color: var(--ink); }
.dcw-menu summary:hover, .dcw-tool:hover { border-color: var(--ink); }
.dcw-menu-list { position: absolute; z-index: 5; top: calc(100% + 4px); left: 0; min-width: 100%; display: flex; flex-direction: column; padding: 4px; background: var(--surface); border: 1.5px solid var(--ink); border-radius: var(--btn-radius); box-shadow: 0 10px 24px rgba(22, 35, 63, .18); }
.dcw-menu-list button { min-height: 44px; padding: 0 12px; background: transparent; border: 0; border-radius: 6px; color: var(--ink); font-size: 15px; font-weight: 600; text-align: left; white-space: nowrap; cursor: pointer; }
.dcw-menu-list button:hover, .dcw-menu-list button:focus-visible { background: var(--line-soft); }
.dcw-tool { width: 100%; background: var(--ink); border-color: var(--ink); color: var(--surface); }
.dcw-tool:hover { background: var(--ink-2); }

/* On-screen keyboard: about the size of a phone's own keys, so it fits under the grid but is easy to type on */
.dcw-keys { display: flex; flex-direction: column; gap: 5px; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.dcw-keys[hidden] { display: none; }
.dcw-key-row { display: flex; justify-content: center; gap: 4px; }
.dcw-key { flex: 1 1 0; max-width: 48px; min-width: 0; height: 42px; padding: 0; background: var(--bg, #F4F6FA); border: 1px solid var(--line); border-radius: 6px; color: var(--ink); font: 700 18px/1 var(--font-display); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.dcw-key:active { background: #DCE8FF; border-color: var(--ink); }
.dcw-key-wide { display: grid; place-items: center; flex: 1.5 1 0; max-width: 70px; font-size: 13px; }
.dcw-key-wide .icon { width: 24px; height: 24px; }
@media (min-width: 600px) { .dcw-key { height: 46px; } }
@media (max-height: 700px) { .dcw-key { height: 38px; } body.dcw-touch .dcw-clue-bar { min-height: 42px; } .dcw-keys { gap: 4px; } }
.dcw-hint { font-size: 13px; }

/* Clue lists: Across and Down side by side, compact */
.dcw-lists { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 14px; }
.dcw-list h2 { margin: 0; padding: 2px 4px 6px; font-size: 16px; }
.dcw-list ol { margin: 0; padding: 0; list-style: none; }
.dcw-list li { display: flex; gap: 4px; padding: 4px; border-radius: 6px; font-size: 13.5px; line-height: 1.3; cursor: pointer; }
.dcw-list li b { flex: none; min-width: 1.5em; }
@media (min-width: 600px) { .dcw-list li { gap: 6px; padding: 5px 6px; font-size: 14.5px; } .dcw-list h2 { font-size: 17px; } }
.dcw-list li:hover { background: var(--line-soft); }
.dcw-list li.is-cur { background: #FFD84D; }
.dcw-list li.is-other { background: #DCE8FF; }
.dcw-list li.is-done { color: var(--ink-3); }
.dcw-list li.is-done span { text-decoration: line-through; text-decoration-color: rgba(90, 102, 132, .5); }

/* Finished */
.dcw-win { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 20px; background: #E3F3EC; border: 1px solid #A7D8C3; border-radius: var(--card-radius); color: #0A5A43; }
.dcw-win h3 { margin: 0; font-size: 24px; color: #0A5A43; }
.dcw-win p { margin: 0; }
.dcw-win.is-near { background: #FFF6D6; border-color: #EBCB6B; color: #6B4E00; }
.dcw-win.is-near h3 { color: #6B4E00; }
.dcw-win-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.dcw-win[hidden] { display: none; }

@media (max-width: 420px) {
  .dcw-levels button { font-size: 13px; }
  .dcw-menu summary, .dcw-tool { font-size: 13px; }
}
/* The site's back-to-top button would sit on the delete key */
body.dcw-touch .to-top { display: none !important; }

/* Lobby: resume the game in progress or start a new one */
.dcw-lobby { display: grid; gap: 16px; }
.dcw-lobby[hidden], .dcw-play[hidden] { display: none; }
@media (min-width: 700px) { .dcw-lobby { grid-template-columns: 1fr 1fr; align-items: start; } .dcw-progress { grid-column: 1 / -1; } }
.dcw-resume, .dcw-start { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 20px; background: var(--panel-bg); border: var(--panel-border); border-radius: var(--panel-radius); }
.dcw-resume p, .dcw-progress p { margin: 0; }
.dcw-lobby-kicker { font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.dcw-lobby-id { font: 700 26px var(--font-display); color: var(--ink); }
.dcw-lobby-meta { color: var(--ink-2); }
.dcw-start .btn, .dcw-resume .btn { min-width: 160px; }
.dcw-goto { display: flex; flex-direction: column; gap: 6px; width: 100%; margin-top: 6px; }
.dcw-goto label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.dcw-goto-row { display: flex; align-items: center; gap: 6px; }
.dcw-goto-prefix { font: 700 18px var(--font-mono); color: var(--ink); }
.dcw-goto input { width: 7em; min-height: 44px; padding: 0 10px; border: var(--input-border); border-radius: var(--btn-radius); background: var(--surface); color: var(--ink); font: 600 18px var(--font-mono); }
.dcw-goto .field-hint:empty { display: none; }
.dcw-progress { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; color: var(--ink-2); font-size: 15px; }
.dcw-link { padding: 6px 0; background: none; border: 0; color: var(--accent-text); font-weight: 600; text-decoration: underline; cursor: pointer; }
.dcw-menu-btn { min-height: 40px; padding: 0 14px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px; color: var(--ink); font-weight: 600; cursor: pointer; }
.dcw-menu-btn[hidden], .dcw-pause[hidden] { display: none; }

/* A tick before the number once a clue's answer is filled in */
.dcw-tick { flex: none; width: 1em; font-style: normal; font-weight: 800; color: #12704F; }
/* With the side ad column beside the game, keep at least 320px for the clue lists (v218s) */
@media (min-width: 900px) {
  .dcw-play { grid-template-columns: max(300px, min(600px, calc(100vh - 170px), calc(100% - 344px))) minmax(320px, 1fr); }
  body.dcw-touch .dcw-play { grid-template-columns: max(300px, min(600px, calc(100vh - 200px), calc(100% - 364px))) minmax(340px, 1fr); }
}
/* Clue lists one size smaller on bigger screens (v218t) */
@media (min-width: 600px) { .dcw-list li { font-size: 13px; padding: 4px 5px; } .dcw-list h2 { font-size: 15.5px; } }

/* Finished: toast, confetti and a little bounce of the grid */
.dcw-toast { position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translate(-50%, 140%); opacity: 0; max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 999px; background: #0A5A43; color: #fff; font-weight: 700; box-shadow: 0 8px 24px rgba(0,0,0,.25); transition: transform .35s ease, opacity .35s ease; pointer-events: none; text-align: center; }
.dcw-toast.is-on { transform: translate(-50%, 0); opacity: 1; }
body.dcw-touch .dcw-toast { bottom: auto; top: 16px; transform: translate(-50%, -140%); }
body.dcw-touch .dcw-toast.is-on { transform: translate(-50%, 0); }
.dcw-confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 59; pointer-events: none; }
.dcw-grid.is-cheer .dcw-cell:not(.is-block) { animation: dcw-cheer .6s ease both; }
@keyframes dcw-cheer { 40% { transform: scale(1.12); } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .dcw-toast { transition: none; } .dcw-grid.is-cheer .dcw-cell { animation: none; } }
