:root {
  --bg: #f3f3f4;
  --bg-soft: #ececed;
  --surface: #ffffff;
  --surface-muted: #f7f7f8;
  --surface-strong: #5b5456;
  --text: #171717;
  --text-soft: #666168;
  --text-muted: #88828a;
  --border: #ddd8db;
  --accent: #ef2b2d;
  --accent-strong: #d71920;
  --accent-soft: #fff1f1;
  --ok: #1f7a57;
  --shadow: 0 24px 80px rgba(50, 35, 38, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, #f6f6f6 0, #f6f6f6 180px, #efefef 180px, #f4f4f4 100%);
}

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

.app-shell {
  width: min(1380px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.site-header,
.hero-card,
.status-card,
.result-topbar {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.site-header {
  display: grid;
  grid-template-columns: auto;
  align-items: center;
  gap: 24px;
  justify-content: start;
  padding: 18px 24px;
  border-radius: 30px;
}

.brand-lockup,
.result-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  position: relative;
  width: 112px;
  height: 88px;
  flex: 0 0 auto;
}

.brand-mark-small {
  width: 72px;
  height: 56px;
}

.brand-two,
.brand-a {
  position: absolute;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.06em;
}

.brand-two {
  left: 0;
  top: 6px;
  color: #8d8b88;
  font-size: 86px;
}

.brand-a {
  right: 0;
  top: 0;
  color: var(--accent);
  font-size: 82px;
}

.brand-mark-small .brand-two {
  font-size: 56px;
  top: 4px;
}

.brand-mark-small .brand-a {
  font-size: 54px;
}

.brand-copy {
  display: grid;
  gap: 4px;
}

.brand-copy.compact {
  gap: 0;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
}

.hero-card,
.status-card {
  border-radius: 32px;
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.05fr);
  gap: 28px;
  margin-top: 22px;
  padding: 28px;
}

.hero-copy {
  display: block;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.04;
}

.upload-panel {
  display: grid;
  gap: 18px;
  align-content: start;
  padding: 22px;
  border-radius: 28px;
  background: linear-gradient(180deg, #ffffff 0%, #f7f7f8 100%);
  border: 1px solid var(--border);
}

.upload-drop {
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 290px;
  padding: 34px 24px;
  border-radius: 28px;
  border: 1.5px dashed rgba(239, 43, 45, 0.32);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(253, 245, 245, 0.92)),
    repeating-linear-gradient(135deg, rgba(239, 43, 45, 0.03), rgba(239, 43, 45, 0.03) 10px, transparent 10px, transparent 20px);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.upload-drop:hover {
  transform: translateY(-2px);
  border-color: rgba(239, 43, 45, 0.56);
  box-shadow: 0 18px 48px rgba(239, 43, 45, 0.12);
}

.upload-drop input {
  display: none;
}

.upload-icon {
  display: inline-flex;
  align-items: end;
  gap: 8px;
  min-height: 58px;
}

.upload-wave {
  width: 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), #ff8486);
  animation: eq 1.1s ease-in-out infinite;
}

.upload-wave:nth-child(1) {
  height: 28px;
}

.upload-wave:nth-child(2) {
  height: 52px;
  animation-delay: 0.12s;
}

.upload-wave:nth-child(3) {
  height: 38px;
  animation-delay: 0.24s;
}

.upload-title {
  margin-top: 10px;
  font-weight: 800;
  font-size: 24px;
}

.upload-subtitle {
  margin-top: 8px;
  color: var(--text-soft);
  font-size: 14px;
}

.selected-file {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  border-radius: 16px;
  background: var(--accent-soft);
  border: 1px solid rgba(239, 43, 45, 0.18);
  color: var(--accent-strong);
  font-weight: 700;
}

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

.mode-switch {
  display: inline-flex;
  gap: 8px;
  padding: 8px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.mode-switch label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  color: var(--text-soft);
  cursor: pointer;
  font-weight: 600;
}

.mode-switch input {
  accent-color: var(--accent);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 0 26px;
  border: none;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  box-shadow: 0 16px 36px rgba(215, 25, 32, 0.24);
}

.primary-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.hero-visual {
  display: grid;
  gap: 0;
}

.visual-banner {
  position: relative;
  display: block;
  overflow: hidden;
  min-height: 460px;
  border-radius: 30px;
  background: linear-gradient(135deg, #f1f1f1 0 36%, var(--accent) 36% 100%);
  border: 1px solid var(--border);
}

.visual-banner::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 40%;
  width: 160px;
  background: linear-gradient(135deg, transparent 0 35%, var(--accent) 36% 100%);
  transform: skewX(-20deg);
  transform-origin: left;
}

.visual-right {
  position: relative;
  z-index: 1;
  padding: 34px 30px;
}

.visual-right {
  color: #fff;
  display: grid;
  align-content: space-between;
  justify-items: end;
}

.visual-right.solo {
  min-height: 460px;
}

.pack-roll {
  position: absolute;
  border-radius: 999px;
  box-shadow: 0 30px 50px rgba(0, 0, 0, 0.18);
}

.pack-roll-main {
  right: 84px;
  bottom: 42px;
  width: 250px;
  height: 250px;
  background:
    radial-gradient(circle at 34% 50%, #aa8f68 0 18%, #f0ddc3 18% 26%, #0f0f12 26% 36%, #fbfbfb 36% 63%, #dedede 63% 72%, transparent 72%),
    linear-gradient(140deg, #ffffff 0%, #f2f2f2 52%, #111317 52%, #07090d 100%);
  transform: rotate(-28deg);
}

.pack-roll-side {
  right: 12px;
  bottom: 96px;
  width: 132px;
  height: 132px;
  background:
    radial-gradient(circle at 34% 50%, #aa8f68 0 18%, #f0ddc3 18% 26%, #121317 26% 36%, #2a2a2d 36% 63%, #08090b 63% 72%, transparent 72%),
    linear-gradient(140deg, #2a2d34 0%, #141519 100%);
  transform: rotate(18deg);
}

.mini-step,
.status-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
}

.status-card {
  margin-top: 24px;
  padding: 28px;
}

.hidden {
  display: none !important;
}

.status-header,
.status-body,
.result-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 110px;
  min-height: 42px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid rgba(239, 43, 45, 0.18);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-body {
  align-items: stretch;
  margin-top: 22px;
}

.spinner-stage {
  width: 250px;
  min-width: 250px;
  display: grid;
  place-items: center;
  gap: 16px;
  padding: 22px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, #fff6f6 0%, #ffffff 100%);
  border: 1px solid rgba(239, 43, 45, 0.14);
}

.spinner {
  position: relative;
  width: 94px;
  height: 94px;
  border-radius: 50%;
  border: 6px solid rgba(23, 23, 23, 0.08);
  border-top-color: var(--accent);
  border-right-color: #8d8b88;
  animation: spin 1.05s linear infinite;
}

.spinner::after {
  content: "";
  position: absolute;
  inset: 20px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(239, 43, 45, 0.16), transparent 68%);
}

.equalizer {
  display: flex;
  align-items: end;
  gap: 8px;
  height: 42px;
}

.equalizer span {
  width: 8px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fe8183, var(--accent));
  animation: eq 0.9s ease-in-out infinite;
}

.equalizer span:nth-child(2) { animation-delay: 0.12s; }
.equalizer span:nth-child(3) { animation-delay: 0.24s; }
.equalizer span:nth-child(4) { animation-delay: 0.36s; }
.equalizer span:nth-child(5) { animation-delay: 0.48s; }

.status-content {
  flex: 1;
}

.status-message {
  font-size: 18px;
  line-height: 1.6;
  color: var(--text-soft);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.status-item {
  padding: 16px;
  background: var(--surface-muted);
}

.status-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-value {
  margin-top: 8px;
  font-size: 17px;
  font-weight: 700;
}

.job-error {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  color: #7c1418;
  background: #fff1f1;
  border: 1px solid rgba(239, 43, 45, 0.24);
}

.result-actions {
  margin-top: 20px;
}

.result-body {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

.result-topbar {
  padding: 18px 24px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
  border-radius: 0;
}

.result-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.result-frame {
  width: 100%;
  height: calc(100vh - 102px);
  border: none;
  background: white;
}

.result-placeholder {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 40px;
}

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

@keyframes eq {
  0%, 100% { transform: scaleY(0.5); opacity: 0.65; }
  50% { transform: scaleY(1); opacity: 1; }
}

@media (max-width: 1180px) {
  .site-header,
  .hero-card,
  .status-body,
  .result-topbar {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: flex-start;
  }

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

  .visual-banner {
    min-height: auto;
  }

  .visual-banner::before {
    display: none;
  }

  .visual-right {
    min-height: 290px;
  }
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 24px, 1380px);
    padding-top: 12px;
  }

  .controls-row,
  .status-header {
    flex-direction: column;
    align-items: stretch;
  }

  .mode-switch {
    width: 100%;
    justify-content: space-between;
  }

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

  .spinner-stage {
    width: 100%;
    min-width: 0;
  }

  .pack-roll-main {
    right: 44px;
    width: 200px;
    height: 200px;
  }

  .pack-roll-side {
    right: 0;
    bottom: 84px;
  }
}
