:root {
  --bg: #0e0c09;
  --bg-soft: #17130e;
  --panel: rgba(30, 25, 18, 0.9);
  --panel-light: rgba(42, 35, 25, 0.78);
  --line: rgba(206, 166, 98, 0.19);
  --line-bright: rgba(218, 178, 105, 0.46);
  --gold: #cda35b;
  --gold-light: #ead39b;
  --purple: #985f52;
  --jade: #668f78;
  --text: #eee5d1;
  --muted: #a39a89;
  --danger: #b66252;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  --serif: "STKaiti", "KaiTi", "FangSong", serif;
  --sans: "Microsoft YaHei", "PingFang SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--text);
  font-family: var(--sans);
  background:
    radial-gradient(circle at 18% 0%, rgba(114, 62, 48, 0.18), transparent 35%),
    radial-gradient(circle at 82% 30%, rgba(54, 92, 72, 0.13), transparent 32%),
    linear-gradient(145deg, #0d0b08 0%, #17130e 48%, #0d0b08 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.34;
  background-image:
    repeating-linear-gradient(7deg, rgba(235, 210, 155, 0.018) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(93deg, rgba(235, 210, 155, 0.012) 0 1px, transparent 1px 7px);
  background-size: auto;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
}

.ambient-one {
  width: 320px;
  height: 320px;
  top: 18%;
  left: -160px;
  background: rgba(101, 75, 156, 0.16);
}

.ambient-two {
  width: 420px;
  height: 420px;
  right: -200px;
  bottom: -80px;
  background: rgba(68, 119, 109, 0.12);
}

.stars {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 12% 18%, rgba(255, 235, 189, 0.62) 0 1px, transparent 1.5px),
    radial-gradient(circle at 84% 16%, rgba(255, 255, 255, 0.42) 0 1px, transparent 1.5px),
    radial-gradient(circle at 72% 70%, rgba(255, 235, 189, 0.36) 0 1px, transparent 1.5px),
    radial-gradient(circle at 31% 82%, rgba(255, 255, 255, 0.32) 0 1px, transparent 1.5px);
  background-size: 310px 280px, 390px 340px, 450px 390px, 520px 440px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(28px, calc((100vw - 1420px) / 2));
  border-bottom: 1px solid var(--line-bright);
  box-shadow: 0 3px 0 rgba(205, 163, 91, 0.04), 0 12px 30px rgba(0, 0, 0, 0.18);
  background:
    linear-gradient(90deg, transparent, rgba(205, 163, 91, 0.025), transparent),
    rgba(14, 12, 9, 0.88);
  backdrop-filter: blur(20px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-bright);
  color: var(--gold-light);
  font-family: var(--serif);
  font-size: 22px;
  background: linear-gradient(145deg, rgba(215, 174, 98, 0.1), rgba(134, 61, 49, 0.1));
  transform: rotate(45deg);
}

.brand-mark::first-letter {
  transform: rotate(-45deg);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  letter-spacing: 0.14em;
  font-family: var(--serif);
  font-size: 19px;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.28em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.main-nav {
  display: flex;
  align-self: stretch;
  gap: 4px;
}

.main-nav button {
  position: relative;
  padding: 0 19px;
  border: 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 13px;
  background: transparent;
  cursor: pointer;
}

.main-nav button::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: 0;
  left: 18px;
  height: 2px;
  background: var(--gold);
  transform: scaleX(0);
  transition: transform 0.25s ease;
}

.main-nav button:hover,
.main-nav button.active {
  color: var(--gold-light);
}

.main-nav button.active::after {
  transform: scaleX(1);
}

.today {
  padding-right: 12px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.icon-button,
.close-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--gold-light);
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  transition: 0.25s ease;
}

.icon-button:hover,
.close-button:hover {
  border-color: var(--line-bright);
  background: rgba(215, 174, 98, 0.09);
  transform: translateY(-1px);
}

.page {
  width: min(1420px, calc(100% - 56px));
  margin: 0 auto;
  padding: 38px 0 60px;
}

.app-view[hidden] {
  display: none !important;
}

.app-view {
  animation: view-in 0.35s ease;
}

.compact-hero {
  min-height: 125px;
}

.hero {
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 28px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(34px, 4vw, 56px);
  font-weight: 500;
  letter-spacing: 0.08em;
}

.hero h1 span {
  position: relative;
  margin-left: 8px;
  color: var(--gold-light);
}

.hero h1 span::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -4px;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.hero-copy {
  margin: 12px 0 0;
  color: var(--muted);
  font-family: var(--serif);
  letter-spacing: 0.12em;
}

.hero-seal {
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;
  margin-right: 18px;
  border: 1px solid rgba(177, 81, 69, 0.56);
  color: #c8796d;
  font-family: var(--serif);
  font-size: 42px;
  background: rgba(125, 47, 42, 0.08);
  box-shadow: inset 0 0 0 5px var(--bg), inset 0 0 0 6px rgba(177, 81, 69, 0.28);
  transform: rotate(5deg);
  opacity: 0.72;
}

.practice-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
  margin-bottom: 18px;
}

.practice-nav button {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  color: var(--muted);
  text-align: left;
  background: rgba(20, 25, 34, 0.66);
  cursor: pointer;
  transition: 0.25s ease;
}

.practice-nav button:hover,
.practice-nav button.active {
  border-color: var(--line-bright);
  color: var(--text);
  background: linear-gradient(145deg, rgba(215, 174, 98, 0.075), rgba(141, 115, 211, 0.035));
  transform: translateY(-1px);
}

.practice-nav button > span {
  width: 34px;
  height: 34px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line-bright);
  color: var(--gold);
  font-family: var(--serif);
  transform: rotate(45deg);
}

.practice-nav strong,
.practice-nav small {
  display: block;
}

.practice-nav strong {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 400;
}

.practice-nav small {
  margin-top: 4px;
  color: #707578;
  font-size: 9px;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(250px, 0.82fr) minmax(410px, 1.38fr) minmax(270px, 0.9fr);
  gap: 18px;
  align-items: stretch;
}

.focus-workspace {
  min-height: 690px;
}

.focus-workspace > .timer-panel,
.focus-workspace > .treasure-panel {
  width: min(760px, 100%);
  min-height: 690px;
  margin: 0 auto;
}

.focus-workspace > .treasure-panel {
  display: none;
}

.focus-workspace.show-treasure > .timer-panel {
  display: none;
}

.focus-workspace.show-treasure > .treasure-panel {
  display: grid;
  grid-template-rows: auto auto minmax(160px, 1fr) auto minmax(0, auto) auto auto;
}

.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 4px;
  background:
    repeating-linear-gradient(3deg, rgba(236, 213, 167, 0.01) 0 1px, transparent 1px 6px),
    linear-gradient(145deg, rgba(234, 207, 147, 0.035), transparent 50%),
    var(--panel);
  box-shadow: var(--shadow), inset 0 0 45px rgba(0, 0, 0, 0.14);
  backdrop-filter: blur(16px);
  overflow: hidden;
}

.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.panel::before {
  top: 8px;
  left: 8px;
  border-top: 2px solid var(--line-bright);
  border-left: 2px solid var(--line-bright);
}

.panel::after {
  right: 8px;
  bottom: 8px;
  border-right: 2px solid var(--line-bright);
  border-bottom: 2px solid var(--line-bright);
}

.cultivation-panel,
.records-panel {
  min-height: 590px;
  padding: 28px 25px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.panel-heading.compact h2 {
  font-size: 21px;
}

.realm-badge {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-bright);
  border-radius: 50%;
  color: var(--gold-light);
  font-family: var(--serif);
  background: rgba(215, 174, 98, 0.07);
}

.cultivator {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 26px 0 24px;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.018);
}

.avatar-ring {
  padding: 3px;
  border: 1px solid var(--line-bright);
  border-radius: 50%;
}

.avatar {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--gold-light);
  font-family: var(--serif);
  font-size: 20px;
  background: linear-gradient(145deg, #292334, #15201f);
}

.cultivator strong,
.cultivator span {
  display: block;
}

.cultivator strong {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
}

.cultivator span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.progress-block {
  padding-bottom: 23px;
  border-bottom: 1px solid var(--line);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
}

.progress-meta strong {
  color: var(--gold-light);
  font-weight: 500;
}

.progress-track {
  height: 5px;
  margin: 12px 0 10px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--gold));
  box-shadow: 0 0 12px rgba(215, 174, 98, 0.38);
  transition: width 0.7s ease;
}

.progress-block p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.realm-path-wrap {
  margin-top: 20px;
}

.path-title {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-family: var(--serif);
  font-size: 14px;
}

.path-title small {
  color: var(--muted);
  font-family: var(--sans);
}

