:root {
  --bg-app: #F7F6F1;
  --bg-card: #FAF9F5;
  --border-soft: #E5E0D6;

  --green: #A8CDB8;
  --green-border: #8DB79F;
  --green-text: #2F5F4B;

  --yellow: #F1D395;
  --yellow-border: #D9B96A;
  --yellow-text: #6A4A16;

  --danger: #EBC0B1;
  --text-main: #2F2F2F;
  --text-muted: #6B6B6B;

  --shadow-soft: 0 12px 32px rgba(80, 70, 50, 0.08);
  --radius-card: 24px;
  --radius-button: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  color: var(--text-main);
  background: var(--bg-app);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button,
label.button {
  user-select: none;
}

.app-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 20px;
  width: 100%;
  height: 100vh;
  min-width: 0;
  overflow: hidden;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  min-width: 0;
  min-height: 76px;
  padding: 17px 22px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  background: color-mix(in srgb, var(--bg-card) 82%, transparent);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px) saturate(1.04);
}

.brand-row,
.brand-heading,
.top-actions,
.playback-row,
.timeline-actions,
.range-meta,
.panel-heading,
.two-buttons,
.volume-group {
  display: flex;
  align-items: center;
}

.brand-row {
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
}

.brand-heading {
  gap: 14px;
  min-width: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  color: var(--text-main);
  font-size: 24px;
  letter-spacing: 0;
}

h2 {
  color: var(--text-main);
  font-size: 17px;
  font-weight: 760;
}

h3 {
  color: var(--text-main);
  font-size: 15px;
  font-weight: 760;
}

.topbar p,
.panel-heading p,
.range-meta,
.field-label,
.empty-video span {
  color: var(--text-muted);
}

.version-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-button);
  background: color-mix(in srgb, var(--bg-card) 76%, transparent);
}

.version-pill {
  min-height: 27px;
  padding: 5px 13px;
  color: var(--green-text);
  font-size: 12px;
  font-weight: 820;
}

.top-actions {
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  flex: 0 1 auto;
  min-width: 0;
}

.status-pill {
  gap: 9px;
  min-height: 34px;
  padding: 8px 16px;
  color: var(--text-muted);
  font-size: 13px;
}

.status-pill span {
  width: 9px;
  height: 9px;
  border-radius: var(--radius-button);
  background: var(--green-text);
}

.workbench {
  display: grid;
  grid-template-columns: 320px minmax(560px, 1fr) 350px;
  gap: 20px;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.entry-list-panel {
  grid-area: list;
}

.center-stage {
  grid-area: center;
}

.comment-panel,
.right-panel {
  grid-area: right;
}

.panel {
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  background: color-mix(in srgb, var(--bg-card) 88%, transparent);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px) saturate(1.03);
}

.entry-list-panel,
.editor-panel,
.video-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
}

.center-stage {
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.video-panel {
  height: 100%;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.comment-panel,
.right-panel {
  height: 100%;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.panel-heading {
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
}

.panel-heading span,
.panel-heading p {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 650;
}

.field {
  width: 100%;
  border: 1px solid var(--border-soft);
  outline: none;
  border-radius: var(--radius-button);
  background: color-mix(in srgb, var(--bg-app) 76%, transparent);
  color: var(--text-main);
}

.search-field {
  min-height: 46px;
  padding: 13px 15px;
}

.field:focus,
.note-field:focus {
  border-color: var(--green-border);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 28%, transparent);
}

.field-label {
  display: block;
  margin-bottom: -6px;
  font-size: 12px;
  font-weight: 760;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-height: 38px;
  padding: 10px 18px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-button);
  color: var(--text-main);
  background: color-mix(in srgb, var(--bg-card) 82%, transparent);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  font-size: 13px;
  font-weight: 720;
  line-height: 1;
  text-decoration: none;
  transition: filter 0.14s ease, opacity 0.14s ease, transform 0.14s ease;
}

.button:hover {
  filter: brightness(0.98);
  transform: translateY(-1px);
}

.button:disabled {
  cursor: default;
  opacity: 0.42;
  transform: none;
}

.button.primary,
.range-start {
  border-color: var(--green-border);
  background: var(--green);
  color: var(--green-text);
}

.button.ghost,
.nudge {
  border-color: var(--border-soft);
  background: color-mix(in srgb, var(--bg-card) 82%, transparent);
  color: var(--text-main);
}

.button.export,
.range-end {
  border-color: var(--yellow-border);
  background: var(--yellow);
  color: var(--yellow-text);
}

.button.compact {
  min-height: 30px;
  padding: 8px 13px;
  border-radius: calc(var(--radius-button) - 5px);
  font-size: 12px;
}

.button.danger,
.range-clear {
  border-color: var(--border-soft);
  background: var(--danger);
  color: var(--text-main);
}

.range-start,
.range-end {
  min-width: 112px;
}

.nudge {
  width: 64px;
  min-width: 64px;
  padding-right: 0;
  padding-left: 0;
}

.entry-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--border-soft);
  border-radius: calc(var(--radius-card) - 4px);
  background: color-mix(in srgb, var(--bg-card) 42%, transparent);
}

