/* 页边 · 学习笔记 — a quiet local study player */
:root {
  --bg: #0d0e0f;
  --bg-deep: #08090a;
  --surface: #15171a;
  --surface-2: #1b1e22;
  --surface-3: #22262a;
  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #f2efe8;
  --text-2: #a8a49a;
  --text-3: #7c786f;
  --paper: #e0d3b5;
  --paper-strong: #eee3cb;
  --paper-soft: rgba(224, 211, 181, 0.12);
  --paper-line: rgba(224, 211, 181, 0.34);
  --danger: #d99282;
  --radius: 16px;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Segoe UI", sans-serif;
  --mono: "SF Mono", ui-monospace, "Menlo", "Cascadia Mono", monospace;
}

* { box-sizing: border-box; }

html {
  background: var(--bg-deep);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--paper-line);
  outline-offset: 2px;
}

img { display: block; max-width: 100%; }

[hidden] { display: none !important; }

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 22px;
  height: 22px;
  display: block;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app {
  position: relative;
  width: 100%;
  max-width: 560px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  background: var(--bg);
  overflow-x: clip;
}

.view { width: 100%; }

.noscript {
  max-width: 480px;
  margin: 40px auto;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--text-2);
  background: var(--surface);
  font-size: 13px;
  line-height: 1.7;
}