.realm-path {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.realm-path li {
  position: relative;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 8px 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  color: #73787b;
  background: rgba(255, 255, 255, 0.012);
  transition: 0.25s ease;
}

.realm-path li span {
  font-family: var(--serif);
  font-size: 13px;
}

.realm-path li small {
  margin-top: 3px;
  font-size: 9px;
}

.realm-path li.done {
  border-color: rgba(108, 166, 155, 0.21);
  color: var(--jade);
}

.realm-path li.current {
  border-color: var(--line-bright);
  color: var(--gold-light);
  background: linear-gradient(145deg, rgba(215, 174, 98, 0.1), rgba(141, 115, 211, 0.06));
  box-shadow: inset 2px 0 0 var(--gold);
}

.timer-panel {
  min-height: 590px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 28px 36px 30px;
  background:
    radial-gradient(circle at 50% 43%, rgba(147, 88, 67, 0.11), transparent 38%),
    repeating-linear-gradient(4deg, rgba(232, 207, 156, 0.012) 0 1px, transparent 1px 7px),
    linear-gradient(145deg, rgba(255, 241, 205, 0.026), transparent 55%),
    rgba(25, 21, 16, 0.94);
}

.focus-realm-strip {
  width: min(100%, 520px);
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(150px, 1.2fr);
  align-items: end;
  gap: 8px 22px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  background: linear-gradient(100deg, rgba(215, 174, 98, 0.055), rgba(141, 115, 211, 0.025));
}

.focus-realm-strip > div:first-child span,
.focus-realm-strip > div:first-child strong {
  display: block;
}

.focus-realm-strip > div:first-child span {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.focus-realm-strip > div:first-child strong {
  margin-top: 4px;
  color: var(--gold-light);
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 400;
}

.focus-realm-progress > span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  text-align: right;
}

.focus-realm-progress .progress-track {
  margin: 7px 0 0;
}

.focus-realm-strip > p {
  grid-column: 1 / -1;
  margin: 0;
  color: #73787b;
  font-size: 9px;
}

.timing-method {
  width: min(100%, 470px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
}

.timing-method > span {
  color: var(--muted);
  font-family: var(--serif);
  font-size: 12px;
}

.timing-method > div {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.12);
}

.timing-method button {
  min-width: 82px;
  padding: 7px 13px;
  border: 0;
  color: var(--muted);
  font-family: var(--serif);
  background: transparent;
  cursor: pointer;
}

.timing-method button.active {
  color: #1d160c;
  background: linear-gradient(135deg, var(--gold-light), #b98942);
}

.timer-panel.count-up .duration-selector,
.timer-panel.count-up .cycle-strip {
  display: none;
}

.timer-panel.count-up .timing-method {
  margin-bottom: 12px;
}

.duration-selector {
  width: min(100%, 470px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.duration-selector > span {
  color: var(--muted);
  font-family: var(--serif);
  font-size: 12px;
  white-space: nowrap;
}

.duration-presets {
  display: flex;
  gap: 5px;
}

.duration-presets button {
  width: 42px;
  height: 32px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: Georgia, serif;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.018);
  cursor: pointer;
  transition: 0.25s ease;
}

.duration-presets button:hover {
  border-color: var(--line-bright);
  color: var(--gold-light);
}

.duration-presets button.active {
  border-color: rgba(215, 174, 98, 0.55);
  color: #17130c;
  background: linear-gradient(135deg, var(--gold-light), #b98d48);
}

.cycle-strip {
  width: min(100%, 470px);
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding: 10px 13px;
  border: 1px solid rgba(141, 115, 211, 0.18);
  background: rgba(141, 115, 211, 0.035);
}

.cycle-strip strong,
.cycle-strip span {
  display: block;
}

.cycle-strip strong {
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 400;
}

.cycle-strip span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.timer-orbit {
  position: relative;
  width: min(320px, 70vw);
  height: min(320px, 70vw);
  display: grid;
  place-items: center;
  margin: 8px 0;
}

.timer-orbit::before,
.timer-orbit::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(215, 174, 98, 0.09);
  border-radius: 50%;
  pointer-events: none;
}

.timer-orbit::before {
  inset: 23px;
  border-style: dashed;
  animation: slow-spin 80s linear infinite;
}

.timer-orbit::after {
  inset: 38px;
  border-color: rgba(141, 115, 211, 0.1);
}

.timer-orbit.running::before {
  border-color: rgba(215, 174, 98, 0.22);
  animation-duration: 18s;
}

.timer-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  filter: drop-shadow(0 0 8px rgba(141, 115, 211, 0.1));
}

.timer-track,
.timer-progress {
  fill: none;
  stroke-width: 3;
}

.timer-track {
  stroke: rgba(255, 255, 255, 0.065);
}

.timer-progress {
  stroke: url(#timerGradient);
  stroke-linecap: round;
  stroke-dasharray: 898.5;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.35s linear;
}

.timer-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timer-label {
  color: var(--gold);
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.28em;
}

.timer-value {
  margin: 12px 0 9px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(56px, 6vw, 76px);
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 1;
  text-shadow: 0 0 28px rgba(215, 174, 98, 0.1);
}

.timer-status {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.round-label {
  margin-top: 10px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  color: #777c7f;
  font-size: 9px;
  letter-spacing: 0.08em;
}

.orbit-rune {
  position: absolute;
  z-index: 3;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--gold);
  font-family: var(--serif);
  font-size: 11px;
  background: var(--bg-soft);
}

.rune-one {
  top: 25px;
  right: 38px;
}

.rune-two {
  bottom: 30px;
  left: 32px;
}

.timer-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.control {
  border: 1px solid var(--line);
  cursor: pointer;
  transition: 0.25s ease;
}

.control.secondary {
  width: 58px;
  height: 42px;
  border-radius: 2px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.control.secondary:hover {
  color: var(--gold-light);
  border-color: var(--line-bright);
}

.control.primary {
  min-width: 168px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-color: rgba(215, 174, 98, 0.5);
  border-radius: 2px;
  color: #1a150d;
  font-family: var(--serif);
  font-size: 16px;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, #f0d79e, #c3964d);
  box-shadow: 0 8px 26px rgba(190, 144, 69, 0.16);
}

.control.primary:hover {
  filter: brightness(1.07);
  transform: translateY(-2px);
}

.control.primary.paused {
  color: var(--gold-light);
  background: rgba(215, 174, 98, 0.08);
}

.current-intent {
  width: min(100%, 440px);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding: 12px 15px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.intent-mark {
  width: 30px;
  height: 30px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line-bright);
  color: var(--gold);
  font-family: var(--serif);
  font-size: 13px;
  transform: rotate(45deg);
}

.current-intent > div {
  min-width: 0;
  flex: 1;
}

.current-intent label {
  display: block;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.current-intent input {
  width: 100%;
  margin-top: 4px;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  font-family: var(--serif);
  background: transparent;
}

.current-intent input::placeholder {
  color: #62676b;
}

.current-intent input.input-attention {
  color: var(--gold-light);
  text-shadow: 0 0 10px rgba(215, 174, 98, 0.35);
}

.current-intent input:disabled {
  color: var(--gold-light);
  opacity: 0.8;
}

.noise-control {
  width: min(100%, 520px);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin-top: 15px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.noise-control > span {
  color: var(--muted);
  font-family: var(--serif);
  font-size: 11px;
}

.noise-options {
  display: flex;
  gap: 4px;
}

.noise-options button {
  padding: 5px 9px;
  border: 1px solid var(--line);
  color: #73787b;
  font-size: 9px;
  background: rgba(255, 255, 255, 0.015);
  cursor: pointer;
}

.noise-options button.active {
  border-color: var(--line-bright);
  color: var(--gold-light);
  background: rgba(215, 174, 98, 0.07);
}

.noise-volume {
  display: flex;
  align-items: center;
  gap: 6px;
}

.noise-volume span {
  color: #6d7275;
  font-size: 8px;
}

.noise-volume input {
  width: 72px;
  accent-color: var(--gold);
}

.immersive-exit {
  display: none;
}

.timer-panel.immersive {
  position: fixed;
  inset: 0;
  z-index: 200;
  width: 100vw !important;
  height: 100dvh;
  min-height: 100dvh !important;
  padding:
    max(28px, env(safe-area-inset-top))
    max(24px, 7vw, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(24px, 7vw, env(safe-area-inset-left));
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 50% 45%, rgba(100, 72, 153, 0.19), transparent 32%),
    radial-gradient(circle at 20% 20%, rgba(58, 112, 101, 0.08), transparent 30%),
    #090c11;
}

.timer-panel.immersive::before,
.timer-panel.immersive::after,
.timer-panel.immersive .timing-method,
.timer-panel.immersive .duration-selector,
.timer-panel.immersive .cycle-strip {
  display: none;
}

.timer-panel.immersive .focus-realm-strip {
  position: absolute;
  top: 25px;
  left: 50%;
  width: min(520px, calc(100% - 160px));
  transform: translateX(-50%);
}

.timer-panel.immersive .timer-orbit {
  width: min(52vh, 430px);
  height: min(52vh, 430px);
  margin-top: 62px;
}

.timer-panel.immersive .timer-value {
  font-size: clamp(76px, 11vh, 118px);
}

.timer-panel.immersive .current-intent {
  max-width: 520px;
  margin-top: 8px;
}

.timer-panel.immersive .noise-control {
  max-width: 580px;
}

.timer-panel.immersive .immersive-exit {
  position: absolute;
  top: 24px;
  right: 28px;
  display: block;
  padding: 8px 13px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--serif);
  font-size: 11px;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
}

body.immersive-mode {
  overflow: hidden;
}

.date-chip {
  padding: 6px 9px;
  border: 1px solid var(--line);
  color: var(--gold);
  font-size: 10px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
  margin: 25px 0;
}

.stat-card {
  min-height: 76px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  background: rgba(255, 255, 255, 0.018);
}

.stat-card span,
.stat-card strong {
  display: block;
}

.stat-card span {
  color: var(--muted);
  font-size: 10px;
}

.stat-card strong {
  margin-top: 8px;
  color: var(--gold-light);
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 400;
}

.stat-card b {
  margin-right: 3px;
  font-family: Georgia, serif;
  font-size: 24px;
  font-weight: 400;
}

.session-section {
  min-height: 212px;
}

.session-title {
  display: flex;
  justify-content: space-between;
  margin-bottom: 11px;
  color: var(--text);
  font-family: var(--serif);
  font-size: 13px;
}

.session-title button {
  padding: 0;
  border: 0;
  color: #6f7375;
  font-size: 10px;
  background: none;
  cursor: pointer;
}

.session-title button:hover {
  color: var(--danger);
}

.session-list {
  max-height: 185px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-bright) transparent;
}

.session-item {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 1px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
}

.session-item i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--jade);
  box-shadow: 0 0 8px rgba(108, 166, 155, 0.45);
}

.session-item strong,
.session-item small {
  display: block;
}

.session-item strong {
  overflow: hidden;
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-item small {
  margin-top: 3px;
  color: #707578;
  font-size: 9px;
}

.session-item > span {
  color: var(--gold);
  font-size: 10px;
}

.empty-sessions {
  min-height: 150px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(255, 255, 255, 0.06);
  color: #62676b;
  font-family: var(--serif);
  font-size: 12px;
}

blockquote {
  position: relative;
  margin: 20px 0 0;
  padding: 16px 14px;
  border-left: 1px solid var(--line-bright);
  color: #aaa69c;
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.7;
  background: linear-gradient(90deg, rgba(215, 174, 98, 0.045), transparent);
}

blockquote small {
  display: block;
  margin-top: 4px;
  color: #65696b;
  font-family: var(--sans);
  font-size: 9px;
}

.journey-panel {
  min-height: 125px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  margin-top: 18px;
  padding: 24px 34px;
}

.journey-copy h2 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 500;
}

.journey-copy > p:last-child {
  max-width: 650px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.journey-stats {
  display: flex;
  align-items: center;
  gap: 26px;
}

.journey-stats div {
  min-width: 88px;
  text-align: center;
}

.journey-stats span,
.journey-stats small {
  display: block;
}

.journey-stats span {
  color: var(--gold-light);
  font-family: Georgia, serif;
  font-size: 27px;
}

.journey-stats small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.journey-stats i {
  width: 1px;
  height: 38px;
  background: var(--line);
}

.special-practices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.records-page {
  width: min(900px, 100%);
  min-height: 560px;
  margin: 0 auto;
}

.records-page .stat-grid {
  grid-template-columns: repeat(4, 1fr);
}

.records-page .session-list {
  max-height: 270px;
}

.overview-grid-single {
  display: block;
}

.overview-grid-single > div {
  display: grid;
  gap: 18px;
}

.overview-grid-single .journey-panel,
.overview-grid-single .summary-panel {
  margin-top: 0;
}

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(560px, 1.35fr) minmax(330px, 0.65fr);
  gap: 18px;
  align-items: stretch;
}

.calendar-panel,
.daily-todo-panel {
  min-height: 690px;
  padding: 28px 30px;
}

.calendar-toolbar {
  display: grid;
  grid-template-columns: 86px 1fr 86px;
  align-items: center;
  gap: 18px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.calendar-toolbar h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 400;
  letter-spacing: 0.08em;
}

.calendar-toolbar button {
  min-height: 36px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--serif);
  background: rgba(255, 255, 255, 0.018);
  cursor: pointer;
}

.calendar-toolbar button:hover {
  border-color: var(--line-bright);
  color: var(--gold-light);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-top: 14px;
  color: var(--gold);
  font-family: var(--serif);
  font-size: 12px;
  text-align: center;
}

.calendar-weekdays span {
  padding: 7px 0;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: minmax(90px, 1fr);
  gap: 6px;
}

.calendar-day {
  position: relative;
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(205, 163, 91, 0.1);
  color: var(--text);
  text-align: left;
  background: rgba(255, 248, 226, 0.012);
  cursor: pointer;
  overflow: hidden;
  transition: 0.2s ease;
}

.calendar-day:hover {
  border-color: var(--line-bright);
  background: rgba(205, 163, 91, 0.045);
}

.calendar-day.outside {
  color: #5e584d;
  background: rgba(0, 0, 0, 0.07);
}

.calendar-day.today::after {
  content: "今";
  position: absolute;
  top: 7px;
  right: 7px;
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(176, 75, 58, 0.65);
  color: #cf7b68;
  font-family: var(--serif);
  font-size: 9px;
  transform: rotate(5deg);
}

.calendar-day.selected {
  border-color: var(--gold);
  background: linear-gradient(145deg, rgba(205, 163, 91, 0.095), rgba(140, 75, 57, 0.035));
  box-shadow: inset 0 0 0 1px rgba(205, 163, 91, 0.09);
}

.calendar-date-number {
  display: block;
  margin-bottom: 7px;
  color: inherit;
  font-family: Georgia, serif;
  font-size: 15px;
}

.calendar-task-preview {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  padding-left: 8px;
  color: #9c9484;
  font-size: 9px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-task-preview::before {
  content: "";
  position: absolute;
  width: 3px;
  height: 3px;
  margin-top: 5px;
  margin-left: -8px;
  border-radius: 50%;
  background: #a95647;
}

.calendar-task-preview.done {
  color: #676c61;
  text-decoration: line-through;
}

.calendar-task-preview.done::before {
  background: var(--jade);
}

.calendar-more {
  display: block;
  margin-top: 5px;
  color: var(--gold);
  font-size: 8px;
}

.daily-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.daily-heading h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 400;
}

.daily-heading > div > span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 9px;
}

