:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-raised: #f8fafc;
  --line: #d9dee7;
  --line-bright: #aeb7c5;
  --text: #111827;
  --muted: #667085;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-ink: #ffffff;
  --blue: #2563eb;
  --danger: #dc2626;
  --radius: 10px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-size: 1rem;
  line-height: 1.5;
}

button, a { font: inherit; }
button { color: inherit; }
a { color: inherit; }

.shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding-bottom: 64px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 82px;
  border-bottom: 1px solid rgba(157, 169, 188, 0.16);
}

.top-actions { display: flex; align-items: center; gap: 12px; }
.text-link { color: var(--muted); font-size: 0.9rem; font-weight: 680; text-decoration: none; }
.text-link:hover { color: var(--text); }
.compact-button { min-height: 42px; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 760;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand-mark {
  display: flex;
  align-items: end;
  gap: 3px;
  width: 26px;
  height: 26px;
  padding: 5px;
  border-radius: 8px;
  background: var(--accent);
}

.brand-mark span { display: block; width: 4px; background: var(--accent-ink); border-radius: 2px; }
.brand-mark span:nth-child(1) { height: 8px; }
.brand-mark span:nth-child(2) { height: 15px; }
.brand-mark span:nth-child(3) { height: 11px; }

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.icon-button:hover { border-color: var(--line-bright); background: var(--surface-raised); }
.icon-button:active { transform: scale(0.96); }
.icon-button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-button.is-loading svg { animation: spin 800ms linear infinite; }

.live-panel {
  position: relative;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  margin-top: 42px;
  padding: clamp(26px, 5vw, 48px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}

.live-panel::after {
  display: none;
}

.live-copy { position: relative; z-index: 1; max-width: 700px; }
.eyebrow { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 0.82rem; font-weight: 720; letter-spacing: 0.08em; text-transform: uppercase; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #98a2b3; }
.status-dot.is-live { background: #16a34a; }
.status-dot.is-starting { background: #ffd36b; animation: pulse 1s ease-in-out infinite; }
.status-dot.is-error { background: var(--danger); }

.live-panel h1 {
  margin: 18px 0 8px;
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  line-height: 1.15;
  letter-spacing: -0.035em;
}

.live-panel p { max-width: 620px; margin: 0; color: var(--muted); font-size: 1rem; }
.live-actions { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 10px; }

.library { margin-top: 54px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.section-kicker { margin: 0 0 6px; color: var(--blue); font-size: 0.75rem; font-weight: 800; letter-spacing: 0.14em; }
.section-heading h2 { margin: 0; font-size: clamp(1.5rem, 3vw, 2.1rem); letter-spacing: -0.035em; }
.section-heading > p { margin: 0 0 4px; color: var(--muted); font-size: 0.9rem; }

.deck-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.deck-card { position: relative; display: flex; min-height: 344px; flex-direction: column; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: border-color 170ms ease, transform 170ms ease, background 170ms ease; }
.deck-card:hover { transform: translateY(-3px); border-color: var(--line-bright); background: var(--surface); }
.deck-card.is-live { border-color: #16a34a; }
.live-badge { padding: 4px 8px; border-radius: 5px; color: #ffffff; background: #16a34a; font-size: 0.7rem; font-weight: 850; letter-spacing: 0.08em; }
.deck-card > .live-badge { position: absolute; top: 18px; right: 18px; }
.deck-content { padding-top: 28px; }
.deck-title { margin: 0; font-size: 1.45rem; line-height: 1.15; letter-spacing: -0.035em; }
.deck-description { display: -webkit-box; margin: 10px 0 0; overflow: hidden; color: var(--muted); font-size: 0.94rem; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.publication-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 26px; padding: 14px 0; border-top: 1px solid rgba(157, 169, 188, 0.14); border-bottom: 1px solid rgba(157, 169, 188, 0.14); }
.publication-row strong { display: block; font-size: 0.88rem; }
.publication-hint { display: block; margin-top: 2px; color: var(--muted); font-size: 0.75rem; }
.switch { position: relative; display: inline-flex; flex: 0 0 auto; cursor: pointer; }
.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch > span[aria-hidden] { position: relative; display: block; width: 46px; height: 26px; border: 1px solid var(--line-bright); border-radius: 999px; background: #e5e7eb; transition: background 160ms ease, border-color 160ms ease; }
.switch > span[aria-hidden]::after { position: absolute; top: 4px; left: 4px; width: 16px; height: 16px; border-radius: 50%; background: #ffffff; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.18); content: ""; transition: transform 160ms ease, background 160ms ease; }
.switch input:checked + span { border-color: var(--accent); background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); background: var(--accent); }
.switch input:focus-visible + span { outline: 3px solid rgba(119, 168, 255, 0.72); outline-offset: 3px; }
.switch input:disabled + span { opacity: 0.5; cursor: wait; }
.deck-meta { margin-top: auto; padding-top: 26px; color: #78869f; font-size: 0.78rem; }
.deck-actions { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 9px; margin-top: 16px; }

.button { display: inline-flex; min-height: 43px; align-items: center; justify-content: center; padding: 0 16px; border: 1px solid transparent; border-radius: 7px; font-size: 0.9rem; font-weight: 730; text-decoration: none; cursor: pointer; transition: filter 150ms ease, border-color 150ms ease, background 150ms ease, transform 150ms ease; }
.button:hover { filter: brightness(1.08); }
.button:active { transform: translateY(1px); }
.button-primary { color: var(--accent-ink); background: var(--accent); }
.button-primary:hover { background: var(--accent-strong); }
.button-secondary { color: #ffffff; background: var(--blue); }
.button-danger { color: #ffffff; background: var(--danger); }
.button-ghost { border-color: var(--line); color: var(--text); background: transparent; }
.button-ghost:hover { border-color: var(--line-bright); background: var(--surface-raised); }
.button[disabled], .button.is-disabled { opacity: 0.42; cursor: not-allowed; pointer-events: none; }
.button.is-loading { color: transparent; background: var(--accent); animation: pulse 900ms ease-in-out infinite; }

.notice { margin-bottom: 16px; padding: 14px 16px; border: 1px solid #fecaca; border-radius: 8px; color: #991b1b; background: #fef2f2; }
.empty-state { grid-column: 1 / -1; padding: 52px 24px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); text-align: center; }
.empty-state h3 { margin: 0 0 6px; color: var(--text); font-size: 1.25rem; }
.empty-state p { margin: 0; }
.skeleton { min-height: 304px; border-color: transparent; background: #e9edf2; animation: pulse 1.1s ease-in-out infinite; }
.is-hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.login-view { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.login-card { width: min(100%, 420px); padding: 34px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 8px 24px rgba(16, 24, 40, 0.08); }
.login-mark { margin-bottom: 30px; }
.login-card h1 { margin: 4px 0 8px; font-size: 2rem; letter-spacing: -0.045em; }
.login-card > p:not(.section-kicker):not(.form-error) { margin: 0 0 28px; color: var(--muted); }
.login-card label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 0.86rem; font-weight: 700; }
.login-card input { width: 100%; min-height: 48px; padding: 0 13px; border: 1px solid var(--line-bright); border-radius: 7px; color: var(--text); background: #ffffff; font: inherit; }
.login-card .button { width: 100%; margin-top: 18px; }
.login-card > a { display: block; margin-top: 20px; color: var(--muted); font-size: 0.88rem; text-align: center; }
.form-error { margin: 10px 0 0; color: #b91c1c; font-size: 0.86rem; }

.release-shell { padding-top: clamp(24px, 5vw, 56px); padding-bottom: 80px; }
.release-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.release-card { display: flex; overflow: hidden; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); transition: transform 170ms ease, border-color 170ms ease, box-shadow 170ms ease; }
.release-card:hover { transform: translateY(-4px); border-color: var(--line-bright); background: var(--surface); }
.release-card.is-live { border-color: #16a34a; background: var(--surface); }
.release-main { display: block; color: inherit; text-decoration: none; }
.release-preview { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-bottom: 1px solid var(--line); background: #eef1f5; }
.release-preview img { display: block; width: 100%; height: 100%; background: #ffffff; object-fit: cover; }
.release-preview .live-badge { position: absolute; top: 12px; right: 12px; }
.release-card-body { min-height: 94px; padding: 16px 16px 12px; }
.release-card-footer { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: auto; padding: 0 16px 16px; }
.release-card h2 { margin: 0; font-size: 1.25rem; line-height: 1.15; letter-spacing: -0.025em; }
.release-card .deck-description { max-width: 520px; }
.release-card-footer { color: var(--muted); font-size: 0.82rem; }
.open-label, .export-label { display: inline-flex; min-height: 36px; align-items: center; justify-content: center; padding: 0 12px; border-radius: 6px; font-size: 0.86rem; font-weight: 720; text-decoration: none; }
.open-label { color: #ffffff; background: #111827; }
.export-label { border: 1px solid var(--line); color: var(--text); background: #ffffff; }
.export-label:hover { border-color: var(--line-bright); background: var(--surface-raised); }

:focus-visible { outline: 3px solid rgba(119, 168, 255, 0.72); outline-offset: 3px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: 0.45; } }

@media (max-width: 900px) {
  .deck-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .release-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .live-panel { align-items: start; flex-direction: column; }
}

@media (max-width: 600px) {
  .shell { width: min(100% - 24px, 1180px); padding-bottom: 40px; }
  .topbar { min-height: 68px; }
  .live-panel { margin-top: 24px; padding: 24px 20px; border-radius: 10px; }
  .live-actions, .live-actions .button { width: 100%; }
  .library { margin-top: 38px; }
  .section-heading { align-items: start; flex-direction: column; gap: 8px; }
  .deck-grid { grid-template-columns: 1fr; }
  .deck-card { min-height: 350px; }
  .top-actions .text-link { display: none; }
  .compact-button { min-height: 40px; padding-inline: 12px; }
  .release-grid { grid-template-columns: 1fr; }
  .release-card-body { min-height: 128px; padding: 16px; }
  .login-card { padding: 28px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
