:root {
  --bg: #071b28;
  --panel: #102e3d;
  --ink: #f4eddd;
  --muted: #b2c5c9;
  --gold: #f2c47c;
  --line: #8bb5b52e;
  --tile: #bddfdf;
  --tile-ink: #f8f0d7;
  --rose: #e1bd78;
  --garden-light: 0;
}

body { background: #06151f; }
.night-scene, .night-shade { position: fixed; inset: 0; pointer-events: none; }
.night-scene {
  z-index: 0;
  background: url('/assets/night-garden.webp') center center / cover no-repeat;
  opacity: calc(.48 + var(--garden-light) * .045);
  transition: opacity 1.2s ease;
}
.night-shade {
  z-index: 0;
  background: linear-gradient(180deg, #0410193d, #04101912 45%, #041019a6),
    radial-gradient(ellipse at center, #0414206b 22%, transparent 72%);
}
.app { position: relative; z-index: 1; max-width: 1080px; padding-top: 24px; }
.masthead { border-color: #c7c19a40; padding-bottom: 20px; }
.wordmark { font-weight: 500; color: #f3ecdb; text-shadow: 0 2px 14px #06131c; }
.wordmark span, .wordmark i { color: #f6ce86; text-shadow: 0 0 22px #dfb05c3b; }
.icon-button, .quiet-button {
  border-color: #9cbabc66;
  background: #071c29cf;
  color: #e5ece5;
}
.icon-button:hover, .quiet-button:hover { background: #1e4553; }
.game-layout { grid-template-columns: 246px minmax(0, 1fr); gap: 38px; padding: 26px 12px 12px; }
.score-panel {
  align-self: start;
  padding: 22px 20px 24px;
  background: linear-gradient(165deg, #0c2838eb, #091c29e6);
  border: 1px solid #bac49738;
  border-radius: 16px;
  box-shadow: 0 16px 40px #020b1433, inset 0 1px 0 #b9d5c00d;
  backdrop-filter: blur(10px);
}
.score { font-size: 54px; color: #ffe4ac; text-shadow: 0 0 28px #edc57624; }
.eyebrow { color: #b6c5c1; font-size: 12px; letter-spacing: 1.5px; }
.device-note { color: #a9c0c5; }
.level-block { margin: 23px 0 0; }
progress { background: #32525c; }
progress::-webkit-progress-bar { background: #32525c; }
progress::-webkit-progress-value { background: linear-gradient(90deg, #bf8a48, #ffe3a2); }
progress::-moz-progress-bar { background: #ecc078; }
.level-heading { gap: 6px; }
.level-heading span:last-child { font-size: 12px; }
.bonus-block { padding: 18px 0; border-color: #a4c5c132; }
.bonus-heading > span:first-child { font-size: 27px; }
.recent-block { padding-top: 21px; }
.recent-block ol { gap: 11px; }
.pace-note { color: #d8c398; padding-top: 24px; font-size: 16px; line-height: 1.65; }

.lantern-progress { margin: 22px 0 18px; }
.lantern-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.lantern-heading .eyebrow { margin: 0; font-size: 11px; letter-spacing: 1.1px; }
#lantern-count { color: #e2c186; font-size: 12px; white-space: nowrap; }
.lanterns { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; list-style: none; margin: 10px -3px 4px; padding: 0; }
.lantern { position: relative; display: grid; place-items: center; height: 54px; }
.lantern img {
  position: relative;
  z-index: 1;
  display: block;
  width: 54px;
  height: 54px;
  max-height: 56px;
  object-fit: contain;
  filter: saturate(.12) brightness(.46);
  opacity: .82;
  transition: filter 1s ease, opacity 1s ease;
}
.lantern::before {
  content: '';
  position: absolute;
  width: 170%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, #f5c2746b, #e7a5440d 53%, transparent 72%);
  opacity: 0;
  transition: opacity 1.2s ease;
}
.lantern.is-lit img { filter: drop-shadow(0 0 6px #f4c1696b); opacity: 1; }
.lantern.is-lit::before { opacity: 1; }
.lantern.newly-lit img { animation: lantern-awakens 1s ease both; }
#lantern-next { margin: 3px 0 0; font-size: 12px; line-height: 1.5; color: #b4c8c9; }

.play-panel { max-width: 520px; }
.board-heading { color: #d8d6bb; font-size: 12px; letter-spacing: 1.8px; margin-bottom: 12px; text-shadow: 0 1px 9px #061520; }
.board-heading > span:last-child { color: #c2d8d8; letter-spacing: 0; }
.board-surround {
  background: linear-gradient(155deg, #173f4ae6, #071c2bea 65%);
  border: 1px solid #b59d666b;
  border-radius: 19px;
  padding: 12px 15px 15px;
  box-shadow: 0 16px 48px #01090f6b, inset 0 0 0 4px #6b8c7b0d, inset 0 1px 0 #dbdfb329;
  backdrop-filter: blur(8px);
}
.tile {
  color: #fff1c9;
  background: linear-gradient(145deg, #8ebcb1, #43696d 42%, #183b4d 70%, #beac6e);
  filter: none;
  transition: filter .15s;
}
.tile::before {
  inset: 2px;
  background: linear-gradient(150deg, #457987 0%, #224f63 35%, #12364b 73%, #244c5c 100%);
  box-shadow: inset 0 4px 18px #b2e1d026, inset 0 -9px 15px #020f1b38;
}
.tile .letter { font-weight: 500; text-shadow: 0 1px 2px #031823, 0 0 12px #f4d0891f; }
.tile .tile-value { color: #c1d9d8; font-size: 12px; }
.tile:not(:disabled):hover { filter: brightness(1.16); }
.tile.selected::before,
.tile.selected.bonus2::before,
.tile.selected.bonus3::before,
.tile.selected.fire::before { background: linear-gradient(145deg, #fff1c7, #efc070 58%, #d49546); }
.tile.bonus2 { background: #a9d9bd; filter: none; }
.tile.bonus2::before { background: linear-gradient(145deg, #3a927a, #1d685b 65%, #185446); }
.tile.bonus3 { background: #cbc2f3; filter: none; }
.tile.bonus3::before { background: linear-gradient(145deg, #8678b3, #534470 70%, #3f3d63); }
.tile.bonus2 .tile-value, .tile.bonus3 .tile-value { color: #fff0c8; }
.tile.fire { background: #f1b981; filter: none; }
.tile.fire::before { background: linear-gradient(145deg, #9e4c39, #682f32 65%, #512a33); }
.tile.fire .letter { color: #fff0bf; }
.tile.fire .tile-value { color: #ffc786; }
.tile.selected { background: #ffe5a6; filter: drop-shadow(0 0 5px #eec17866); }
.tile.selected .letter { color: #273633; text-shadow: 0 1px 0 #ffffff4d; }
.tile.selected .tile-value, .tile.selected::after { color: #594825; }
.tile.bottom-fire::before { animation: lantern-ember 1.6s ease-in-out infinite; }
.tile.blast-zone { background: #edc477; }
.tile.blast-zone::before { background: linear-gradient(145deg, #e9ba6e, #ba7842); }
.tile.blast-zone .letter, .tile.blast-zone .tile-value { color: #273435; text-shadow: none; }
.tile.blast-center::before { background: linear-gradient(145deg, #fff2cd, #ffe4a0); }
.tile.blasting::before { background: #fff0c8; }
.tile:focus-visible { filter: brightness(1.25) drop-shadow(0 0 4px #ffedba); }
.bottom-line { background: #c5a76a; opacity: .62; }
.word-tray { background: #061d2aeb; border-color: #8dafa05c; box-shadow: inset 0 1px 10px #020c1433; }
.clear-button { background: #234756; color: #dfebe4; }
.message { color: #c3d5d5; text-shadow: 0 1px 6px #04111b; }
.message.success { color: #c4e6c8; }
.message.error { color: #ffd2aa; }
.submit-button { background: linear-gradient(145deg, #ffe1a5, #eabd73); color: #213532; box-shadow: inset 0 1px 0 #fff6d580, 0 3px 12px #030e1a40; }
.submit-button:not(:disabled):hover { background: #ffe5b1; }
.submit-button:disabled { background: #284652; color: #b0c2c5; box-shadow: none; }
.shuffle-button { background: #0a2433e6; border-color: #8eb1ae80; color: #d9e7df; }
.shuffle-button:hover { background: #234a58; }
.bloom-button { background: #30392ce6; border-color: #c7aa697a; color: #f5d395; }
.bloom-count { background: #5f5435; }
.bloom-button:not(:disabled):hover, .bloom-button[aria-pressed="true"] { background: #efd08c; color: #233a38; }
.bloom-button[aria-pressed="true"] .bloom-count { background: #d7b575; }
.board-instructions { color: #c0d2d3; text-shadow: 0 1px 8px #020d17; }
footer { border-color: #a7ba983d; color: #c1d1cd; text-shadow: 0 1px 8px #030f1b; }
footer > span:first-child { color: #e3cd9c; }
.modal { background: linear-gradient(150deg, #153747, #0b2333); border-color: #b9a67480; }
.modal::backdrop { background: #020e18bf; }
.modal p { color: #cfdfdb; }
.rule-mark { background: #eed091; color: #233b3a; }
.fire-mark { background: #dca16f; }
.credits { color: #c0d2d0; }

@keyframes lantern-awakens {
  0% { filter: saturate(.12) brightness(.46); transform: scale(.94); }
  60% { filter: brightness(1.13) drop-shadow(0 0 11px #ffd38499); transform: scale(1.04); }
  100% { filter: drop-shadow(0 0 6px #f4c1696b); transform: scale(1); }
}
@keyframes lantern-ember { 50% { filter: brightness(1.25); } }

@media (max-width: 900px) and (min-width: 621px) {
  .game-layout { grid-template-columns: 196px minmax(0, 1fr); gap: 24px; padding-left: 0; padding-right: 0; }
  .score-panel { padding: 20px 14px; }
  .score { font-size: 47px; }
  .lantern-heading { flex-wrap: wrap; gap: 4px; }
  .lanterns { margin-top: 5px; }
  .lantern img { width: 46px; height: 46px; }
}
@media (max-width: 620px) {
  .app { padding: 11px 14px 18px; }
  .night-scene { background-position: 26% center; }
  .night-shade { background: linear-gradient(180deg, #03152129, #03152166 80%); }
  .masthead { padding-bottom: 12px; }
  .wordmark { font-size: 30px; }
  .top-actions { gap: 8px; }
  .game-layout { padding-top: 12px; padding-left: 0; padding-right: 0; gap: 10px; }
  .score-panel { align-self: stretch; padding: 12px 14px 6px; border-radius: 12px; gap: 0 18px; }
  .score { font-size: 40px; margin-bottom: 4px; }
  .score-block .eyebrow { font-size: 11px; }
  .level-block { margin: 0; }
  .bonus-block { padding: 8px 0 0; border: 0; }
  .bonus-heading > span:first-child { font-size: 21px; }
  .lantern-progress { grid-column: 1 / -1; grid-row: 3; display: grid; grid-template-columns: minmax(0, 1fr) 116px; gap: 10px; align-items: center; margin: 9px 0 0; padding-top: 3px; border-top: 1px solid #b7b98e29; }
  .lantern-heading { display: none; }
  .lanterns { margin: 0 -2px; gap: 2px; }
  .lantern { height: 42px; }
  .lantern img { width: 40px; height: 40px; }
  #lantern-next { margin: 0; font-size: 12px; line-height: 1.4; text-align: right; }
  .board-heading { margin-bottom: 8px; font-size: 11px; letter-spacing: 1.6px; }
  .board-heading > span:last-child { font-size: 12px; }
  .board-surround { padding: 7px 9px 9px; border-radius: 14px; }
  .board { aspect-ratio: 5.6 / 6.3; }
  .tile .letter { font-size: clamp(23px, 6.2vw, 28px); }
  .tile .tile-value { font-size: 11px; bottom: 9%; }
  .tile.selected::after { top: 6%; font-size: 9px; }
  .tile.fire .tile-value { bottom: 7%; }
  .word-tray { margin-top: 10px; min-height: 48px; }
  .message { margin-top: 7px; margin-bottom: 9px; }
  .board-instructions { margin-top: 9px; }
  footer { margin-top: 16px; }
}
@media (max-width: 360px) {
  .app { padding-left: 11px; padding-right: 11px; }
  .wordmark { font-size: 27px; }
  .score-panel { padding: 10px 11px 5px; }
  .score { font-size: 36px; }
  .lantern-progress { grid-template-columns: minmax(0, 1fr) 101px; gap: 6px; }
  .tile .letter { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

[hidden] { display: none !important; }
.night-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.pocket-button, .chain-status { min-width: 0; min-height: 60px; border: 1px solid #8eb1ae66; border-radius: 10px; padding: 9px 12px; background: #0b2634e8; text-align: left; }
.pocket-button { display: flex; flex-direction: column; justify-content: center; gap: 5px; }
.pocket-label { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; color: #f1e7cb; }
#pocket-letter { color: #d4f3de; letter-spacing: 1px; }
#pocket-charges { font-size: 12px; line-height: 1.4; color: #bed0d1; }
.pocket-button:disabled { opacity: .82; }
.pocket-button:not(:disabled):hover, .pocket-button[aria-pressed="true"] { background: #28584f; border-color: #c5eed0; }
.chain-status { display: flex; flex-direction: column; justify-content: center; gap: 5px; }
#chain-next { color: #f2d6a2; font-size: 14px; font-weight: 600; }
#chain-detail { color: #bed0d1; font-size: 12px; line-height: 1.4; }
.chain-status.chain-ready { background: #39442ce8; border-color: #efd591; }
.tile.cluster .letter { font-size: 25px; letter-spacing: -1px; }
.tile.triple-cluster .letter { font-size: 21px; letter-spacing: -1px; }
.tile.lantern-target { background: #ffe6a0; }
.tile.lantern-target::before { box-shadow: inset 0 0 12px #f9d78c44; }
.tile.lantern-target .tile-value { color: #ffe4a1; }
.tile.selected.lantern-target .tile-value, .tile.blast-zone.lantern-target .tile-value { color: #594825; }
.pocket-armed .tile { cursor: crosshair; }
.tile.pocket-target::before { background: linear-gradient(145deg, #d8f4d9, #80c8b5); }
.tile.pocket-target .letter, .tile.pocket-target .tile-value { color: #173d39; text-shadow: none; }
.bloom-shapes { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 9px; border: 1px solid #b89f6a80; border-radius: 10px; background: #0b2534; }
.bloom-shapes legend { padding: 0 5px; font-size: 14px; color: #e8d3a7; }
.bloom-shapes button { flex: 1; min-height: 42px; border: 1px solid #8b9f9673; border-radius: 7px; padding: 8px; background: #183847; color: #e4e9d6; font-size: 14px; }
.bloom-shapes button[aria-pressed="true"] { background: #efce8c; color: #253936; border-color: #efce8c; }
.collection-link { min-height: 42px; display: flex; gap: 10px; align-items: center; border: 0; background: transparent; padding: 4px 0; color: #f1d19a; font-size: 14px; }
.collection-link:hover { text-decoration: underline; }
#collection-count { min-width: 23px; padding: 3px 6px; border: 1px solid #b9bf9773; border-radius: 6px; font-size: 12px; }
.collection-modal { max-width: 690px; }
.collection-summary { margin-top: 0; }
.collection-records { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 20px 0; }
.collection-records > div { padding: 14px; background: #071e2e; border: 1px solid #6e8e8869; border-radius: 10px; }
.collection-records span { display: block; font-size: 13px; color: #b7d0d0; margin-bottom: 8px; }
.collection-records strong { font-size: 16px; color: #f0d49f; overflow-wrap: anywhere; }
.collection-sort { display: flex; align-items: center; gap: 12px; margin: 20px 0 8px; font-size: 14px; }
.collection-sort select { min-height: 42px; flex: 1; max-width: 280px; background: #173b4c; color: #f3ead7; border: 1px solid #8ca79c; border-radius: 7px; padding: 8px 12px; font: inherit; font-size: 16px; }
.collection-words { padding: 0; margin: 0; list-style: none; }
.collection-words > li { padding: 17px 0; border-bottom: 1px solid #9bb4a438; }
.collection-word-heading strong { display: block; font-family: 'Fraunces', Georgia, serif; font-size: 23px; font-weight: 500; letter-spacing: .4px; overflow-wrap: anywhere; }
.collection-word-heading span { display: block; margin-top: 6px; color: #bed2d1; font-size: 13px; }
.collection-word-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.collection-word-actions button { min-height: 40px; border: 1px solid #829d926b; border-radius: 7px; padding: 7px 11px; background: #173b47; color: #e5e8d5; font-size: 14px; }
.collection-word-actions button:hover { background: #305445; }
.collection-word-actions .discovery-button[aria-pressed="true"] { color: #ffe0a0; border-color: #d5b97b; }
.word-definition { margin-top: 13px; padding: 2px 14px; border-left: 2px solid #e3bd77; color: #dbe8df; font-size: 16px; line-height: 1.6; }
.word-definition a { color: #f2d49e; }
.word-definition .definition-credit { font-size: 12px; }
@media (max-width: 620px) {
  .night-tools { gap: 8px; margin-bottom: 9px; }
  .pocket-button, .chain-status { padding: 8px 10px; min-height: 60px; }
  .tile.cluster .letter { font-size: 22px; }
  .tile.triple-cluster .letter { font-size: 18px; letter-spacing: -.5px; }
  .collection-records { gap: 8px; }
  .collection-records > div { padding: 11px; }
  .collection-records strong { font-size: 14px; }
}
@media (max-width: 360px) {
  .pocket-button, .chain-status { padding: 7px 8px; }
  .tile.cluster .letter { font-size: 20px; }
  .tile.triple-cluster .letter { font-size: 17px; }
}