.todo-form {
  display: grid;
  gap: 13px;
  margin-top: 24px;
  padding: 17px;
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(205, 163, 91, 0.045), transparent),
    rgba(0, 0, 0, 0.08);
}

.todo-form label > span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 11px;
}

.todo-form input {
  width: 100%;
  height: 39px;
  padding: 0 11px;
  border: 1px solid var(--line);
  outline: 0;
  color: var(--text);
  color-scheme: dark;
  background: rgba(0, 0, 0, 0.14);
}

.todo-form input:focus {
  border-color: var(--line-bright);
}

.todo-form input::placeholder {
  color: #665f54;
}

.todo-time-fields {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
}

.add-todo-button {
  min-height: 42px;
  border: 1px solid rgba(205, 163, 91, 0.48);
  color: #1e170c;
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, #ead39b, #b98942);
  cursor: pointer;
}

.todo-list-heading {
  display: flex;
  justify-content: space-between;
  margin: 24px 0 10px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
  font-family: var(--serif);
  font-size: 13px;
}

.todo-list-heading small {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 9px;
}

.daily-todo-list {
  max-height: 325px;
  overflow-y: auto;
}

.todo-item {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 12px 2px;
  border-bottom: 1px solid rgba(205, 163, 91, 0.09);
}

.todo-check {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-bright);
  color: transparent;
  font-family: var(--serif);
  background: rgba(255, 255, 255, 0.015);
  cursor: pointer;
}

.todo-item.done .todo-check {
  border-color: rgba(102, 143, 120, 0.62);
  color: var(--jade);
  background: rgba(102, 143, 120, 0.07);
}

.todo-content {
  min-width: 0;
}

.todo-content strong {
  display: block;
  overflow-wrap: anywhere;
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 400;
}

.todo-item.done .todo-content strong {
  color: #75756d;
  text-decoration: line-through;
}

.todo-times {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 7px;
}

.todo-times label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #777166;
  font-size: 8px;
}

.todo-times input {
  width: 78px;
  padding: 3px 4px;
  border: 1px solid rgba(205, 163, 91, 0.12);
  outline: 0;
  color: #aaa18e;
  color-scheme: dark;
  font-size: 9px;
  background: rgba(0, 0, 0, 0.1);
}

.todo-delete {
  padding: 4px 2px;
  border: 0;
  color: #71685c;
  font-family: var(--serif);
  font-size: 10px;
  background: none;
  cursor: pointer;
}

.todo-delete:hover {
  color: var(--danger);
}

.todo-empty {
  min-height: 160px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(205, 163, 91, 0.12);
  color: #6e675c;
  font-family: var(--serif);
  font-size: 12px;
}

.special-panel {
  min-height: 590px;
  padding: 28px 30px;
}

.special-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.special-heading h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 500;
}

.special-heading p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.special-seal {
  width: 42px;
  height: 42px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line-bright);
  color: var(--gold-light);
  font-family: var(--serif);
  font-size: 19px;
  background: rgba(215, 174, 98, 0.05);
}

.video-config {
  display: grid;
  gap: 8px;
  margin: 24px 0 14px;
}

.video-config > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.video-config input {
  min-width: 0;
  height: 39px;
  padding: 0 12px;
  border: 1px solid var(--line);
  outline: 0;
  color: var(--text);
  background: rgba(0, 0, 0, 0.16);
}

.video-config input:focus {
  border-color: var(--line-bright);
}

.video-config input::placeholder {
  color: #5f6468;
}

.video-config-hint {
  color: var(--muted);
  line-height: 1.5;
}

.video-config button,
.treasure-controls button {
  padding: 0 16px;
  border: 1px solid rgba(215, 174, 98, 0.42);
  color: #1a150d;
  font-family: var(--serif);
  background: linear-gradient(135deg, var(--gold-light), #c3964d);
  cursor: pointer;
}

.video-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  background: #080a0e;
  overflow: hidden;
}

.video-stage iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.video-load-status {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 10px;
  color: var(--muted);
  text-align: center;
  background: rgba(8, 10, 14, 0.92);
  pointer-events: none;
}

.video-load-status[hidden] {
  display: none;
}

.video-load-status span {
  width: 28px;
  height: 28px;
  margin: auto;
  border: 2px solid rgba(215, 174, 98, 0.2);
  border-top-color: var(--gold-light);
  border-radius: 50%;
  animation: video-loading 0.8s linear infinite;
}

@keyframes video-loading {
  to { transform: rotate(360deg); }
}

.video-actions {
  display: flex;
  gap: 8px;
  margin-top: 9px;
}

.video-actions[hidden] {
  display: none;
}

.video-actions button,
.video-actions a {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--serif);
  text-decoration: none;
  background: rgba(215, 174, 98, 0.05);
  cursor: pointer;
}

.video-actions button.active,
.video-actions button:hover,
.video-actions a:hover {
  border-color: var(--line-bright);
  color: var(--gold-light);
}

.chapter-panel {
  min-height: 0;
  padding: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.12);
}

.chapter-panel[hidden] {
  display: none;
}

.chapter-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.chapter-heading strong,
.chapter-heading small {
  display: block;
}

.chapter-heading strong {
  color: var(--gold-light);
  font-family: var(--serif);
  font-weight: 400;
}

.chapter-heading small {
  margin-top: 2px;
  color: var(--muted);
}

.chapter-jump {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
}

.chapter-jump input {
  width: 52px;
  height: 30px;
  padding: 0 5px;
  border: 1px solid var(--line);
  color: var(--text);
  text-align: center;
  background: rgba(0, 0, 0, 0.16);
}

.chapter-jump button {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  color: var(--gold-light);
  background: rgba(215, 174, 98, 0.06);
  cursor: pointer;
}

.chapter-list {
  max-height: 118px;
  display: grid;
  gap: 5px;
  overflow-y: auto;
}

.chapter-list button {
  min-width: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid transparent;
  color: var(--muted);
  text-align: left;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
}

