:root {
  --bg: #0e1014;
  --surface: #171a21;
  --surface-2: #1f232c;
  --line: #2a2f3a;
  --text: #f2f4f8;
  --muted: #9aa3b2;
  --calm: #8aa4ff;
  --accent: #8aa4ff;
  --radius: 20px;
  --loop: 2.4s;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
html { overscroll-behavior: none; }
body {
  color: var(--text);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }

#app { min-height: 100%; }

.view {
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top, 0px) + 20px) max(20px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 20px) max(20px, env(safe-area-inset-left, 0px));
  max-width: 1280px;
  margin: 0 auto;
}

.home-main {
  display: flex; flex-direction: column;
  min-height: calc(100vh - 20px - env(safe-area-inset-top, 0px));
  min-height: calc(100svh - 20px - env(safe-area-inset-top, 0px));
}
.home-main > .cats { flex: 1 0 auto; }
.home-head { padding: 24px 4px 18px; }
.home-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.seg { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.seg button { min-height: 44px; padding: 0 18px; border-radius: 999px; color: var(--muted); font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); }
.equip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 22px; }
.equip-label { color: var(--muted); margin-right: 4px; }
.pill.base {
  cursor: default; gap: 8px; padding-left: 6px; padding-right: 4px;
  background: transparent; border-color: transparent; color: var(--text);
}
.pill.base svg { width: 18px; height: 18px; color: #4cd964; }
.equip-sep { color: var(--muted); font-size: 1.2rem; margin: 0 2px 0 -2px; }
.home-head h1 { margin: 0; font-size: clamp(2.4rem, 5vw, 3.6rem); letter-spacing: -0.02em; line-height: 1.05; }
.brand { display: flex; align-items: flex-end; gap: .28em; }
.brand .logo { width: .9em; height: .9em; flex: none; margin-bottom: .08em; }
.home-head p { margin: 8px 0 0; color: var(--muted); font-size: 1.1rem; }
.home-head .tagline { margin: 6px 0 0; color: var(--text); font-size: clamp(1.15rem, 2.2vw, 1.4rem); font-weight: 600; }

.cats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
@media (min-width: 1000px) and (orientation: landscape) {
  .cats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cat-meta { min-height: 4.2em; }
}
@media (max-width: 560px) { .cats { grid-template-columns: 1fr; } }
.cat-text { display: flex; flex-direction: column; gap: 6px; }
.cat.cat-wide { grid-column: 1 / -1; min-height: min-content; padding-top: 58px; }
.cat-wide .cat-meta { min-height: 0; }
.cat-wide .durs { grid-template-columns: repeat(3, 1fr); }
.cats .cat:not(.cat-wide) { min-height: clamp(240px, 26vh, 400px); padding-top: 48px; }
@media (min-width: 700px) {
  .cat.cat-wide { flex-direction: row; align-items: flex-end; column-gap: 28px; padding-top: 50px; padding-bottom: 26px; }
  .cat-wide .cat-text { flex: 1 1 0; min-width: 0; }
  .cat-wide .durs { flex: 0 0 auto; margin-top: 0; grid-template-columns: repeat(3, 96px); }
}
@media (min-width: 1000px) and (orientation: landscape) {
  .cat.cat-wide { padding-top: 40px; padding-bottom: 26px; }
  .cat-wide .cat-text { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 28px; row-gap: 2px; align-items: end; }
  .cat-wide .cat-name { grid-row: 1 / 3; align-self: center; }
  .cats .cat:not(.cat-wide) { padding: 40px 22px 20px; }
  .cats .cat:not(.cat-wide)::before { top: 20px; left: 22px; }
  .cats .cat:not(.cat-wide) .durs { margin-top: 10px; }
  .cats .cat-pool { font-size: .8rem; }
}
@media (min-width: 1150px) and (orientation: landscape) {
  .cats .cat-pool { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
.cat {
  position: relative; overflow: hidden; text-align: left;
  min-height: clamp(260px, 40vh, 400px); padding: 26px; border-radius: 24px;
  background: radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--c) 35%, transparent), transparent 60%), var(--surface);
  border: 1px solid var(--line);
  display: flex; flex-direction: column; justify-content: flex-end; gap: 6px;
}
.cat::before {
  content: ""; position: absolute; left: 26px; top: 26px; width: 44px; height: 6px; border-radius: 3px; background: var(--c);
}
.cat-name { font-size: 2rem; font-weight: 700; letter-spacing: -0.01em; }
.cat-meta { color: var(--muted); line-height: 1.4; min-height: 2.8em; }
.cat-pool { color: var(--muted); font-size: .88rem; opacity: .8; }
.durs { margin-top: 14px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.dur {
  min-height: 74px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--c) 16%, var(--surface-2)); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
  transition: transform .12s ease, background .12s ease;
}
.dur:active { transform: scale(.96); background: color-mix(in srgb, var(--c) 30%, var(--surface-2)); }
.dur b { font-size: 1.7rem; line-height: 1; color: var(--c); font-variant-numeric: tabular-nums; }
.dur span { font-size: .85rem; color: var(--muted); margin-top: 4px; }
.dur.all { background: transparent; }
.dur.all b { display: grid; place-items: center; height: 1.7rem; }
.dur.all svg { width: 1.6rem; height: 1.6rem; }

