/* Elementa — a precision instrument in a dark room. Colour comes only from light. */

:root {
  --bg: #000;
  --fg: #fff;
  --fg2: #8e8e93;
  --fg3: #48484a;
  --tile: #0e0e10;
  --tile-hover: #18181b;
  --tile-sel: #232327;
  --r: 6px;
  --ok: #30d158;
  --bad: #ff453a;
  --pad: 16px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}
html:lang(zh) [data-l="en"], html:not(:lang(zh)) [data-l="zh"] { display: none !important; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
a { color: inherit; }
sup, sub { font-size: .62em; line-height: 0; }

.vh {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

:focus { outline: none; }
:focus-visible { outline: none; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .7); }

/* ——— header ——— */

.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: calc(56px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(var(--pad), env(safe-area-inset-right)) 0 max(var(--pad), env(safe-area-inset-left));
  background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; color: var(--fg); text-decoration: none; border-radius: 8px; padding: 4px 6px 4px 2px; margin-left: -2px; }
.mark svg { display: block; width: 20px; height: 20px; }
.wm { font-weight: 600; font-size: 16px; letter-spacing: -.01em; white-space: nowrap; }
.sub { color: var(--fg2); font-size: 13px; white-space: nowrap; margin-left: 2px; }
.nav { display: flex; align-items: center; gap: 2px; margin-right: -8px; flex: none; }
.brand { overflow: hidden; }
@media (max-width: 600px) { .sub { display: none; } }

.ib {
  position: relative;
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; margin: 0; padding: 0;
  border: 0; border-radius: 10px; background: transparent;
  color: var(--fg2); cursor: pointer; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: color .15s ease;
}
.ib svg { width: 22px; height: 22px; display: block; }
.ib[aria-current="page"] { color: var(--fg); }
.ib:disabled { color: var(--fg3); cursor: default; }
.ib.lang { font-size: 14px; font-weight: 600; letter-spacing: .01em; }
@media (hover: hover) { .ib:not(:disabled):hover { color: var(--fg); } }
@media (pointer: coarse) { .ib { width: 44px; height: 44px; } }

@media (hover: hover) and (pointer: fine) {
  .ib[data-tip]:not([data-tip=""])::after {
    content: attr(data-tip);
    position: absolute; top: calc(100% + 2px); left: 50%;
    transform: translate(-50%, -3px);
    padding: 4px 9px; border-radius: 7px;
    background: #1c1c1e; color: var(--fg);
    font: 500 12px/1.3 var(--font); letter-spacing: 0; white-space: nowrap;
    opacity: 0; pointer-events: none; z-index: 30;
    transition: opacity .15s ease, transform .15s ease;
  }
  .ib[data-tip]:hover::after { opacity: 1; transform: translate(-50%, 0); transition-delay: .45s; }
  .nav .ib:last-child::after, .bar-r .ib:last-child::after { left: auto; right: 0; transform: translate(0, -3px); }
  .nav .ib:last-child:hover::after, .bar-r .ib:last-child:hover::after { transform: none; }
  .bar > .ib::after { left: 0; transform: translate(0, -3px); }
  .bar > .ib:hover::after { transform: none; }
}

/* ——— layout ——— */

main {
  flex: 1; width: 100%; max-width: 1400px; margin: 0 auto;
  padding: 0 max(var(--pad), env(safe-area-inset-right)) 8px max(var(--pad), env(safe-area-inset-left));
  opacity: 0; transition: opacity .35s ease;
}
.ready main, .ready .foot { opacity: 1; }
.view.enter { animation: view-in .3s cubic-bezier(.2, .7, .3, 1) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

h2 { font-size: 13px; font-weight: 600; color: var(--fg2); letter-spacing: .01em; margin: 0 0 10px; }
.note { color: var(--fg2); font-size: 13px; line-height: 1.5; margin: 0; }
.textbtn {
  border: 0; background: transparent; color: var(--fg2); padding: 6px 8px; border-radius: 8px; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: color .15s ease;
}
@media (hover: hover) { .textbtn:hover { color: var(--fg); } }

/* segmented choice: white text + a small dot for the chosen one, no boxes */
.seg { display: inline-flex; gap: 2px; }
.seg button {
  position: relative; border: 0; background: transparent; color: var(--fg2);
  font-size: 14px; padding: 8px 11px 10px; border-radius: 8px; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: color .15s ease;
}
.seg button[aria-pressed="true"] { color: var(--fg); }
.seg button::after {
  content: ""; position: absolute; left: 50%; bottom: 3px; width: 3px; height: 3px; margin-left: -1.5px;
  border-radius: 50%; background: var(--fg); opacity: 0; transform: scale(.4); transition: opacity .2s ease, transform .2s ease;
}
.seg button[aria-pressed="true"]::after { opacity: 1; transform: none; }
@media (hover: hover) { .seg button:hover { color: var(--fg); } }

/* ——— play: table ——— */

.stage { --cell: 20px; --gap: 1.5px; --step: 21.5px; --fgap: 7px; position: relative; width: calc(18 * var(--step) - var(--gap)); margin: 10px auto 0; }
.board {
  position: relative;
  height: calc(9 * var(--step) - var(--gap) + var(--fgap));
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.tile {
  position: absolute;
  left: calc(var(--c) * var(--step));
  top: calc(var(--r) * var(--step) + var(--f) * var(--fgap));
  width: var(--cell); height: var(--cell);
  margin: 0; padding: 0; border: 0;
  border-radius: min(var(--r), calc(var(--cell) * .14));
  background: var(--tile); color: var(--fg);
  cursor: pointer; touch-action: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .18s ease;
}
.tile .sym {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-weight: 600; font-size: calc(var(--cell) * .4); line-height: 1; letter-spacing: -.02em;
  pointer-events: none;
}
.board.big .tile .sym { padding-top: calc(var(--cell) * .07); font-size: calc(var(--cell) * .36); }
.tile .z {
  display: none; position: absolute; left: calc(var(--cell) * .1); top: calc(var(--cell) * .09);
  font-size: calc(var(--cell) * .165); line-height: 1; color: var(--fg3); font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.board.big .tile .z { display: block; }
.tile .dot {
  position: absolute; width: 3px; height: 3px; border-radius: 50%;
  right: max(2px, calc(var(--cell) * .1)); top: max(2px, calc(var(--cell) * .1));
  background: rgb(var(--g)); pointer-events: none;
}
.halo { position: absolute; inset: 0; border-radius: inherit; opacity: 0; pointer-events: none; }
.tile .halo {
  background: rgba(var(--g), .24);
  box-shadow: 0 0 calc(var(--cell) * .55) rgba(var(--g), .6), inset 0 0 calc(var(--cell) * .35) rgba(var(--g), .5);
}
.tile.lit { z-index: 1; }
.tile.mute { background: #09090a; }
.tile.mute .sym { color: var(--fg3); }
.tile.sel { background: var(--tile-sel); }
@media (hover: hover) {
  .tile:hover { background: var(--tile-hover); }
  .tile.sel:hover { background: #29292e; }
}
.tile:focus-visible { box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .75); z-index: 2; }
.fmark {
  position: absolute; left: calc(var(--c) * var(--step)); top: calc(var(--r) * var(--step));
  width: var(--cell); height: var(--cell); display: grid; place-items: center;
  color: var(--fg3); font-size: max(8px, calc(var(--cell) * .15)); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.board:not(.big) .fmark { display: none; }

/* ——— play: now-playing panel (below the table on narrow screens) ——— */

.panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "head ctl" "strip strip" "chips chips";
  align-items: center; row-gap: 12px;
  margin: 22px 4px 0;
  --g: 255, 255, 255;
}
.p-head { grid-area: head; display: flex; align-items: center; gap: 14px; min-width: 0; }
.p-symbox { display: flex; flex-direction: column; min-width: 58px; }
.p-z { color: var(--fg2); font-size: 12px; line-height: 1; font-variant-numeric: tabular-nums; }
.p-sym { font-size: 46px; font-weight: 600; line-height: 1.05; letter-spacing: -.03em; }
.panel.mute .p-sym { color: var(--fg3); }
.p-names { min-width: 0; }
.p-n1 { font-size: 17px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-n2 { color: var(--fg2); font-size: 14px; line-height: 1.35; white-space: nowrap; }
.p-cat { color: var(--fg3); font-size: 12px; line-height: 1.4; white-space: nowrap; }
.p-ctl { grid-area: ctl; display: flex; gap: 0; margin-right: -8px; }
.strip { display: block; width: 100%; }
.p-strip { grid-area: strip; height: 64px; }
.chips {
  grid-area: chips; list-style: none; margin: 0; padding: 0; align-self: start;
  min-height: calc(8 * 22px);
  color: var(--fg2); font-size: 12.5px; font-variant-numeric: tabular-nums;
}
.chips.full { min-height: calc(12 * 22px); }
.chips li { display: flex; align-items: center; gap: 9px; height: 22px; white-space: nowrap; }
.chips li i { flex: none; width: 5px; height: 5px; border-radius: 50%; background: var(--lc); box-shadow: 0 0 6px var(--lc); opacity: .85; }
.chips .none { color: var(--fg3); }
.hint { text-align: center; color: var(--fg3); font-size: 12.5px; line-height: 1.6; margin: 20px 0 0; }
.hint .ios { color: var(--fg3); }

@media (min-width: 600px) {
  .stage:not(.wide) .chips { columns: 2; column-gap: 32px; min-height: calc(4 * 22px); }
  .stage:not(.wide) .chips.full { min-height: calc(6 * 22px); }
  .stage:not(.wide) .chips li { break-inside: avoid; }
  .stage:not(.wide) .p-strip { height: 80px; }
}

/* wide screens: the panel sits in the table's own gap (columns 3–12, rows 1–3) */
.stage.wide .panel {
  position: absolute; margin: 0;
  left: calc(2 * var(--step) + var(--cell) * .2);
  top: 0;
  width: calc(10 * var(--step) - var(--gap) - var(--cell) * .4);
  height: calc(3 * var(--step) - var(--gap));
  grid-template-columns: calc(var(--cell) * 2.35) minmax(0, 1fr);
  grid-template-rows: calc(var(--cell) * 1.2) minmax(0, 1fr) auto;
  grid-template-areas: "head strip" "head chips" "ctl chips";
  column-gap: calc(var(--cell) * .35); row-gap: calc(var(--cell) * .12);
  align-items: start;
}
.stage.wide .p-head { flex-direction: column; align-items: flex-start; gap: calc(var(--cell) * .06); }
.stage.wide .p-sym { font-size: calc(var(--cell) * 1.02); line-height: 1; }
.stage.wide .p-z { font-size: max(11px, calc(var(--cell) * .18)); margin-bottom: 3px; }
.stage.wide .p-n1 { font-size: clamp(14px, calc(var(--cell) * .26), 18px); }
.stage.wide .p-n2 { font-size: clamp(12px, calc(var(--cell) * .21), 14px); }
.stage.wide .p-cat { display: none; }
.stage.wide.roomy .p-cat { display: block; }
.stage.wide .p-names { max-width: 100%; }
.stage.wide .p-ctl { align-self: end; margin: 0 0 0 -10px; }
.stage.wide .p-ctl .ib { width: 36px; height: 36px; }
.stage.wide .panel.full { grid-template-rows: calc(var(--cell) * .9) minmax(0, 1fr) auto; }
.stage.wide .p-strip { height: 100%; }
.stage.wide .chips {
  min-height: 0; columns: 2; column-gap: calc(var(--cell) * .4);
  font-size: clamp(10.5px, calc(var(--cell) * .185), 12.5px);
  padding-top: calc(var(--cell) * .04);
}
.stage.wide .chips li { height: max(15px, calc(var(--cell) * .3)); break-inside: avoid; }
.stage.wide + .hint { margin-top: 26px; }

/* landscape phones: a compact panel in the same gap — symbol, name, strip and controls, no chips */
.stage.wide.compact .panel, .stage.wide.compact .panel.full {
  grid-template-columns: calc(var(--cell) * 3.3) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas: "head strip" "head ctl";
  row-gap: 0;
}
.stage.wide.compact .p-head { align-self: center; gap: 2px; }
.stage.wide.compact .p-sym { font-size: calc(var(--cell) * 1.25); }
.stage.wide.compact .p-z { margin-bottom: 1px; }
.stage.wide.compact .chips, .stage.wide.compact .p-cat, .stage.wide.compact .p-n2 { display: none; }
.stage.wide.compact .p-ctl { justify-self: end; margin: 0 -8px 0 0; }
.stage.wide.compact .p-ctl .ib { width: 40px; height: 34px; }

/* ——— element detail ——— */

#v-el { max-width: 1000px; margin: 0 auto; --g: 255, 255, 255; }
.bar { display: flex; align-items: center; justify-content: space-between; margin: 6px -8px 0; }
.bar-r { display: flex; gap: 0; }
.d-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: end; gap: 12px 24px; margin: 10px 0 26px; }
.d-symbox { display: flex; flex-direction: column; }
.d-z { color: var(--fg2); font-size: 14px; line-height: 1; font-variant-numeric: tabular-nums; margin-bottom: 4px; }
.d-sym { font-size: clamp(72px, 13vw, 132px); font-weight: 600; line-height: .92; letter-spacing: -.035em; }
#v-el.mute .d-sym { color: var(--fg3); }
.d-names { padding-bottom: 6px; min-width: 0; }
.d-n1 { font-size: clamp(24px, 3.4vw, 36px); font-weight: 600; letter-spacing: -.015em; line-height: 1.15; margin: 0; }
.d-n2 { color: var(--fg2); font-size: clamp(16px, 2vw, 20px); margin-top: 2px; }
.d-cat { color: var(--fg3); font-size: 13px; margin-top: 4px; }
.d-ctl { display: flex; align-items: center; gap: 2px; padding-bottom: 4px; margin-right: -8px; }
.ib.play { width: 56px; height: 56px; color: var(--fg); }
.ib.play svg { width: 30px; height: 30px; }
.ib.play:disabled { color: var(--fg3); }
.d-spec { margin: 0; }
.d-strip { height: clamp(110px, 17vw, 176px); }
.d-axis { position: relative; height: 36px; color: var(--fg3); font-size: 11px; font-variant-numeric: tabular-nums; }
.d-axis span { position: absolute; top: 6px; transform: translateX(-50%); white-space: nowrap; text-align: center; line-height: 1.35; }
.d-axis span.l { transform: none; text-align: left; }
.d-axis span.r { transform: translateX(-100%); text-align: right; }
.d-axis small { display: block; font-size: 10.5px; }
#v-el .seg { margin: 6px 0 0 -11px; }
.d-cols { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 40px 56px; margin-top: 30px; }
.d-tap { margin: -4px 0 10px; }
.d-lines { list-style: none; margin: 0 -10px; padding: 0; color: var(--fg2); }
.line {
  display: grid; grid-template-columns: 8px 1.15fr 1.1fr 1fr 56px; align-items: center; gap: 14px;
  width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: transparent;
  color: inherit; font-size: 14px; font-variant-numeric: tabular-nums; text-align: left; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: background-color .15s ease, color .15s ease;
}
@media (hover: hover) { .line:hover { background: var(--tile); color: var(--fg); } }
.line i { width: 7px; height: 7px; border-radius: 50%; background: var(--lc); box-shadow: 0 0 8px var(--lc); }
.line small { color: var(--fg3); }
.line .amp { display: block; height: 2px; }
.line .amp b { display: block; height: 2px; border-radius: 1px; background: var(--lc); opacity: .75; }
.d-lines .none { padding: 9px 10px; color: var(--fg3); }
.d-sws { display: flex; flex-wrap: wrap; gap: 14px 32px; margin: 0 0 30px; }
.d-sws:empty { display: none; }
.sw { display: flex; align-items: center; gap: 12px; font-size: 14px; line-height: 1.35; }
.sw i { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--sc); box-shadow: 0 0 18px var(--sc); }
.sw small { color: var(--fg3); font-size: 12px; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.d-sws .note { flex-basis: 100%; color: var(--fg3); font-size: 12.5px; }
.d-explain p { margin: 0 0 12px; font-size: 15px; line-height: 1.65; }

@media (max-width: 760px) {
  .d-head { grid-template-columns: auto minmax(0, 1fr); }
  .d-ctl { grid-column: 1 / -1; justify-self: start; margin: -6px 0 0 -12px; }
  .d-cols { grid-template-columns: 1fr; gap: 28px; margin-top: 22px; }
  .line { grid-template-columns: 8px 1.2fr 1.1fr 1fr 34px; gap: 10px; font-size: 13.5px; }
}
@media (max-width: 400px) {
  .line { grid-template-columns: 7px 1.25fr 1.1fr 1fr 24px; gap: 9px; font-size: 13px; }
}

/* ——— ear test ——— */

#v-test { max-width: 620px; margin: 0 auto; text-align: center; }
.t-head { margin: 22px 0 0; }
.t-title { font-size: 28px; font-weight: 600; letter-spacing: -.015em; margin: 0; line-height: 1.2; }
.t-meta { color: var(--fg2); font-size: 14px; margin: 4px 0 0; min-height: 21px; }
.t-dots { list-style: none; display: flex; justify-content: center; gap: 10px; margin: 18px 0 30px; padding: 0; }
.t-dots li { width: 7px; height: 7px; border-radius: 50%; background: #2c2c2e; transition: background-color .3s ease, transform .3s ease; }
.t-dots li.cur { background: var(--fg); transform: scale(1.15); }
.t-dots li.ok { background: var(--ok); }
.t-dots li.bad { background: var(--bad); }
.t-play {
  position: relative; display: grid; place-items: center;
  width: 112px; height: 112px; margin: 0 auto; border: 0; border-radius: 50%;
  background: var(--tile); color: var(--fg); cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.t-play svg { position: relative; width: 38px; height: 38px; margin-left: 5px; }
.t-play .halo { border-radius: 50%; background: rgba(255, 255, 255, .06); box-shadow: 0 0 44px rgba(255, 255, 255, .28), inset 0 0 26px rgba(255, 255, 255, .16); }
.revealed .t-play { color: var(--fg2); }
.t-q { color: var(--fg2); margin: 20px 0 22px; }
.t-choices { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; max-width: 470px; margin: 0 auto; }
.choice {
  position: relative; aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  margin: 0; padding: 0; border: 0; border-radius: var(--r);
  background: var(--tile); color: var(--fg); cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: opacity .35s ease, background-color .18s ease, box-shadow .35s ease;
}
@media (hover: hover) { .choice:hover { background: var(--tile-hover); } }
.choice .sym { position: relative; font-size: clamp(26px, 7.5vw, 36px); font-weight: 600; line-height: 1; letter-spacing: -.02em; }
.choice .nm { position: relative; font-size: 12px; color: var(--fg2); max-width: 92%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.choice .k { position: absolute; left: 8px; top: 6px; font-size: 11px; color: var(--fg3); font-variant-numeric: tabular-nums; }
@media (pointer: coarse) { .choice .k { display: none; } }
.revealed .choice .k { display: none; }
.choice.ok { box-shadow: 0 0 26px rgba(48, 209, 88, .38), inset 0 0 22px rgba(48, 209, 88, .22); }
.choice.ok .sym { color: var(--ok); }
.choice.bad { box-shadow: 0 0 26px rgba(255, 69, 58, .34), inset 0 0 22px rgba(255, 69, 58, .2); }
.choice.bad .sym { color: var(--bad); }
.choice.dim { opacity: .35; }
.choice .halo { background: rgba(48, 209, 88, .1); }
.t-after { opacity: 0; transition: opacity .3s ease; pointer-events: none; }
.revealed .t-after { opacity: 1; pointer-events: auto; }
.t-verdict { font-size: 15px; margin: 22px 0 10px; min-height: 23px; }
.t-verdict.ok { color: var(--ok); }
.t-verdict.bad { color: var(--bad); }
.t-strip { max-width: 470px; height: 48px; margin: 0 auto 6px; }
.t-next { color: var(--fg); }
.t-ios { color: var(--fg3); margin-top: 18px; min-height: 20px; }
.t-done { display: none; }
.finished .t-game, .finished .t-dots { display: none; }
.finished .t-done { display: block; }
.t-score { font-size: 72px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.03em; line-height: 1.05; margin-top: 26px; }
.t-squares { display: flex; justify-content: center; gap: 7px; margin: 16px 0 10px; }
.t-squares i { width: 18px; height: 18px; border-radius: 4px; }
.t-squares i.ok { background: var(--ok); box-shadow: 0 0 12px rgba(48, 209, 88, .35); }
.t-squares i.bad { background: var(--bad); box-shadow: 0 0 12px rgba(255, 69, 58, .3); }
.t-streak { color: var(--fg2); margin: 0; min-height: 22px; }
.t-share { color: var(--fg); margin: 10px 0 4px; }
.t-nextin { color: var(--fg3); font-variant-numeric: tabular-nums; margin-bottom: 34px; }
.t-done h2 { margin-bottom: 8px; }
.t-today { list-style: none; margin: 0 auto; padding: 0; max-width: 340px; text-align: left; }
.t-row {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 8px; color: var(--fg); text-decoration: none; transition: background-color .15s ease;
}
@media (hover: hover) { .t-row:hover { background: var(--tile); } }
.t-row .sym { font-size: 21px; font-weight: 600; letter-spacing: -.02em; text-shadow: 0 0 16px rgba(var(--g), .55); }
.t-row .nm { color: var(--fg2); }
.t-row .mk svg { width: 18px; height: 18px; display: block; }
.t-row .mk.ok { color: var(--ok); }
.t-row .mk.bad { color: var(--bad); }

/* ——— spell ——— */

#v-spell { max-width: 900px; margin: 0 auto; text-align: center; }
.s-field { display: block; }
.s-field input {
  width: 100%; margin: 0; padding: 30px 0 6px; border: 0; background: transparent; color: var(--fg);
  font: 600 clamp(30px, 6.2vw, 50px)/1.2 var(--font); letter-spacing: -.015em; text-align: center; caret-color: var(--fg);
}
.s-field input::placeholder { color: var(--fg3); font-weight: 500; }
.s-field input:focus-visible { box-shadow: none; }
.s-tiles { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; min-height: 92px; margin: 20px 0 10px; }
.stile {
  position: relative; width: 84px; height: 84px; margin: 0; padding: 0; border: 0; border-radius: var(--r);
  background: var(--tile); color: var(--fg); cursor: pointer; -webkit-tap-highlight-color: transparent;
  animation: tile-in .32s cubic-bezier(.2, .7, .3, 1) both;
}
@keyframes tile-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.stile .z { position: absolute; left: 8px; top: 6px; font-size: 11px; line-height: 1; color: var(--fg3); font-variant-numeric: tabular-nums; }
.stile .sym { position: absolute; left: 0; right: 0; top: 24%; font-size: 32px; font-weight: 600; line-height: 1; letter-spacing: -.02em; }
.stile .nm { position: absolute; left: 4px; right: 4px; bottom: 9px; font-size: 10.5px; color: var(--fg2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stile .halo { background: rgba(var(--g, 255, 255, 255), .24); box-shadow: 0 0 34px rgba(var(--g, 255, 255, 255), .55), inset 0 0 24px rgba(var(--g, 255, 255, 255), .45); }
.stile.lit { z-index: 1; }
.stile.mute .sym { color: var(--fg3); }
@media (hover: hover) { .stile:hover { background: var(--tile-hover); } }
.miss { display: inline-block; min-width: 26px; font-size: 32px; font-weight: 600; color: var(--fg3); animation: tile-in .32s ease both; }
.gap { display: inline-block; width: 22px; }
.s-note { min-height: 20px; }
.s-strips { max-width: 560px; margin: 6px auto 0; }
.s-strips:empty { display: none; }
.s-row { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 10px; height: 26px; }
.s-row span { color: var(--fg3); font-size: 12px; font-weight: 600; text-align: right; }
.s-row .strip { height: 22px; }
.s-ctl { display: flex; justify-content: center; gap: 4px; margin: 10px 0 18px; }
.s-ctl .ib:not(:disabled) { color: var(--fg); }
.s-try { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 0 2px; color: var(--fg3); font-size: 14px; margin: 0; }
.s-try > span { margin-right: 4px; }
@media (max-width: 520px) {
  .stile { width: 64px; height: 64px; }
  .stile .sym { font-size: 25px; top: 22%; }
  .stile .nm { font-size: 9.5px; bottom: 6px; }
  .stile .z { font-size: 10px; left: 6px; top: 5px; }
  .s-tiles { gap: 8px; min-height: 72px; }
  .miss { font-size: 25px; min-width: 20px; }
}

/* ——— about ——— */

.prose { max-width: 680px; margin: 0 auto; padding-top: 14px; }
.prose .lead { font-size: clamp(23px, 3.6vw, 32px); font-weight: 600; line-height: 1.28; letter-spacing: -.015em; margin: 18px 0 8px; }
.prose h2 { font-size: 17px; color: var(--fg); letter-spacing: -.005em; margin: 44px 0 10px; }
.prose p, .prose li { font-size: 16px; line-height: 1.68; }
.prose p { margin: 0 0 14px; }
.prose ul { margin: 0; padding-left: 1.1em; }
.prose li { margin: 0 0 6px; }
.prose li::marker { color: var(--fg3); }
.prose cite { font-style: italic; }
.prose .note { font-size: 13px; }
.formula { font: 500 clamp(13.5px, 3.7vw, 21px)/1.5 var(--mono); letter-spacing: 0; margin: 20px 0 !important; white-space: nowrap; overflow-x: auto; }
.formula span { font-style: italic; }
.demo {
  position: relative; display: inline-flex; align-items: center; gap: 10px;
  margin: 0 0 0 -2px; padding: 6px 2px; border: 0; background: transparent; color: var(--fg);
  font-size: 15px; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.demo::before { content: ""; width: 10px; height: 12px; background: currentColor; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.demo .halo { inset: -6px -14px; border-radius: 14px; background: radial-gradient(closest-side, rgba(255, 255, 255, .14), rgba(255, 255, 255, 0)); }
.a-strip { height: 56px; margin: 4px 0 18px; }
.a-cap { margin: -12px 0 14px !important; color: var(--fg3) !important; }
.settings { margin: 0 0 6px; }
.set-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 16px; min-height: 44px; }
.set-row > span { font-size: 16px; }
.settings .note { margin: -4px 0 8px; }
.links { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 18px !important; }
.links a { color: var(--fg2); text-decoration: none; }
@media (hover: hover) { .links a:hover { color: var(--fg); } }
.prose a:not(.ib) { text-underline-offset: 3px; text-decoration-color: var(--fg3); }

/* ——— footer, toast, misc ——— */

.foot {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px;
  padding: 34px var(--pad) calc(22px + env(safe-area-inset-bottom));
  color: var(--fg3); font-size: 12.5px;
  opacity: 0; transition: opacity .35s ease;
}
.foot a { color: var(--fg3); text-decoration: none; transition: color .15s ease; }
@media (hover: hover) { .foot a:hover { color: var(--fg2); } }

#toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); z-index: 50;
  padding: 9px 16px; border-radius: 20px; background: #1c1c1e; color: var(--fg); font-size: 14px;
  max-width: calc(100vw - 32px); overflow-wrap: anywhere; text-align: center;
  transform: translate(-50%, 8px); opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.fail { text-align: center; padding: 80px 0; color: var(--fg2); }
.noscript { text-align: center; color: var(--fg2); padding: 40px var(--pad); }

@media (prefers-reduced-motion: reduce) {
  .view.enter, .stile, .miss { animation: none; }
  *, *::before, *::after { transition-duration: 0s !important; }
}

/* ——— static pages (support, privacy, making of, 404) ——— */

.page { max-width: 680px; margin: 0 auto; padding: 8px max(var(--pad), env(safe-area-inset-right)) 40px max(var(--pad), env(safe-area-inset-left)); }
.page h1 { font-size: clamp(28px, 5vw, 38px); font-weight: 600; letter-spacing: -.02em; line-height: 1.15; margin: 34px 0 6px; }
.page .sub1 { color: var(--fg2); margin: 0 0 30px; }
.page h2 { font-size: 17px; color: var(--fg); margin: 36px 0 8px; }
.page p, .page li { font-size: 16px; line-height: 1.68; }
.page p { margin: 0 0 14px; }
.page ul, .page ol { padding-left: 1.2em; margin: 0 0 14px; }
.page li::marker { color: var(--fg3); }
.page a { text-underline-offset: 3px; text-decoration-color: var(--fg3); }
.page .quiet { color: var(--fg2); }
.page code { font: 14px var(--mono); }
body.static main { opacity: 1; }
body.static .foot { opacity: 1; }
@media (max-width: 360px) { .formula { white-space: normal; } }
@media (max-width: 360px) {
  .top { gap: 2px; }
  .nav .ib { width: 36px; }
  .brand { gap: 7px; padding-right: 0; }
}