.chapter-list button strong {
  overflow: hidden;
  color: var(--text);
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-list button.active,
.chapter-list button:hover {
  border-color: var(--line-bright);
  color: var(--gold-light);
  background: rgba(215, 174, 98, 0.08);
}

.video-placeholder {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #656a6d;
}

.video-placeholder span {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin-bottom: 13px;
  border: 1px solid var(--line);
  color: var(--gold);
  font-family: var(--serif);
  font-size: 20px;
  transform: rotate(45deg);
}

.video-placeholder strong {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 400;
}

.video-placeholder small {
  margin-top: 6px;
  font-size: 9px;
}

.treasure-controls {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.treasure-controls > div span,
.treasure-controls > div strong {
  display: block;
}

.treasure-controls > div span {
  color: var(--muted);
  font-size: 9px;
}

.treasure-controls > div strong {
  margin-top: 3px;
  color: var(--gold-light);
  font-family: Georgia, serif;
  font-size: 22px;
  font-weight: 400;
}

.treasure-controls button {
  min-height: 39px;
}

.treasure-controls .quiet-button {
  border-color: var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
}

.practice-note {
  margin: 12px 0 0;
  color: #6d7275;
  font-size: 9px;
  line-height: 1.6;
}

.note-dropzone {
  min-height: 230px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 24px 0 16px;
  border: 1px dashed var(--line-bright);
  color: var(--muted);
  background:
    radial-gradient(circle at 50% 50%, rgba(141, 115, 211, 0.065), transparent 48%),
    rgba(255, 255, 255, 0.012);
  cursor: pointer;
  transition: 0.25s ease;
}

.note-modal-copy {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.note-modal .note-dropzone {
  min-height: 190px;
}

.note-modal-actions {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr;
  gap: 9px;
}

.note-modal-actions .save-settings {
  margin-top: 0;
}

.note-modal-actions .save-settings:disabled {
  cursor: not-allowed;
  filter: grayscale(0.6);
  opacity: 0.45;
}

.quiet-modal-button {
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--serif);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
}

.note-dropzone:hover {
  border-color: var(--gold);
  background-color: rgba(215, 174, 98, 0.025);
}

.note-dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.note-dropzone > span {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  margin-bottom: 15px;
  border: 1px solid var(--line-bright);
  color: var(--gold);
  font-family: var(--serif);
  font-size: 20px;
  transform: rotate(45deg);
}

.note-dropzone strong {
  color: var(--text);
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 400;
}

.note-dropzone small {
  margin-top: 7px;
  color: #686d70;
  font-size: 9px;
}

.note-reward {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 13px 16px;
  border: 1px solid rgba(108, 166, 155, 0.18);
  background: rgba(108, 166, 155, 0.035);
}

.note-reward > div {
  display: flex;
  align-items: baseline;
  gap: 5px;
  color: var(--jade);
}

.note-reward strong {
  font-family: Georgia, serif;
  font-size: 26px;
  font-weight: 400;
}

.note-reward span,
.note-reward p {
  font-size: 9px;
}

.note-reward p {
  margin: 0;
  color: var(--muted);
}

.note-reward b {
  color: var(--gold-light);
  font-weight: 400;
}

.recent-notes {
  margin-top: 20px;
}

.recent-notes-list {
  max-height: 126px;
  overflow-y: auto;
}

.recent-note-item {
  display: grid;
  grid-template-columns: 25px 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
}

.recent-note-item > span:first-child {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--jade);
  font-family: var(--serif);
  font-size: 10px;
}

.recent-note-item strong {
  overflow: hidden;
  font-size: 10px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-note-item small {
  color: var(--jade);
  font-size: 9px;
}

.summary-panel {
  margin-top: 18px;
  padding: 30px 34px 34px;
}

.summary-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.summary-header h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 500;
}

.summary-header > div > p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.summary-tabs {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.12);
}

.summary-tabs button {
  min-width: 62px;
  padding: 8px 13px;
  border: 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 12px;
  background: transparent;
  cursor: pointer;
}

.summary-tabs button.active {
  color: #17130c;
  background: linear-gradient(135deg, var(--gold-light), #b98d48);
}

.summary-body {
  display: grid;
  grid-template-columns: minmax(260px, 0.7fr) minmax(400px, 1.3fr);
  gap: 34px;
  padding-top: 25px;
}

.summary-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  align-content: start;
}

.summary-overview article {
  min-height: 92px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  background: rgba(255, 255, 255, 0.018);
}

.summary-overview article span,
.summary-overview article strong {
  display: block;
}

.summary-overview article span {
  min-height: 28px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.summary-overview article strong {
  color: var(--gold-light);
  font-family: var(--serif);
  font-size: 10px;
  font-weight: 400;
}

.summary-overview article b {
  margin-right: 2px;
  font-family: Georgia, serif;
  font-size: 24px;
  font-weight: 400;
}

.summary-overview > p {
  grid-column: 1 / -1;
  margin: 5px 0 0;
  padding: 14px;
  border-left: 1px solid var(--line-bright);
  color: #99968d;
  font-family: var(--serif);
  font-size: 12px;
  line-height: 1.7;
  background: linear-gradient(90deg, rgba(215, 174, 98, 0.04), transparent);
}

.goal-summary-title {
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
  font-family: var(--serif);
  font-size: 13px;
}

.goal-summary-title small {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 9px;
}

.goal-summary-list {
  display: grid;
  gap: 12px;
}

.goal-summary-item {
  display: grid;
  grid-template-columns: minmax(100px, 0.85fr) minmax(160px, 1.5fr) 72px;
  align-items: center;
  gap: 14px;
}

.goal-summary-name {
  min-width: 0;
}

.goal-summary-name strong,
.goal-summary-name small {
  display: block;
}

.goal-summary-name strong {
  overflow: hidden;
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.goal-summary-name small {
  margin-top: 3px;
  color: #6f7477;
  font-size: 9px;
}

.goal-summary-track {
  height: 5px;
  background: rgba(255, 255, 255, 0.06);
}

.goal-summary-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--gold));
  box-shadow: 0 0 9px rgba(141, 115, 211, 0.22);
}

.goal-summary-time {
  color: var(--gold-light);
  font-family: Georgia, serif;
  font-size: 12px;
  text-align: right;
}

.goal-summary-empty {
  min-height: 150px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(255, 255, 255, 0.06);
  color: #62676b;
  font-family: var(--serif);
  font-size: 12px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 5, 8, 0.74);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: 0.25s ease;
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  width: min(500px, 100%);
  padding: 28px;
  border: 1px solid var(--line-bright);
  background:
    linear-gradient(145deg, rgba(215, 174, 98, 0.04), transparent 35%),
    #141922;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.5);
  transform: translateY(12px) scale(0.98);
  transition: 0.25s ease;
}

.modal-backdrop.open .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.modal-header h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
}

.close-button {
  font-size: 23px;
  line-height: 1;
}

.setting-list {
  margin: 24px 0 18px;
  border-top: 1px solid var(--line);
}