.entry-row {
  position: relative;
  width: 100%;
  padding: 12px 12px 12px 14px;
  border: 1px solid var(--border-soft);
  border-radius: calc(var(--radius-button) - 1px);
  background: color-mix(in srgb, var(--bg-app) 74%, transparent);
  text-align: left;
  cursor: pointer;
}

.entry-row.selected {
  border-color: var(--green-border);
  background: color-mix(in srgb, var(--green) 26%, var(--bg-card));
}

.entry-row.selected::before {
  content: "";
  position: absolute;
  left: 0;
  top: 13px;
  bottom: 13px;
  width: 4px;
  border-radius: var(--radius-button);
  background: var(--green);
}

.entry-row-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 760;
}

.entry-row-note {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 680;
  line-height: 1.42;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.selected .entry-row-note {
  color: var(--text-main);
}

.empty-list {
  display: grid;
  flex: 1;
  min-height: 100%;
  place-items: center;
  border: 0;
  border-radius: calc(var(--radius-button) - 1px);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 680;
  opacity: 0.52;
}

.panel-footer {
  display: flex;
  gap: 10px;
  margin-top: auto;
}

.video-drop-zone {
  position: relative;
  display: grid;
  flex: 1;
  min-width: 0;
  min-height: 390px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  background: color-mix(in srgb, var(--bg-card) 46%, transparent);
}

.video-drop-zone::before {
  content: "";
  position: absolute;
  inset: 62px 42px;
  border: 2px dashed var(--green-border);
  border-radius: var(--radius-card);
  opacity: 0.42;
  pointer-events: none;
}

.video-drop-zone:has(#reviewVideo.has-video)::before {
  display: none;
}

.video-drop-zone.dragging {
  border-color: var(--green-border);
  background: color-mix(in srgb, var(--green) 24%, transparent);
}

#reviewVideo {
  display: none;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-card);
  background: var(--bg-app);
  object-fit: contain;
}

#reviewVideo.has-video {
  display: block;
}

.empty-video {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 13px;
  justify-items: center;
  color: var(--text-main);
  text-align: center;
}

.empty-video strong {
  font-size: 17px;
  font-weight: 760;
}

.empty-video .button {
  margin-top: 2px;
}

.lucide-icon {
  color: var(--green-text);
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.control-card {
  display: flex;
  flex-direction: column;
  gap: 13px;
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: visible;
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  background: color-mix(in srgb, var(--bg-card) 72%, transparent);
  box-shadow: var(--shadow-soft);
}

.control-card .button {
  height: 48px;
  min-width: 72px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: var(--radius-button);
  white-space: nowrap;
}

.control-card .button.compact {
  height: 48px;
  min-width: 72px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: var(--radius-button);
}

.control-card .nudge {
  width: 64px;
  min-width: 64px;
  padding: 0;
}

.playback-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 8px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-button);
  background: color-mix(in srgb, var(--bg-card) 80%, transparent);
}

.play-button {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid var(--green-border);
  border-radius: var(--radius-button);
  background: var(--green);
  color: var(--green-text);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}

.player-icon {
  width: 24px;
  height: 24px;
}

.icon-pause {
  display: none;
}

.play-button.is-playing .icon-play {
  display: none;
}

.play-button.is-playing .icon-pause {
  display: block;
}

.mono-time {
  flex: 1 1 auto;
  min-width: 0;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-weight: 760;
  letter-spacing: 0;
}

.volume-group {
  flex: 0 1 280px;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  margin-left: auto;
}

.icon-button {
  position: relative;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-button);
  background: color-mix(in srgb, var(--bg-card) 82%, transparent);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}

.volume-icon {
  position: absolute;
  inset: 12px;
  width: 22px;
  height: 22px;
}

.icon-volume-x {
  display: none;
}

.speaker-button.is-muted .icon-volume {
  display: none;
}

.speaker-button.is-muted .icon-volume-x {
  display: block;
}

.volume-slider,
.timeline-slider {
  accent-color: var(--green);
}

.volume-slider {
  flex: 1 1 120px;
  min-width: 88px;
  max-width: 160px;
}

.range-meta {
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
  font-size: 13px;
}

.range-meta b {
  color: var(--green-text);
}

.range-meta em {
  margin-left: auto;
  color: var(--text-muted);
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-style: normal;
  font-weight: 720;
}

.timeline-slider {
  width: 100%;
  min-width: 0;
}

.timeline-actions {
  width: 100%;
  min-width: 0;
  gap: 12px;
  flex-wrap: wrap;
  overflow: hidden;
}

.range-start,
.range-end,
.range-clear {
  order: 1;
}

.range-clear {
  margin-left: auto;
}

.nudge-group {
  display: flex;
  order: 2;
  flex: 1 0 100%;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-button);
  background: color-mix(in srgb, var(--bg-app) 64%, transparent);
}

