:root {
  --bg: #fbfaf6;
  --surface: #ffffff;
  --surface-soft: #f4f1ea;
  --text: #121212;
  --muted: #68635b;
  --line: #e7e2d8;
  --accent: #111111;
  --accent-hover: #2a2926;
  --warm: #f0a33a;
  --green: #93b84c;
  --danger: #b7402d;
  --shadow: 0 18px 45px rgba(17, 17, 17, 0.08);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 8%, rgba(240, 163, 58, 0.16), transparent 30%),
    radial-gradient(circle at 88% 12%, rgba(147, 184, 76, 0.12), transparent 28%),
    var(--bg);
  color: var(--text);
}

button,
input,
a {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(980px, calc(100% - 40px));
  margin: 0 auto;
  padding: 46px 0 72px;
}

.hero {
  text-align: center;
  margin-bottom: 38px;
}

.brand-mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.brand-mark img {
  width: 100%;
  height: 100%;
}

.eyebrow,
.status-label,
.file-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--muted);
}

h1 {
  margin: 0;
  font-size: clamp(2.7rem, 7vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: -0.08em;
  font-weight: 900;
}

.subtitle {
  margin: 15px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.17rem);
}

.upload-section {
  display: grid;
  gap: 14px;
}

.upload-card {
  min-height: 230px;
  border: 1.5px dashed rgba(17, 17, 17, 0.24);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  gap: 10px;
  text-align: center;
  padding: 34px;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.upload-card:hover,
.upload-card:focus-visible,
.upload-card.dragging {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  background: var(--surface);
  outline: none;
}

.upload-icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: linear-gradient(135deg, rgba(240, 163, 58, 0.22), rgba(147, 184, 76, 0.22));
}

.upload-card strong {
  font-size: 1.05rem;
}

.upload-card span,
.privacy-note,
.muted {
  color: var(--muted);
}

.privacy-note {
  margin: 0;
  text-align: center;
  font-size: 0.92rem;
}

.upload-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 12px;
}

.btn {
  border: 0;
  border-radius: 999px;
  min-height: 44px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn-primary {
  color: #fffdf8;
  background: var(--accent);
  box-shadow: 0 12px 22px rgba(17, 17, 17, 0.15);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

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

.btn-wide {
  width: 100%;
}

.hidden {
  display: none !important;
}

.loading-card,
.processing-card,
.message-box,
.panel,
.file-strip {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 35px rgba(17, 17, 17, 0.045);
}

.loading-card,
.processing-card {
  display: grid;
  gap: 18px;
  padding: 26px;
}

.loading-card h2,
.processing-card h2,
.panel h2 {
  margin: 4px 0 0;
  letter-spacing: -0.04em;
}

.progress-track {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--warm), var(--green));
  transition: width 0.2s ease;
}

.workspace {
  display: grid;
  gap: 22px;
}

.file-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
}

.file-strip strong {
  display: block;
  margin-top: 4px;
  word-break: break-word;
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 22px;
  align-items: start;
}

.left-column,
.right-column {
  display: grid;
  gap: 22px;
}

.panel {
  padding: 24px;
}

.preview-panel h2 {
  font-size: 1.25rem;
  margin-bottom: 16px;
}

.video-shell {
  background: #0d0d0d;
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.video-shell video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0d0d0d;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.stat-card {
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  min-height: 88px;
}

.stat-card span {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.67rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.stat-card strong {
  font-size: 0.95rem;
  word-break: break-word;
}

.control-panel {
  display: grid;
  gap: 13px;
}

.field-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

label,
.field-head label {
  font-weight: 800;
  color: var(--text);
}

#compression-label {
  font-size: 0.92rem;
  color: var(--muted);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.text-input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: var(--radius-sm);
  min-height: 46px;
  padding: 0 13px;
  outline: none;
}

.text-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(17, 17, 17, 0.08);
}

.small-text {
  margin: 0;
  font-size: 0.88rem;
}

.estimate-panel h2 {
  margin: 6px 0 8px;
  font-size: 2.05rem;
  color: var(--accent);
}

.estimate-panel p {
  margin: 6px 0;
}

.estimate-panel hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 18px 0 14px;
}

.strong-note {
  font-weight: 800;
}

.download-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.result-summary {
  margin: 8px 0 4px;
  color: var(--text);
  font-weight: 800;
}

.download-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.processing-card {
  text-align: center;
  place-items: center;
}

.spinner {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 5px solid var(--surface-soft);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.message-box {
  margin-top: 18px;
  padding: 16px 18px;
  border-color: rgba(183, 64, 45, 0.35);
  color: var(--danger);
}

.message-box.success {
  border-color: rgba(147, 184, 76, 0.45);
  color: #3f6422;
}

@media (max-width: 850px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 26px, 980px);
    padding-top: 28px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .download-panel,
  .file-strip,
  .field-head {
    align-items: flex-start;
  }

  .download-panel,
  .file-strip {
    flex-direction: column;
  }

  .download-actions,
  .download-actions .btn,
  .upload-actions,
  .upload-actions .btn {
    width: 100%;
  }
}