.home-foot { margin-top: 32px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.pill {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 18px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--text);
}
.pill svg { width: 20px; height: 20px; }
.pill[aria-pressed="false"] { color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.pill[aria-pressed="true"] .dot { background: #4cd964; }
.sound-msg { color: var(--muted); font-size: .9rem; }
.home-ctrl { display: flex; align-items: center; gap: 12px; }
.home-ctrl .icon-btn[aria-pressed="false"] { color: var(--muted); }
.sound-row, .help-test { width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.help-warn { margin: 4px 0 8px; padding: 10px 14px; border-radius: 12px; background: rgba(255, 184, 107, .12); color: #ffb86b; }
.help-steps { margin: 6px 0 14px; padding-left: 1.4em; display: grid; gap: 10px; }
.help-steps li b { display: block; color: var(--text); }
.help-test { padding: 10px 0 8px; border-top: 1px solid var(--line); }
.foot-card { width: 100%; padding: 8px 4px 0; color: #cfd4dd; font-size: .95rem; }
.foot-card p { margin: 0; }
.foot-ver { margin-top: 12px !important; font-variant-numeric: tabular-nums; }
.byline { margin-top: 14px !important; display: flex; align-items: center; gap: 12px; }
.mono {
  width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--line); color: var(--text); font-size: .95rem; font-weight: 700; letter-spacing: .02em;
}
.foot-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px; }
.foot-card .foot-links { margin-top: 20px; padding-top: 8px; border-top: 1px solid var(--line); }
.foot-links button { min-height: 44px; padding: 0 2px; color: #b8bfcb; font-size: .9rem; }
.foot-links button:hover, .foot-links button:focus-visible { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.foot-links button[aria-current="page"] { color: var(--text); font-weight: 600; }
.foot-links .sep { color: var(--muted); }

.sheet-backdrop.legal-bd { place-items: start center; }
.legal-sheet { width: min(760px, 100%); padding: 18px 26px 10px; gap: 6px; }
.legal-title { flex: 1; margin: 0; font-size: clamp(1.4rem, 3vw, 1.8rem); letter-spacing: -0.01em; }
.legal-body { color: #cfd4dd; line-height: 1.55; }
.legal-body h3 { margin: 22px 0 6px; color: var(--text); font-size: 1.05rem; }
.legal-body p { margin: 0 0 10px; }
.legal-body a { color: var(--accent); overflow-wrap: anywhere; }
.legal-body details { margin: 4px 0 12px; }
.legal-body summary { cursor: pointer; color: var(--accent); }
.legal-body pre {
  margin: 10px 0 0; padding: 14px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  white-space: pre-wrap; font: .8rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--muted);
}
.legal-body .legal-missing { color: #ffb86b; }
.legal-body .legal-meta { margin-top: 18px; color: var(--muted); font-size: .85rem; }
.legal-sheet .foot-links { padding-top: 6px; border-top: 1px solid var(--line); }

.ov-head { display: flex; align-items: center; gap: 14px; padding: 6px 0 18px; }
.icon-btn {
  width: 52px; height: 52px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line);
}
.icon-btn svg { width: 24px; height: 24px; }
.ov-title { margin: 0; font-size: clamp(2rem, 4vw, 2.8rem); letter-spacing: -0.02em; line-height: 1.1; }
.ov-min { color: var(--accent); }
.ov-meta, .ov-regions, .ov-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.ov-tools { margin-top: 6px; gap: 12px; }
.chip.region { background: transparent; border: 1px solid var(--line); }
.sec { margin: 26px 0 12px; font-size: 1.35rem; letter-spacing: -0.01em; }
.sec span { font-size: .95rem; font-weight: 500; color: var(--muted); margin-left: 8px; }
.list-end { height: 120px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: .9rem; }
.chip.accent { color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.ov-note { color: var(--muted); margin: 10px 0 18px; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.row {
  display: grid; grid-template-columns: 112px 1fr auto auto; gap: 16px; align-items: center;
  padding: 10px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line);
}
.row-num { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; padding-right: 4px; display: flex; align-items: center; gap: 6px; }
.row-num svg { width: 18px; height: 18px; opacity: .7; }
.row { cursor: pointer; transition: background .12s ease, transform .12s ease; }
.row:active { background: var(--surface-2); transform: scale(.99); }
.row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.thumb { width: 112px; aspect-ratio: 3 / 2; border-radius: 10px; overflow: hidden; background: #e9ecef; position: relative; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .ph { position: absolute; inset: 0; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-size: .75rem; text-align: center; padding: 6px; }
.row-name { font-weight: 600; font-size: 1.08rem; }
.row-sub { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

.row-wrap { position: relative; border-radius: 16px; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.row-wrap .row { position: relative; z-index: 1; touch-action: pan-y; }
.row-wrap.swiping, .row-wrap.leaving { overflow: hidden; }
.row-wrap.swiping .row { transition: none; }
.row-wrap.leaving .row { transition: transform .2s ease-in; }
.row-act {
  position: absolute; inset: 0; border-radius: 16px; opacity: 0;
  display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding-right: 28px;
  background: color-mix(in srgb, var(--accent) 22%, var(--surface)); color: var(--accent); font-weight: 700;
  transition: background .12s ease, color .12s ease;
}
.row-act svg { width: 22px; height: 22px; }
.row-wrap.swiping .row-act, .row-wrap.leaving .row-act { opacity: 1; }
.row-act.ready { background: var(--accent); color: #0e1014; }
.grip {
  width: 48px; height: 64px; margin-right: -4px; border-radius: 12px; display: grid; place-items: center;
  color: var(--muted); touch-action: none; cursor: grab;
}
.grip svg { width: 24px; height: 24px; }
.grip:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.row-wrap.lifted { z-index: 5; }
.row-wrap.lifted .row { background: var(--surface-2); box-shadow: 0 14px 34px rgba(0, 0, 0, .5); transform: scale(1.015); }
.row-wrap.lifted .grip { cursor: grabbing; color: var(--accent); }
.row-wrap.shift { transition: transform .18s ease; }
.row-wrap.lifted:not(.shift) { transition: none; }
.row-wrap.fresh .row { animation: fresh 1.4s ease-out; }
@keyframes fresh { from { background: color-mix(in srgb, var(--accent) 32%, var(--surface)); border-color: var(--accent); } }
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 100px); transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 14px; max-width: calc(100% - 32px); padding: 8px 8px 8px 20px;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  animation: fadein .15s ease-out;
}
#app:has(#detail) .toast { bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); }
.toast span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast button { flex: none; min-height: 44px; padding: 0 18px; border-radius: 999px; background: var(--accent); color: #0e1014; font-weight: 700; }

.startbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 16px max(20px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 16px) max(20px, env(safe-area-inset-left, 0px));
  background: linear-gradient(to top, var(--bg) 60%, transparent);
  display: flex; justify-content: center;
}
.big-btn {
  min-width: min(420px, 100%); min-height: 64px; padding: 0 32px; border-radius: 999px;
  background: var(--accent); color: #0e1014; font-size: 1.25rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 35%, transparent);
}
.big-btn svg { width: 26px; height: 26px; }

.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50; overflow-y: auto; overscroll-behavior: contain;
  display: grid; place-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) max(16px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 16px) max(16px, env(safe-area-inset-left, 0px));
  background: rgba(8, 10, 14, .72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: fadein .15s ease-out;
}
@keyframes fadein { from { opacity: 0; } }
.sheet {
  --ph: var(--accent);
  width: min(1240px, 100%); display: grid; gap: 16px; padding: 16px 22px 20px;
  border-radius: 24px; background: var(--bg); border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}
.sheet-backdrop.instant { animation: none; }
.sh-top { display: flex; align-items: center; gap: 14px; }
.sh-top .where { flex: 1; min-width: 0; }
.sh-swap { color: var(--accent); }
.sh-swap:active { background: var(--surface-2); }
.sh-top .where { color: var(--muted); font-variant-numeric: tabular-nums; }
.sh-top .where b { color: var(--text); font-weight: 600; }
.sh-main { display: grid; grid-template-columns: 1.35fr 1fr; gap: 24px; align-items: center; }
.sheet .media { max-height: none; }
.sheet .seg { align-self: flex-start; }
.sh-nav { display: flex; justify-content: center; align-items: center; gap: 24px; }
.sh-nav .ctl { width: 60px; height: 60px; }
.sh-nav .ctl svg { width: 26px; height: 26px; }
.sh-count { min-width: 5ch; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.ctl:disabled { opacity: .3; cursor: default; }

.player {
  height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; gap: 14px;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) max(20px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 14px) max(20px, env(safe-area-inset-left, 0px));
  max-width: 1400px; margin: 0 auto;
}
.player[data-phase="work"] { --ph: var(--accent); }
.player:not([data-phase="work"]) { --ph: var(--calm); }

.pl-top { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; }
.pl-top .where { text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.pl-top .where b { color: var(--text); font-weight: 600; }
.quit { min-height: 48px; padding: 0 18px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.quit.armed { background: #ff3b30; border-color: #ff3b30; color: #fff; }
.progress { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s linear; }

.pl-main { min-height: 0; display: grid; grid-template-columns: 1.35fr 1fr; gap: 24px; align-items: center; }

.media {
  position: relative; width: 100%; aspect-ratio: 3 / 2; max-height: 100%;
  border-radius: var(--radius); overflow: hidden; background: #bab8bb;
  box-shadow: 0 0 0 3px var(--surface-2);
}
.media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.media .f1 { opacity: 0; animation: xfade var(--loop) ease-in-out infinite; }
.player.paused .media img { animation-play-state: paused; }
@keyframes xfade {
  0%, 38% { opacity: 0; }
  50%, 88% { opacity: 1; }
  100% { opacity: 0; }
}
.media .f1.t3 { animation: xfadeA calc(var(--loop) * 2) ease-in-out infinite; }
.media .f2 { opacity: 0; animation: xfadeB calc(var(--loop) * 2) ease-in-out infinite; }
@keyframes xfadeA {
  0%, 19% { opacity: 0; }
  25%, 44% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
@keyframes xfadeB {
  0%, 69% { opacity: 0; }
  75%, 94% { opacity: 1; }
  100% { opacity: 0; }
}
.media .f1.t4 { animation: circleA calc(var(--loop) * 2) ease-in-out infinite; }
.media .f2.t4 { animation: circleB calc(var(--loop) * 2) ease-in-out infinite; }
.media .f3.t4 { opacity: 0; animation: circleC calc(var(--loop) * 2) ease-in-out infinite; }
.media.reverse-cycle .t4 { animation-direction: reverse; }
@keyframes circleA { 0%, 19% { opacity: 0; } 25%, 44% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes circleB { 0%, 44% { opacity: 0; } 50%, 69% { opacity: 1; } 75%, 100% { opacity: 0; } }
@keyframes circleC { 0%, 69% { opacity: 0; } 75%, 94% { opacity: 1; } 100% { opacity: 0; } }
.media .ph {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px;
  background: var(--surface); border: 2px dashed var(--line); border-radius: var(--radius); color: var(--muted);
}
.media .ph strong { display: block; color: var(--text); font-size: 1.3rem; margin-bottom: 6px; }
.media .ph code { font-size: .85rem; color: var(--muted); }
.equip-tag {
  position: absolute; left: 14px; top: 14px; padding: 8px 16px; border-radius: 999px;
  background: var(--accent); color: #0e1014; font-weight: 700; font-size: 1.05rem; box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
}
.pause-veil {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(14, 16, 20, .55); color: #fff; font-size: 1.6rem; font-weight: 700; letter-spacing: .02em;
}

.info { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.phase { color: var(--ph); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; font-size: .95rem; }
.ex-name { margin: 0; font-size: clamp(1.8rem, 3.4vw, 2.9rem); line-height: 1.08; letter-spacing: -0.02em; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { padding: 6px 14px; border-radius: 999px; font-weight: 600; background: color-mix(in srgb, var(--ph) 18%, transparent); color: var(--ph); }
.badge.neutral { background: var(--surface-2); color: var(--muted); }
.badge.equip { background: var(--accent); color: #0e1014; }
.muscles { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 1rem; line-height: 1.35; }
.mz { display: block; padding-left: 20px; position: relative; }
.mz i { position: absolute; left: 0; top: .32em; width: 12px; height: 12px; border-radius: 50%; }
.mz b { color: var(--text); font-weight: 600; }
.mz.r i { background: #ff2a2a; box-shadow: 0 0 8px rgba(255, 42, 42, .7); }
.mz.b i { background: #2e7bff; box-shadow: 0 0 8px rgba(46, 123, 255, .7); }
.mz.g i { background: #3deb5c; box-shadow: 0 0 8px rgba(61, 235, 92, .7); }
.phase.flash { color: #ffd166; animation: flash .5s ease-in-out 3; }
@keyframes flash { 50% { opacity: .25; } }
.next-equip { margin-left: 6px; padding: 2px 10px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent); font-size: .9rem; }

.timer-row { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; }
.tr-text { display: grid; gap: 14px; }
.ring { position: relative; width: clamp(150px, 19vw, 240px); aspect-ratio: 1; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring .track { stroke: var(--surface-2); }
.ring .bar { stroke: var(--ph); stroke-linecap: round; transition: stroke-dashoffset .12s linear; }
.ring .count {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: clamp(3.4rem, 7.5vw, 5.6rem); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; line-height: 1;
}
.ring .count small { font-size: 1rem; font-weight: 600; letter-spacing: 0; color: var(--muted); margin-top: 6px; }
.ring .count small:empty { display: none; }
.cues { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; color: #d6dbe4; }
.cues li { position: relative; padding-left: 22px; }
.cues li::before { content: ""; position: absolute; left: 4px; top: .62em; width: 7px; height: 7px; border-radius: 50%; background: var(--ph); }
.next { color: var(--muted); }
.next b { color: var(--text); font-weight: 600; }

.controls { display: flex; justify-content: center; align-items: center; gap: 28px; }
.ctl { width: 68px; height: 68px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); }
.ctl svg { width: 28px; height: 28px; }
.ctl.main { width: 92px; height: 92px; background: var(--ph); color: #0e1014; border: 0; }
.ctl.main svg { width: 38px; height: 38px; }

@media (orientation: landscape) and (min-width: 761px) {
  .player { height: auto; min-height: 100dvh; }
  .pl-main { grid-template-columns: 1.15fr 1fr; }
  .info { gap: 12px; }
  .ex-name { font-size: clamp(1.6rem, 2.8vw, 2.5rem); }
  .timer-row { flex-direction: row; align-items: center; gap: 22px; }
  .ring { width: clamp(130px, min(16vw, 26dvh), 210px); }
  .ring .count { font-size: clamp(2.6rem, min(5.8vw, 9.5dvh), 4.8rem); }
  .ctl.main { width: 84px; height: 84px; }
}

@media (orientation: portrait), (max-width: 760px) {
  .pl-main { grid-template-columns: 1fr; align-content: start; gap: 18px; }
  .sh-main { grid-template-columns: 1fr; gap: 18px; }
  .timer-row { flex-direction: row; align-items: center; gap: 28px; }
  .ring { width: clamp(130px, 30vw, 220px); }
}

.done { display: grid; place-items: center; text-align: center; min-height: 100dvh; }
.done-mark { width: 120px; height: 120px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent); }
.done-mark svg { width: 60px; height: 60px; }
.done h1 { margin: 0 0 8px; font-size: clamp(2.4rem, 5vw, 3.4rem); }
.done p { color: var(--muted); margin: 0 0 28px; font-size: 1.15rem; }

@media (max-width: 560px) {
  .row { grid-template-columns: 84px 1fr auto; gap: 12px; }
  .grip { width: 40px; margin-right: -6px; }
  .thumb { width: 84px; }
  .row-num { display: none; }
  .controls { gap: 18px; }
  .sh-swap span { display: none; }
  .sh-swap { padding: 10px 14px; }
  .player .muscles { display: none; }
}

@media (orientation: portrait) and (max-width: 560px) {
  .player { height: auto; min-height: 100dvh; grid-template-rows: auto auto auto; gap: 12px;
    padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .pl-top { gap: 10px; }
  .pl-top .quit { min-height: 40px; padding: 0 14px; }
  .pl-top .icon-btn { width: 44px; height: 44px; }
  .pl-top .where { font-size: .95rem; }
  .pl-main { gap: 14px; }
  .media { width: 100%; max-height: none; }
  .info { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 16px; row-gap: 6px; align-items: center;
    grid-template-areas: "ring phase" "ring name" "ring badges" "cues cues" "next next"; }
  .timer-row, .tr-text { display: contents; }
  .ring { grid-area: ring; width: 118px; }
  .ring .count { font-size: 2.9rem; }
  .ring .count small { font-size: .8rem; margin-top: 2px; }
  .phase { grid-area: phase; align-self: end; }
  .ex-name { grid-area: name; font-size: 1.5rem; }
  .badges { grid-area: badges; align-self: start; }
  .badge { padding: 4px 11px; font-size: .9rem; }
  .cues { grid-area: cues; margin-top: 8px; }
  .next { grid-area: next; }
  .controls { gap: 18px; padding-top: 4px; }
  .ctl { width: 52px; height: 52px; }
  .ctl.main { width: 64px; height: 64px; }
  .ctl svg { width: 22px; height: 22px; }
  .ctl.main svg { width: 28px; height: 28px; }
  .pause-veil { font-size: 1.25rem; padding: 0 16px; text-align: center; }
}

@media (orientation: landscape) and (max-height: 500px) {
  .player { --bildh: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 84px);
    height: auto; min-height: 100dvh; grid-template-rows: auto auto auto; gap: 8px;
    padding-top: calc(env(safe-area-inset-top, 0px) + 8px); padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); }
  .pl-top { gap: 6px 12px; position: sticky; top: 0; z-index: 5; background: var(--bg);
    margin-top: calc(-8px - env(safe-area-inset-top, 0px)); padding: calc(env(safe-area-inset-top, 0px) + 8px) 0 6px; }
  .pl-top .quit { min-height: 34px; padding: 0 14px; font-size: .9rem; }
  .pl-top .icon-btn { width: 36px; height: 36px; }
  .pl-top .icon-btn svg { width: 20px; height: 20px; }
  .pl-top .where { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pl-main { --ringw: min(104px, 30dvh); grid-template-columns: minmax(0, 1fr) var(--ringw) 22%; align-content: start; align-items: center; gap: 6px 14px;
    grid-template-rows: 1fr auto auto auto auto 1fr auto auto;
    grid-template-areas: "media . ." "media phase phase" "media name name" "media badges badges" "media ring next" "media . ."
      "cues cues cues" "mus mus mus"; }
  .info, .timer-row, .tr-text { display: contents; }
  .media { grid-area: media; width: auto; height: var(--bildh); max-width: 100%; max-height: none; justify-self: center; margin-right: 4px; }
  .phase { grid-area: phase; font-size: .8rem; }
  .ex-name { grid-area: name; font-size: 1.3rem; }
  .badges { grid-area: badges; }
  .badge { padding: 3px 10px; font-size: .85rem; }
  .ring { grid-area: ring; width: var(--ringw); }
  .phase, .ex-name, .badges, .next { min-width: 0; overflow-wrap: anywhere; }
  .ring .count { font-size: 2.6rem; }
  .ring .count small { font-size: .75rem; margin-top: 2px; }
  .next { grid-area: next; font-size: .85rem; line-height: 1.3; }
  .cues { grid-area: cues; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
  .player .muscles { grid-area: mus; margin-top: 6px; }
  .controls { padding: 10px 0 4px; gap: 22px; }
  .ctl { width: 52px; height: 52px; }
  .ctl.main { width: 64px; height: 64px; }
  .ctl svg { width: 22px; height: 22px; }
  .ctl.main svg { width: 28px; height: 28px; }
  .pause-veil { font-size: 1.2rem; padding: 0 16px; text-align: center; }
}
@media (orientation: landscape) and (max-height: 360px) {
  .ex-name { font-size: 1.12rem; }
  .badge { padding: 2px 8px; font-size: .78rem; }
  .pl-main { --ringw: min(92px, 28dvh); }
  .ring .count { font-size: 2.2rem; }
}

.sheet .info { display: flex; flex-direction: column; align-items: stretch; min-width: 0; }
.sheet .info > * { grid-area: auto; min-width: 0; }
.sheet .ex-name { overflow-wrap: anywhere; }
.sheet .media { grid-area: auto; height: auto; width: 100%; margin-right: 0; }
.sheet #dCoord { align-self: flex-start; max-width: 100%; white-space: normal; text-align: left; }

@media (orientation: portrait) and (max-width: 560px), (orientation: landscape) and (max-height: 500px) {
  .equip-tag { display: none; }
}

.boot { display: grid; place-items: center; }
.boot-wrap { width: min(560px, 100%); display: grid; justify-items: center; gap: 12px; text-align: center; padding: 8px 0; }
.boot-brand { display: flex; align-items: flex-end; gap: .28em; font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.boot-brand .logo { width: .9em; height: .9em; flex: none; margin-bottom: .08em; }
.boot-ring { position: relative; width: clamp(150px, 44vw, 220px); aspect-ratio: 1; margin: 14px 0 6px; }
.boot-ring svg { width: 100%; height: 100%; display: block; }
.boot-ring circle { fill: none; stroke-width: 9; stroke-linecap: round; }
.boot-ring .qt { opacity: .16; }
.boot-ring .q { transition: stroke-dasharray .3s linear, opacity .2s; }
.boot-pct, .boot-check { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.boot-pct { font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; line-height: 1; }
.boot-pct b { font-size: clamp(3rem, 13vw, 4.6rem); }
.boot-pct span { font-size: clamp(1.1rem, 4vw, 1.5rem); color: var(--muted); align-self: center; margin: .9em 0 0 3px; }
.boot-check { color: #4cd964; animation: bootpop .45s cubic-bezier(.2, 1.4, .4, 1); }
.boot-check svg { width: 42%; height: 42%; }
@keyframes bootpop { from { transform: scale(.4); opacity: 0; } }
.boot-title { margin: 0; font-size: clamp(1.45rem, 4.6vw, 2rem); letter-spacing: -0.02em; line-height: 1.15; }
.boot-sub { margin: 0; color: var(--muted); max-width: 32em; }
.boot-count { margin: 2px 0 0; color: var(--text); font-size: .95rem; font-variant-numeric: tabular-nums; }
.boot-msg { margin: 0; color: var(--muted); font-size: .92rem; min-height: 1.4em; white-space: pre-line; }
.boot.ready { cursor: pointer; }
.boot-msg.warn { color: #ffb86b; }
.boot.ready .boot-msg { color: #4cd964; font-weight: 600; }
.boot-act { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px; }
.boot-skip { min-height: 44px; padding: 0 6px; color: #b8bfcb; font-size: .92rem; text-decoration: underline; text-underline-offset: 3px; }
.boot-prev { width: 100%; margin: 10px 0 0; display: grid; gap: 10px; transition: opacity .3s ease; }
.boot-prev.swap { opacity: 0; }
.boot-media { max-height: none; }
.boot-cap { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 10px; }
.boot-cap small { width: 100%; color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.boot-cap b { font-size: 1.08rem; font-weight: 600; }
.boot-cat { padding: 2px 10px; border-radius: 999px; font-size: .85rem; font-weight: 600; color: var(--c); background: color-mix(in srgb, var(--c) 18%, transparent); }
.boot .media.boot-media { grid-area: auto; width: 100%; height: auto; max-width: 100%; max-height: none; margin: 0; justify-self: stretch; }
@media (orientation: landscape) and (min-width: 600px) {
  .boot-wrap { width: min(1040px, 100%); grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); column-gap: clamp(28px, 5vw, 64px); align-items: center; }
  .boot-wrap > * { grid-column: 1; }
  .boot-prev { grid-column: 2; grid-row: 1 / span 8; margin: 0; }
  .boot-ring { width: clamp(130px, min(22vw, 30dvh), 220px); margin: 6px 0 2px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .boot-wrap { gap: 6px; }
  .boot-brand { font-size: 1.3rem; }
  .boot-ring { width: clamp(96px, 30dvh, 150px); margin: 4px 0 0; }
  .boot-pct b { font-size: clamp(2rem, 9dvh, 3rem); }
  .boot-title { font-size: 1.25rem; }
  .boot-sub { font-size: .88rem; line-height: 1.35; }
  .boot-count, .boot-msg { font-size: .85rem; }
  .boot .media.boot-media { width: min(100%, calc((100dvh - 110px) * 1.5)); justify-self: center; }
}
@media (min-width: 760px) and (min-height: 700px) {
  .boot-brand { font-size: 2.1rem; }
  .boot-ring { width: clamp(200px, 32vmin, 300px); }
  .boot-pct b { font-size: clamp(4rem, 9.5vmin, 6rem); }
  .boot-title { font-size: 2.3rem; }
  .boot-sub { font-size: 1.12rem; }
  .boot-count, .boot-msg { font-size: 1.02rem; }
  .boot-cap b { font-size: 1.25rem; }
}
@media (orientation: portrait) and (min-width: 760px) and (min-height: 700px) { .boot-wrap { width: min(680px, 100%); gap: 16px; } }
@media (orientation: landscape) and (min-width: 1000px) and (min-height: 700px) { .boot-wrap { width: min(1120px, 100%); } }

.boot-credit { margin: 14px 0 0; font-size: 12px; line-height: 1.4; opacity: .45; text-align: center; }
