:root {
  --bg: #f6f1ff; --ink: #241c4b; --muted: #6d658f; --card: rgba(255,255,255,.82); --line: rgba(70,50,140,.12);
  --shadow: 0 14px 40px -18px rgba(60,35,130,.35); --a1: #ffd9ec; --a2: #cfe4ff; --a3: #ffe9c7;
  --btn1: #6a4cf0; --btn2: #c23d9a; --field: #fff;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f0c26; --ink: #f1eeff; --muted: #a9a1cf; --card: rgba(36,29,74,.78); --line: rgba(190,175,255,.14);
    --shadow: 0 18px 44px -18px rgba(0,0,0,.7); --a1: #4b1f5e; --a2: #17356b; --a3: #53291f; --field: #1c1742; color-scheme: dark; }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body { min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--ink); overflow-x: hidden;
  font: 16px/1.45 ui-rounded, "SF Pro Rounded", "Nunito", system-ui, sans-serif;
  padding: env(safe-area-inset-top) 16px calc(32px + env(safe-area-inset-bottom)); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible { outline: 3px solid #8f7bff; outline-offset: 2px; }

.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.aurora i { position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%; filter: blur(60px); opacity: .85; animation: drift 22s ease-in-out infinite alternate; }
.aurora i:nth-child(1) { background: radial-gradient(circle, var(--a1), transparent 65%); top: -30vmax; left: -20vmax; }
.aurora i:nth-child(2) { background: radial-gradient(circle, var(--a2), transparent 65%); top: 5vmax; right: -35vmax; animation-delay: -8s; }
.aurora i:nth-child(3) { background: radial-gradient(circle, var(--a3), transparent 65%); bottom: -35vmax; left: 0; animation-delay: -15s; }
@keyframes drift { to { transform: translate(6vmax, 4vmax) scale(1.12); } }

header { max-width: 1060px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 14px 0 12px; }
h1 { font-family: ui-rounded, "SF Pro Rounded", system-ui, sans-serif; font-size: 1.65rem; letter-spacing: -.02em; display: flex; align-items: center; gap: 10px; }
.logo { width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle, #fff 0 12%, #ffcf5c 13% 30%, #ff6f91 31% 52%, #8a6bff 53% 74%, #4aa8ff 75%);
  box-shadow: 0 0 18px rgba(138,107,255,.6); }
nav { display: flex; gap: 8px; }
.round { width: 42px; height: 42px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow); font-weight: 800; font-size: 1.05rem; }

#loading { text-align: center; padding-top: 18vh; color: var(--muted); }
.loader-orb { width: 90px; height: 90px; margin: 0 auto 22px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #a78bff 40%, #5b3fd6); box-shadow: 0 0 50px #8a6bff99; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.1); } }
.loadbar { width: min(260px, 70vw); height: 8px; margin: 14px auto; border-radius: 9px; background: var(--line); overflow: hidden; }
.loadbar b { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--btn1), var(--btn2)); transition: width .2s; }