.setting-list > label {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.setting-list span,
.setting-list small {
  display: block;
}

.setting-list span {
  font-family: var(--serif);
  font-size: 14px;
}

.setting-list small {
  margin-top: 3px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 9px;
}

.setting-list label > div {
  display: flex;
  align-items: center;
  gap: 7px;
}

.setting-list input {
  width: 66px;
  padding: 8px;
  border: 1px solid var(--line);
  outline: 0;
  color: var(--gold-light);
  text-align: center;
  background: rgba(0, 0, 0, 0.15);
}

.setting-list input:focus {
  border-color: var(--line-bright);
}

.setting-list b {
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
}

.switch {
  position: relative;
  width: 44px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.switch i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: 0.25s ease;
}

.switch.on {
  border-color: rgba(215, 174, 98, 0.45);
  background: rgba(215, 174, 98, 0.1);
}

.switch.on i {
  left: 23px;
  background: var(--gold);
}

.rules-box {
  padding: 14px;
  border: 1px solid rgba(141, 115, 211, 0.2);
  color: var(--muted);
  background: rgba(141, 115, 211, 0.045);
}

.rules-box + .rules-box {
  margin-top: 10px;
}

.rules-box strong {
  color: var(--purple);
  font-family: var(--serif);
  font-size: 13px;
}

.rules-box p {
  margin: 6px 0 0;
  font-size: 10px;
  line-height: 1.7;
}

.save-settings {
  width: 100%;
  margin-top: 18px;
  padding: 12px;
  border: 1px solid rgba(215, 174, 98, 0.45);
  color: #19140c;
  font-family: var(--serif);
  font-size: 15px;
  background: linear-gradient(135deg, var(--gold-light), #c3964d);
  cursor: pointer;
}

.breakthrough {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(5, 7, 11, 0.86);
  opacity: 0;
  visibility: hidden;
  transition: 0.5s ease;
  overflow: hidden;
}

.breakthrough.open {
  opacity: 1;
  visibility: visible;
}

.breakthrough-light {
  position: absolute;
  width: 650px;
  height: 650px;
  border: 1px solid rgba(215, 174, 98, 0.18);
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle, transparent 0 42px, rgba(215, 174, 98, 0.045) 43px 44px),
    radial-gradient(circle, rgba(141, 115, 211, 0.25), transparent 65%);
  animation: breakthrough-pulse 3s ease-in-out infinite;
}

.breakthrough-content {
  position: relative;
  z-index: 2;
  text-align: center;
}

.breakthrough-content p {
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.35em;
}

.breakthrough-content h2 {
  margin: 14px 0 9px;
  color: var(--gold-light);
  font-family: var(--serif);
  font-size: clamp(46px, 8vw, 80px);
  font-weight: 400;
  letter-spacing: 0.16em;
  text-shadow: 0 0 35px rgba(215, 174, 98, 0.28);
}

.breakthrough-content strong {
  display: block;
  margin-bottom: 32px;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 400;
  letter-spacing: 0.1em;
}

.breakthrough-content button {
  padding: 11px 28px;
  border: 1px solid var(--line-bright);
  color: var(--gold-light);
  font-family: var(--serif);
  background: rgba(215, 174, 98, 0.07);
  cursor: pointer;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 120;
  max-width: 320px;
  padding: 12px 18px;
  border: 1px solid var(--line-bright);
  color: var(--gold-light);
  font-family: var(--serif);
  font-size: 13px;
  background: rgba(20, 25, 34, 0.95);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@keyframes slow-spin {
  to { transform: rotate(360deg); }
}

@keyframes breakthrough-pulse {
  0%, 100% { transform: scale(0.92) rotate(0deg); opacity: 0.65; }
  50% { transform: scale(1.06) rotate(8deg); opacity: 1; }
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1180px) {
  .dashboard {
    grid-template-columns: minmax(280px, 0.8fr) minmax(430px, 1.2fr);
  }

  .records-panel {
    grid-column: 1 / -1;
    min-height: auto;
  }

  .records-panel .stat-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .session-section {
    min-height: auto;
  }

  .session-list {
    max-height: 160px;
  }

  .practice-nav {
    grid-template-columns: repeat(2, 1fr);
  }

  .calendar-layout {
    grid-template-columns: 1fr;
  }

  .calendar-panel,
  .daily-todo-panel {
    min-height: auto;
  }
}

@media (max-width: 790px) {
  .topbar {
    height: 68px;
    padding-right: max(18px, env(safe-area-inset-right));
    padding-left: max(18px, env(safe-area-inset-left));
  }

  .today {
    display: none;
  }

  .main-nav button {
    padding: 0 7px;
    font-size: 11px;
  }

  .calendar-grid {
    grid-auto-rows: minmax(76px, 1fr);
  }

  .calendar-task-preview:nth-of-type(n + 3) {
    display: none;
  }

  .page {
    width: min(100% - 28px, 620px);
    padding-top: 22px;
    padding-bottom: max(60px, env(safe-area-inset-bottom));
  }

  .hero {
    min-height: 130px;
    padding: 8px 3px 22px;
  }

  .hero-seal {
    width: 58px;
    height: 58px;
    margin-right: 2px;
    font-size: 28px;
  }

  .hero-copy {
    font-size: 12px;
  }

  .dashboard {
    display: flex;
    flex-direction: column;
  }

  .timer-panel {
    order: -1;
    min-height: 580px;
    padding-right: 18px;
    padding-left: 18px;
  }

  .cultivation-panel,
  .records-panel {
    min-height: auto;
  }

  .journey-panel {
    flex-direction: column;
    align-items: flex-start;
  }

  .special-practices {
    grid-template-columns: 1fr;
  }

  .records-page .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .summary-body {
    grid-template-columns: 1fr;
  }

  .journey-stats {
    width: 100%;
    justify-content: space-around;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .topbar {
    flex-wrap: wrap;
    height: auto;
    min-height: 68px;
    padding-top: max(8px, env(safe-area-inset-top));
  }

  .main-nav {
    order: 3;
    width: 100%;
    height: 40px;
    justify-content: center;
  }

  .main-nav button {
    flex: 1;
    padding: 0 3px;
    font-size: 10px;
  }

  button,
  input {
    min-height: 44px;
  }

  .calendar-day,
  .todo-check,
  .icon-button,
  .close-button {
    min-height: 0;
  }

  .brand small {
    display: none;
  }

  .brand strong {
    font-size: 17px;
  }

  .hero h1 {
    font-size: 31px;
  }

  .hero-copy {
    font-size: 10px;
  }

  .hero-seal {
    display: none;
  }

  .practice-nav {
    grid-template-columns: 1fr 1fr;
  }

  .practice-nav button {
    padding: 10px;
  }

  .practice-nav button > span {
    display: none;
  }

  .duration-selector {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .timing-method {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .timing-method > div,
  .timing-method button {
    width: 100%;
  }

  .focus-realm-strip {
    grid-template-columns: 1fr;
  }

  .focus-realm-progress > span {
    text-align: left;
  }

  .noise-control {
    grid-template-columns: 1fr;
  }

  .noise-options {
    width: 100%;
  }

  .noise-options button {
    flex: 1;
    padding-right: 3px;
    padding-left: 3px;
  }

  .noise-volume input {
    flex: 1;
    width: auto;
  }

  .timer-panel.immersive {
    padding:
      max(16px, env(safe-area-inset-top))
      max(16px, env(safe-area-inset-right))
      max(16px, env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
  }

  .timer-panel.immersive .focus-realm-strip {
    top: 14px;
    left: 15px;
    width: calc(100% - 95px);
    transform: none;
  }

  .timer-panel.immersive .timer-orbit {
    width: min(74vw, 300px);
    height: min(74vw, 300px);
    margin-top: 105px;
  }

  .timer-panel.immersive .timer-value {
    font-size: 62px;
  }

  .timer-panel.immersive .immersive-exit {
    top: 14px;
    right: max(12px, env(safe-area-inset-right));
    padding: 7px;
  }

  .duration-presets {
    width: 100%;
  }

  .duration-presets button {
    flex: 1;
  }

  .timer-panel {
    min-height: 540px;
  }

  .timer-orbit {
    width: 280px;
    height: 280px;
  }

  .timer-controls {
    gap: 8px;
  }

  .control.primary {
    min-width: 145px;
  }

  .control.secondary {
    width: 49px;
  }

  .realm-path {
    grid-template-columns: repeat(3, 1fr);
  }

  .records-panel .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .journey-panel {
    padding: 25px 20px;
  }

  .summary-panel {
    padding: 25px 20px;
  }

  .special-panel {
    min-height: auto;
    padding: 25px 20px;
  }

  .calendar-panel,
  .daily-todo-panel {
    padding: 22px 14px;
  }

  .calendar-toolbar {
    grid-template-columns: 60px 1fr 60px;
    gap: 7px;
  }

  .calendar-toolbar h2 {
    font-size: 21px;
  }

  .calendar-grid {
    gap: 3px;
    grid-auto-rows: minmax(58px, 1fr);
  }

  .calendar-day {
    padding: 5px;
  }

  .calendar-date-number {
    margin-bottom: 3px;
    font-size: 12px;
  }

  .calendar-task-preview {
    display: none;
  }

  .calendar-more {
    font-size: 7px;
  }

  .calendar-day.today::after {
    top: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    font-size: 7px;
  }

  .todo-time-fields {
    grid-template-columns: 1fr;
  }

  .video-config > div,
  .treasure-controls {
    grid-template-columns: 1fr;
  }

  .treasure-controls button {
    min-height: 42px;
  }

  .summary-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .summary-tabs,
  .summary-tabs button {
    width: 100%;
  }

  .summary-overview {
    grid-template-columns: 1fr;
  }

  .summary-overview > p {
    grid-column: auto;
  }

  .goal-summary-item {
    grid-template-columns: minmax(90px, 1fr) 70px;
  }

  .goal-summary-track {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .journey-stats div {
    min-width: 70px;
  }
}

/* Archive, local notes and focus lock v9 */
.records-page {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
}

.journal-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.journal-tabs button {
  min-height: 34px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--serif);
  background: rgba(255, 255, 255, 0.018);
  cursor: pointer;
}

.journal-tabs button.active {
  border-color: var(--line-bright);
  color: var(--gold-light);
  background: rgba(205, 163, 91, 0.08);
}

.journal-panes,
.journal-pane {
  min-height: 0;
  height: 100%;
}

.journal-pane[hidden] {
  display: none;
}

#journalTodayPane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
}

#journalTodayPane .stat-grid {
  margin: 0;
}

#journalTodayPane .session-section {
  height: auto;
  min-height: 0;
}

#journalTodayPane .session-list {
  max-height: calc(100% - 25px);
}

#journalTodayPane blockquote {
  margin: 0;
}

.archive-pane {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

.archive-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

.archive-toolbar strong,
.archive-toolbar small {
  display: block;
}

.archive-toolbar strong {
  color: var(--gold-light);
  font-family: var(--serif);
  font-weight: 400;
}

.archive-toolbar small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.archive-toolbar button,
.archive-actions button,
.archive-actions a {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  color: var(--gold-light);
  font-size: 9px;
  text-decoration: none;
  background: rgba(205, 163, 91, 0.05);
  cursor: pointer;
}

.video-history-list,
.note-gallery {
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-bright) transparent;
}

.video-history-list {
  display: grid;
  align-content: start;
  gap: 7px;
}

.video-history-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(205, 163, 91, 0.12);
  background: rgba(255, 255, 255, 0.016);
}

.archive-seal {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-bright);
  color: var(--gold-light);
  font-family: var(--serif);
}

.archive-copy {
  min-width: 0;
}

.archive-copy strong,
.archive-copy small {
  display: block;
}

.archive-copy strong {
  overflow: hidden;
  font-family: var(--serif);
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-copy small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.archive-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.archive-actions a {
  display: inline-flex;
  align-items: center;
}

.archive-actions .danger {
  color: #d48778;
}

.note-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  align-content: start;
  gap: 9px;
}

.note-card {
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(100px, 1fr) auto;
  border: 1px solid rgba(205, 163, 91, 0.14);
  background: rgba(255, 255, 255, 0.018);
  overflow: hidden;
}

.note-preview {
  min-height: 120px;
  background: #090909;
}

.note-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.note-card-copy {
  min-width: 0;
  padding: 8px;
}

.note-card-copy strong,
.note-card-copy small {
  display: block;
}

.note-card-copy strong {
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-card-copy small {
  margin: 4px 0 6px;
  color: var(--muted);
  font-size: 8px;
}

.note-card-copy a {
  color: var(--gold);
  font-size: 9px;
}

.legacy-note {
  grid-template-columns: 46px minmax(0, 1fr);
  grid-template-rows: auto;
  align-items: center;
  padding: 10px;
}

.note-missing {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-bright);
  color: var(--muted);
  font-family: var(--serif);
}

.legacy-note p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 8px;
}

.archive-empty {
  min-height: 150px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  color: var(--muted);
  font-family: var(--serif);
}

.video-lock-button {
  position: absolute;
  z-index: 6;
  top: 10px;
  left: 10px;
  min-width: 54px;
  height: 32px;
  border: 1px solid rgba(215, 174, 98, 0.58);
  color: var(--gold-light);
  font-family: var(--serif);
  background: rgba(8, 10, 14, 0.82);
  backdrop-filter: blur(8px);
  cursor: pointer;
}