/* ============ Landing ============ */
.landing {
  min-height: 100vh;
  min-height: 100svh;
  padding: env(safe-area-inset-top) 24px calc(26px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.landing-head {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.landing-tools {
  display: flex;
  align-items: center;
  margin-right: -8px;
}

.brand-mark {
  position: relative;
  display: inline-block;
  width: 12px;
  height: 21px;
  border-left: 2px solid var(--paper);
}

.brand-mark::after {
  content: "";
  position: absolute;
  left: -6px;
  top: 8px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--paper);
}

.landing-main {
  flex: 1;
  padding-top: clamp(34px, 8vh, 74px);
}

.eyebrow,
.kicker {
  margin: 0;
  font-size: 9px;
  line-height: 1.4;
  letter-spacing: 0.19em;
  font-weight: 600;
  color: var(--paper);
  opacity: 0.72;
}

.landing h1 {
  margin: 16px 0 18px;
  font-size: clamp(36px, 10.2vw, 45px);
  line-height: 1.2;
  letter-spacing: -0.045em;
  font-weight: 650;
  color: var(--text);
}

.lede {
  max-width: 320px;
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.8;
  letter-spacing: 0.005em;
}

.cta-group { margin-top: 34px; }

.btn {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.btn:active { transform: scale(0.985); }

.btn.primary {
  background: var(--paper);
  color: #171512;
}

.btn.primary .icon { width: 18px; height: 18px; }

.btn.ghost {
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: var(--text-2);
}

.btn.compact {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 21px;
}

.btn.link {
  min-height: 36px;
  padding: 0;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.btn.link:active { color: var(--paper); }

#chooseVideoBtn {
  width: 100%;
  height: 56px;
  justify-content: space-between;
  padding: 0 20px;
  font-size: 15px;
}

.cta-sub {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}

.sep { color: var(--text-3); font-size: 12px; }

.format-hint {
  margin: 20px 0 0;
  color: var(--text-3);
  font-size: 10px;
  letter-spacing: 0.045em;
}

.install-tip {
  margin-top: 24px;
  padding: 9px 8px 9px 11px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
}

.install-tip-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.install-tip-icon {
  width: 33px;
  height: 33px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--paper-soft);
  color: var(--paper);
}

.install-tip-icon .icon { width: 17px; height: 17px; }

.install-tip-copy { flex: 1; min-width: 0; }

.install-tip-copy strong {
  display: block;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}

.install-tip-copy small {
  display: block;
  margin-top: 2px;
  color: var(--text-3);
  font-size: 9px;
  line-height: 1.5;
}

.install-tip-main > .icon { width: 15px; height: 15px; color: var(--text-3); }

.recent { margin-top: 42px; }

.section-label {
  margin-bottom: 9px;
  color: var(--text-3);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.17em;
}

.recent-list { display: grid; gap: 7px; }

.recent-item {
  width: 100%;
  min-height: 58px;
  padding: 10px 12px 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.recent-item:active { background: var(--surface-2); }

.recent-copy { min-width: 0; flex: 1; }

.recent-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 550;
  color: var(--text);
}

.recent-meta {
  display: block;
  margin-top: 3px;
  color: var(--text-3);
  font-size: 10px;
  font-family: var(--mono);
}

.recent-item > .icon { width: 15px; height: 15px; color: var(--text-3); }

.feature-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 42px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.feature-strip li {
  min-width: 0;
  padding: 17px 8px 16px;
  border-right: 1px solid var(--line);
}

.feature-strip li:first-child { padding-left: 0; }
.feature-strip li:last-child { border-right: 0; }

.feature-strip .icon {
  width: 19px;
  height: 19px;
  margin-bottom: 9px;
  color: var(--paper);
  opacity: 0.8;
}

.feature-strip strong {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.04em;
}

.feature-strip span {
  display: block;
  margin-top: 3px;
  font-size: 9px;
  line-height: 1.5;
  color: var(--text-3);
}

.privacy-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 22px 0 0;
  color: var(--text-3);
  font-size: 10px;
}

.privacy-line .icon { width: 13px; height: 13px; }

/* ============ Player chrome ============ */
.player {
  min-height: 100vh;
  min-height: 100svh;
  padding-bottom: env(safe-area-inset-bottom);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px 44px;
  align-items: center;
  gap: 1px;
  padding: calc(env(safe-area-inset-top) + 5px) 8px 7px;
  background: rgba(13, 14, 15, 0.9);
  -webkit-backdrop-filter: blur(20px) saturate(130%);
  backdrop-filter: blur(20px) saturate(130%);
  border-bottom: 1px solid var(--line);
}

.top-titles {
  min-width: 0;
  padding: 0 4px;
}

.top-titles .kicker {
  font-size: 8px;
  letter-spacing: 0.16em;
  opacity: 0.58;
}

.top-titles h1 {
  margin: 2px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: 0.005em;
}

.icon-btn {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: var(--text-2);
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn:active { background: rgba(255, 255, 255, 0.07); color: var(--text); }
.icon-btn.quiet { color: var(--text-3); }
.icon-btn.small { width: 36px; height: 36px; }
.icon-btn.small .icon { width: 18px; height: 18px; }
.icon-btn.tiny { width: 28px; height: 28px; }
.icon-btn.tiny .icon { width: 15px; height: 15px; }

.player-scroll {
  padding: 10px 12px 0;
}

/* ============ Video card ============ */
.video-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}

@supports not (aspect-ratio: 1 / 1) {
  .video-wrap { height: 0; padding-top: 56.25%; }
  .video-wrap video { position: absolute; inset: 0; }
}

.video-wrap video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #000;
}

.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-3);
  font-size: 10px;
  letter-spacing: 0.04em;
  background: #000;
  pointer-events: none;
}

.video-placeholder .icon { width: 24px; height: 24px; opacity: 0.55; }

.video-tap {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: 0;
}

.subtitle {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 3;
  display: flex;
  justify-content: center;
  pointer-events: none;
  font-size: var(--sub-size, 18px);
  line-height: 1.42;
  font-weight: 500;
  text-align: center;
  letter-spacing: 0.005em;
}

.subtitle.top { top: 10px; bottom: auto; }
.subtitle.native-caption { display: none; }

.subtitle span {
  max-width: 94%;
  padding: 3px 10px 4px;
  border-radius: 5px;
  color: #fff;
  background: rgba(0, 0, 0, 0.62);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  white-space: pre-line;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.pip-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 20px;
  color: rgba(255, 255, 255, 0.8);
  background: rgba(0, 0, 0, 0.52);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-size: 9px;
  letter-spacing: 0.06em;
  pointer-events: none;
}

.pulse {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 0 0 0 rgba(224, 211, 181, 0.5);
  animation: pipPulse 2.4s infinite;
}

