:root {
  --bg: #04030d;
  --ink: #ece9ff;
  --ink-2: #b9b4dc;
  --ink-3: #7f79a8;
  --glass: rgba(18, 14, 44, 0.72);
  --glass-edge: rgba(170, 160, 255, 0.22);
  --accent: #9d8cff;
  --accent-2: #6ee7ff;
  --danger: #ff6b8b;
  --good: #7cf0b5;
  --radius: 16px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: ui-serif, Georgia, "Times New Roman", serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
#sky, #life { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; display: block; pointer-events: none; }
#life { z-index: 1; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ---------- buttons ---------- */
.primary, .ghost, .danger {
  border-radius: 999px; padding: 0.6em 1.3em; border: 1px solid transparent;
  transition: transform .15s, box-shadow .2s, background .2s;
}
.primary {
  background: linear-gradient(135deg, #7b6bff, #4fc8ff);
  color: #07051a; font-weight: 600;
  box-shadow: 0 0 18px rgba(120, 140, 255, .45);
}
.primary:hover { transform: translateY(-1px); box-shadow: 0 0 28px rgba(120, 160, 255, .7); }
.primary:disabled { opacity: .5; cursor: wait; }
.ghost { background: rgba(255,255,255,.04); border-color: var(--glass-edge); }
.ghost:hover { background: rgba(255,255,255,.09); }
.danger { background: transparent; border-color: rgba(255,107,139,.45); color: var(--danger); }
.danger:hover { background: rgba(255,107,139,.12); }
.link { background: none; border: 0; color: var(--ink-2); padding: .3em .5em; }
.link:hover { color: var(--ink); }
.row { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; margin-top: 1rem; }

/* ---------- auth ---------- */
.screen { position: relative; z-index: 2; min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card {
  width: min(420px, 100%); text-align: center;
  background: var(--glass); border: 1px solid var(--glass-edge); border-radius: 24px;
  padding: 2rem 1.5rem; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
}
.auth-card h1 { margin: .6rem 0 .2rem; font-weight: 300; letter-spacing: .12em; text-transform: uppercase; font-size: 1.5rem; }
.lede { color: var(--ink-2); margin: 0 0 1.4rem; }
.auth-card form { text-align: left; }
.auth-card .row { justify-content: center; margin-top: .6rem; }
.auth-orb { width: 110px; margin: 0 auto; --hue: 255; --size: 110px; animation: bob 6s ease-in-out infinite; }
.fine { color: var(--ink-3); font-size: .82rem; margin: .8rem 0 0; }
.msg { color: var(--danger); min-height: 1.2em; margin: .5rem 0 0; font-size: .9rem; }
.msg.ok { color: var(--good); }

label { display: block; margin: .9rem 0 0; color: var(--ink-2); font-size: .9rem; }
.opt { color: var(--ink-3); font-size: .8rem; }
input:not([type=range]), textarea {
  display: block; width: 100%; margin-top: .35rem; padding: .7em .9em;
  background: rgba(5, 4, 20, .65); border: 1px solid var(--glass-edge); border-radius: 12px;
  outline: none; transition: border-color .2s, box-shadow .2s;
}
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(157,140,255,.18); }
textarea { resize: vertical; font-family: var(--serif); font-size: 1.05rem; line-height: 1.55; }
input[type=range] { width: 100%; accent-color: var(--accent); margin-top: .5rem; }
output { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.count { text-align: right; color: var(--ink-3); font-size: .78rem; margin-top: .2rem; }

/* ---------- top bar ---------- */
#app { position: relative; z-index: 2; min-height: 100vh; }
.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: .7rem 16px; padding-top: max(.7rem, env(safe-area-inset-top));
  /* solid enough that content scrolling underneath never shows through the nav row */
  background: rgba(6, 5, 18, .9);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(170, 160, 255, .12);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}
.brand { font-weight: 300; letter-spacing: .18em; text-transform: uppercase; font-size: .95rem; display: flex; align-items: center; gap: .6rem; }
.brand .dot { width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #8f7dff 45%, #2a1f7a); box-shadow: 0 0 12px #8f7dff; }
nav { display: flex; gap: .3rem; background: rgba(255,255,255,.04); border: 1px solid var(--glass-edge); border-radius: 999px; padding: .25rem; }
nav button { background: none; border: 0; padding: .4em 1em; border-radius: 999px; color: var(--ink-2); }
nav button[aria-selected=true] { background: rgba(157,140,255,.22); color: var(--ink); }
.who { display: flex; gap: .3rem; align-items: center; }

/* ---------- field of orbs ---------- */
.view { position: relative; }
#field { position: relative; width: 100%; min-height: calc(100vh - 70px); }
.hint { position: absolute; inset: 30vh 16px auto; text-align: center; color: var(--ink-2); pointer-events: none; }
.hint p { margin: .2rem; }
.hint p:first-child { font-size: 1.2rem; color: var(--ink); font-weight: 300; }

.fab {
  position: fixed; z-index: 6; left: 50%; bottom: max(22px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  border-radius: 999px; border: 1px solid rgba(200,190,255,.5); padding: .85em 1.6em;
  background: radial-gradient(120% 140% at 30% 20%, rgba(170,150,255,.55), rgba(40,30,120,.75));
  color: #fff; font-weight: 500; letter-spacing: .03em;
  box-shadow: 0 0 30px rgba(140,120,255,.55), inset 0 0 14px rgba(255,255,255,.2);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  white-space: nowrap;
  animation: fabglow 4s ease-in-out infinite;
}
.fab span { font-size: 1.2em; margin-right: .2em; }
@keyframes fabglow { 50% { box-shadow: 0 0 46px rgba(140,160,255,.8), inset 0 0 14px rgba(255,255,255,.3); } }

.orb {
  position: absolute; left: 0; top: 0; width: var(--size);
  display: flex; flex-direction: column; align-items: center;
  cursor: pointer; will-change: transform; user-select: none;
  -webkit-tap-highlight-color: transparent;
  background: none; border: 0; padding: 0;
}
.orb:focus-visible { outline: none; }
.orb:focus-visible .sphere { outline: 2px solid var(--accent-2); outline-offset: 6px; }

.sphere {
  --h: var(--hue, 250);
  position: relative; width: var(--size); height: var(--size); border-radius: 50%; overflow: hidden;
  background:
    radial-gradient(circle at 34% 28%, hsla(var(--h), 100%, 92%, .55) 0%, hsla(var(--h), 95%, 70%, .16) 30%, transparent 55%),
    radial-gradient(circle at 50% 55%, hsla(var(--h), 80%, 25%, .35) 0%, hsla(var(--h), 85%, 18%, .55) 65%, hsla(var(--h), 100%, 72%, .5) 100%);
  border: 1px solid hsla(var(--h), 100%, 85%, .35);
  box-shadow:
    0 0 24px hsla(var(--h), 100%, 65%, .45),
    0 0 70px hsla(var(--h), 100%, 60%, .22),
    inset 0 0 26px hsla(var(--h), 100%, 82%, .35),
    inset -12px -16px 40px rgba(0, 0, 0, .5);
  animation: pulse 5.5s ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  transition: transform .3s;
}
.orb:hover .sphere { transform: scale(1.05); }
/* crystal facets */
.sphere::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%; z-index: 3; pointer-events: none;
  background:
    repeating-conic-gradient(from var(--facet, 0deg) at 58% 62%, transparent 0deg 17deg, hsla(0,0%,100%,.07) 17deg 19deg, transparent 19deg 29deg),
    linear-gradient(125deg, transparent 40%, hsla(0,0%,100%,.10) 47%, transparent 52%);
  mix-blend-mode: screen;
}
/* rim light */
.sphere::after {
  content: ""; position: absolute; inset: 3%; border-radius: 50%; z-index: 4; pointer-events: none;
  border: 1px solid hsla(var(--h), 100%, 90%, .18);
  border-bottom-color: hsla(var(--h), 100%, 85%, .5);
  filter: blur(.5px);
}
.core {
  position: absolute; inset: -35%; z-index: 1;
  background: conic-gradient(from 0deg, hsla(var(--h),100%,70%,0), hsla(calc(var(--h) + 40),100%,72%,.55), hsla(var(--h),100%,70%,0) 35%, hsla(calc(var(--h) - 50),100%,65%,.45) 60%, hsla(var(--h),100%,70%,0) 80%);
  filter: blur(14px); mix-blend-mode: screen; opacity: .75;
  animation: swirl 18s linear infinite; animation-delay: var(--delay, 0s);
}
.script {
  position: absolute; inset: 16%; z-index: 2; overflow: hidden;
  font-family: var(--serif); font-style: italic; text-align: center;
  font-size: calc(var(--size) / 13); line-height: 1.25; letter-spacing: .02em;
  color: hsla(var(--h), 100%, 94%, .95);
  text-shadow: 0 0 6px hsla(var(--h), 100%, 75%, .9);
  filter: blur(calc(var(--size) / 55));
  -webkit-mask-image: radial-gradient(circle, #000 50%, transparent 72%);
  mask-image: radial-gradient(circle, #000 50%, transparent 72%);
}
.script span { display: block; animation: drift 26s linear infinite; animation-delay: var(--delay, 0s); }
.shine {
  position: absolute; z-index: 5; pointer-events: none;
  left: 16%; top: 10%; width: 38%; height: 26%; border-radius: 50%;
  background: radial-gradient(ellipse at 50% 50%, rgba(255,255,255,.75), rgba(255,255,255,0) 70%);
  transform: rotate(-28deg); filter: blur(2px); opacity: .7;
}
.timer {
  margin-top: .65rem; font-variant-numeric: tabular-nums; letter-spacing: .06em;
  font-size: .95rem; color: hsl(var(--hue), 100%, 90%);
  text-shadow: 0 0 10px hsla(var(--hue), 100%, 65%, .9);
  white-space: nowrap;
}
.caption { font-size: .72rem; color: var(--ink-3); letter-spacing: .04em; white-space: nowrap; }

/* ready to open */
.orb.ready .sphere {
  animation: readypulse 1.8s ease-in-out infinite;
  border-color: rgba(255,255,255,.75);
}
.orb.ready .timer { color: #fff; font-weight: 600; }
.orb.ready::before {
  content: ""; position: absolute; left: 50%; top: calc(var(--size) / 2);
  width: var(--size); height: var(--size); margin: calc(var(--size) / -2) 0 0 calc(var(--size) / -2);
  border-radius: 50%; border: 2px solid hsla(var(--hue), 100%, 85%, .7);
  animation: ripple 2.4s ease-out infinite; pointer-events: none;
}
/* opened, verdict pending */
.orb.opened .sphere { filter: saturate(.6) brightness(.8); animation-duration: 9s; }
.orb.opened .script { filter: none; opacity: .6; }
.orb.broken .sphere { filter: grayscale(1) brightness(.6); }

.orb.cracking .sphere { animation: shake .09s linear infinite; filter: brightness(1.8) saturate(1.4); transition: filter .6s; }
.orb.gone { opacity: 0; transform: scale(1.4) !important; transition: opacity .25s, transform .25s; }
.orb.born .sphere { animation: birth 1.4s cubic-bezier(.2,1.4,.4,1) both, pulse 5.5s ease-in-out 1.4s infinite; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 24px hsla(var(--h),100%,65%,.45), 0 0 70px hsla(var(--h),100%,60%,.22), inset 0 0 26px hsla(var(--h),100%,82%,.35), inset -12px -16px 40px rgba(0,0,0,.5); }
  50% { box-shadow: 0 0 34px hsla(var(--h),100%,70%,.65), 0 0 110px hsla(var(--h),100%,62%,.32), inset 0 0 34px hsla(var(--h),100%,85%,.5), inset -12px -16px 40px rgba(0,0,0,.45); }
}
@keyframes readypulse {
  0%, 100% { box-shadow: 0 0 30px hsla(var(--h),100%,80%,.8), 0 0 120px hsla(var(--h),100%,70%,.5), inset 0 0 40px rgba(255,255,255,.45); }
  50% { box-shadow: 0 0 50px rgba(255,255,255,.9), 0 0 170px hsla(var(--h),100%,75%,.7), inset 0 0 60px rgba(255,255,255,.65); }
}
@keyframes ripple { from { transform: scale(1); opacity: .9; } to { transform: scale(1.7); opacity: 0; } }
@keyframes swirl { to { transform: rotate(360deg); } }
@keyframes drift { 0% { transform: translateY(0); } 50% { transform: translateY(-35%); } 100% { transform: translateY(0); } }
@keyframes bob { 50% { transform: translateY(-10px); } }
@keyframes shake {
  0% { transform: translate(1px, -1px) scale(1.06); } 25% { transform: translate(-2px, 1px) scale(1.07); }
  50% { transform: translate(2px, 2px) scale(1.06); } 75% { transform: translate(-1px, -2px) scale(1.08); }
  100% { transform: translate(1px, 1px) scale(1.07); }
}
@keyframes birth {
  0% { transform: scale(0); filter: brightness(3); }
  60% { transform: scale(1.15); filter: brightness(1.8); }
  100% { transform: scale(1); filter: none; }
}

/* ---------- dialogs ---------- */
dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto;
  color: var(--ink); background: var(--glass); border: 1px solid var(--glass-edge); border-radius: 22px;
  padding: 1.5rem; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 40px 120px rgba(0,0,0,.7), 0 0 60px rgba(120,100,255,.15);
}
dialog { scrollbar-width: thin; scrollbar-color: rgba(157,140,255,.45) transparent; }
body:has(dialog[open]) .fab { opacity: 0; pointer-events: none; }
.fab { transition: opacity .3s; }
dialog::backdrop { background: rgba(2, 1, 10, .55); backdrop-filter: blur(3px); }
dialog[open] { animation: dlg .35s ease-out; }
@keyframes dlg { from { opacity: 0; transform: translateY(12px) scale(.98); } }
dialog h2 { margin: 0 0 .3rem; font-weight: 400; letter-spacing: .02em; }
fieldset { border: 0; padding: 0; margin: 1rem 0 0; }
legend { color: var(--ink-2); font-size: .9rem; padding: 0; margin-bottom: .45rem; }
.chips, .scale { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip {
  border-radius: 999px; padding: .4em .95em; background: rgba(255,255,255,.04);
  border: 1px solid var(--glass-edge); color: var(--ink-2); font-size: .88rem;
}
.chip[aria-pressed=true] { background: rgba(157,140,255,.28); border-color: var(--accent); color: var(--ink); }
.custom { margin-top: .6rem; }
.scale .chip { flex: 1 1 90px; text-align: center; }
.big-timer { font-size: 2.2rem; font-weight: 200; letter-spacing: .06em; margin: .4rem 0 .8rem; font-variant-numeric: tabular-nums; text-shadow: 0 0 22px rgba(160,150,255,.8); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; margin: 0; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; }
.kicker { text-transform: uppercase; letter-spacing: .18em; font-size: .72rem; color: var(--accent-2); margin: 0 0 .3rem; }
.reveal {
  margin: .8rem 0; padding: 1rem 1.2rem; border-left: 2px solid var(--accent);
  font-family: var(--serif); font-size: 1.15rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere;
  background: rgba(157,140,255,.06); border-radius: 0 12px 12px 0;
  filter: blur(14px); opacity: .2; transition: filter 2.2s ease-out, opacity 1.6s ease-out;
}
.reveal.clear { filter: blur(0); opacity: 1; }

/* ---------- ledger & patterns ---------- */
.panel {
  width: min(880px, calc(100% - 32px)); margin: 1rem auto 7rem; padding: 1.4rem;
  background: var(--glass); border: 1px solid var(--glass-edge); border-radius: 22px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.panel h2 { margin: 0; font-weight: 300; letter-spacing: .06em; }
.sub { color: var(--ink-3); margin: .2rem 0 1.2rem; }
.entry { border-top: 1px solid rgba(170,160,255,.12); padding: 1rem 0; }
.entry:first-child { border-top: 0; }
.entry-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: baseline; }
.entry h3 { margin: 0; font-weight: 500; font-size: 1rem; }
.entry .quote { font-family: var(--serif); color: var(--ink-2); margin: .5rem 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.entry .meta { color: var(--ink-3); font-size: .82rem; }
.entry .note { color: var(--ink-2); font-size: .9rem; margin: .4rem 0 0; padding-left: .8rem; border-left: 2px solid rgba(110,231,255,.4); white-space: pre-wrap; }
.badge { display: inline-flex; align-items: center; gap: .35em; font-size: .78rem; padding: .15em .7em; border-radius: 999px; border: 1px solid var(--glass-edge); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--accent)); }
.empty { color: var(--ink-3); text-align: center; padding: 2rem 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; margin-bottom: 1.4rem; }
.tile { background: rgba(255,255,255,.03); border: 1px solid rgba(170,160,255,.14); border-radius: 14px; padding: .9rem 1rem; }
.tile .v { font-size: 1.7rem; font-weight: 300; font-variant-numeric: tabular-nums; }
.tile .k { color: var(--ink-3); font-size: .8rem; }
.bars { margin: .4rem 0 1.4rem; }
.bars h3, .insights h3 { font-size: .9rem; font-weight: 500; color: var(--ink-2); margin: 0 0 .6rem; }
.barrow { display: grid; grid-template-columns: 7.5rem 1fr 2.5rem; gap: .6rem; align-items: center; margin: .3rem 0; font-size: .85rem; }
.barrow .lbl { color: var(--ink-2); }
.barrow .track { height: 12px; }
.barrow .fill { height: 100%; min-width: 2px; border-radius: 0 4px 4px 0; background: #8f7dff; }
.barrow .num { text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }
.insights ul { margin: 0; padding: 0; list-style: none; }
.insights li { padding: .7rem .9rem; margin: .5rem 0; background: rgba(255,255,255,.03); border-radius: 12px; border-left: 2px solid var(--accent-2); }
.insights li b { display: block; font-weight: 500; margin-bottom: .15rem; }
.insights li span { color: var(--ink-2); font-size: .9rem; }

/* ---------- sound toggle ---------- */
.sound { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; }
.sound .wave { display: none; }
.sound[aria-pressed=true] { color: var(--accent-2); filter: drop-shadow(0 0 6px rgba(110,231,255,.8)); }
.sound[aria-pressed=true] .wave { display: inline; animation: wave 1.6s ease-in-out infinite; }
.sound[aria-pressed=true] .mute { display: none; }
@keyframes wave { 50% { opacity: .35; } }

/* ---------- tags ---------- */
.tagbar { position: relative; z-index: 4; display: flex; gap: .4rem; flex-wrap: wrap; justify-content: center; padding: .2rem 16px .4rem; }
.tag {
  --th: 250;
  display: inline-flex; align-items: center; gap: .4em;
  border-radius: 999px; padding: .32em .9em; font-size: .84rem;
  background: hsla(var(--th), 70%, 50%, .08); border: 1px solid hsla(var(--th), 90%, 75%, .28); color: var(--ink-2);
  transition: background .2s, box-shadow .2s, color .2s;
}
.tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: hsl(var(--th), 95%, 70%); box-shadow: 0 0 6px hsl(var(--th), 95%, 65%); }
.tag[aria-pressed=true] { background: hsla(var(--th), 80%, 55%, .28); border-color: hsl(var(--th), 95%, 75%); color: var(--ink); box-shadow: 0 0 14px hsla(var(--th), 95%, 60%, .35); }
.tag .n { color: var(--ink-3); font-size: .75rem; font-variant-numeric: tabular-nums; }
.tagpick { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.tag-new { width: 9.5rem !important; display: inline-block !important; margin: 0 !important; padding: .32em .9em !important; border-radius: 999px !important; font-size: .84rem; border-style: dashed !important; }
.pills { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: center; margin-top: .3rem; }
.pill { --th: 250; font-size: .68rem; padding: .08em .6em; border-radius: 999px; letter-spacing: .03em; white-space: nowrap;
  color: hsl(var(--th), 100%, 88%); background: hsla(var(--th), 80%, 50%, .18); border: 1px solid hsla(var(--th), 90%, 70%, .35); }
.kindpill { --th: 45; }
.entry .pills, #revTags { justify-content: flex-start; margin: .2rem 0 .4rem; }
.facts-label { color: var(--ink-3); margin: 1rem 0 .4rem; font-size: .9rem; }

/* ---------- write dialog ---------- */
dialog.wide { width: min(760px, calc(100vw - 24px)); }
.compose { display: grid; grid-template-columns: 170px 1fr; gap: 1.2rem; align-items: center; }
.preview { display: grid; justify-items: center; gap: .3rem; }
.orb-preview { width: var(--size); transition: width .4s; animation: bob 6s ease-in-out infinite; }
.orb-preview .sphere { transition: width .4s, height .4s; }
.preview-cap { margin: 0; font-size: .78rem; color: var(--ink-2); text-align: center; }
.kinds { display: grid; grid-template-columns: repeat(3, 1fr); gap: .45rem; }
.kind {
  display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: .55rem .3rem;
  border-radius: 14px; background: rgba(255,255,255,.03); border: 1px solid var(--glass-edge); color: var(--ink-2); font-size: .8rem;
  transition: background .2s, color .2s, box-shadow .2s, transform .15s;
}
.kind .ic { width: 26px; height: 26px; display: block; }
.kind .ic svg { width: 100%; height: 100%; }
.kind:hover { transform: translateY(-1px); color: var(--ink); }
.kind[aria-checked=true] { color: #fff; background: radial-gradient(120% 120% at 50% 0%, rgba(157,140,255,.38), rgba(80,60,200,.12)); border-color: var(--accent); box-shadow: 0 0 18px rgba(157,140,255,.35); }
.kind[aria-checked=true] .ic { filter: drop-shadow(0 0 6px rgba(190,180,255,.9)); }
.crystals { cursor: pointer; touch-action: none; padding: .2rem 0; border-radius: 12px; }
.crystals svg { width: 100%; max-width: 560px; height: auto; margin: 0 auto; display: block; overflow: visible; }
.crystals .shard { transition: transform .2s; transform-box: fill-box; transform-origin: 50% 100%; }
.crystals .shard.top { animation: shardpulse 1.6s ease-in-out infinite; }
@keyframes shardpulse { 50% { transform: scaleY(1.07); } }
#convWord { font-weight: 500; color: var(--ink); margin-left: .3rem; }
.twin { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: start; }
.dial { width: min(250px, 100%); margin: 0 auto; touch-action: none; transition: opacity .3s, filter .3s; }
.dial.off { opacity: .35; filter: saturate(.3); }
.dial svg { width: 100%; display: block; cursor: grab; overflow: visible; }
.dial svg:active { cursor: grabbing; }
.dial .track { fill: none; stroke: rgba(255,255,255,.08); stroke-width: 12; stroke-linecap: round; }
.dial .val { fill: none; stroke: url(#dialGrad); stroke-width: 12; stroke-linecap: round; }
.dial .val.glow { stroke-width: 18; opacity: .55; }
.dial .preset circle { fill: rgba(255,255,255,.5); }
.dial .preset text { fill: var(--ink-3); font-size: 11px; cursor: pointer; }
.dial .preset:hover text { fill: var(--ink); }
.dial .handle { fill: rgba(255,255,255,.18); stroke: #fff; stroke-width: 2; filter: drop-shadow(0 0 8px rgba(200,190,255,.95)); }
.dial .handle-core { fill: #fff; }
.dial .big { fill: var(--ink); font-size: 24px; font-weight: 300; }
.dial .small { fill: var(--ink-3); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.small { font-size: .82rem; }
#exactBtn { display: block; margin: .3rem auto 0; }
.swatches { display: grid; grid-template-columns: repeat(5, 44px); gap: .7rem; justify-content: center; padding-top: .6rem; }
.swatch {
  --hue: 250; width: 44px; height: 44px; border-radius: 50%; padding: 0; border: 1px solid hsla(var(--hue), 100%, 85%, .5);
  background: radial-gradient(circle at 34% 28%, hsla(var(--hue),100%,92%,.9), hsla(var(--hue),95%,60%,.55) 40%, hsla(var(--hue),85%,22%,.9) 100%);
  box-shadow: 0 0 12px hsla(var(--hue), 100%, 65%, .45);
  transition: transform .15s, box-shadow .2s;
}
.swatch:hover { transform: scale(1.1); }
.swatch[aria-checked=true] { box-shadow: 0 0 0 3px rgba(4,3,13,.9), 0 0 0 5px hsl(var(--hue), 100%, 80%), 0 0 24px hsla(var(--hue), 100%, 65%, .9); }
.swatch.shuffle { background: conic-gradient(from 0deg, #ff6b8b, #f5e27a, #7cf0b5, #6ee7ff, #9d8cff, #ff6b8b); color: #07051a; font-size: 1.1rem; border-color: rgba(255,255,255,.6); }

#toast {
  position: fixed; z-index: 20; left: 50%; bottom: 90px; transform: translate(-50%, 20px);
  background: var(--glass); border: 1px solid var(--glass-edge); border-radius: 999px;
  padding: .55em 1.2em; opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s;
  backdrop-filter: blur(10px); max-width: calc(100vw - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 600px) {
  .bar { gap: .5rem; }
  .brand { font-size: .8rem; }
  nav { order: 3; width: 100%; justify-content: center; }
  .bar { padding-top: max(.5rem, env(safe-area-inset-top)); padding-bottom: .5rem; row-gap: .45rem; }
  .big-timer { font-size: 1.7rem; }
  .barrow { grid-template-columns: 6rem 1fr 2rem; }
  .compose { grid-template-columns: 1fr; }
  .twin { grid-template-columns: 1fr; }
  .kinds { grid-template-columns: repeat(3, 1fr); }
  .swatches { grid-template-columns: repeat(5, 40px); }
  .swatch { width: 40px; height: 40px; }
  dialog { padding: 1.1rem; }
}
/* small phones: the logo shrinks to its dot so the icons share its row (two rows instead of three) */
@media (max-width: 440px) {
  .brand { font-size: 0; gap: 0; }
  .brand .dot { width: 14px; height: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .reveal { filter: none; opacity: 1; }
}
