:root { font-family: 'Trebuchet MS', 'Avenir Next', sans-serif; color: #302b30; background: #f5f4ef; font-synthesis: none; }
* { box-sizing: border-box; }
body { margin: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; color: inherit; touch-action: manipulation; }
button:focus-visible, a:focus-visible { outline: 3px solid #6940b1; outline-offset: 3px; }
.playground { max-width: 960px; padding: 20px 24px; margin: auto; }
.topbar { display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.topbar a { color: #625b66; font-size: 14px; text-decoration: none; }
.small { min-height: 44px; border: 1px solid #928894; border-radius: 8px; padding: 10px 16px; background: white; font-size: 14px; }
#sound[aria-checked=true] { background: #c2e8bc; }
.intro { text-align: center; margin: 26px 0 22px; }
h1 { font-size: clamp(36px, 7vw, 58px); letter-spacing: -2px; margin: 6px 0 8px; }
h1 span { color: #b54b76; display: inline-block; transform: rotate(12deg); }
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 245px; gap: 24px; align-items: start; }
.board-panel { background: white; border: 2px solid #302b30; border-radius: 16px; padding: 12px; box-shadow: 0 5px 0 #d4cfda; min-width: 0; }
.board-heading { display: flex; align-items: center; justify-content: space-between; min-height: 35px; gap: 8px; padding: 0 5px 8px; }
#selection { font-size: 13px; font-weight: bold; letter-spacing: 1px; }
.text-button { border: 0; background: transparent; color: #6d526f; padding: 8px; font-size: 13px; text-decoration: underline; }
.grid { display: grid; grid-template-columns: repeat(var(--columns, 10), minmax(0, 1fr)); touch-action: none; user-select: none; -webkit-user-select: none; gap: 2px; }
.cell { border: 0; background: #f8f6f2; border-radius: 9px; padding: 0; width: 100%; aspect-ratio: 1; font-size: var(--letter-size, 26px); font-weight: bold; display: grid; place-items: center; position: relative; touch-action: none; }
.cell:hover { background: #eee7f6; }
.cell.found { background-color: #f8f6f2; background-image: var(--found-layers); background-blend-mode: multiply; }
.cell.selected { background: #e4cbff; box-shadow: inset 0 0 0 2px #7954a2; }
.cell.hint { box-shadow: inset 0 0 0 3px #a56800; background: #ffe297; }
.cell.anchor::after { content: ''; position: absolute; bottom: 3px; width: 5px; height: 5px; border-radius: 50%; background: #51306f; }
.word-panel { background: #e9e2f4; border: 2px solid #302b30; border-radius: 15px; padding: 17px; }
.word-heading { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
h2 { font-size: 17px; margin: 0; }
#count { font-size: 13px; white-space: nowrap; }
progress { display: block; width: 100%; height: 9px; margin: 13px 0 18px; accent-color: #77529b; border: 0; border-radius: 9px; overflow: hidden; }
progress::-webkit-progress-bar { background: #fff9; }
progress::-webkit-progress-value { background: #77529b; }
h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 1.3px; color: #6d587a; margin: 0 0 7px; }
.word-list { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.word { border: 1px solid #b6a8c5; background: #ffffffb3; border-radius: 6px; padding: 6px 8px; font-size: 14px; font-weight: bold; letter-spacing: .5px; }
.word.found { background: #d0eaca; border-color: #81a47b; text-decoration: line-through; }
.tiny { color: #675a70; font-size: 12px; line-height: 1.6; margin: 20px 0 0; }
.feedback { text-align: center; min-height: 48px; font-size: 15px; line-height: 1.6; margin: 20px 0 10px; }
.next { min-height: 44px; background: #302b30; color: white; border: 2px solid #302b30; border-radius: 8px; padding: 12px 20px; font-size: 15px; font-weight: bold; box-shadow: 0 3px 0 #aba0ae; }
.next:active { transform: translateY(2px); box-shadow: none; }
#party { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 10; }
.confetti { position: absolute; left: var(--left); top: -50px; width: 11px; height: 8px; background: var(--color); animation: fall var(--duration) var(--delay) ease-in both; }
.confetti.symbol { width: auto; height: auto; background: none; font-size: 30px; }
.happy { animation: hop .4s ease 3; }
@keyframes fall { from { opacity: 1; transform: translate(0, -5vh) rotate(0); } to { opacity: 0; transform: translate(var(--drift), 110vh) rotate(650deg); } }
@keyframes hop { 50% { transform: translateY(-10px) rotate(12deg); } }
@media (max-width: 700px) {
  .playground { padding: 16px 12px; max-width: 560px; }
  .intro { margin-top: 22px; }
  .game-layout { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .board-panel { padding: 8px; }
  .cell { font-size: clamp(12px, calc(76vw / var(--columns, 10)), var(--letter-size, 26px)); border-radius: 6px; }
  .word-panel { padding: 14px; }
  #words { display: flex; gap: 6px; }
  .word { font-size: 12px; padding: 5px; }
  h3 { font-size: 10px; letter-spacing: .5px; }
  .tiny { margin: 12px 0 0; }
  .tiny br { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.board-wrap { position: relative; isolation: isolate; }
.cell-letter { position: relative; z-index: 3; color: #302b30; pointer-events: none; }
#trails { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; overflow: visible; }
#trails polyline { fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: .6; mix-blend-mode: multiply; }
#selection { overflow-wrap: anywhere; font-size: 15px; }
.check-word { display: block; width: 100%; margin-top: 12px; min-height: 44px; background: #e9e2f4; border: 1px solid #7954a2; border-radius: 8px; font-weight: bold; }
.check-word:disabled { opacity: .45; cursor: default; }
#words { gap: 8px; }
.bonus-panel { border-top: 1px solid #b6a8c5; margin-top: 20px; padding-top: 16px; }
#bonus-title { font-size: 15px; margin-bottom: 10px; }
#bonus-count { display: inline-block; border-radius: 20px; background: #ffdf9a; min-width: 24px; padding: 3px 6px; text-align: center; margin-left: 4px; font-size: 12px; }
.bonus-word { background: #fff1c2; border-color: #cdb566; }
#bonus-help { margin-top: 0; }

.settings { display: flex; justify-content: center; align-items: end; flex-wrap: wrap; gap: 12px; margin: 0 0 24px; }
.settings label { display: grid; gap: 6px; font-size: 12px; font-weight: bold; }
.settings input { width: 76px; height: 44px; padding: 8px; border: 1px solid #928894; border-radius: 8px; background: white; color: inherit; font: inherit; font-size: 17px; }
.settings input:focus-visible { outline: 3px solid #6940b1; outline-offset: 3px; }
.times { align-self: end; line-height: 44px; color: #786b7d; }