@keyframes pipPulse {
  0% { box-shadow: 0 0 0 0 rgba(224, 211, 181, 0.4); }
  60% { box-shadow: 0 0 0 6px rgba(224, 211, 181, 0); }
  100% { box-shadow: 0 0 0 0 rgba(224, 211, 181, 0); }
}

.cc-chip {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
  min-width: 29px;
  height: 23px;
  padding: 0 6px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 5px;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(0, 0, 0, 0.32);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.09em;
}

.cc-chip.on {
  color: var(--paper);
  border-color: var(--paper-line);
  background: rgba(0, 0, 0, 0.48);
}

/* ============ Timeline ============ */
.timeline { padding: 9px 14px 0; }

.progress {
  position: relative;
  height: 27px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
  outline-offset: 4px;
}

.progress-track {
  position: relative;
  width: 100%;
  height: 3px;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.14);
}

.progress-buffered,
.progress-played {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(0);
}

.progress-buffered { background: rgba(255, 255, 255, 0.18); }
.progress-played { background: var(--paper); }

.progress-thumb {
  position: absolute;
  top: 50%;
  left: 0;
  width: 11px;
  height: 11px;
  margin-left: -5.5px;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 0 0 3px rgba(224, 211, 181, 0.13);
  transform: translateY(-50%);
  pointer-events: none;
  opacity: 0.9;
}

.seek-tip {
  position: absolute;
  bottom: 25px;
  left: 0;
  padding: 3px 7px;
  transform: translateX(-50%);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--text);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.03em;
  white-space: nowrap;
  pointer-events: none;
}

.time-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1px;
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.03em;
}

/* ============ Controls ============ */
.controls {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 6px 9px 11px;
}

.ctrl-round {
  width: 40px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--text-2);
}

.ctrl-round .icon { width: 23px; height: 23px; }
.ctrl-round:active { color: var(--paper); }

.play-btn {
  width: 46px;
  height: 46px;
  margin: 0 4px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--paper);
  color: #171512;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.3);
}

.play-btn .icon { width: 23px; height: 23px; }
.play-btn:active { background: var(--paper-strong); transform: scale(0.97); }

.ctrl-spacer { flex: 1; min-width: 2px; }

.ctrl-label {
  width: 44px;
  height: 46px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-3);
  font-size: 8px;
  letter-spacing: 0.05em;
}

.ctrl-label .icon { width: 19px; height: 19px; }
.ctrl-label:active { color: var(--paper); }

/* ============ Resume / PiP bar ============ */
.resume-bar,
.pip-banner {
  min-height: 38px;
  margin: 0 11px 11px;
  padding: 6px 7px 6px 11px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--paper-line);
  border-radius: 9px;
  background: var(--paper-soft);
  color: var(--text-2);
  font-size: 10px;
}

.resume-bar span:first-child { flex: 1; min-width: 0; }

.pip-banner-text { flex: 1; min-width: 0; }

.mini-action {
  min-height: 26px;
  padding: 0 8px;
  border-radius: 6px;
  background: rgba(224, 211, 181, 0.12);
  color: var(--paper);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

/* ============ Notes ============ */
.notes-section {
  margin-top: 18px;
  padding: 0 4px;
}

.notes-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
}

.notes-head h2 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.count {
  min-width: 18px;
  height: 17px;
  padding: 0 5px;
  display: inline-grid;
  place-items: center;
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
}

.notes-tools {
  display: flex;
  align-items: center;
  gap: 0;
  margin-right: -6px;
}

.search-wrap {
  height: 39px;
  margin: 4px 0 6px;
  padding: 0 6px 0 11px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.search-wrap .icon { width: 16px; height: 16px; color: var(--text-3); }

.search-wrap input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
}

.search-wrap input::placeholder { color: var(--text-3); }
.search-wrap input::-webkit-search-cancel-button { display: none; }

.notes-list { margin-top: 2px; }

.note {
  position: relative;
  display: flex;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  transition: background 0.4s ease;
}

.note.flash { background: rgba(224, 211, 181, 0.1); }

.note-open {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 41px minmax(0, 1fr) auto;
  gap: 9px;
  padding: 14px 0 14px 2px;
  text-align: left;
  align-items: start;
}

