:root {
  --ct-page: #f5f7fa;
  --ct-surface: #ffffff;
  --ct-surface-soft: #f0f4f8;
  --ct-ink: #07111f;
  --ct-muted: #5b6879;
  --ct-line: #dce3eb;
  --ct-line-strong: #bdc9d8;
  --ct-blue: #1769e0;
  --ct-cyan: #24b8b0;
  --ct-orange: #ff7a3d;
  --ct-red: #d73737;
  --ct-green: #16845b;
  --ct-yellow: #9a6500;
  --ct-shadow: 0 18px 50px rgba(7, 17, 31, 0.08);
}

html[data-theme="dark"] {
  --ct-page: #07111f;
  --ct-surface: #0c1828;
  --ct-surface-soft: #111f32;
  --ct-ink: #f4f7fb;
  --ct-muted: #a9b7c9;
  --ct-line: #263951;
  --ct-line-strong: #3a506b;
  --ct-blue: #4a91f2;
  --ct-cyan: #48d7d0;
  --ct-orange: #ff8b54;
  --ct-red: #ff7272;
  --ct-green: #50d19a;
  --ct-yellow: #f3c762;
  --ct-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

html { background: var(--ct-page); scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    linear-gradient(rgba(31, 70, 111, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 70, 111, 0.045) 1px, transparent 1px),
    var(--ct-page);
  background-size: 80px 80px;
  color: var(--ct-ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button, input, select { font: inherit; }
button, select, input[type="search"] { color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }

.srOnly {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.studioShell { width: 100%; min-height: 100vh; }

.studioHeader,
.uploadSection,
.resultsArea {
  width: min(100%, 1560px);
  margin: 0 auto;
  padding-inline: clamp(20px, 4vw, 72px);
}

.studioHeader {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  border-bottom: 1px solid var(--ct-line);
}

.brandBlock,
.headerControls,
.resultsHeading,
.chartHeading,
.primaryActions {
  display: flex;
  align-items: center;
}

.brandBlock { gap: 16px; }

.brandIcon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: var(--ct-cyan);
  background: color-mix(in srgb, var(--ct-cyan) 12%, var(--ct-surface));
  border: 1px solid color-mix(in srgb, var(--ct-cyan) 34%, var(--ct-line));
}

.brandIcon svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.eyebrow { margin: 0 0 5px; color: var(--ct-cyan); font: 700 10px "Cascadia Code", Consolas, monospace; letter-spacing: .16em; }
.brandBlock h1 { margin: 0; font-size: clamp(24px, 3vw, 34px); line-height: 1; letter-spacing: -.045em; }
.headerControls { gap: 14px; }
.localBadge { display: inline-flex; align-items: center; gap: 8px; color: var(--ct-muted); font-size: 13px; font-weight: 700; }
.localBadge i { width: 8px; height: 8px; border-radius: 50%; background: var(--ct-green); box-shadow: 0 0 0 5px color-mix(in srgb, var(--ct-green) 14%, transparent); }
.languageField select,
.encodingField select,
.channelToolbar input {
  border: 1px solid var(--ct-line);
  background: var(--ct-surface);
  border-radius: 10px;
  outline: none;
}
.languageField select { min-width: 136px; padding: 11px 36px 11px 13px; font-size: 13px; font-weight: 700; }
.languageField select:focus,
.encodingField select:focus,
.channelToolbar input:focus { border-color: var(--ct-blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ct-blue) 16%, transparent); }

.uploadSection { padding-top: clamp(42px, 6vw, 82px); padding-bottom: clamp(54px, 7vw, 96px); }
.sectionIntro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 380px); align-items: end; gap: 50px; margin-bottom: 28px; }
.stepNumber { display: inline-block; color: var(--ct-orange); font: 750 11px "Cascadia Code", Consolas, monospace; letter-spacing: .14em; margin-bottom: 10px; }
.sectionIntro h2,
.resultsHeading h2 { margin: 0; font-size: clamp(34px, 5vw, 58px); line-height: 1; letter-spacing: -.055em; }
.sectionIntro p { max-width: 760px; margin: 16px 0 0; color: var(--ct-muted); font-size: 15px; line-height: 1.7; }
.encodingField { display: grid; gap: 9px; color: var(--ct-muted); font-size: 12px; font-weight: 700; }
.encodingField select { width: 100%; padding: 13px 42px 13px 14px; }