.video-lock-button[hidden],
.video-touch-shield[hidden] {
  display: none !important;
}

.video-touch-shield {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4, 5, 7, 0.42);
  backdrop-filter: blur(2px);
  touch-action: none;
}

.video-lock-card {
  width: min(360px, 88%);
  padding: 20px;
  border: 1px solid var(--line-bright);
  color: var(--text);
  text-align: center;
  background: rgba(14, 12, 9, 0.94);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5);
}

.video-lock-card > span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  margin: 0 auto 9px;
  border: 1px solid var(--line-bright);
  color: var(--gold-light);
  font-family: var(--serif);
  font-size: 19px;
}

.video-lock-card strong,
.video-lock-card small {
  display: block;
}

.video-lock-card strong {
  font-family: var(--serif);
  font-weight: 400;
}

.video-lock-card small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
}

.video-lock-card > div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 14px;
}

.video-lock-card button {
  min-height: 36px;
  border: 1px solid var(--line);
  color: var(--gold-light);
  font-family: var(--serif);
  background: rgba(205, 163, 91, 0.05);
  cursor: pointer;
}

#videoUnlockButton {
  position: relative;
  overflow: hidden;
}

#videoUnlockButton::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 0;
  background: rgba(102, 143, 120, 0.24);
}

#videoUnlockButton.holding::before {
  width: 100%;
  transition: width 2s linear;
}

body.practice-locked .topbar,
body.practice-locked .practice-nav,
body.practice-locked .video-actions,
body.practice-locked .video-marker-panel,
body.practice-locked .chapter-panel,
body.practice-locked .treasure-controls {
  pointer-events: none;
}

