:root {
  --bg: #f7f5f0;
  --card: #ffffff;
  --ink: #18181b;
  --soft: rgba(24, 24, 27, 0.58);
  --line: rgba(24, 24, 27, 0.1);
  --accent: #2f6fe4;
  --cell: min(38px, calc((100vw - 60px) / 5), calc((100vh - 196px) / 5));
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 8px 12px;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; outline: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.cw { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 11px; width: min(300px, 100%); padding: 16px 16px 14px; border-radius: 26px; background: var(--card); box-shadow: inset 0 0 0 1.500px var(--line), 0 30px 44px -30px rgba(24, 24, 27, 0.35); }
.cw__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; padding: 0 2px; }
.cw__what { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; min-width: 0; }
.cw__what strong { font-size: 16px; line-height: 20px; font-weight: 740; letter-spacing: -0.01em; white-space: nowrap; }
.cw__clip { display: block; height: 16px; line-height: 16px; overflow: hidden; white-space: nowrap; font-size: 12px; font-weight: 600; color: var(--soft); }
.cw__clip span { display: block; overflow: hidden; text-overflow: ellipsis; }
.cw__time { flex: none; height: 26px; padding: 0 11px; border-radius: 13px; background: rgba(24, 24, 27, 0.05); font-size: 12.500px; line-height: 26px; font-weight: 720; color: var(--ink); transition: background-color 0.4s ease, color 0.4s ease; }
.cw.is-done .cw__time { background: var(--accent); color: #ffffff; }

/* the grid: black squares are just dark cells, the others are buttons with a number and a letter */
.cw__grid { display: grid; grid-template-columns: repeat(5, var(--cell)); grid-auto-rows: var(--cell); gap: 3px; padding: 3px; border-radius: 12px; background: var(--ink); }
.cw__black { border-radius: 4px; background: var(--ink); }
.cw__cell { position: relative; display: grid; place-items: center; border-radius: 5px; background: #ffffff; transition: background-color 0.2s ease; }
.cw__cell.is-word { background: color-mix(in srgb, var(--accent) 20%, #ffffff); }
.cw__cell.is-cur { background: color-mix(in srgb, var(--accent) 46%, #ffffff); }
.cw__cell:focus-visible { box-shadow: inset 0 0 0 2px var(--ink); }
.cw__num { position: absolute; left: 3px; top: 2px; font-size: 8.500px; line-height: 10px; font-weight: 700; color: rgba(24, 24, 27, 0.55); pointer-events: none; }
.cw__let { display: block; font-size: calc(var(--cell) * 0.5); line-height: 1; font-weight: 720; text-transform: uppercase; pointer-events: none; }
@media (hover: hover) { .cw__cell:not(.is-word):hover { background: rgba(24, 24, 27, 0.06); } }

.cw__clue { display: flex; align-items: center; gap: 8px; width: 100%; height: 30px; padding: 0 10px 0 5px; border-radius: 15px; background: rgba(24, 24, 27, 0.045); }
.cw__clip--tag { flex: none; height: 20px; padding: 0 8px; border-radius: 10px; background: var(--accent); line-height: 20px; font-size: 11px; font-weight: 740; color: #ffffff; }
.cw__clip--clue { min-width: 0; font-size: 12.500px; font-weight: 640; color: var(--ink); }
.cw__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; width: 100%; }
.cw__btn { display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; height: 40px; padding: 0 16px; border-radius: 20px; background: var(--ink); color: #ffffff; font-size: 13.500px; font-weight: 720; white-space: nowrap; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 12px 16px -10px rgba(24, 24, 27, 0.7); }
.cw__clip--btn { height: 18px; line-height: 18px; font-size: 13.500px; font-weight: 720; color: #ffffff; }
.cw__btn--quiet { background: rgba(24, 24, 27, 0.06); color: var(--ink); box-shadow: none; }
.cw__btn:focus-visible { box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px var(--ink); }

.ghost { position: absolute; left: 0; top: 0; width: 24px; height: 24px; margin: -3px 0 0 -5px; transform-origin: 20% 15%; pointer-events: none; opacity: 0; fill: #17171a; stroke: #ffffff; stroke-width: 1.300; stroke-linejoin: round; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3)); z-index: 6; }

@media (max-height: 400px) { .cw { gap: 9px; padding: 14px 14px 12px; } .cw__btn { height: 38px; } }
@media (prefers-reduced-motion: reduce) { .cw__cell, .cw__time { transition: none; } }