.dropzone {
  min-height: 270px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 9px;
  border: 1.5px dashed var(--ct-line-strong);
  background: color-mix(in srgb, var(--ct-surface) 80%, transparent);
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
  text-align: center;
  padding: 34px 20px;
  outline: none;
}
.dropzone:hover,
.dropzone:focus-visible,
.dropzone.dragover { border-color: var(--ct-blue); background: color-mix(in srgb, var(--ct-blue) 5%, var(--ct-surface)); }
.dropzone.dragover { transform: scale(.997); }
.dropzone input { display: none; }
.uploadIcon { width: 56px; height: 56px; display: grid; place-items: center; color: var(--ct-blue); border-radius: 50%; background: color-mix(in srgb, var(--ct-blue) 11%, var(--ct-surface)); margin-bottom: 5px; }
.uploadIcon svg { width: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dropzone strong { font-size: clamp(18px, 2.2vw, 25px); letter-spacing: -.025em; }
.dropzone > span:not(.uploadIcon) { color: var(--ct-muted); font-size: 14px; }
.dropzone small { color: var(--ct-green); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .09em; margin-top: 8px; }

.fileStatus { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--ct-line); border-top: 0; }
.fileChip { min-width: 0; min-height: 84px; display: flex; align-items: center; gap: 15px; padding: 17px 20px; background: var(--ct-surface); }
.fileChip + .fileChip { border-left: 1px solid var(--ct-line); }
.fileType { width: 46px; height: 46px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 12px; background: var(--ct-surface-soft); color: var(--ct-muted); font: 750 11px "Cascadia Code", Consolas, monospace; }
.fileChip.ready .fileType { color: var(--ct-green); background: color-mix(in srgb, var(--ct-green) 12%, var(--ct-surface)); }
.fileChip div { min-width: 0; display: grid; gap: 4px; }
.fileChip strong, .fileChip small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.fileChip strong { font-size: 13px; }
.fileChip small { color: var(--ct-muted); }

