/* Rimely homepage — layered on rime-future.css (Future-flat). Game-UI pieces follow the Rimely client renders. */
:root,
:root[data-theme='infernal'] {
  --ry-char: #262320;
  --ry-char-2: #1d1b19;
  --ry-char-line: #3a3530;
  --ry-char-ink: #ece6df;
  --ry-char-mute: #9c948b;
  --ry-warm: #d97757;
}
:root[data-theme='internal'] .ry-stage-inner {
  /* the HUD stage is a game viewport: same dark values as the dark theme, whatever the site toggle says */
  --ry-char: #262320;
  --ry-char-2: #1d1b19;
  --ry-char-line: #3a3530;
  --ry-char-ink: #ece6df;
  --ry-char-mute: #9c948b;
  --ry-warm: #d97757;
  --accent: #5effc3;
  --accent-soft: #1a3d32;
  --accent-text: #5effc3;
}
:root[data-theme='internal'] {
  --ry-char: #f1ece6;
  --ry-char-2: #e8e1d9;
  --ry-char-line: #d6cdc2;
  --ry-char-ink: #2a2622;
  --ry-char-mute: #6f665d;
  --ry-warm: #b85a3c;
}
:root {
  /* egui defaults: proportional Ubuntu-Light, monospace Hack; CJK fallback simhei / Deng / msyh / Noto Sans SC. No font files shipped. */
  --rm-ui: "Ubuntu", "Noto Sans", "Segoe UI", system-ui, "DengXian", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", "Noto Sans CJK SC", sans-serif;
  --rm-mono: "Hack", "DejaVu Sans Mono", "Cascadia Mono", Consolas, ui-monospace, monospace;
}

.rimely-home .ry-hero { align-items: center; padding: 88px 0 64px; }
.ry-status-line {
  display: flex; align-items: center; gap: 10px;
  margin: 22px 0 0; font-size: 12px; color: var(--text-muted);
}
.ry-dot { width: 6px; height: 6px; background: var(--ry-warm); flex: none; }


/* ClickGUI — replica of the client's offline render (cui6/clickgui.jpg).
   Laid out at the client's logical size (760×480) and scaled to the column; values from clickgui/tokens.rs + adjust.rs. */