.timecode-field {
  position: relative;
}

.timecode-field .field {
  min-height: 48px;
  padding: 13px 86px 13px 14px;
}

.timecode-field .button {
  position: absolute;
  top: 6px;
  right: 7px;
}

.note-field {
  min-height: 184px;
  padding: 18px;
  resize: vertical;
  line-height: 1.55;
}

.annotation-box,
.helper-box {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  background: color-mix(in srgb, var(--bg-card) 54%, transparent);
}

.helper-box {
  margin-top: 6px;
  padding-top: 24px;
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.reference-preview {
  display: grid;
  min-height: 82px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-button);
  background: color-mix(in srgb, var(--bg-app) 72%, transparent);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 720;
}

.reference-preview img {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
}

.two-buttons {
  gap: 18px;
}

.two-buttons > * {
  flex: 1;
}

#codex-browser-sidebar-comments-root {
  display: none !important;
}

@media (max-width: 900px) {
  .app-shell {
    padding: 14px;
  }
}

@media (max-width: 1320px) {
  .app-shell {
    padding: 14px;
  }

  .workbench {
    grid-template-columns: 300px minmax(0, 1fr) 320px;
    gap: 14px;
  }

  .entry-list-panel,
  .editor-panel,
  .video-panel {
    padding: 14px;
  }

  .video-drop-zone {
    min-height: 300px;
  }

  .control-card {
    padding: 12px;
  }

  .timeline-actions {
    gap: 10px;
  }

  .nudge-group {
    flex: 1 1 240px;
  }
}

@media (max-width: 1180px) {
  .app-shell {
    gap: 16px;
    padding: 12px;
  }

  .topbar {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 18px;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .workbench {
    grid-template-columns: minmax(0, 1fr) 320px;
    grid-template-areas:
      "center right"
      "list right";
    grid-auto-rows: max-content;
    gap: 14px;
    height: auto;
    overflow-y: auto;
    align-items: start;
    align-content: start;
  }

  .workbench > * {
    align-self: start;
  }

  .entry-list-panel,
  .editor-panel,
  .video-panel {
    padding: 14px;
  }

  .center-stage {
    display: contents;
    height: auto;
    overflow: visible;
  }

  .video-panel {
    display: grid;
    align-content: start;
    grid-area: center;
    height: auto;
    overflow: visible;
  }

  .video-drop-zone {
    min-height: 280px;
  }

  .playback-row {
    flex-wrap: wrap;
    gap: 10px;
  }

  .mono-time {
    flex: 1 1 calc(100% - 58px);
    white-space: nowrap;
  }

  .volume-group {
    flex: 1 0 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  .range-meta {
    gap: 10px;
  }

  .range-meta em {
    margin-left: 0;
  }

  .two-buttons {
    flex-wrap: wrap;
  }
}

@media (max-width: 960px) {
  .entry-list-panel,
  .video-panel,
  .comment-panel,
  .right-panel {
    display: grid;
    align-content: start;
    gap: 12px;
  }

  .workbench {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "center"
      "right"
      "list";
    grid-auto-rows: max-content;
    height: auto;
    align-items: start;
  }

  .comment-panel,
  .right-panel,
  .entry-list-panel {
    height: auto;
  }

  .comment-panel,
  .right-panel {
    max-height: none;
    overflow: visible;
  }

  .video-drop-zone {
    min-height: 240px;
  }

  .timeline-actions {
    gap: 10px;
  }

  .range-start,
  .range-end,
  .range-clear {
    flex: 1 1 120px;
    margin-left: 0;
  }

  .nudge-group {
    justify-content: flex-start;
  }
}

@media (max-height: 920px) {
  .entry-list-panel,
  .editor-panel,
  .video-panel {
    gap: 12px;
    padding: 14px;
  }

  .video-drop-zone {
    min-height: 300px;
  }

  .control-card {
    gap: 10px;
    padding: 12px;
  }

  .playback-row {
    min-height: 48px;
    padding: 6px 10px;
  }

  .note-field {
    min-height: 136px;
    padding: 14px;
  }

  .annotation-box,
  .helper-box {
    gap: 12px;
    padding: 14px;
  }

  .helper-box {
    margin-top: 0;
    padding-top: 18px;
  }

  .reference-preview {
    min-height: 68px;
  }

  .two-buttons {
    gap: 12px;
  }
}

@media (max-height: 760px) {
  .video-drop-zone {
    min-height: 220px;
  }

  .control-card {
    gap: 8px;
    padding: 10px;
  }

  .range-meta {
    gap: 8px;
  }

  .note-field {
    min-height: 112px;
  }

  .reference-preview {
    min-height: 56px;
  }

  .playback-row {
    gap: 8px;
  }

  .mono-time {
    white-space: nowrap;
    font-size: 13px;
  }

  .volume-group {
    flex-basis: 228px;
    gap: 8px;
  }

  .volume-slider {
    max-width: 108px;
  }
}
