/* Scramble game. Uses the colours and buttons from crossword.css. */
/* Filter above the game: minimum name length */
.sc-filter { margin-bottom: 16px; }
.sc-label { font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 8px; }
.sc-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sc-chip { padding: 8px 14px; border-radius: 999px; background: var(--card); border: 1.5px solid var(--border); color: var(--ink); font-family: inherit; font-size: 14px; cursor: pointer; }
.sc-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.sc-game { display: flex; flex-direction: column; gap: 16px; }
.sc-game[hidden] { display: none; } /* the game box goes away when the result screen shows */
.sc-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.sc-slots { min-height: 52px; padding: 14px 8px; background: var(--accent-soft); border-radius: 14px; }
.sc-slot, .sc-tile {
  --s: min(46px, calc((100vw - 60px - var(--sc-n, 8) * 6px) / var(--sc-n, 8)));
  width: var(--s); height: var(--s); padding: 0; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  font-family: inherit; font-weight: 500; font-size: calc(var(--s) * .5); color: var(--ink);
}
.sc-slot { background: var(--card); border: 1px dashed var(--border); }
.sc-slot.filled { border-style: solid; }
.sc-slot.locked { background: var(--grey); }
.sc-tile { background: var(--card); border: 1.5px solid var(--accent); cursor: pointer; }
@media (min-width: 641px) and (hover: hover){.sc-tile:hover{ background: var(--accent-soft); color: var(--ink); }}
.sc-tile.used { opacity: .25; border-color: var(--border); cursor: default; }
.sc-slots.right .sc-slot { background: var(--green); border-color: var(--green); color: var(--green-ink); }
.sc-slots.wrong { animation: sc-shake .4s; }
.sc-slots.wrong .sc-slot.filled:not(.locked) { background: var(--red); border-color: var(--red-ink); }
.sc-slots.shown .sc-slot { background: var(--grey); border-color: var(--border); color: var(--muted); }
.sc-game .actions { justify-content: center; }
.sc-end { display: flex; flex-direction: column; align-items: center; text-align: center; background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 28px 22px; }
.sc-end[hidden] { display: none; }
.sc-end h2 { font-size: 26px; font-weight: 500; margin: 0 0 8px; color: var(--head); }
.sc-end p { color: var(--muted); margin: 0 0 14px; }
.sc-end .win-perfect { color: var(--head); background: var(--accent-soft); border-radius: 10px; padding: 8px 10px; font-weight: 500; }
.sc-end button { display: block; width: 100%; max-width: 320px; margin: 8px auto 0; }
.sc-end button:not(.primary) { border-color: var(--line2); color: var(--head); }
.sc-end .share-note { order: 3; margin: 8px 0 0; font-size: 13px; }
.sc-link { order: 4; display: inline-block; margin-top: 16px; color: var(--accent); }
@keyframes sc-shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* Phones: a quick double tap on a letter must not zoom the page or select text */
#scramble button, #scramble .sc-tile, #scramble .sc-slot { touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
#scramble { touch-action: manipulation; }

/* "How to play" under the game: folded by default, opens on click */
.sc-rules { margin-top: 32px; border-top: 1px solid var(--border); color: var(--muted); font-size: 14px; line-height: 1.55; }
.sc-rules 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; touch-action: manipulation; }
.sc-rules summary::-webkit-details-marker { display: none; }
.sc-rules summary::after { content: "+"; font-size: 20px; font-weight: 350; color: var(--muted); }
.sc-rules[open] summary::after { content: "−"; }
.sc-rules ul { margin: 0 0 8px; padding-left: 18px; }
.sc-rules li { margin-bottom: 4px; }

/* Layout from the design: heading lines up with the game bar; the game is a white card, 640px wide, at the left edge */
.sc-filter, .sc-game, .sc-end, .sc-rules { max-width: 640px; margin-left: 0; margin-right: auto; }
.sc-game { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 28px 24px; gap: 22px; align-items: center; }
.sc-game .meta { align-self: stretch; justify-content: flex-end; margin: 0; }
.sc-game .meta .count { font-size: 13px; }
.sc-row { gap: 8px; }
.sc-slots { background: none; padding: 0; min-height: 0; border-radius: 0; }
.sc-slot, .sc-tile {
  --s: min(68px, calc((min(100vw - 96px, 556px) - (var(--sc-nd, 8) - 1) * 8px) / var(--sc-nd, 8)));
  height: calc(var(--s) * 1.14); border-radius: 14px; font-size: calc(var(--s) * .5);
}
.sc-slot { border: 2px solid var(--border); border-style: solid; background: var(--card); color: var(--head); }
.sc-slot.filled { background: var(--accent-soft); border-color: var(--line2); }
.sc-tile { border: 1px solid var(--line2); color: var(--head); background: var(--card); }
@media (min-width: 641px) and (hover: hover){.sc-tile:hover{ background: var(--accent-soft); color: var(--head); }}
.sc-game .actions { justify-content: center; gap: 10px; }
.sc-game .actions button { padding: 12px 30px; border-radius: 12px; font-size: 15px; font-weight: 400; border: 1px solid var(--line2); color: var(--head); background: var(--card); }
.sc-game .actions #scHint { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }
@media (max-width: 640px) {
  .sc-game { padding: 20px 16px; border-radius: 16px; }
  .sc-slot, .sc-tile { --s: min(54px, calc((100vw - 74px - (var(--sc-n, 8) - 1) * 6px) / var(--sc-n, 8))); border-radius: 12px; }
  .sc-row { gap: 6px; }
  .sc-game .actions { align-self: stretch; }
  .sc-game .actions button { flex: 1 1 0; padding: 12px 8px; }
}
@media (min-width: 900px) { main.narrow:has(.sc-game) { max-width: 1000px; } }

/* Clock, personal best and skipped names */
.sc-game .meta { justify-content: space-between; }
.sc-time { font-size: 13px; font-variant-numeric: tabular-nums; }
.sc-end .sc-result-time { margin-bottom: 6px; }
.sc-end .sc-best { font-weight: 600; color: var(--ink); }
.sc-missed { margin: 4px 0 14px; max-width: 420px; }
.sc-missed[hidden] { display: none; }
.sc-missed h3 { font-size: 14px; margin: 0 0 8px; }
.sc-missed ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; list-style: none; margin: 0; padding: 0; }
.sc-missed li { font-size: 13px; padding: 4px 10px; border: 1.5px solid var(--ink); border-radius: 999px; }