.ry-gui { margin: 0; min-width: 0; }
.ry-gui-frame { position: relative; width: 100%; aspect-ratio: 760 / 480; }
.ry-cg {
  --cg-w: 760px; --cg-h: 480px;
  position: absolute; left: 0; top: 0; width: var(--cg-w); height: var(--cg-h);
  transform: scale(var(--gs, .72)); transform-origin: 0 0;
  font: 400 12.5px/1 var(--rm-ui); color: #f5f5f5; letter-spacing: 0;
  background: rgba(21, 21, 21, .92); border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .10), 0 3px 16px rgba(0, 0, 0, .34);
}
.ry-cg > *, .ry-cg-head > *, .ry-cg-nav > * { position: absolute; }
.ry-cg-head, .ry-cg-nav { inset: 0; }
.ry-cg-dot { left: 19.5px; top: 25.5px; width: 9px; height: 9px; border-radius: 50%; background: #d97757; }
.ry-cg-dot::after { content: ''; position: absolute; left: -3px; top: -3px; width: 13px; height: 13px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(217, 119, 87, .35); }
.ry-cg-title { left: 50px; top: 21px; font: 400 18px/18px var(--rm-ui); color: #f5f5f5; }
.ry-cg-target { left: 116px; top: 25px; font: 400 10.5px/10.5px var(--rm-ui); color: #a3a3a3; white-space: nowrap; }
.ry-cg-search {
  left: 534px; top: 17px; width: 201px; height: 30px; box-sizing: border-box; padding-left: 28px;
  display: flex; align-items: center; color: #a3a3a3; font-size: 12.5px; white-space: nowrap;
  background: rgba(255, 255, 255, .05); border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .09);
}
.ry-cg-search svg { position: absolute; left: 10px; top: 9px; width: 12px; height: 12px; fill: none; stroke: #a3a3a3; stroke-width: 1.2; }
.ry-cg-navi { left: 1px; width: 138px; height: 30px; display: flex; align-items: center; padding-left: 16px; box-sizing: border-box; color: #a3a3a3; border-radius: 6px; }
.ry-cg-navi.n1 { top: 72px; } .ry-cg-navi.n2 { top: 104px; } .ry-cg-navi.n3 { top: 136px; }
.ry-cg-navi.is-on { color: #f5f5f5; background: rgba(217, 119, 87, .15); }
.ry-cg-navi.is-on::before { content: ''; position: absolute; left: 5.5px; top: 8px; width: 3px; height: 14px; border-radius: 1.5px; background: #d97757; }
.ry-cg-cap { left: 17px; top: 183px; font: 400 10.5px/10.5px var(--rm-ui); color: #666; }
.ry-cg-shadows { left: 17px; top: 211px; line-height: 14px; }
.ry-cg-tg-nav { left: 108px; top: 211px; }
.ry-cg-h { left: 160px; top: 68px; font: 400 13.5px/13.5px var(--rm-ui); }
.ry-cg-card {
  width: 288px; height: 60px; border-radius: 8px;
  background: rgba(26, 26, 25, .92);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .10), 0 3px 16px rgba(0, 0, 0, .34);
}
.ry-cg-card.c1 { left: 160px; top: 94px; } .ry-cg-card.c2 { left: 456px; top: 94px; } .ry-cg-card.c3 { left: 160px; top: 165px; }
.ry-cg-row {
  position: absolute; left: 12px; top: 12px; width: 264px; height: 36px; border-radius: 6px;
  display: flex; align-items: center; transform-origin: 50% 50%;
  transition: background-color .15s cubic-bezier(.16, 1, .3, 1), transform .1s cubic-bezier(.16, 1, .3, 1);
}
.ry-cg-row span { position: absolute; left: 10px; top: 11.75px; line-height: 12.5px; white-space: nowrap; }
.ry-cg-row s { position: absolute; left: 2px; top: 50%; width: 2px; height: 19.8px; margin-top: -9.9px; border-radius: 1px; background: #d97757; transform: scaleY(var(--on, 0)); opacity: var(--on, 0); }
.ry-cg-row.is-on s { --on: 1; }
.ry-cg-row:not(.is-on) span { color: rgba(245, 245, 245, .94); }
.ry-cg-row.is-hover { background: rgba(255, 255, 255, .05); }
.ry-cg-row.is-press { transform: scale(.98); }
.ry-cg-row .ry-cg-tg { left: 232px; top: 11px; }
.ry-cg-tg { position: absolute; width: 26px; height: 14px; border-radius: 7px; background: rgba(255, 255, 255, .30); }
.ry-cg-tg.is-on { background: #d97757; }
.ry-cg-tg b { position: absolute; left: 2px; top: 2px; width: 10px; height: 10px; border-radius: 50%; background: #f5f5f5; transform: translateX(calc(var(--k, 0) * 12px)); }
.ry-cg-tg.is-on b { --k: 1; }
.ry-cg-foot { left: 0; top: 463px; margin: 0; font: 400 10.5px/10.5px var(--rm-ui); color: #a3a3a3; white-space: nowrap; }
.ry-gui figcaption { margin-top: 10px; font-size: 11px; color: var(--text-muted); text-align: right; }
@media (max-width: 520px) {
  .ry-gui-frame { aspect-ratio: 480 / 480; }
  .ry-cg { --cg-w: 480px; }
  .ry-cg-search { display: none; }
  .ry-cg-card.c2 { left: 160px; top: 236px; }
  .ry-gui figcaption { text-align: left; }
}

/* Spec strip */
.ry-specs { border-bottom: 1px solid var(--border); }
.ry-specs dl {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0;
}
.ry-specs dl > div { padding: 22px 0; }
.ry-specs dl > div + div { padding-left: 24px; border-left: 1px solid var(--border); }
.ry-specs dt { font: 500 10px/1 var(--mono); letter-spacing: .12em; color: var(--accent); margin-bottom: 10px; }
.ry-specs dd { margin: 0; font-size: 15px; }

/* Module categories */
.rimely-home .ry-modules { padding: 72px 0 56px; }
.ry-grid {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px;
  background: var(--border); border: 1px solid var(--border);
}
.ry-card { grid-column: span 2; }
.ry-card:nth-child(n+4) { grid-column: span 3; }
.ry-card ul { margin-top: 8px; }
.ry-card li { padding: 3px 0; }
.ry-card li small { margin-left: 8px; font-size: 11px; color: var(--text-muted); }
.ry-card-bed { background: color-mix(in srgb, var(--accent) 6%, var(--card)); }

/* GUI themes */
.ry-gui-notes { padding: 8px 0 64px; }
.ry-gui-notes .section-heading {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px;
}
.ry-gui-notes .section-heading h2 { margin: 0; font: 500 28px/1.2 var(--sans); letter-spacing: -.03em; }
.ry-gui-notes .section-heading > p { margin: 0; font-size: 13px; color: var(--text-muted); }
.ry-theme-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.ry-theme { padding: 22px 20px; border: 1px solid var(--border); background: var(--card); }
.ry-theme b { display: block; margin-top: 16px; font: 500 16px/1.3 var(--sans); }
.ry-theme p { margin: 6px 0 0; font-size: 12.5px; color: var(--text-muted); }
.ry-swatch { display: block; height: 44px; border-radius: 4px; border: 1px solid rgba(255, 255, 255, .10); margin-bottom: 16px; }
.ry-theme b { margin-top: 0; }
/* real client tokens: SURFACE_1 / SURFACE_2 / CLAY */
.ry-theme-claude .ry-swatch { background: linear-gradient(135deg, #151515 0 45%, #1a1a19 45% 70%, #d97757 70% 100%); }

/* Status + Rime cross-link */
.rimely-home .ry-cta { margin: 0 0 24px; }
.ry-cta p:last-of-type { max-width: 36em; line-height: 1.7; }
.ry-rime {
  display: flex; justify-content: space-between; align-items: center; gap: 24px;
  padding: 32px; margin: 0 0 72px;
  border: 1px solid var(--border); background: var(--card);
}
.ry-rime .eyebrow { margin-bottom: 12px; }
.ry-rime h2 { margin: 0 0 8px; font: 500 22px/1.3 var(--sans); letter-spacing: -.02em; }
.ry-rime p:last-of-type { margin: 0; font-size: 13px; color: var(--text-muted); max-width: 38em; }
.ry-rime-actions { display: flex; flex-wrap: wrap; gap: 10px; flex: none; }

@media (max-width: 900px) {
  .rimely-home .ry-hero { padding: 48px 0 40px; }
  .ry-specs dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ry-specs dl > div:nth-child(3) { padding-left: 0; border-left: 0; }
  .ry-specs dl > div:nth-child(n+3) { border-top: 1px solid var(--border); }
  .ry-grid { grid-template-columns: 1fr; }
  .ry-card, .ry-card:nth-child(n+4) { grid-column: auto; }
  .ry-theme-row { grid-template-columns: 1fr; }
  .ry-rime { flex-direction: column; align-items: flex-start; padding: 28px 22px; }
  .rimely-home .ry-modules { padding: 56px 0 40px; }
}
@media (max-width: 520px) {
  .ry-specs dl > div + div { padding-left: 16px; }
  .ry-specs dl > div:nth-child(3) { padding-left: 0; }
}

/* ── HUD 演示 (illustrative; CSS + vanilla JS; animates transform / opacity / SVG dash only) ── */
.ry-hud { padding: 72px 0 8px; }
.ry-hud .section-heading {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px;
}
.ry-hud .section-heading h2 { margin: 0; font: 500 28px/1.2 var(--sans); letter-spacing: -.03em; }
.ry-hud .section-heading > p { margin: 0; font-size: 13px; color: var(--text-muted); }
.ry-stage { margin: 0; }
.ry-stage figcaption { margin-top: 10px; font-size: 11px; color: var(--text-muted); text-align: right; }
.ry-stage-inner {
  --row: 22px;
  position: relative; aspect-ratio: 2 / 1; overflow: hidden; contain: layout paint;
  color: var(--ry-char-ink);
  background: linear-gradient(180deg, var(--ry-char) 0%, var(--ry-char-2) 100%);
  border: 1px solid var(--ry-char-line); border-radius: 6px;
}
.ry-scene { position: absolute; inset: 0; width: 100%; height: 100%; }

/* In-game HUD layers — copied from the client's offline renders; values from clickgui/hud/*.rs + tokens.rs.
   Game-UI colours are fixed (they do not follow the site theme), like the client. */
.ry-stage-inner {
  --rm-surface2: rgba(26, 26, 25, .92);
  --rm-hair: inset 0 0 0 1px rgba(255, 255, 255, .10);
  --rm-shadow: 0 3px 16px rgba(0, 0, 0, .34);
}
.ry-floor path { fill: none; stroke: var(--ry-char-line); stroke-width: 1; }
.ry-figure rect { fill: color-mix(in srgb, var(--ry-char-ink) 20%, transparent); }
.ry-scene text { font-family: var(--rm-ui); }
/* ESP — esp.jpg player box: corner brackets + 0.75px outline (ink×0.45) + 18% fill, left health bar, caption plate */
.ry-esp-fill { fill: rgba(217, 119, 87, .18); }
.ry-esp-thin { fill: none; stroke: rgba(217, 119, 87, .36); stroke-width: .75; vector-effect: non-scaling-stroke; }
.ry-esp-halo { fill: none; stroke: rgba(18, 16, 14, .57); stroke-width: 1.55; vector-effect: non-scaling-stroke; }
.ry-esp-brk { fill: none; stroke: rgba(217, 119, 87, .80); stroke-width: 1; vector-effect: non-scaling-stroke; }
.ry-esp-track { fill: rgba(15, 14, 13, .745); stroke: rgba(58, 53, 48, .59); stroke-width: 1; vector-effect: non-scaling-stroke; }
.ry-esp-trail, .ry-esp-hp { transform-box: fill-box; transform-origin: 50% 100%; }
.ry-esp-trail { fill: rgba(120, 96, 84, .784); transform: scaleY(.7); }
.ry-esp-hp { fill: rgba(212, 165, 116, .902); transform: scaleY(.7); }
.ry-esp-plate { fill: rgba(21, 21, 21, .784); stroke: rgba(255, 255, 255, .10); stroke-width: 1; vector-effect: non-scaling-stroke; }
.ry-esp-name { fill: rgba(245, 240, 232, .90); font-size: 8.93px; text-anchor: middle; }
.ry-esp-dist, .ry-esp-item { fill: rgba(163, 158, 148, .863); font-size: 7.86px; text-anchor: middle; }
/* Trajectory — trajectory-previews/v3: 3px clay arc fading 230→58% of head, cream landing ring 1.6px, label plate */
.ry-traj { fill: none; stroke-width: 3; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.ry-land ellipse { fill: rgba(232, 168, 132, .275); stroke: rgb(245, 236, 220); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.ry-land-plate { fill: rgba(58, 40, 32, .902); }
.ry-land text { fill: rgb(245, 236, 220); font-size: 8.93px; text-anchor: middle; }
.ry-cross { stroke: var(--ry-char-ink); stroke-width: 1.5; opacity: .55; }

/* TargetHUD — Classic (target_hud_style 1, default): 292×118, margin 18, bottom-right */
.ry-th {
  position: absolute; right: 18px; bottom: 18px; width: 292px; height: 118px; transform-origin: 100% 100%;
  font: 400 12.5px/1 var(--rm-ui); color: #f5f5f5;
  background: var(--rm-surface2); border-radius: 10px; box-shadow: var(--rm-hair), var(--rm-shadow);
}
.ry-th > * { position: absolute; }
.ry-th-bar { left: 0; top: 0; width: 3px; height: 118px; background: #d97757; }
.ry-th-av {
  left: 14px; top: 14px; width: 36px; height: 36px; border-radius: 50%; box-sizing: border-box;
  display: flex; align-items: center; justify-content: center; background: #20201e;
  box-shadow: inset 0 0 0 .25px #20201e, inset 0 0 0 1.75px #d97757; font-size: 13.5px;
}
.ry-th-name { left: 62px; top: 12px; font: 400 13.5px/13.5px var(--rm-ui); white-space: nowrap; }
.ry-th-num { right: 14px; top: 12px; font: 400 13.5px/13.5px var(--rm-mono); font-variant-numeric: tabular-nums; }
.ry-th-chip {
  left: 62px; top: 32px; padding: 2px 6px; font: 400 11px/11px var(--rm-ui); color: #a3a3a3; white-space: nowrap;
  background: rgba(255, 255, 255, .09); border-radius: 4px;
}
.ry-th-hp, .ry-th-armor { left: 62px; width: 216px; overflow: hidden; background: rgba(255, 255, 255, .09); }
.ry-th-hp { top: 56px; height: 4px; border-radius: 2px; }
.ry-th-armor { top: 64px; height: 3px; border-radius: 1.5px; }
.ry-th-hp i, .ry-th-armor i { position: absolute; inset: 0; transform-origin: 0 50%; border-radius: inherit; }
.ry-th-trail { background: rgba(120, 96, 84, .784); transform: scaleX(.7); }
.ry-th-fill { background: rgba(212, 165, 116, .902); transform: scaleX(.7); }
.ry-th-armor i { background: rgb(186, 176, 160); transform: scaleX(.42); }
/* HP text, bar and trail are written per frame by JS from one shared value (no CSS transition). */
.ry-th-eq { left: 62px; top: 78px; display: flex; gap: 4px; }
.ry-th-eq i {
  width: 16px; height: 16px; border-radius: 2px; background: rgba(255, 255, 255, .05);
  font: 400 10.5px/16px var(--rm-mono); font-style: normal; text-align: center; color: #666;
}

/* ArrayList — arraylist.jpg: per-row plates, rows touch, 2px clay bar on the right, 12px edge margin */
.ry-array {
  position: absolute; top: 12px; right: 12px; margin: 0; padding: 0; list-style: none;
  display: flex; flex-direction: column; align-items: flex-end;
  width: 240px; height: 200px; pointer-events: none; /* same box static and live: no layout shift */
}
.ry-array li {
  position: relative; height: 20px; box-sizing: border-box; padding: 4px 10px 4px 6px;
  font: 400 12.5px/12px var(--rm-ui); white-space: nowrap; color: #f5f5f5; text-shadow: 1px 1px 0 rgb(12, 10, 8);
  background: rgba(26, 26, 25, .43); border-radius: 4px; box-shadow: var(--rm-hair), var(--rm-shadow);
}
.ry-array li::after { content: ''; position: absolute; right: 0; top: 0; bottom: 0; width: 2px; background: #d97757; }
.ry-array em { font-style: normal; color: #a3a3a3; }
.ry-array.is-live { display: block; }
.ry-array.is-live li { position: absolute; top: 0; right: 0; will-change: transform; }

.ry-bed {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 10px;
  background: color-mix(in srgb, var(--ry-char) 90%, transparent);
  border: 1px solid var(--ry-char-line); border-radius: 4px;
}
.ry-ring { width: 56px; height: 56px; flex: none; }
.ry-ring circle { fill: none; stroke-width: 5; }
.ry-ring-track { stroke: var(--ry-char-line); }
.ry-ring-seg {
  stroke: var(--accent); stroke-dasharray: 50.45 200; stroke-dashoffset: 0;
  transform-box: view-box; transform-origin: 50% 50%;
}
.ry-ring-seg.is-active { stroke: var(--ry-warm); }
.ry-ring-seg.s1 { transform: rotate(-85.6deg); }
.ry-ring-seg.s2 { transform: rotate(34.4deg); }
.ry-ring-seg.s3 { transform: rotate(154.4deg); }
.ry-bed-text { display: flex; flex-direction: column; gap: 3px; min-width: 84px; }
.ry-bed-text b { font: 600 16px/1 var(--mono); font-variant-numeric: tabular-nums; }
.ry-bed-text span { font-size: 11px; color: var(--ry-char-mute); }
.ry-bed-text em { font: 500 11px/1 var(--sans); font-style: normal; color: var(--accent); }

.ry-hud-legend {
  list-style: none; margin: 20px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px;
  counter-reset: hud;
}
.ry-hud-legend li { counter-increment: hud; display: flex; flex-direction: column; gap: 4px; padding-top: 12px; border-top: 1px solid var(--border); }
.ry-hud-legend li::before { content: '0' counter(hud); font: 500 10px/1 var(--mono); letter-spacing: .1em; color: var(--accent); }
.ry-hud-legend b { font: 500 14px/1.3 var(--sans); }
.ry-hud-legend span { font-size: 12px; color: var(--text-muted); }

/* Live mode (JS on, motion allowed) */
.ry-stage.is-live:not(.is-playing) .ry-scene * { animation-play-state: paused; }

@media (max-width: 900px) {
  .ry-hud { padding: 56px 0 8px; }
  .ry-stage-inner { aspect-ratio: 16 / 10; }
  .ry-hud-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* client HUD is movable; on narrow stages TargetHUD sits top-left so it never meets the BedNuker panel */
  .ry-th { right: auto; bottom: auto; left: 12px; top: 12px; transform-origin: 0 0; transform: scale(.8); }
}
@media (max-width: 520px) {
  .ry-scene { inset: auto; top: 22%; left: -43%; width: 200%; height: auto; aspect-ratio: 2 / 1; }
  .ry-stage-inner { aspect-ratio: 3 / 4; }
  /* keep caption text near the client's 11–12.5px on the 0.875× mobile scene */
  .ry-esp-cap, .ry-esp-dist, .ry-esp-item, .ry-land-lbl { transform-box: fill-box; transform: scale(1.35); }
  .ry-esp-cap, .ry-esp-dist { transform-origin: 50% 100%; }
  .ry-esp-item { transform-origin: 50% 0; }
  .ry-land-lbl { transform-origin: 50% 0; }
  /* the hand end sits just above the BedNuker panel on the 0.875× scene: start the visible arc 4% in */
  .ry-traj { stroke-dasharray: 96 4; stroke-dashoffset: 96; }
  .ry-th { left: 10px; top: 10px; transform: scale(.7); }
  .ry-array li { height: 18px; padding: 3.5px 10px 3.5px 6px; font-size: 11px; line-height: 11px; }
  .ry-array { width: 160px; height: 180px; }
  .ry-bed { bottom: 12px; gap: 10px; padding: 8px 12px 8px 8px; }
  .ry-ring { width: 46px; height: 46px; }
  .ry-stage figcaption { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  .ry-stage .ry-scene * { animation: none !important; }
  .ry-array li, .ry-cg-row { transition: none !important; }
}
