/* Video Upscaler. Colors come from the shared --cpk-* appearance tokens
   (public/css/design-system.css) so light and dark themes both work. */
:root {
  --card-subtle: var(--cpk-surface-2, #eeefe8);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body, button, input, select { font-family: Inter, ui-sans-serif, system-ui, sans-serif; }
body {
  margin: 0;
  color: var(--cpk-ink);
  min-height: 100vh;
  background: var(--cpk-bg);
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--cpk-link); }

.wrap { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }

main { position: relative; z-index: 1; padding-bottom: 80px; }
.hero { padding: 48px 0 24px; max-width: 760px; }
.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--cpk-link);
  font-weight: 600;
  margin-bottom: 12px;
}
.hero-kicker svg { width: 14px; height: 14px; }
.hero h1 {
  font-size: clamp(30px, 5vw, 44px);
  line-height: 1.15;
  margin: 0 0 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
/* CJK text breaks between characters anyway; keep punctuation rules (no "。" at line start). */
html:is([lang="ja"], [lang="zh-CN"]) .hero h1 { overflow-wrap: normal; word-break: normal; line-break: strict; }
.hero p.lede {
  font-size: 18px;
  line-height: 1.55;
  color: var(--cpk-muted);
  margin: 0 0 24px;
}

.badges { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 32px; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  background: var(--cpk-surface);
  border: 1px solid var(--cpk-line);
  color: var(--cpk-muted);
}
.badge--lime {
  background: var(--cpk-accent-soft);
  border-color: var(--cpk-line-strong);
  color: var(--cpk-link);
}
.badge svg { width: 14px; height: 14px; flex: none; }

/* Workspace Card */
.workspace {
  background: var(--cpk-surface);
  border: 1px solid var(--cpk-line);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--cpk-shadow);
}

/* Dropzone */
.dropzone {
  border: 2px dashed var(--cpk-line-strong);
  border-radius: 12px;
  padding: 48px 24px;
  text-align: center;
  transition: border-color 0.2s ease, background-color 0.2s ease;
  background: var(--cpk-bg);
  cursor: pointer;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--cpk-link);
  background: var(--cpk-accent-soft);
}
.dropzone-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  color: var(--cpk-link);
  display: grid;
  place-items: center;
}
.dropzone-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 8px;
}
.dropzone-hint {
  font-size: 14px;
  color: var(--cpk-muted);
  margin: 0 0 16px;
}
.btn-select {
  background: var(--cpk-surface);
  border: 1px solid var(--cpk-line-strong);
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  transition: background-color 0.15s ease;
}
.btn-select:hover { background: var(--cpk-surface-2); }

/* File Loaded Details */
.file-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  background: var(--card-subtle);
  border: 1px solid var(--cpk-line);
  border-radius: 10px;
  margin-bottom: 24px;
}
.file-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.file-thumb {
  width: 72px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  background: #000;
  border: 1px solid var(--cpk-line);
  flex: none;
}
.file-meta { min-width: 0; }
.file-meta strong {
  display: block;
  font-size: 15px;
  color: var(--cpk-ink);
  overflow-wrap: anywhere;
}
.file-meta span {
  font-size: 13px;
  color: var(--cpk-muted);
}
.btn-clear {
  background: transparent;
  border: 1px solid var(--cpk-line);
  color: var(--cpk-muted);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
}
.btn-clear:hover {
  color: var(--cpk-ink);
  border-color: var(--cpk-line-strong);
}

/* Quality presets (simple path) */
.up-presets {
  border: 0;
  padding: 0;
  margin: 0 0 24px;
  min-width: 0;
}
.up-presets legend { padding: 0; margin-bottom: 8px; }
.up-preset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.up-preset {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 14px 14px 42px;
  border: 1px solid var(--cpk-line);
  border-radius: 10px;
  background: var(--cpk-surface);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.up-preset:hover { border-color: var(--cpk-line-strong); }
.up-preset:has(input:checked) {
  border-color: var(--cpk-link);
  background: var(--cpk-accent-soft);
}
.up-preset:has(input:focus-visible) {
  outline: 2px solid var(--cpk-link);
  outline-offset: 2px;
}
.up-preset input {
  position: absolute;
  left: 14px;
  top: 16px;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--cpk-link);
}
.up-preset b { font-size: 15px; color: var(--cpk-ink); }
.up-preset span { font-size: 13px; line-height: 1.45; color: var(--cpk-muted); }