@media (max-width: 790px) {
  .records-page {
    gap: 5px;
  }

  .journal-tabs button {
    min-height: 29px;
    font-size: 9px;
  }

  .video-history-card {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 6px;
    padding: 7px;
  }

  .archive-seal {
    width: 28px;
    height: 28px;
  }

  .archive-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .note-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .video-lock-card {
    padding: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* One-screen responsive layout */
html,
body {
  height: 100%;
  overflow: hidden;
}

.topbar {
  height: clamp(58px, 7vh, 72px);
}

.page {
  height: calc(100dvh - clamp(58px, 7vh, 72px));
  padding: clamp(8px, 1.4vh, 16px) 0;
  overflow: hidden;
}

.app-view {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.hero,
.compact-hero {
  min-height: 0;
  height: clamp(54px, 8vh, 82px);
  padding: 0 8px clamp(8px, 1vh, 12px);
}

.hero h1 {
  font-size: clamp(25px, 3.1vh, 39px);
}

.hero-copy {
  margin-top: 5px;
  font-size: 10px;
}

.hero-seal {
  width: clamp(44px, 6vh, 62px);
  height: clamp(44px, 6vh, 62px);
  font-size: clamp(24px, 3.5vh, 33px);
}

.practice-nav {
  height: clamp(48px, 6vh, 58px);
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-bottom: clamp(7px, 1vh, 11px);
}

.practice-nav button {
  min-height: 0;
  height: 100%;
  padding: 7px 12px;
}

.practice-nav button > span {
  width: 28px;
  height: 28px;
}

.focus-workspace {
  height: calc(100% - clamp(54px, 8vh, 82px) - clamp(48px, 6vh, 58px) - clamp(7px, 1vh, 11px));
  min-height: 0;
}

.focus-workspace > .timer-panel,
.focus-workspace > .treasure-panel {
  width: min(900px, 100%);
  height: 100%;
  min-height: 0;
}

.timer-panel {
  display: grid;
  grid-template-columns: minmax(190px, 0.78fr) minmax(250px, 1.22fr);
  grid-template-rows: auto auto auto 1fr auto auto;
  column-gap: clamp(18px, 3vw, 42px);
  row-gap: clamp(5px, 0.8vh, 9px);
  align-items: center;
  padding: clamp(14px, 2vh, 22px) clamp(18px, 3vw, 36px);
}

.focus-realm-strip {
  grid-column: 1 / -1;
  width: 100%;
  max-width: none;
  padding: 8px 13px;
}

.timing-method,
.duration-selector,
.cycle-strip,
.current-intent,
.noise-control {
  width: 100%;
  max-width: none;
}

.timing-method {
  grid-column: 1;
  grid-row: 2;
  margin: 0;
}

.duration-selector {
  grid-column: 1;
  grid-row: 3;
}

.cycle-strip {
  grid-column: 1;
  grid-row: 4;
  align-self: start;
  min-height: 44px;
  margin: 0;
  padding: 7px 10px;
}

.timer-orbit {
  grid-column: 2;
  grid-row: 2 / 6;
  width: min(35vh, 310px);
  height: min(35vh, 310px);
  margin: 0 auto;
}

.timer-value {
  font-size: clamp(48px, 7vh, 70px);
}

.timer-controls {
  grid-column: 2;
  grid-row: 6;
}

.current-intent {
  grid-column: 1;
  grid-row: 5;
  margin: 0;
  padding: 8px 10px;
}

.noise-control {
  grid-column: 1;
  grid-row: 6;
  grid-template-columns: auto 1fr;
  margin: 0;
  padding-top: 8px;
}

.noise-volume {
  display: none;
}

.timer-panel.count-up .timing-method {
  margin: 0;
}

.timer-panel.count-up .timer-orbit {
  grid-row: 2 / 6;
}

.special-panel {
  min-height: 0;
  height: 100%;
  padding: clamp(18px, 2.4vh, 28px);
}

.treasure-panel {
  gap: clamp(7px, 1vh, 12px);
}

.video-config {
  margin: 0;
}

.video-stage {
  width: 100%;
  min-height: 160px;
  max-height: min(42vh, 400px);
}

.records-page {
  width: min(980px, 100%);
  height: calc(100% - clamp(54px, 8vh, 82px));
  min-height: 0;
  padding: clamp(18px, 2.5vh, 28px);
}

.records-page .stat-grid {
  margin: clamp(12px, 2vh, 22px) 0;
}

.records-page .session-section {
  height: calc(100% - 215px);
  min-height: 110px;
}

.records-page .session-list {
  max-height: calc(100% - 25px);
}

.records-page blockquote {
  margin-top: 10px;
  padding: 9px 13px;
}

.overview-grid-single {
  height: calc(100% - clamp(54px, 8vh, 82px));
}

.overview-grid-single > div {
  height: 100%;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

.journey-panel {
  min-height: 0;
  padding: clamp(14px, 2vh, 22px) 28px;
}

.summary-panel {
  min-height: 0;
  height: 100%;
  margin: 0;
  padding: clamp(16px, 2vh, 26px) clamp(20px, 2.5vw, 32px);
}

.summary-header {
  padding-bottom: 12px;
}

.summary-body {
  height: calc(100% - 72px);
  min-height: 0;
  gap: 24px;
  padding-top: 14px;
}

.goal-summary,
.goal-summary-list {
  min-height: 0;
}

.goal-summary-list {
  max-height: calc(100% - 26px);
  overflow-y: auto;
}

.calendar-layout {
  height: calc(100% - clamp(54px, 8vh, 82px));
  min-height: 0;
  grid-template-columns: minmax(520px, 1.35fr) minmax(300px, 0.65fr);
}

.calendar-panel,
.daily-todo-panel {
  height: 100%;
  min-height: 0;
  padding: clamp(16px, 2vh, 26px);
}

.calendar-toolbar {
  padding-bottom: 10px;
}

.calendar-weekdays {
  margin-top: 6px;
}

.calendar-grid {
  height: calc(100% - 78px);
  grid-template-rows: repeat(6, minmax(0, 1fr));
  grid-auto-rows: unset;
}

.calendar-day {
  min-height: 0;
  padding: 5px 7px;
}

.todo-form {
  gap: 8px;
  margin-top: 13px;
  padding: 11px;
}

.todo-form input {
  height: 34px;
  min-height: 34px;
}

.add-todo-button {
  min-height: 36px;
}

.todo-list-heading {
  margin: 13px 0 7px;
}

.daily-todo-list {
  max-height: calc(100% - 255px);
}

@media (max-height: 760px) and (min-width: 791px) {
  .hero,
  .compact-hero {
    height: 48px;
  }

  .hero-copy,
  .hero-seal,
  .practice-nav small {
    display: none;
  }

  .practice-nav {
    height: 43px;
  }

  .focus-workspace,
  .records-page,
  .overview-grid-single,
  .calendar-layout {
    height: calc(100% - 48px - 43px - 7px);
  }

  #journalView .records-page,
  #overviewView .overview-grid-single,
  #calendarView .calendar-layout {
    height: calc(100% - 48px);
  }

  .timer-panel {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .timer-orbit {
    width: min(31vh, 235px);
    height: min(31vh, 235px);
  }

  .focus-realm-strip > p,
  .cycle-strip span {
    display: none;
  }
}

@media (max-width: 790px) {
  body {
    overflow: hidden;
  }

  .topbar {
    height: 104px;
  }

  .page {
    height: calc(100dvh - 104px);
    width: min(100% - 18px, 620px);
    padding: 7px 0;
  }

  .hero,
  .compact-hero {
    display: none;
  }

  .practice-nav {
    height: 48px;
    grid-template-columns: repeat(3, 1fr);
    margin-bottom: 6px;
  }

  .practice-nav button {
    justify-content: center;
    padding: 5px;
    text-align: center;
  }

  .practice-nav button > span,
  .practice-nav small {
    display: none;
  }

  .focus-workspace {
    height: calc(100% - 54px);
  }

  .focus-workspace > .timer-panel,
  .focus-workspace > .treasure-panel {
    height: 100%;
    min-height: 0;
  }

  .timer-panel {
    display: flex;
    gap: clamp(4px, 0.8vh, 8px);
    padding: clamp(8px, 1.5vh, 14px) 12px;
    overflow: hidden;
  }

  .focus-realm-strip {
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
    padding: 6px 9px;
  }

  .focus-realm-strip > p {
    display: none;
  }

  .timing-method,
  .duration-selector {
    flex-direction: row;
    align-items: center;
    gap: 7px;
    margin: 0;
  }

  .timing-method > span,
  .duration-selector > span {
    font-size: 10px;
  }

  .timing-method > div {
    flex: 1;
  }

  .timing-method button {
    min-width: 0;
    min-height: 34px;
    padding: 5px 8px;
  }

  .duration-presets {
    flex: 1;
  }

  .duration-presets button {
    min-height: 32px;
    height: 32px;
  }

  .cycle-strip {
    min-height: 36px;
    padding: 4px 9px;
  }

  .cycle-strip span {
    display: none;
  }

  .timer-orbit {
    width: min(29vh, 230px, 58vw);
    height: min(29vh, 230px, 58vw);
    flex: 0 1 auto;
  }

  .timer-value {
    font-size: clamp(43px, 8vh, 62px);
  }

  .timer-controls {
    min-height: 44px;
  }

  .current-intent {
    margin: 0;
    padding: 6px 9px;
  }

  .noise-control {
    display: flex;
    gap: 7px;
    margin: 0;
    padding-top: 5px;
  }

  .noise-control > span,
  .noise-volume {
    display: none;
  }

  .noise-options {
    flex: 1;
  }

  .noise-options button {
    min-height: 31px;
  }

  .records-page,
  .overview-grid-single,
  .calendar-layout {
    height: 100%;
  }

  .records-page {
    padding: 13px;
  }

  .records-page .stat-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    margin: 10px 0;
  }

  .records-page .stat-card {
    min-height: 58px;
    padding: 7px;
  }

  .records-page .session-section {
    height: calc(100% - 155px);
  }

  .records-page blockquote {
    display: none;
  }

  .overview-grid-single > div {
    gap: 6px;
  }

  .journey-panel {
    flex-direction: row;
    padding: 10px 13px;
  }

  .journey-copy > p:last-child {
    display: none;
  }

  .summary-panel {
    padding: 12px;
  }

  .summary-header {
    flex-direction: row;
    align-items: center;
    padding-bottom: 7px;
  }

  .summary-header h2 {
    font-size: 16px;
  }

  .summary-header > div > p:last-child {
    display: none;
  }

  .summary-body {
    height: calc(100% - 50px);
    grid-template-columns: 1fr;
    gap: 8px;
    padding-top: 7px;
  }

  .summary-overview {
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
  }

  .summary-overview article {
    min-height: 52px;
    padding: 6px;
  }

  .summary-overview > p {
    display: none;
  }

  .goal-summary {
    min-height: 0;
  }

  .calendar-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1.08fr) minmax(0, 0.92fr);
    gap: 6px;
  }

  .calendar-panel,
  .daily-todo-panel {
    padding: 8px;
  }

  .calendar-toolbar {
    grid-template-columns: 56px 1fr 56px;
    padding-bottom: 3px;
  }

  .calendar-toolbar h2 {
    font-size: 17px;
  }

  .calendar-toolbar .section-kicker {
    display: none;
  }

  .calendar-weekdays {
    margin: 0;
  }

  .calendar-weekdays span {
    padding: 3px 0;
  }

  .calendar-grid {
    height: calc(100% - 48px);
    gap: 2px;
  }

  .calendar-day {
    padding: 2px 4px;
  }

  .calendar-task-preview {
    display: none;
  }

  .daily-heading .section-kicker,
  .daily-heading > div > span,
  .daily-heading .special-seal {
    display: none;
  }

  .daily-heading h2 {
    font-size: 17px;
  }

  .todo-form {
    grid-template-columns: 1fr auto;
    gap: 5px;
    margin-top: 5px;
    padding: 6px;
  }

  .todo-form > label {
    grid-column: 1 / -1;
  }

  .todo-form label > span {
    display: none;
  }

  .todo-time-fields {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
  }

  .todo-form input {
    height: 31px;
    min-height: 31px;
  }

  .add-todo-button {
    min-height: 31px;
    padding: 4px 8px;
    font-size: 11px;
  }

  .todo-list-heading {
    margin: 6px 0 3px;
    padding-bottom: 3px;
  }

  .daily-todo-list {
    max-height: calc(100% - 118px);
  }
}

@media (max-width: 480px) and (max-height: 720px) {
  .topbar {
    min-height: 94px;
    height: 94px;
    padding-top: 4px;
  }

  .page {
    height: calc(100dvh - 94px);
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .timer-orbit {
    width: min(24vh, 170px, 48vw);
    height: min(24vh, 170px, 48vw);
  }

  .timer-label,
  .round-label,
  .orbit-rune {
    display: none;
  }

  .timer-value {
    margin: 0 0 4px;
    font-size: 42px;
  }

  .control.primary {
    height: 42px;
  }

  .current-intent label {
    display: none;
  }

  .noise-control {
    padding: 0;
    border: 0;
  }
}

/* Treasure player v6: unobstructed playback, side chapters and viewport fit */
.video-placeholder[hidden],
.video-stage iframe[hidden],
.video-expand-button[hidden] {
  display: none !important;
}

.focus-workspace.show-treasure > .treasure-panel {
  width: min(1180px, 100%);
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  overflow: hidden;
}

.video-reading-layout {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(220px, 25vw, 300px);
  gap: clamp(8px, 1.2vw, 14px);
  overflow: hidden;
}

.video-main {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 7px;
}

.video-stage {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  aspect-ratio: auto;
}

.video-stage iframe,
.video-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.video-actions {
  min-height: 34px;
  margin: 0;
}

.chapter-panel {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.chapter-list {
  min-height: 0;
  max-height: none;
}

.video-expand-button {
  position: absolute;
  z-index: 5;
  top: 10px;
  right: 10px;
  min-width: 54px;
  height: 32px;
  border: 1px solid rgba(215, 174, 98, 0.58);
  color: var(--gold-light);
  font-family: var(--serif);
  background: rgba(8, 10, 14, 0.82);
  backdrop-filter: blur(8px);
  cursor: pointer;
}

.video-stage:fullscreen,
.video-stage.expanded {
  width: 100vw;
  height: 100dvh;
  max-height: none;
  border: 0;
  background: #000;
}

.video-stage:fullscreen iframe,
.video-stage.expanded iframe {
  position: absolute;
  inset: 0;
}

.video-stage.expanded {
  position: fixed;
  z-index: 10000;
  inset: 0;
}

body.video-expanded {
  overflow: hidden;
}

.treasure-controls {
  grid-template-columns: minmax(110px, 1fr) auto auto;
  margin-top: 0;
}

.treasure-panel > .practice-note {
  margin: 0;
}

@media (max-height: 820px) {
  .treasure-panel {
    padding-top: 12px;
    padding-bottom: 12px;
    gap: 6px;
  }

  .treasure-panel .special-heading p:last-child,
  .treasure-panel .video-config-hint,
  .treasure-panel > .practice-note {
    display: none;
  }

  .treasure-panel .special-heading h2 {
    font-size: 20px;
  }

  .treasure-panel .special-seal {
    width: 36px;
    height: 36px;
  }

  .video-config {
    gap: 5px;
  }

  .video-config input {
    height: 34px;
  }

  .treasure-controls button {
    min-height: 34px;
  }
}

@media (max-width: 790px) {
  .focus-workspace.show-treasure > .treasure-panel {
    padding: 8px;
    gap: 5px;
  }

  .treasure-panel .special-heading {
    display: none;
  }

  .video-reading-layout {
    grid-template-columns: minmax(0, 1fr) clamp(108px, 31vw, 155px);
    gap: 6px;
  }

  .chapter-panel {
    padding: 6px;
  }

  .chapter-heading {
    display: block;
    margin-bottom: 5px;
  }

  .chapter-heading small {
    display: none;
  }

  .chapter-jump {
    margin-top: 4px;
  }

  .chapter-jump input {
    width: 38px;
    height: 27px;
  }

  .chapter-jump button {
    height: 27px;
    padding: 0 6px;
  }

  .chapter-list button {
    grid-template-columns: 31px minmax(0, 1fr);
    gap: 4px;
    padding: 6px 4px;
    font-size: 9px;
  }

  .chapter-list button small {
    display: none;
  }

  .video-actions {
    gap: 4px;
  }

  .video-actions button,
  .video-actions a {
    min-height: 30px;
    padding: 0 7px;
    font-size: 9px;
  }

  .treasure-controls {
    grid-template-columns: minmax(82px, 1fr) auto auto;
    gap: 4px;
  }

  .treasure-controls button {
    min-height: 32px;
    padding: 0 8px;
    font-size: 10px;
  }

  .treasure-controls > div strong {
    font-size: 17px;
  }
}

@media (max-width: 420px) {
  .video-reading-layout {
    grid-template-columns: minmax(0, 1fr) 104px;
  }

  .video-actions a:last-child {
    display: none;
  }
}

/* Study markers v7 */
.video-main {
  grid-template-rows: minmax(0, 1fr) auto auto;
}

.video-marker-panel {
  position: relative;
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.14);
}

.video-marker-panel[hidden],
.marker-detail[hidden] {
  display: none;
}

.marker-rail {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  color: var(--muted);
  font-size: 8px;
}

.marker-track {
  position: relative;
  grid-column: 1 / -1;
  height: 8px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(205, 163, 91, 0.3), rgba(102, 143, 120, 0.25)),
    rgba(255, 255, 255, 0.04);
}

.marker-pin {
  position: absolute;
  z-index: 2;
  top: 50%;
  width: 12px;
  height: 12px;
  padding: 0;
  border: 2px solid #17130e;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
}

.marker-pin.focus {
  background: #d9ad5e;
  box-shadow: 0 0 0 2px rgba(217, 173, 94, 0.22);
}

.marker-pin.difficult {
  background: #b66252;
  box-shadow: 0 0 0 2px rgba(182, 98, 82, 0.24);
}

.marker-form {
  display: grid;
  grid-template-columns: 82px auto 68px minmax(90px, 1fr) auto;
  gap: 5px;
}

.marker-form input,
.marker-form select,
.marker-form button,
.marker-detail button {
  min-width: 0;
  height: 29px;
  padding: 0 8px;
  border: 1px solid var(--line);
  outline: 0;
  color: var(--text);
  font-size: 9px;
  background: rgba(0, 0, 0, 0.16);
}

.marker-form button,
.marker-detail button {
  color: var(--gold-light);
  font-family: var(--serif);
  cursor: pointer;
}

.marker-detail {
  position: absolute;
  z-index: 4;
  right: 8px;
  bottom: 7px;
  max-width: min(55%, 420px);
  height: 31px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding-left: 9px;
  border: 1px solid var(--line-bright);
  color: var(--gold-light);
  font-size: 9px;
  background: rgba(14, 12, 9, 0.96);
}

.marker-detail span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.marker-detail button {
  flex: 0 0 auto;
  height: 24px;
  color: #d48778;
}

@media (max-height: 820px) {
  .video-marker-panel {
    gap: 3px;
    padding: 5px 7px;
  }

  .marker-form input,
  .marker-form select,
  .marker-form button {
    height: 26px;
  }
}

@media (max-width: 790px) {
  .marker-form {
    grid-template-columns: 60px 54px 52px minmax(55px, 1fr) 38px;
    gap: 3px;
  }

  .marker-form input,
  .marker-form select,
  .marker-form button {
    padding: 0 4px;
    font-size: 8px;
  }

  .marker-detail {
    max-width: calc(100% - 14px);
  }
}

@media (max-width: 480px) {
  .marker-form {
    grid-template-columns: 54px 42px 46px minmax(42px, 1fr) 34px;
  }

  #markerNowButton {
    font-size: 0;
  }

  #markerNowButton::after {
    content: "当前";
    font-size: 8px;
  }
}

