:root {
  color-scheme: light;
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --ink: #1f2528;
  --muted: #68727a;
  --line: #d7dde2;
  --accent: #16796f;
  --accent-dark: #0f4f4a;
  --accent-soft: #e7f4f1;
  --danger: #b64242;
  --danger-soft: #fff2f2;
  --tag: #2f5d8c;
  --tag-soft: #edf4fb;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
textarea,
input {
  font: inherit;
}

.app-shell {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(28px, 5vw, 42px);
}

h2 {
  font-size: 18px;
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted);
  font-size: 14px;
}

.video-area {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101315;
  aspect-ratio: 16 / 9;
}

.review-workspace {
  margin-top: 0;
}

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

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 20px;
  background: #ffffff;
  text-align: center;
}

.empty-state strong {
  font-size: 20px;
}

.empty-state span,
.hint,
.button-tip {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.upload-button,
button,
.export-links a,
.export-button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}

.upload-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  background: var(--accent);
  color: #fff;
}

.upload-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.control-panel,
.notes-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.player-controls {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px 12px;
}

.player-row {
  display: grid;
  grid-template-columns: 72px 1fr 72px;
  gap: 8px;
  align-items: center;
}

.icon-button,
.play-control {
  min-height: 44px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink);
}

.play-control {
  background: var(--accent);
  color: #fff;
}

.seek-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 64px;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

.seek-row span:last-child {
  text-align: right;
}

.seek-bar {
  width: 100%;
  accent-color: var(--accent);
}

.time-readout {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.time-readout span {
  color: var(--muted);
}

.time-readout strong {
  font-variant-numeric: tabular-nums;
  font-size: 30px;
}

.button-row {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(132px, 0.65fr);
  gap: 10px;
  margin-bottom: 8px;
}

button {
  min-height: 48px;
  padding: 0 12px;
  font-weight: 700;
  line-height: 1.2;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.primary-button {
  background: var(--accent);
  color: #fff;
  touch-action: none;
  user-select: none;
}

.primary-button.recording {
  background: var(--danger);
}

.fallback-audio-button {
  width: 100%;
  margin: 0 0 8px;
  border: 1px solid var(--line);
  background: var(--danger-soft);
  color: var(--danger);
}

.fallback-audio-input {
  display: none;
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink);
}

.button-tip {
  margin: 0 0 10px;
}

textarea {
  display: block;
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  line-height: 1.6;
  color: var(--ink);
}

.hint {
  margin-top: 8px;
}

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

.export-links {
  display: flex;
  gap: 8px;
}

.export-links a {
  border: 1px solid var(--line);
  padding: 8px 10px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 14px;
}

.export-button {
  min-height: 39px;
  padding: 8px 10px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
}

.notes-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.note-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.empty-note {
  color: var(--muted);
}

.note-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.note-meta-left {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.time-button {
  border: 1px solid var(--line);
  background: var(--accent-soft);
  color: var(--accent-dark);
  min-height: 36px;
  font-variant-numeric: tabular-nums;
}

.type-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  max-width: 100%;
  border: 1px solid #cbdff1;
  border-radius: 8px;
  padding: 0 9px;
  background: var(--tag-soft);
  color: var(--tag);
  font-size: 13px;
  font-weight: 700;
}

.delete-button {
  flex: 0 0 auto;
  border: 1px solid #ebc8c8;
  min-height: 36px;
  background: var(--danger-soft);
  color: var(--danger);
}

.note-text {
  white-space: pre-wrap;
  line-height: 1.6;
}

audio {
  width: 100%;
  margin-top: 8px;
}

@media (max-width: 640px) {
  html,
  body {
    min-height: 100svh;
  }

  .app-shell {
    padding: 8px;
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
  }

  .eyebrow {
    display: none;
  }

  h1 {
    font-size: 22px;
  }

  .status-pill {
    width: auto;
    padding: 6px 10px;
    font-size: 13px;
  }

  .review-workspace {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
  }

  .control-panel,
  .notes-panel,
  .player-controls {
    margin-top: 0;
  }

  .video-area {
    width: min(68vw, 300px);
    margin: 0 auto;
    aspect-ratio: 9 / 16;
  }

  .player-controls {
    padding: 8px;
  }

  .player-row {
    grid-template-columns: 48px 66px 48px;
    justify-content: center;
    gap: 6px;
  }

  .icon-button,
  .play-control {
    min-height: 34px;
    padding: 0 6px;
    font-size: 13px;
  }

  .seek-row {
    grid-template-columns: 52px minmax(0, 1fr) 52px;
    gap: 6px;
    margin-top: 6px;
    font-size: 12px;
  }

  .control-panel {
    padding: 10px;
  }

  .time-readout {
    margin-bottom: 8px;
  }

  .time-readout strong {
    font-size: 24px;
  }

  .button-row {
    grid-template-columns: minmax(0, 1fr) 86px;
    gap: 8px;
    margin-bottom: 6px;
  }

  button {
    min-height: 38px;
  }

  .primary-button {
    min-height: 44px;
  }

  .secondary-button {
    font-size: 13px;
  }

  .button-tip {
    display: none;
  }

  textarea {
    min-height: 58px;
    max-height: 78px;
    padding: 9px 10px;
    font-size: 14px;
    line-height: 1.45;
  }

  .hint {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.45;
  }

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

  .export-links {
    width: 100%;
  }

  .export-links a {
    flex: 1 1 0;
    text-align: center;
  }
}

@media (max-width: 640px) and (max-height: 760px) {
  .video-area {
    width: min(58vw, 260px);
  }

  textarea {
    min-height: 48px;
    max-height: 60px;
  }

  .hint {
    display: none;
  }
}