/* Controls */
.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin: 16px 0 20px;
}
.ctrl-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
  min-width: 0;
}
.controls-grid .ctrl-group { margin-bottom: 0; }
.ctrl-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--cpk-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
/* Extra specificity: design-system.css tints every .chip by default. */
.workspace .chip-row button.chip {
  background: var(--cpk-surface);
  border: 1px solid var(--cpk-line);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--cpk-muted);
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.workspace .chip-row button.chip:hover:not(:disabled) {
  background: var(--cpk-surface-2);
  color: var(--cpk-ink);
}
.workspace .chip-row button.chip.active {
  background: var(--cpk-accent-soft);
  border-color: var(--cpk-link);
  color: var(--cpk-link);
  font-weight: 600;
}
.workspace .chip-row button.chip:disabled { cursor: not-allowed; }

.custom-res-inputs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.custom-res-inputs input {
  width: 96px;
  background: var(--cpk-bg);
  border: 1px solid var(--cpk-line-strong);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 14px;
  text-align: center;
}
.aspect-note { font-size: 12px; color: var(--cpk-muted); }

/* Advanced disclosure */
.up-advanced {
  border: 1px solid var(--cpk-line);
  border-radius: 10px;
  background: var(--card-subtle);
  margin: 0 0 20px;
}
.up-advanced > summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--cpk-ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.up-advanced > summary::-webkit-details-marker { display: none; }
.up-advanced > summary::after {
  content: "+";
  font-size: 18px;
  line-height: 1;
  color: var(--cpk-muted);
}
.up-advanced[open] > summary::after { content: "−"; }
.up-advanced[open] > summary { border-bottom: 1px solid var(--cpk-line); }
.up-advanced > :not(summary) { margin-left: 16px; margin-right: 16px; }
.up-advanced-note {
  font-size: 13px;
  line-height: 1.5;
  color: var(--cpk-muted);
  margin-top: 12px;
  margin-bottom: 0;
}

/* Checkbox Rows */
.option-rows {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  padding: 12px 0 16px;
  border-top: 1px solid var(--cpk-line);
}
.option-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--cpk-ink);
  cursor: pointer;
  user-select: none;
}
.option-row small { display: block; font-size: 12px; color: var(--cpk-muted); }
.option-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--cpk-link);
  cursor: pointer;
  flex: none;
}

/* Dimensions Multiplier Preview Banner */
.multiplier-banner {
  background: var(--cpk-accent-soft);
  border: 1px solid var(--cpk-line-strong);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.mult-left {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.mult-stat {
  font-size: 14px;
  color: var(--cpk-muted);
}
.mult-stat strong { color: var(--cpk-ink); }
.mult-badge {
  background: var(--cpk-surface);
  border: 1px solid var(--cpk-line);
  color: var(--cpk-link);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

/* Primary CTA Button */
.btn-primary {
  width: 100%;
  background: var(--cpk-accent);
  color: var(--cpk-accent-ink);
  font-size: 16px;
  font-weight: 700;
  padding: 14px 24px;
  border-radius: 10px;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: filter 0.15s ease, transform 0.05s ease;
}
.btn-primary:hover:not(:disabled) { filter: brightness(0.96); }
.btn-primary:active:not(:disabled) { transform: scale(0.99); }
.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Progress Box */
.progress-card {
  padding: 24px;
  background: var(--card-subtle);
  border: 1px solid var(--cpk-line);
  border-radius: 12px;
  margin-top: 24px;
  text-align: center;
}
.progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  margin-bottom: 12px;
  text-align: left;
}
.progress-head strong { color: var(--cpk-link); }
.progress-pct { font-weight: 700; font-variant-numeric: tabular-nums; }
.progress-bar-wrap {
  width: 100%;
  height: 10px;
  background: var(--cpk-surface);
  border: 1px solid var(--cpk-line);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 16px;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--cpk-link);
  border-radius: 999px;
  transition: width 0.15s ease;
}
.progress-meta {
  font-size: 13px;
  color: var(--cpk-muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
  margin-bottom: 12px;
  font-variant-numeric: tabular-nums;
}
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--cpk-line);
  font-size: 11px;
  color: var(--cpk-muted);
}
.progress-hint {
  font-size: 13px;
  color: var(--cpk-muted);
  margin: 0 0 16px;
}
.btn-cancel {
  background: transparent;
  border: 1px solid var(--cpk-line-strong);
  color: var(--cpk-rose);
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
}
.btn-cancel:hover { background: var(--cpk-surface); }

