/* Word Trail, a word game from CASL (23 Sept 2026). Swipe or tap letters to fill a crossword, and
   travel across Canada one painted stop at a time. Large letters, no timer, no losing. */
:root {
  --cream-50: #FDFBF6; --cream-100: #F7F2EA; --cream-200: #F0E8DA; --cream-300: #E8DCC8;
  --ink-900: #2B2620; --ink-700: #574F42; --ink-600: #6E6455; --ink-400: #A69C8C; --ink-200: #DDD5C5; --ink-100: #EBE4D6;
  --green-900: #17332B; --green-800: #204239; --green-700: #2F5D50; --green-600: #3B7566; --green-500: #4C8C7B; --green-200: #C4DBD2; --green-100: #E3ECE7; --green-50: #F1F6F3;
  --terra-800: #8C5335; --terra-700: #A9663F; --terra-600: #C97A4A; --terra-500: #D8925F; --terra-300: #EABF9C; --terra-100: #F6E5D6;
  --gold: #E3B04B; --gold-dark: #B4863B;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Atkinson Hyperlegible Next', 'Atkinson Hyperlegible', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  --cell: 44px; --wheel: 300px; --lsize: 68px;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--cream-100); color: var(--ink-900); font-family: var(--sans); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--terra-500); outline-offset: 3px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ic { display: block; flex: none; }
.mark { width: 34px; height: 34px; flex: none; }
.screen { position: fixed; inset: 0; overflow: hidden; }
.hidden { display: none !important; }

/* round icon buttons and chips */
.ibtn { width: 52px; height: 52px; flex: none; border-radius: 50%; border: 0; display: inline-flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, .92); color: var(--green-800); box-shadow: 0 6px 16px rgba(0, 0, 0, .18); transition: transform .12s ease-out; }
.ibtn:active { transform: scale(.94); }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 16px 6px 8px; border-radius: 999px; background: rgba(255, 255, 255, .92); color: var(--green-900); font-weight: 800; font-size: 18px; box-shadow: 0 6px 16px rgba(0, 0, 0, .15); }
.coin { width: 30px; height: 30px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #FBE3A0, var(--gold) 55%, var(--gold-dark)); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .45); display: inline-flex; align-items: center; justify-content: center; color: #7A5A1E; font-weight: 900; font-size: 15px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 60px; padding: 14px 30px; border-radius: 18px; border: 0; font-weight: 800; font-size: 20px; line-height: 1.2; transition: transform .12s ease-out, background .15s; }
.btn:active { transform: scale(.97); }
.btn-go { background: var(--terra-600); color: #fff; box-shadow: 0 10px 22px rgba(169, 102, 63, .35); }
.btn-go:hover { background: var(--terra-700); }
.btn-green { background: var(--green-700); color: #fff; }
.btn-soft { background: #fff; color: var(--green-800); box-shadow: inset 0 0 0 2px var(--green-200); }

/* ---------------- the trail map ---------------- */
.map { overflow-y: auto; background: radial-gradient(900px 500px at 90% -10%, var(--green-100), transparent 60%), radial-gradient(800px 500px at -10% 110%, var(--terra-100), transparent 60%), var(--cream-100); }
.map-in { max-width: 600px; margin: 0 auto; padding: calc(18px + env(safe-area-inset-top)) 18px calc(40px + env(safe-area-inset-bottom)); }
.map-top { display: flex; align-items: center; gap: 10px; }
.map-top .brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; letter-spacing: .12em; text-transform: uppercase; color: var(--green-800); text-decoration: none; }
.map-top .sp { flex: 1; }
.map-top .ibtn { width: 48px; height: 48px; box-shadow: 0 4px 12px rgba(0, 0, 0, .1); }
.title { margin: 22px 0 4px; font-family: var(--serif); font-weight: 600; font-size: clamp(46px, 11vw, 64px); line-height: 1; letter-spacing: -.02em; color: var(--green-900); }
.title em { font-style: italic; font-weight: 500; color: var(--terra-700); }
.subtitle { margin: 0 0 20px; font-size: 20px; color: var(--ink-700); }
.continue { width: 100%; justify-content: space-between; text-align: left; }
.continue small { display: block; font-size: 15px; font-weight: 700; opacity: .85; }
.trail { position: relative; list-style: none; margin: 26px 0 0; padding: 0; }
.trail svg.path { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.stop { position: relative; display: flex; align-items: center; gap: 16px; width: 100%; min-height: 140px; padding: 6px 0; border: 0; background: none; text-align: left; }
.trail li:nth-child(even) .stop { flex-direction: row-reverse; text-align: right; }
.stop-img { position: relative; width: 124px; height: 124px; flex: none; border-radius: 50%; border: 6px solid #fff; box-shadow: 0 10px 26px rgba(23, 51, 43, .2); background: var(--cream-200) center/cover; }
.stop.locked .stop-img { filter: grayscale(1) opacity(.55); }
.stop.here .stop-img { border-color: var(--terra-500); box-shadow: 0 0 0 6px rgba(216, 146, 95, .35), 0 10px 26px rgba(23, 51, 43, .2); animation: here 2.2s ease-in-out infinite; }
@keyframes here { 50% { box-shadow: 0 0 0 12px rgba(216, 146, 95, .12), 0 10px 26px rgba(23, 51, 43, .2); } }
.badge { position: absolute; right: -4px; bottom: -4px; width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 4px solid #fff; color: #fff; }
.badge.done { background: var(--green-600); }
.badge.lock { background: var(--ink-400); }
.stop-text { display: flex; flex-direction: column; gap: 4px; }
.stop-name { font-family: var(--serif); font-weight: 600; font-size: 26px; line-height: 1.1; color: var(--green-900); }
.stop.locked .stop-name { color: var(--ink-600); }
.stop-prog { display: flex; gap: 6px; align-items: center; font-size: 16px; font-weight: 700; color: var(--ink-600); }
.trail li:nth-child(even) .stop-prog { justify-content: flex-end; }
.pips { display: inline-flex; gap: 5px; }
.pips i { width: 13px; height: 13px; border-radius: 50%; background: var(--ink-200); }
.pips i.on { background: var(--green-600); }
.here-tag { align-self: flex-start; padding: 3px 10px; border-radius: 999px; background: var(--terra-600); color: #fff; font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.trail li:nth-child(even) .here-tag { align-self: flex-end; }
.map-foot { margin-top: 30px; padding: 18px; border-radius: 20px; background: #fff; display: flex; gap: 14px; align-items: flex-start; font-size: 16px; color: var(--ink-700); box-shadow: 0 4px 16px rgba(0, 0, 0, .05); }
.map-foot a { color: var(--green-700); font-weight: 700; }

/* ---------------- the puzzle ---------------- */
.play { display: flex; flex-direction: column; color: #fff; }
.play .bg { position: absolute; inset: -20px; background: var(--green-900) center/cover no-repeat; transform: scale(1.03); }
.play .bg::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(15, 35, 29, .45) 0%, rgba(15, 35, 29, .1) 22%, rgba(15, 35, 29, .12) 42%, rgba(15, 35, 29, .78) 66%, rgba(15, 35, 29, .92) 100%); }
.bar { position: relative; z-index: 3; display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 12px 6px; }
.where { flex: 1; min-width: 0; text-shadow: 0 2px 8px rgba(0, 0, 0, .45); }
.where b { display: block; font-family: var(--serif); font-weight: 600; font-size: 24px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.where span { display: block; font-size: 15px; font-weight: 700; opacity: .95; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 440px) { .where b { font-size: 19px; } .where span { font-size: 14px; } .bar .ibtn { width: 46px; height: 46px; } .bar .chip { padding: 4px 12px 4px 4px; font-size: 17px; } .bar .coin { width: 26px; height: 26px; font-size: 13px; } }
.col { position: relative; z-index: 2; flex: 1; min-height: 0; width: 100%; max-width: 560px; margin: 0 auto; padding: 0 14px calc(12px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; }
.gridwrap { flex: 1 1 auto; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; padding: 6px 0; }
.grid { display: grid; gap: 5px; padding: 12px; border-radius: 22px; background: rgba(15, 35, 29, .32); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); box-shadow: 0 10px 30px rgba(0, 0, 0, .2); }
.cell { width: var(--cell); height: var(--cell); border-radius: calc(var(--cell) * .2); background: rgba(255, 255, 255, .5); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .08); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: calc(var(--cell) * .6); color: transparent; line-height: 1; }
.cell.shown { background: #fff; color: var(--green-900); box-shadow: inset 0 -3px 0 rgba(23, 51, 43, .12); }
.cell.hint { background: var(--cream-50); color: var(--terra-700); }
.cell.pop { animation: pop .42s cubic-bezier(.2, 1.4, .4, 1) both; }
.cell.glow { animation: glow .7s ease-out; }
@keyframes pop { 0% { transform: scale(.4) rotate(-8deg); background: var(--terra-500); color: #fff; } 60% { transform: scale(1.14); background: var(--terra-500); color: #fff; } 100% { transform: none; } }
@keyframes glow { 0%, 100% { transform: none; } 30% { transform: scale(1.15); background: var(--gold); } }
.pill { height: 64px; flex: none; display: flex; align-items: center; justify-content: center; margin: 6px 0; }
.word { display: inline-flex; gap: 3px; min-height: 56px; align-items: center; padding: 0 20px; border-radius: 18px; background: var(--cream-50); color: var(--green-900); font-weight: 900; font-size: 34px; letter-spacing: .06em; box-shadow: 0 8px 20px rgba(0, 0, 0, .25); }
.word.ok { background: var(--green-600); color: #fff; animation: pop .4s ease-out; }
.word.bonus { background: var(--gold); color: #5A3F0F; animation: pop .4s ease-out; }
.word.bad { background: #fff; color: var(--terra-700); animation: shake .4s ease-in-out; }
.word.old { background: var(--green-100); color: var(--green-800); animation: shake .3s ease-in-out; }
.msg { font-weight: 800; font-size: 20px; text-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
@keyframes shake { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
.wheelrow { position: relative; flex: none; width: 100%; display: flex; justify-content: center; padding-bottom: 4px; }
.wheel { position: relative; width: var(--wheel); height: var(--wheel); border-radius: 50%; background: rgba(253, 251, 246, .95); box-shadow: 0 16px 40px rgba(0, 0, 0, .35), inset 0 0 0 6px rgba(255, 255, 255, .6); touch-action: none; user-select: none; -webkit-user-select: none; }
.wheel svg { position: absolute; inset: 0; pointer-events: none; }
.wheel svg polyline { fill: none; stroke: var(--terra-600); stroke-width: calc(var(--lsize) * .2); stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.letter { position: absolute; width: var(--lsize); height: var(--lsize); margin: calc(var(--lsize) / -2) 0 0 calc(var(--lsize) / -2); border-radius: 50%; border: 0; padding: 0; background: transparent; color: var(--green-900); font-weight: 900; font-size: calc(var(--lsize) * .6); line-height: 1; display: flex; align-items: center; justify-content: center; transition: left .38s cubic-bezier(.3, 1.3, .5, 1), top .38s cubic-bezier(.3, 1.3, .5, 1), background .12s, color .12s, transform .12s; touch-action: none; }
.letter.sel { background: var(--terra-600); color: #fff; transform: scale(1.06); }
.side { position: absolute; bottom: 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.side.l { left: 0; }
.side.r { right: 0; }
.side small { font-size: 13px; font-weight: 800; text-shadow: 0 1px 6px rgba(0, 0, 0, .6); }
.hintcost { position: absolute; top: -6px; right: -6px; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 999px; background: var(--gold); color: #5A3F0F; font-size: 13px; font-weight: 900; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); }
.bonusbtn { position: absolute; top: 4px; left: 0; }
.bonusbtn .ibtn { color: var(--gold-dark); }
.bonuscount { position: absolute; top: -6px; right: -6px; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 999px; background: var(--terra-600); color: #fff; font-size: 13px; font-weight: 900; display: flex; align-items: center; justify-content: center; }
.tapbar { position: absolute; top: 4px; right: 0; display: flex; flex-direction: column; gap: 8px; }
.tapbar .ibtn.go { background: var(--green-600); color: #fff; }
.flycoin { position: fixed; z-index: 50; pointer-events: none; }

/* ---------------- overlays ---------------- */
.overlay { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 18px; background: rgba(15, 35, 29, .55); animation: fade .25s ease-out; }
@keyframes fade { from { opacity: 0; } }
.card { width: 100%; max-width: 440px; max-height: calc(100% - 20px); overflow-y: auto; border-radius: 28px; background: var(--cream-50); color: var(--ink-900); box-shadow: 0 30px 70px rgba(0, 0, 0, .4); animation: rise .45s cubic-bezier(.2, 1.3, .4, 1); }
@keyframes rise { from { transform: translateY(40px) scale(.94); opacity: 0; } }
.card-body { padding: 26px 24px 24px; display: flex; flex-direction: column; gap: 14px; }
.card h2 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 38px; line-height: 1.05; color: var(--green-900); }
.card h2 em { font-style: italic; color: var(--terra-700); }
.card p { margin: 0; font-size: 19px; line-height: 1.5; color: var(--ink-700); }
.card .btn { width: 100%; }
.stars { display: flex; justify-content: center; gap: 8px; color: var(--gold); }
.win-coins { align-self: center; display: inline-flex; align-items: center; gap: 10px; padding: 8px 18px 8px 8px; border-radius: 999px; background: #fff; box-shadow: inset 0 0 0 2px var(--cream-300); font-weight: 900; font-size: 20px; color: #7A5A1E; }
.postcard-img { position: relative; aspect-ratio: 3 / 2; background: center/cover; border-radius: 28px 28px 0 0; }
.postcard-img .stamp { position: absolute; right: 14px; top: 14px; width: 74px; height: 88px; padding: 6px; background: #fff; border-radius: 4px; box-shadow: 0 4px 12px rgba(0, 0, 0, .25); display: flex; align-items: center; justify-content: center; transform: rotate(6deg); }
.postcard-img .stamp::before { content: ''; position: absolute; inset: 4px; border: 2px dashed var(--terra-300); border-radius: 2px; }
.postcard-img .stamp .mark { width: 44px; height: 44px; }
.kicker { font-size: 14px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--terra-700); }
.fact { padding: 14px 16px; border-radius: 16px; background: var(--green-50); color: var(--green-900) !important; font-size: 18px !important; }
.howto { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.howto li { display: flex; gap: 12px; align-items: flex-start; font-size: 18px; line-height: 1.45; color: var(--ink-700); }
.howto b { color: var(--green-900); }
.howto .n { width: 32px; height: 32px; flex: none; border-radius: 50%; background: var(--terra-600); color: #fff; font-weight: 900; display: flex; align-items: center; justify-content: center; }
.demo { position: relative; width: 200px; height: 200px; margin: 0 auto; border-radius: 50%; background: #fff; box-shadow: 0 10px 26px rgba(0, 0, 0, .12), inset 0 0 0 5px var(--cream-200); }
.demo span { position: absolute; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 32px; color: var(--green-900); }
.demo span.a { animation: dsel 3.2s infinite; }
.demo span.b { animation: dsel 3.2s .5s infinite; }
.demo span.c { animation: dsel 3.2s 1s infinite; }
@keyframes dsel { 0%, 8% { background: transparent; color: var(--green-900); } 12%, 60% { background: var(--terra-600); color: #fff; } 66%, 100% { background: transparent; color: var(--green-900); } }
.demo .hand { position: absolute; width: 46px; height: 46px; margin: -6px 0 0 -12px; color: var(--green-800); animation: hand 3.2s infinite; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .25)); }
@keyframes hand { 0%, 8% { left: 100px; top: 42px; opacity: 1; } 22% { left: 158px; top: 128px; } 38%, 58% { left: 42px; top: 128px; opacity: 1; } 70%, 100% { left: 42px; top: 128px; opacity: 0; } }
.bonuslist { display: flex; flex-wrap: wrap; gap: 8px; }
.bonuslist span { padding: 6px 12px; border-radius: 10px; background: var(--gold); color: #5A3F0F; font-weight: 900; letter-spacing: .06em; }
#confetti { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.toast { position: fixed; left: 50%; top: calc(80px + env(safe-area-inset-top)); z-index: 70; transform: translateX(-50%); padding: 12px 20px; border-radius: 14px; background: var(--green-900); color: #fff; font-weight: 800; font-size: 18px; box-shadow: 0 12px 30px rgba(0, 0, 0, .3); max-width: calc(100% - 32px); text-align: center; animation: fade .2s ease-out; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .demo .hand { display: none; }
}