/* Journal cache and pane isolation v10 */
.heading-chips {
  display: flex;
  align-items: center;
  gap: 7px;
}

.version-chip {
  padding: 3px 7px;
  border: 1px solid rgba(205, 163, 91, 0.32);
  border-radius: 999px;
  color: var(--gold-light);
  font-size: 9px;
  letter-spacing: 0.08em;
  background: rgba(205, 163, 91, 0.07);
}

.records-page {
  overflow: hidden;
}

.journal-tabs {
  position: relative;
  z-index: 5;
  flex: 0 0 auto;
}

.journal-panes {
  min-height: 0;
  overflow: hidden;
}

.journal-pane {
  display: none !important;
  min-height: 0;
  overflow: hidden;
}

.journal-pane.active {
  display: grid !important;
}

#journalTodayPane.active {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.archive-pane.active {
  grid-template-rows: auto minmax(0, 1fr);
}

@media (max-width: 790px) {
  .heading-chips {
    gap: 4px;
  }

  .version-chip {
    padding: 2px 5px;
    font-size: 8px;
  }
}

/* Viewport-fit video workspace v11 */
.focus-workspace.show-treasure > .treasure-panel {
  min-height: 0;
  height: 100%;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  padding: clamp(10px, 1.5vh, 18px);
  gap: clamp(4px, 0.7vh, 8px);
}

.video-reading-layout {
  height: 100%;
  grid-template-columns: minmax(0, 1fr);
}

.video-reading-layout.has-chapters {
  grid-template-columns: minmax(0, 1fr) clamp(190px, 22vw, 280px);
}

.video-main {
  height: 100%;
  grid-template-rows: minmax(0, 1fr) auto auto;
}

.video-stage {
  height: auto;
  min-height: 0;
  align-self: stretch;
}

.chapter-panel[hidden] {
  display: none !important;
}

@media (max-height: 950px) and (min-width: 791px) {
  .focus-workspace.show-treasure > .treasure-panel {
    padding-top: 9px;
    padding-bottom: 9px;
    gap: 4px;
  }

  .treasure-panel .special-heading p:last-child,
  .treasure-panel .video-config-hint,
  .treasure-panel > .practice-note {
    display: none;
  }

  .treasure-panel .special-heading h2 {
    font-size: 20px;
  }

  .treasure-panel .special-seal {
    width: 36px;
    height: 36px;
  }

  .video-config {
    gap: 4px;
  }

  .video-config input {
    height: 32px;
  }

  .video-actions,
  .video-actions button,
  .video-actions a {
    min-height: 29px;
  }

  .treasure-controls button {
    min-height: 32px;
  }
}

@media (max-width: 790px) {
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
  }

  .topbar {
    height: 88px;
    min-height: 88px;
  }

  .page {
    width: calc(100% - 10px);
    height: calc(100dvh - 88px);
    padding: 4px 0;
    overflow: hidden;
  }

  #focusView {
    height: 100%;
    overflow: hidden;
  }

  .practice-nav {
    height: 40px;
    margin-bottom: 4px;
  }

  .focus-workspace {
    height: calc(100% - 44px);
    overflow: hidden;
  }

  .focus-workspace.show-treasure > .treasure-panel {
    height: 100%;
    min-height: 0;
    padding: 5px;
    gap: 3px;
    overflow: hidden;
  }

  .video-config {
    gap: 3px;
  }

  .video-config > div {
    gap: 3px;
  }

  .video-config input {
    height: 29px;
    padding: 0 7px;
    font-size: 11px;
  }

  .video-config button {
    min-height: 29px;
    padding: 0 9px;
    font-size: 10px;
  }

  .video-reading-layout,
  .video-reading-layout.has-chapters {
    height: 100%;
    grid-template-columns: minmax(0, 1fr) clamp(88px, 28vw, 125px);
    gap: 4px;
  }

  .video-reading-layout:not(.has-chapters) {
    grid-template-columns: minmax(0, 1fr);
  }

  .video-main {
    min-height: 0;
    height: 100%;
    gap: 3px;
  }

  .video-stage {
    min-height: 0;
  }

  .video-actions {
    min-height: 27px;
    gap: 3px;
  }

  .video-actions button,
  .video-actions a {
    min-height: 27px;
    padding: 0 5px;
    font-size: 8px;
  }

  .video-marker-panel {
    gap: 2px;
    padding: 3px 5px;
  }

  .marker-rail {
    display: none;
  }

  .marker-form input,
  .marker-form select,
  .marker-form button {
    height: 24px;
  }

  .chapter-panel {
    padding: 4px;
  }

  .chapter-heading {
    margin-bottom: 3px;
  }

  .chapter-list {
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .chapter-list button {
    padding: 4px 2px;
  }

  .treasure-controls {
    min-height: 30px;
    gap: 3px;
  }

  .treasure-controls button {
    min-height: 30px;
    padding: 0 7px;
    font-size: 9px;
  }

  .treasure-controls > div span {
    display: none;
  }

  .treasure-controls > div strong {
    margin: 0;
    font-size: 15px;
  }
}

@media (max-width: 480px) and (max-height: 740px) {
  .topbar {
    height: 78px;
    min-height: 78px;
  }

  .page {
    height: calc(100dvh - 78px);
  }

  .practice-nav {
    height: 35px;
  }

  .focus-workspace {
    height: calc(100% - 39px);
  }

  .video-config input {
    height: 26px;
  }

  .video-config button {
    min-height: 26px;
  }

  .video-actions button,
  .video-actions a {
    min-height: 24px;
  }

  .video-marker-panel {
    padding: 2px 4px;
  }

  .marker-form input,
  .marker-form select,
  .marker-form button {
    height: 22px;
  }

  .treasure-controls,
  .treasure-controls button {
    min-height: 27px;
  }
}

@media (max-width: 950px) and (orientation: portrait) {
  .video-stage:fullscreen.force-landscape,
  .video-stage.expanded.force-landscape {
    position: fixed;
    inset: auto;
    top: 50%;
    left: 50%;
    width: 100dvh;
    height: 100dvw;
    transform: translate(-50%, -50%) rotate(90deg);
    transform-origin: center;
  }
}

@media (max-height: 520px) and (orientation: landscape) and (max-width: 950px) {
  .topbar {
    height: 46px;
    min-height: 46px;
  }

  .brand small,
  .today,
  .hero,
  .compact-hero {
    display: none;
  }

  .page {
    height: calc(100dvh - 46px);
  }

  .practice-nav {
    height: 34px;
  }

  .focus-workspace {
    height: calc(100% - 38px);
  }
}

/* In-page PWA install entry v12 */
.install-button {
  border-color: rgba(215, 174, 98, 0.48);
  color: #1a150d;
  background: linear-gradient(135deg, var(--gold-light), #c3964d);
}

.install-button[hidden] {
  display: none !important;
}

.install-button.install-ready {
  box-shadow: 0 0 0 3px rgba(215, 174, 98, 0.1), 0 0 18px rgba(215, 174, 98, 0.24);
}

.install-button.install-pending {
  color: var(--gold-light);
  background: rgba(215, 174, 98, 0.08);
  animation: install-pulse 1.4s ease-in-out infinite;
}

@keyframes install-pulse {
  50% {
    box-shadow: 0 0 0 4px rgba(215, 174, 98, 0.12);
  }
}

.install-modal {
  width: min(430px, 100%);
  text-align: center;
}

.install-modal .modal-header {
  text-align: left;
}

.install-emblem {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  margin: 24px auto 18px;
  border: 1px solid var(--line-bright);
  color: var(--gold-light);
  font-family: var(--serif);
  font-size: 34px;
  background: linear-gradient(145deg, rgba(215, 174, 98, 0.12), rgba(102, 143, 120, 0.08));
  transform: rotate(45deg);
}

.install-emblem::first-letter {
  display: inline-block;
  transform: rotate(-45deg);
}

.install-guide {
  min-height: 52px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.install-benefits {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin: 18px 0;
}

.install-benefits span {
  padding: 8px 4px;
  border: 1px solid var(--line);
  color: var(--gold-light);
  font-family: var(--serif);
  font-size: 11px;
  background: rgba(215, 174, 98, 0.04);
}

.install-modal .save-settings {
  margin-top: 0;
}

@media (max-width: 790px) {
  .topbar-actions {
    gap: 5px;
  }

  .install-button {
    width: 34px;
    height: 34px;
  }

  .install-modal {
    padding: 20px;
  }

  .install-emblem {
    width: 62px;
    height: 62px;
    margin: 17px auto 14px;
    font-size: 28px;
  }
}
