:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #64727d;
  --line: #dde5e8;
  --surface: #f6f8f7;
  --panel: #ffffff;
  --green: #147d64;
  --green-dark: #0f5f4f;
  --red: #b64b4b;
  --amber: #b77a21;
  --blue: #2f6f9f;
  --shadow: 0 14px 36px rgba(23, 32, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--surface);
  color: var(--ink);
  font-family:
    Inter, "Pretendard", "Segoe UI", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px 18px;
  background: #0f1d20;
  color: #f8fbfa;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #e9f5ef;
  color: #0f5f4f;
  font-weight: 800;
}

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

.brand span {
  margin-top: 2px;
  color: #a9bbb8;
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #c7d6d3;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: #193236;
  color: #ffffff;
}

.nav-icon {
  width: 18px;
  text-align: center;
}

.side-panel {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.side-panel h2 {
  margin: 0 0 14px;
  font-size: 14px;
}

.channel-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
}

.channel-row strong,
.channel-row small {
  display: block;
}

.channel-row small {
  color: #a9bbb8;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #84929a;
}

.status-dot.live {
  background: #50c878;
  box-shadow: 0 0 0 5px rgba(80, 200, 120, 0.12);
}

.workspace {
  min-width: 0;
  padding: 28px;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  font-size: 30px;
  line-height: 1.18;
}

h2 {
  font-size: 18px;
}

.top-actions,
.review-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.primary-button,
.secondary-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.primary-button {
  padding: 0 16px;
  background: var(--green);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--green-dark);
}

.secondary-button {
  padding: 0 14px;
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
}

.secondary-button:hover {
  border-color: #b7c7cc;
}

.icon-button {
  width: 42px;
  background: #ffffff;
  border-color: var(--line);
  color: var(--ink);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card,
.video-card,
.clip-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 18px;
}

.metric-card span,
.metric-card small {
  display: block;
  color: var(--muted);
}

.metric-card strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 28px;
}

.metric-card.warning strong {
  color: var(--amber);
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) 390px;
  gap: 18px;
  align-items: start;
}

.queue-section,
.clip-board,
.review-panel {
  min-width: 0;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 10px 0 14px;
}

.section-heading.compact {
  margin-top: 0;
}

.segmented-control {
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.segmented-control button {
  min-width: 58px;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.segmented-control button.active {
  background: #e7f3ee;
  color: var(--green-dark);
  font-weight: 800;
}

.video-list,
.clip-list {
  display: grid;
  gap: 12px;
}

.video-card {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr) auto;
  gap: 14px;
  padding: 12px;
}

.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(20, 125, 100, 0.25), rgba(47, 111, 159, 0.25)),
    #dce8e5;
}

.thumb::after {
  content: "";
  position: absolute;
  inset: 34% 42%;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  background: rgba(255, 255, 255, 0.92);
}

.video-meta {
  min-width: 0;
}

.video-meta h3 {
  margin: 0 0 8px;
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.35;
}

.video-meta p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef3f2;
  color: #486068;
  font-size: 12px;
  font-weight: 700;
}

.tag.warn {
  background: #fff3df;
  color: #8b5a12;
}

.tag.good {
  background: #e3f5ed;
  color: #0f6f59;
}

.video-actions {
  display: grid;
  align-content: center;
  justify-items: end;
  gap: 8px;
}

.review-panel {
  position: sticky;
  top: 20px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.phone-preview {
  display: grid;
  place-items: center;
  padding: 16px;
  border-radius: 8px;
  background: #e9efef;
}

.preview-video {
  position: relative;
  width: min(238px, 100%);
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.68)),
    linear-gradient(135deg, #3c7c6d, #223b54 60%, #1d2529);
}

.preview-video::before {
  content: "";
  position: absolute;
  left: 18%;
  top: 28%;
  width: 64%;
  height: 18%;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  transform: rotate(-8deg);
}

.preview-video.is-playing {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.74)),
    radial-gradient(circle at 36% 24%, rgba(255, 255, 255, 0.2), transparent 24%),
    linear-gradient(145deg, #2d7a68, #1e4858 55%, #121a20);
}