.note-time {
  padding-top: 2px;
  color: var(--paper);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.5;
  letter-spacing: 0.01em;
  opacity: 0.86;
}

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

.note-text {
  display: block;
  color: var(--text);
  font-size: 14px;
  line-height: 1.68;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  -webkit-user-select: text;
  user-select: text;
}

.note-sub {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  margin-top: 6px;
  padding-left: 8px;
  border-left: 2px solid var(--line-strong);
  color: var(--text-3);
  font-size: 10px;
  line-height: 1.65;
}

.note-thumb {
  width: 67px;
  height: 42px;
  margin-top: 1px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #000;
}

.note-more {
  width: 31px;
  height: 34px;
  margin-top: 9px;
  display: grid;
  place-items: center;
  color: var(--text-3);
}

.note-more .icon { width: 17px; height: 17px; }

.notes-empty {
  padding: 43px 12px 46px;
  text-align: center;
}

.empty-mark {
  width: 43px;
  height: 43px;
  margin: 0 auto 13px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text-3);
}

.empty-mark .icon { width: 19px; height: 19px; }

.notes-empty p {
  margin: 0 0 5px;
  color: var(--text-2);
  font-size: 12px;
}

.notes-empty span {
  color: var(--text-3);
  font-size: 10px;
  line-height: 1.7;
  white-space: pre-line;
}

.notes-bottom-space { height: 92px; }

/* ============ Mini bar / focus ============ */
.mini-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 45;
  width: auto;
  max-width: 536px;
  margin: 0 auto;
  padding: 7px 9px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: rgba(27, 30, 34, 0.93);
  -webkit-backdrop-filter: blur(22px) saturate(130%);
  backdrop-filter: blur(22px) saturate(130%);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.46);
  animation: miniIn 0.22s ease both;
}

@keyframes miniIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.mini-play {
  width: 37px;
  height: 37px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--paper);
  color: #171512;
}

.mini-play .icon { width: 19px; height: 19px; }

.mini-info {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.mini-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 550;
  color: var(--text);
}

.mini-time {
  display: block;
  margin-top: 1px;
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.02em;
}

.focus-status {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 59px);
  left: 12px;
  right: 12px;
  z-index: 45;
  width: auto;
  max-width: 536px;
  margin: 0 auto;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(21, 23, 26, 0.94);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: var(--text-3);
  font-size: 10px;
}

.focus-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--paper);
}

.focus-actions {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 46;
  display: flex;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
}

.focus-action {
  min-height: 40px;
  padding: 0 17px;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: rgba(27, 30, 34, 0.96);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.36);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.focus-action.primary {
  border-color: transparent;
  background: var(--paper);
  color: #171512;
}

body.focus-mode .video-card,
body.focus-mode .mini-bar { display: none !important; }

body:not(.focus-mode) .focus-actions { display: none; }

body.focus-mode .focus-status { display: flex !important; }
body.focus-mode .focus-actions { display: flex !important; }

body.focus-mode .player-scroll { padding-top: 55px; }
body.focus-mode .notes-section { margin-top: 6px; }

/* ============ Sheets ============ */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, 0.58);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.24s ease;
  touch-action: none;
}

.scrim.show { opacity: 1; }

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  max-height: 88svh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  background: #17191c;
  box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.36);
  transform: translateY(105%);
  visibility: hidden;
  transition: transform 0.27s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0.27s;
}

.sheet.open {
  transform: translateY(0);
  visibility: visible;
}

/* iOS Safari keeps fixed elements behind the software keyboard; lift the
   open sheet by the visual-viewport inset only when the layout viewport
   itself did not resize (otherwise this would double-shift). */
body.keyboard-open .sheet.open {
  bottom: var(--keyboard-inset, 0px);
  max-height: calc(100vh - var(--keyboard-inset, 0px) - 8px);
  max-height: calc(100svh - var(--keyboard-inset, 0px) - 8px);
}

body.keyboard-open .toast {
  bottom: calc(var(--keyboard-inset, 0px) + 18px + env(safe-area-inset-bottom));
}

body.focus-mode .toast {
  bottom: calc(76px + env(safe-area-inset-bottom));
}