.primaryActions { gap: 12px; margin-top: 18px; }
.primaryButton,
.secondaryButton {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 13px 20px;
  border-radius: 9px;
  font-weight: 800;
  border: 1px solid transparent;
  transition: transform 160ms ease, background 160ms ease, opacity 160ms ease;
}
.primaryButton { min-width: min(100%, 360px); color: #07111f; background: var(--ct-orange); }
.primaryButton:not(:disabled):hover,
.secondaryButton:hover { transform: translateY(-1px); }
.primaryButton:disabled { opacity: .48; }
.secondaryButton { color: var(--ct-ink); background: var(--ct-surface); border-color: var(--ct-line); }

.message { margin-top: 18px; padding: 15px 18px; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; border-left: 3px solid; background: var(--ct-surface); font-size: 13px; line-height: 1.55; }
.message[hidden] { display: none; }
.message strong { grid-row: 1 / 3; }
.errorMessage { border-color: var(--ct-red); color: var(--ct-red); }
.warningMessage { border-color: var(--ct-yellow); color: var(--ct-yellow); }

.resultsArea { padding-top: clamp(55px, 7vw, 92px); padding-bottom: 100px; border-top: 1px solid var(--ct-line); }
.resultsArea[hidden] { display: none; }
.resultsHeading { justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.resultsHeading > div { display: grid; }
.metadataGrid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border-block: 1px solid var(--ct-line); margin-bottom: 42px; }
.metaItem { min-width: 0; padding: 22px 18px; }
.metaItem + .metaItem { border-left: 1px solid var(--ct-line); }
.metaItem span { display: block; color: var(--ct-muted); font: 700 9px "Cascadia Code", Consolas, monospace; text-transform: uppercase; letter-spacing: .12em; margin-bottom: 9px; }
.metaItem strong { display: block; overflow: hidden; text-overflow: ellipsis; font-size: clamp(16px, 2vw, 22px); letter-spacing: -.025em; }

.channelToolbar { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 20px; }
.channelToolbar label { width: min(100%, 520px); display: grid; gap: 8px; color: var(--ct-muted); font-size: 12px; font-weight: 700; }
.channelToolbar input { width: 100%; padding: 13px 15px; }
.channelToolbar p { margin: 0; color: var(--ct-muted); font: 700 11px "Cascadia Code", Consolas, monospace; }

.chartSection { margin-top: 18px; border-top: 1px solid var(--ct-line); padding-top: 28px; }
.chartHeading { justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.chartHeading > div { display: flex; align-items: baseline; gap: 14px; }
.chartHeading span { color: var(--ct-cyan); font: 750 10px "Cascadia Code", Consolas, monospace; letter-spacing: .12em; }
.chartHeading h3 { margin: 0; font-size: clamp(22px, 3vw, 34px); letter-spacing: -.035em; }
.chartHeading p { margin: 0; color: var(--ct-muted); font-size: 12px; }
.chart { width: 100%; height: clamp(430px, 54vw, 680px); min-height: 430px; background: var(--ct-surface); border: 1px solid var(--ct-line); box-shadow: var(--ct-shadow); }
.digitalChart { height: clamp(540px, 66vw, 820px); min-height: 540px; }
.emptyState { min-height: 160px; display: grid; place-items: center; color: var(--ct-muted); background: var(--ct-surface); border: 1px dashed var(--ct-line-strong); }
.emptyState[hidden] { display: none; }

@media (max-width: 900px) {
  .metadataGrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metaItem:nth-child(4) { border-left: 0; }
  .metaItem:nth-child(n + 4) { border-top: 1px solid var(--ct-line); }
}

@media (max-width: 680px) {
  body { background-size: 54px 54px; }
  .studioHeader { min-height: 94px; padding-block: 18px; }
  .brandIcon { width: 46px; height: 46px; border-radius: 13px; }
  .eyebrow, .localBadge { display: none; }
  .brandBlock h1 { font-size: 23px; }
  .languageField select { min-width: 110px; max-width: 125px; padding-block: 10px; }
  .sectionIntro { grid-template-columns: 1fr; align-items: start; gap: 22px; }
  .dropzone { min-height: 225px; }
  .fileStatus { grid-template-columns: 1fr; }
  .fileChip + .fileChip { border-left: 0; border-top: 1px solid var(--ct-line); }
  .primaryActions { align-items: stretch; flex-direction: column; }
  .primaryButton { width: 100%; }
  .resultsHeading { align-items: flex-start; flex-direction: column; }
  .metadataGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metaItem:nth-child(3), .metaItem:nth-child(5) { border-left: 0; }
  .metaItem:nth-child(n + 3) { border-top: 1px solid var(--ct-line); }
  .metaItem:nth-child(4) { border-left: 1px solid var(--ct-line); }
  .channelToolbar, .chartHeading { align-items: flex-start; flex-direction: column; }
  .channelToolbar label { width: 100%; }
  .chartHeading p { display: none; }
  .chart { height: 470px; min-height: 470px; }
  .digitalChart { height: 620px; min-height: 620px; }
}

@media (max-width: 420px) {
  .studioHeader, .uploadSection, .resultsArea { padding-inline: 15px; }
  .brandBlock { gap: 10px; }
  .brandIcon { width: 40px; height: 40px; }
  .brandIcon svg { width: 28px; }
  .brandBlock h1 { font-size: 20px; }
  .languageField select { min-width: 100px; max-width: 112px; font-size: 12px; }
  .sectionIntro h2, .resultsHeading h2 { font-size: 36px; }
  .dropzone strong { font-size: 18px; }
  .metaItem { padding: 18px 12px; }
  .chart { margin-inline: -15px; width: calc(100% + 30px); border-inline: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