/* Result Done Box */
.result-card {
  padding: 24px;
  background: var(--cpk-accent-soft);
  border: 1px solid var(--cpk-line-strong);
  border-radius: 12px;
  margin-top: 24px;
  text-align: center;
}
.result-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--cpk-ink);
  margin: 0 0 8px;
}
.result-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 16px;
  font-size: 14px;
  color: var(--cpk-muted);
  margin: 0 0 20px;
}
.result-stats strong { color: var(--cpk-ink); }
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  align-items: center;
}
.btn-download {
  background: var(--cpk-accent);
  color: var(--cpk-accent-ink);
  font-size: 15px;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: 8px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-download:hover { filter: brightness(0.96); }
.btn-secondary {
  display: inline-flex;
  align-items: center;
  padding: 11px 18px;
  border-radius: 8px;
  border: 1px solid var(--cpk-line-strong);
  background: var(--cpk-surface);
  color: var(--cpk-ink);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}
.btn-secondary:hover { background: var(--cpk-surface-2); color: var(--cpk-ink); }
.result-hint {
  max-width: 560px;
  margin: 14px auto 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--cpk-muted);
}

/* Notice / Error banner */
.notice-box {
  padding: 14px 18px;
  border-radius: 8px;
  font-size: 14px;
  margin-top: 16px;
  line-height: 1.45;
  border: 1px solid var(--cpk-line-strong);
  background: var(--cpk-surface-2);
}
.notice-box strong { display: block; margin-bottom: 4px; }
.notice-box--warn { color: var(--cpk-amber); }
.notice-box--error { color: var(--cpk-rose); }

/* Explanatory Content Section */
.info-section {
  margin-top: 64px;
  border-top: 1px solid var(--cpk-line);
  padding-top: 48px;
}
.info-section h2 {
  font-size: 26px;
  margin: 0 0 16px;
  letter-spacing: -0.01em;
}
.info-intro {
  color: var(--cpk-muted);
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 24px;
  max-width: 760px;
}
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 24px;
}
.info-card, .info-why {
  background: var(--cpk-surface);
  border: 1px solid var(--cpk-line);
  border-radius: 12px;
  padding: 24px;
}
.info-card h3, .info-why h3 {
  font-size: 18px;
  margin: 0 0 10px;
  color: var(--cpk-ink);
}
.info-card p, .info-why p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--cpk-muted);
  margin: 0;
}
.info-why { margin-top: 36px; }

/* FAQ Section */
.faq-wrap { margin-top: 48px; }
.faq-wrap h2 { font-size: 24px; margin-bottom: 20px; }
.faq-item {
  border-bottom: 1px solid var(--cpk-line);
  padding: 16px 0;
}
.faq-item summary {
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-size: 20px;
  color: var(--cpk-muted);
}
.faq-item[open] summary::after { content: "−"; }
.faq-item p {
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--cpk-muted);
}

@media (max-width: 720px) {
  .up-preset-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .hero { padding-top: 32px; }
  .hero p.lede { font-size: 16px; }
  .workspace { padding: 16px; }
  .dropzone { padding: 32px 16px; }
  .file-bar { flex-direction: column; align-items: flex-start; }
  .result-actions > * { width: 100%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .progress-bar, .chip, .up-preset, .dropzone, .btn-primary, .btn-select { transition: none; }
  .btn-primary:active:not(:disabled) { transform: none; }
}