.sheet.tall { max-height: 92vh; max-height: 92svh; }
.sheet.actions { max-height: 70vh; max-height: 70svh; }

.sheet-grab {
  width: 36px;
  height: 4px;
  flex: none;
  margin: 8px auto 3px;
  border-radius: 4px;
  background: var(--line-strong);
}

.sheet-head {
  flex: none;
  padding: 10px 18px 8px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.sheet-head h2 {
  margin: 3px 0 0;
  font-size: 20px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.sheet-head .kicker { opacity: 0.6; }
.compact-head { padding-bottom: 2px; }
.compact-head h2 { margin: 0; font-size: 16px; }

.sheet-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 7px 18px 16px;
}

.sheet.tall .sheet-body {
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

.sheet-foot {
  flex: none;
  padding: 10px 18px calc(12px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 9px;
  border-top: 1px solid var(--line);
}

.sheet-foot .btn { flex: 1; }
.sheet-foot .btn.compact { flex: 0 0 auto; }
.sheet-foot.single .btn { flex: 1; }

/* Composer */
.composer-body { display: flex; flex-direction: column; }

.note-thumb-wrap {
  margin-bottom: 11px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #000;
}

.note-thumb-wrap img {
  width: 100%;
  max-height: 174px;
  object-fit: cover;
}

#noteText {
  width: 100%;
  min-height: 142px;
  max-height: 34vh;
  max-height: 34svh;
  padding: 13px 14px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.72;
  -webkit-appearance: none;
}

#noteText:focus { border-color: var(--paper-line); }
#noteText::placeholder { color: var(--text-3); }

.note-sub-q {
  margin-top: 9px;
  padding-left: 9px;
  border-left: 2px solid var(--line-strong);
  color: var(--text-3);
  font-size: 10px;
  line-height: 1.65;
}

.composer-tip {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0 0;
  color: var(--text-3);
  font-size: 9px;
  letter-spacing: 0.02em;
}

.composer-tip .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--paper);
  opacity: 0.7;
}