.preview-play {
  position: absolute;
  left: 50%;
  top: 45%;
  width: 0;
  height: 0;
  border-top: 24px solid transparent;
  border-bottom: 24px solid transparent;
  border-left: 36px solid rgba(255, 255, 255, 0.86);
  transform: translate(-38%, -50%);
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.22));
}

.preview-scene {
  position: absolute;
  inset: 74px 22px 148px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  transform: rotate(-8deg);
}

.base {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.82);
  transform: rotate(45deg);
}

.base-one {
  right: 24%;
  bottom: 18%;
}

.base-two {
  left: 50%;
  top: 14%;
}

.base-three {
  left: 22%;
  bottom: 24%;
}

.ball-trail {
  position: absolute;
  left: 24%;
  top: 44%;
  width: 70px;
  height: 3px;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, #ffffff);
  animation: preview-swing 1.4s ease-in-out infinite;
}

.preview-live,
.preview-title,
.preview-progress {
  position: absolute;
  left: 14px;
  right: 14px;
}

.preview-live {
  top: 56px;
  width: fit-content;
  padding: 5px 8px;
  border-radius: 6px;
  background: #ffdf59;
  color: #182023;
  font-size: 11px;
  font-weight: 900;
}

.preview-title {
  bottom: 138px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.28;
}

.preview-progress {
  bottom: 26px;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
}

.preview-progress span {
  display: block;
  width: 58%;
  height: 100%;
  border-radius: inherit;
  background: #ffffff;
}

@keyframes preview-swing {
  0%,
  100% {
    transform: translateX(-10px) translateY(6px) rotate(-18deg);
    opacity: 0.45;
  }
  50% {
    transform: translateX(28px) translateY(-18px) rotate(-18deg);
    opacity: 1;
  }
}

.scoreboard {
  position: absolute;
  top: 14px;
  left: 12px;
  right: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(8, 13, 15, 0.76);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

.caption {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 76px;
  color: #ffffff;
  font-size: 20px;
  font-weight: 900;
  line-height: 1.18;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
  overflow-wrap: anywhere;
}

.clip-details {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.clip-details label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.clip-details input {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.clip-details input:focus {
  outline: 3px solid rgba(20, 125, 100, 0.15);
  border-color: var(--green);
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.two-col div,
.rights-box {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfb;
}

.two-col span,
.rights-box span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.two-col strong,
.rights-box strong {
  display: block;
  margin-bottom: 4px;
}

.rights-box.good {
  border-color: #b7ddce;
  background: #eefaf5;
}

.rights-box.warn {
  border-color: #f0d7a6;
  background: #fff8ea;
}

.clip-board {
  margin-top: 24px;
}

.upload-board {
  margin-top: 24px;
  padding-bottom: 28px;
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.setup-card {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 220px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.setup-card h3 {
  margin: 0;
  font-size: 17px;
}

.setup-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.setup-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.45;
}

.setup-list code {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.clip-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.clip-card {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.clip-card.selected {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(20, 125, 100, 0.16), var(--shadow);
}

.clip-card h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.clip-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

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

.score-bar {
  flex: 1;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5ecec;
}

.score-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

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

.clip-actions button {
  flex: 1;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(420px, calc(100vw - 44px));
  padding: 13px 16px;
  border-radius: 8px;
  background: #172026;
  color: #ffffff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

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

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }

  .nav-list {
    display: flex;
  }

  .side-panel {
    min-width: 260px;
    margin-top: 0;
  }

  .work-grid {
    grid-template-columns: 1fr;
  }

  .review-panel {
    position: static;
  }
}

@media (max-width: 800px) {
  .workspace {
    padding: 18px;
  }

  .topbar,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .metrics-grid,
  .clip-list,
  .upload-grid {
    grid-template-columns: 1fr;
  }

  .video-card {
    grid-template-columns: 1fr;
  }

  .video-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-items: stretch;
  }

  .top-actions,
  .review-actions {
    width: 100%;
  }

  .primary-button,
  .secondary-button {
    flex: 1;
  }

  h1 {
    font-size: 24px;
  }
}