main { max-width: 1060px; margin: 0 auto; display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.sky { position: relative; border-radius: 30px; padding: 12px 12px 14px; color: #efeaff; overflow: hidden; box-shadow: var(--shadow);
  background: radial-gradient(circle at 50% 50%, #3a2c7e 0, #1d1750 45%, #0e0b2c 100%); }
.chips { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; position: relative; z-index: 1; }
.chip { font-size: .8rem; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.12); border-radius: 99px; padding: 4px 11px; color: #cfc7f5; }
.chip b { color: #fff; font-variant-numeric: tabular-nums; }
#radar { display: block; width: 100%; max-width: min(300px, 80vw); margin: 4px auto 0; overflow: visible; }
.temp { text-align: center; font-weight: 700; min-height: 1.45em; font-size: .98rem; }

#radar .ring { fill: none; stroke: rgba(190,175,255,.2); stroke-dasharray: 2 5; }
#radar .ringlabel { fill: rgba(205,195,255,.55); font-size: 9px; text-anchor: middle; }
#radar .star { fill: #fff; animation: twinkle 3.5s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .15; } }
#radar .sweep { transform-origin: 200px 200px; animation: spin 9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#radar .dot { cursor: pointer; stroke: rgba(255,255,255,.75); stroke-width: 1; }
#radar .dot.hinted { stroke: #fff; stroke-width: 2; stroke-dasharray: 2 2; }
#radar .new { animation: pop .6s cubic-bezier(.2,1.8,.4,1); transform-box: fill-box; transform-origin: center; }
@keyframes pop { from { transform: scale(0); } }
#radar .ping { fill: none; stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: ping 1.4s ease-out 3 forwards; }
@keyframes ping { from { transform: scale(1); opacity: 1; } to { transform: scale(3.4); opacity: 0; } }
#radar .tag { fill: #fff; font-size: 13px; font-weight: 700; text-anchor: middle; paint-order: stroke; stroke: #120e36; stroke-width: 4px; stroke-linejoin: round; pointer-events: none; }
#radar .core { transform-origin: 200px 200px; animation: pulse 2.6s ease-in-out infinite; }
#radar .q { fill: #1d1750; font-size: 26px; font-weight: 900; text-anchor: middle; dominant-baseline: central; }

.play { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
form { display: flex; gap: 8px; padding: 7px; border-radius: 99px; background: var(--field); box-shadow: var(--shadow); border: 1px solid var(--line); position: sticky; top: calc(8px + env(safe-area-inset-top)); z-index: 5; }
#word { flex: 1; min-width: 0; border: 0; background: none; padding: 8px 14px; font-size: 1.15rem; font-weight: 600; }
#word:focus { outline: none; }
form:focus-within { border-color: #8f7bff; box-shadow: 0 0 0 4px rgba(143,123,255,.25), var(--shadow); }
.go, .primary { color: #fff; font-weight: 800; border-radius: 99px; padding: 10px 22px; background: linear-gradient(120deg, var(--btn1), var(--btn2)); box-shadow: 0 8px 20px -8px var(--btn2); }
form.shake { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-7px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }
.msg { text-align: center; color: var(--muted); font-size: .92rem; min-height: 1.4em; }
.letters { display: flex; justify-content: center; flex-wrap: wrap; gap: 5px; }
.letters span { width: 28px; height: 36px; display: grid; place-items: center; border-radius: 9px; background: var(--card); border-bottom: 3px solid #8f7bff; font-weight: 800; text-transform: uppercase; }
.actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.soft { background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 99px; padding: 9px 15px; font-weight: 700; font-size: .92rem; }
.soft.ghost { color: var(--muted); box-shadow: none; }

ol { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.row { position: relative; display: flex; align-items: center; gap: 10px; padding: 11px 15px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); overflow: hidden; }
.row i { position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--c); opacity: .3; border-radius: 0 14px 14px 0; transition: width .7s cubic-bezier(.2,.9,.3,1); }
.row::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c); }
.row span, .row b, .row em { position: relative; }
.row span { flex: 1; font-weight: 700; font-size: 1.08rem; min-width: 0; overflow-wrap: anywhere; }
.row em { font-style: normal; font-size: .8rem; color: var(--muted); }
.row b { font-variant-numeric: tabular-nums; font-weight: 800; }
.row.is-last { border: 2px solid var(--c); }
#last .row { animation: rise .35s ease-out; box-shadow: var(--shadow); }
#last { margin-bottom: 2px; }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.97); } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow); padding: 20px; }
.win { text-align: center; animation: rise .5s ease-out; }
.win .big, dialog .big { font-size: 2.1rem; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; margin: 4px 0;
  background: linear-gradient(100deg, #e08a00, #e2457a 50%, #6a4cf0); -webkit-background-clip: text; background-clip: text; color: transparent; overflow-wrap: anywhere; }
@media (prefers-color-scheme: dark) { .win .big, dialog .big { background-image: linear-gradient(100deg, #ffd166, #ff7aa8 50%, #a995ff); } }
.win .actions { margin-top: 14px; }
.win p { color: var(--muted); }

dialog { margin: auto; width: min(440px, calc(100vw - 28px)); max-height: 86vh; border: 1px solid var(--line); border-radius: 28px; padding: 26px 20px 22px; color: var(--ink); background: var(--field); box-shadow: 0 30px 80px -20px rgba(0,0,0,.6); overflow: auto; }
dialog[open] { animation: rise .3s ease-out; }
dialog::backdrop { background: rgba(12,8,36,.55); backdrop-filter: blur(5px); }
dialog h2 { font-size: 1.3rem; margin-bottom: 12px; text-align: center; }
dialog p { margin-bottom: 10px; }
dialog .center { text-align: center; }
dialog .small { font-size: .78rem; color: var(--muted); }
dialog ol { margin-top: 10px; }
.close { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%; background: var(--line); }
.example { margin: 12px 0; display: flex; flex-direction: column; gap: 7px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 12px 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px; text-align: center; }
.stat b { display: block; font-size: 1.6rem; }
.stat small { color: var(--muted); }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 20; }

@media (min-width: 900px) {
  main { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; gap: 26px; }
  .sky { position: sticky; top: 18px; padding: 18px; }
  #radar { max-width: min(100%, calc(100vh - 220px)); margin-top: 10px; }
  .temp { font-size: 1.15rem; margin-top: 6px; }
  form { top: 12px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