/* Settings */
.setting-block {
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.setting-block:first-child { padding-top: 7px; }
.setting-block:last-of-type { border-bottom: 0; }

.setting-label {
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.035em;
}

.setting-note {
  margin-top: 7px;
  color: var(--text-3);
  font-size: 10px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.setting-row-actions { display: flex; gap: 10px; }

.text-btn {
  min-height: 28px;
  color: var(--paper);
  font-size: 11px;
  font-weight: 600;
}

.text-btn.muted { color: var(--text-3); }

.setting-subrow {
  margin-top: 11px;
  display: flex;
  align-items: center;
  gap: 11px;
}

.setting-mini-label {
  width: 30px;
  flex: none;
  color: var(--text-3);
  font-size: 10px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.chips button {
  min-width: 48px;
  height: 34px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.01em;
}

.chips button.active {
  border-color: var(--paper-line);
  background: var(--paper-soft);
  color: var(--paper);
}

.chips.small { margin-top: 0; }
.chips.small button { min-width: 46px; height: 30px; padding: 0 9px; font-family: var(--sans); font-size: 10px; }

.stepper {
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.stepper button {
  width: 34px;
  height: 30px;
  color: var(--text-2);
  font-size: 15px;
}

.stepper button:active { color: var(--paper); }

.stepper span {
  min-width: 46px;
  text-align: center;
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 10px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.switch-row:first-child { border-top: 0; padding-top: 0; }
.switch-row:last-child { padding-bottom: 0; }

.switch-row strong {
  display: block;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
}

.switch-row small {
  display: block;
  margin-top: 2px;
  color: var(--text-3);
  font-size: 9px;
}

.switch {
  position: relative;
  flex: none;
  width: 42px;
  height: 25px;
  margin: 0;
  border-radius: 20px;
  background: #2a2e33;
  -webkit-appearance: none;
  appearance: none;
  transition: background 0.18s ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #8e8b83;
  transition: transform 0.18s ease, background 0.18s ease;
}

.switch:checked { background: var(--paper); }
.switch:checked::after { transform: translateX(17px); background: #171512; }

.actions-block { padding-bottom: 0; }

.wide-action {
  width: 100%;
  min-height: 51px;
  padding: 10px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  text-align: left;
}

.wide-action strong {
  display: block;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
}

.wide-action small {
  display: block;
  margin-top: 2px;
  color: var(--text-3);
  font-size: 9px;
}

.wide-action .icon { width: 15px; height: 15px; color: var(--text-3); }
.wide-action.danger strong, .wide-action.danger .icon { color: var(--danger); }

.settings-footnote {
  margin: 14px 0 6px;
  color: var(--text-3);
  text-align: center;
  font-size: 9px;
  line-height: 1.7;
}

/* Help */
.data-lede {
  margin: 7px 0 12px;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.75;
}

.data-actions .wide-action:first-child { border-top: 0; }

.help-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.help-list li {
  display: flex;
  gap: 13px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.help-list li:first-child { padding-top: 7px; }
.help-list li:last-child { border-bottom: 0; }

.help-num {
  flex: none;
  padding-top: 2px;
  color: var(--paper);
  font-family: var(--mono);
  font-size: 9px;
  opacity: 0.7;
}

.help-list strong {
  display: block;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 550;
}

.help-list p {
  margin: 4px 0 0;
  color: var(--text-3);
  font-size: 10px;
  line-height: 1.75;
}

.help-note {
  margin: 17px 0 4px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text-3);
  font-size: 9px;
  line-height: 1.7;
}

/* URL */
.text-input {
  width: 100%;
  height: 50px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  -webkit-appearance: none;
}

.text-input:focus { border-color: var(--paper-line); }
.text-input::placeholder { color: var(--text-3); }

.form-hint {
  margin: 12px 0 0;
  color: var(--text-3);
  font-size: 10px;
  line-height: 1.75;
}

.form-error {
  margin: 9px 0 0;
  color: var(--danger);
  font-size: 10px;
  line-height: 1.6;
}

/* Action sheet */
.action-list { padding: 0 18px; }

.action-item {
  width: 100%;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text-2);
  font-size: 13px;
  text-align: left;
}

.action-item:last-child { border-bottom: 0; }
.action-item .icon { width: 18px; height: 18px; color: var(--text-3); }
.action-item.danger { color: var(--danger); }
.action-item.danger .icon { color: var(--danger); }

/* Screenshot modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.78);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.modal-card {
  width: 100%;
  max-width: 430px;
  max-height: 91vh;
  max-height: 91svh;
  overflow-y: auto;
  padding: 15px;
  border: 1px solid var(--line-strong);
  border-radius: 17px;
  background: #17191c;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 11px;
}

.modal-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

#shotPreview {
  width: 100%;
  max-height: 51vh;
  max-height: 51svh;
  object-fit: contain;
  border-radius: 8px;
  background: #000;
}

.modal-hint {
  margin: 11px 2px 13px;
  color: var(--text-3);
  font-size: 10px;
  line-height: 1.65;
}

.modal-actions {
  display: flex;
  gap: 8px;
}

.modal-actions .btn { flex: 1; min-height: 43px; font-size: 12px; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 110;
  max-width: calc(100vw - 32px);
  padding: 9px 13px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #292d31;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.42);
  color: var(--text);
  font-size: 11px;
  line-height: 1.5;
  transform: translateX(-50%) translateY(10px);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-action {
  flex: none;
  color: var(--paper);
  font-size: 11px;
  font-weight: 650;
  pointer-events: auto;
}

/* Desktop framing */
@media (min-width: 600px) {
  body { background: #08090a; }
  .app {
    border-left: 1px solid rgba(255, 255, 255, 0.045);
    border-right: 1px solid rgba(255, 255, 255, 0.045);
  }
  .sheet { border-radius: 22px 22px 0 0; }
}

@media (max-width: 359px) {
  .landing { padding-left: 19px; padding-right: 19px; }
  .controls { padding-left: 6px; padding-right: 6px; }
  .ctrl-label { width: 40px; }
  .ctrl-round { width: 37px; }
  .play-btn { width: 43px; height: 43px; }
}

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