:root {
  --bg: #080c0b;
  --bg-elevated: #121917;
  --bg-panel: #17201d;
  --line: #2c3934;
  --text: #f4f0e7;
  --muted: #93a29a;
  --gold: #d4a84b;
  --gold-soft: #b8923f;
  --gold-glow: rgba(212, 168, 75, 0.18);
  --radius: 14px;
  --font-display: "Fredoka", "Segoe UI Semibold", sans-serif;
  --font-body: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --pad: clamp(0.65rem, 1.6vw, 1rem);
  --topbar-h: 3.85rem;
  --stage-bg: #000000;
  --accent: #d4a84b;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(212, 168, 75, 0.08), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(60, 120, 90, 0.08), transparent 50%),
    var(--bg);
  letter-spacing: 0.01em;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  min-height: var(--topbar-h);
  padding: 0.5rem var(--pad);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(18, 25, 23, 0.98), rgba(8, 12, 11, 0.94));
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
  flex: 1;
}

.brand-lockup {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--gold);
  letter-spacing: 0.01em;
}

.brand-credit {
  font-size: 0.68rem;
  font-weight: 600;
  color: #ffe14a;
  letter-spacing: 0.06em;
  text-transform: none;
  white-space: nowrap;
}

.status-pill,
.status-inline {
  display: inline-flex;
  align-items: center;
  max-width: min(280px, 36vw);
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(212, 168, 75, 0.22);
  background: rgba(212, 168, 75, 0.08);
  font-size: 0.72rem;
  font-weight: 500;
  color: #d9c69a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  gap: 0.45rem;
  flex-shrink: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: rgba(23, 32, 29, 0.95);
  color: var(--text);
  border-radius: 999px;
  padding: 0.42rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.btn[hidden] {
  display: none !important;
}

.btn:hover {
  border-color: var(--gold-soft);
  background: rgba(36, 48, 43, 0.95);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(180deg, #e4bc62, var(--gold-soft));
  color: #1a1408;
  border-color: transparent;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(184, 146, 63, 0.22);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #ecc56f, #c49c45);
  border-color: transparent;
}

.btn-danger {
  border-color: rgba(220, 120, 100, 0.55);
  color: #f0b4a8;
  background: rgba(80, 28, 22, 0.45);
}

.btn-danger:hover {
  border-color: rgba(240, 150, 130, 0.8);
  color: #ffd4cc;
}

.label-short {
  display: none;
}

.editor-layout {
  min-height: 0;
  height: 100%;
  padding: var(--pad);
  overflow: hidden;
}

.stage-wrap {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.9fr);
  grid-template-rows: minmax(0, 1fr) auto;
  column-gap: 0.75rem;
  row-gap: 0;
}

.preview-dock {
  display: contents;
}

.preview-chrome {
  grid-column: 1;
  grid-row: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  background:
    linear-gradient(180deg, rgba(28, 38, 34, 0.98), rgba(20, 28, 25, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.stage-frame {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
}

.stage {
  position: relative;
  container-type: size;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 100%;
  background: var(--stage-bg);
  border-radius: 10px;
  overflow: hidden;
  touch-action: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.stage.is-portrait {
  aspect-ratio: 9 / 16;
  width: auto;
  height: 100%;
  max-width: 100%;
}

.stage-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: var(--stage-bg);
}

.stage-bg.is-interactive {
  pointer-events: auto;
  cursor: grab;
}

.stage-bg.is-interactive.is-panning {
  cursor: grabbing;
}

.stage-bg img {
  position: absolute;
  display: block;
  max-width: none;
  max-height: none;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

body.is-output .stage-bg.is-interactive {
  pointer-events: none;
  cursor: default;
}

.stage.is-output {
  border-radius: 0;
}

.layer {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  margin: 0;
  width: max-content;
  max-width: none;
  padding: 0.15em 0.2em;
  line-height: 0.95;
  letter-spacing: 0;
  font-weight: 700;
  /* Satu baris ke samping; Enter di teks = baris baru (tanpa auto-wrap) */
  white-space: pre;
  word-break: normal;
  overflow-wrap: normal;
  text-align: center;
  cursor: grab;
  user-select: none;
  outline: 2px solid transparent;
  outline-offset: 4px;
  border-radius: 6px;
  transition: outline-color 0.15s ease;
}

.layer.is-selected {
  outline-color: color-mix(in srgb, var(--accent) 70%, transparent);
}

.layer.is-dragging {
  cursor: grabbing;
  outline-color: var(--accent);
}

.layer[data-type="timer"] {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.layer.is-scribble {
  font-weight: 400;
  background-repeat: repeat;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.layer.is-intro {
  animation: intro-pop 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes intro-pop {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.86);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.player-bar {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.45rem 0.75rem 0.75rem;
  border: 1px solid var(--line);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 0 0 var(--radius) var(--radius);
  background: linear-gradient(180deg, rgba(20, 28, 25, 0.96), rgba(16, 23, 21, 0.98));
}

.seek-row {
  width: 100%;
}

.seek-row input[type="range"] {
  width: 100%;
  accent-color: var(--gold);
  cursor: pointer;
}

.player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.player-controls {
  display: flex;
  gap: 0.45rem;
}

.player-meta {
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

.player-meta #player-time {
  color: var(--gold);
  font-weight: 600;
}

.player-meta .dot {
  opacity: 0.5;
}

.player-volume {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
}

.player-volume input[type="range"] {
  width: min(120px, 22vw);
  accent-color: var(--gold);
}

.player-volume #player-volume-val {
  min-width: 2.4rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: right;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 999px;
  font-size: 0.95rem;
  line-height: 1;
  color: var(--gold);
}

.btn-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.btn-icon.is-muted {
  color: #c9a9a0;
}

.btn-icon .icon-mute {
  display: none;
}

.btn-icon.is-muted .icon-vol {
  display: none;
}

.btn-icon.is-muted .icon-mute {
  display: block;
}

.panel {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(23, 32, 29, 0.98), rgba(16, 23, 21, 0.96));
  border-radius: var(--radius);
  padding: 0.75rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.results-pane {
  grid-column: 2;
  grid-row: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  overflow: hidden;
  min-height: 0;
  min-width: 0;
}

.panel-tabs {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
  padding: 0.2rem;
  border-radius: 999px;
  background: rgba(8, 12, 11, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.tab {
  flex: 1;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.42rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  transition: color 0.15s ease, background 0.15s ease;
}

.tab:hover {
  color: var(--text);
}

.tab.is-active {
  color: #1a1408;
  background: linear-gradient(180deg, #e4bc62, var(--gold-soft));
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(184, 146, 63, 0.2);
}

.tab-panels {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-right: 0.25rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 168, 75, 0.45) transparent;
}

.tab-panels::-webkit-scrollbar {
  width: 6px;
}

.tab-panels::-webkit-scrollbar-thumb {
  background: rgba(212, 168, 75, 0.35);
  border-radius: 999px;
}

.tab-panel {
  display: none;
  gap: 0.75rem;
}

.tab-panel.is-active {
  display: flex;
  flex-direction: column;
}

.tab-panel h2,
.timeline-header h2 {
  margin: 0;
  font-size: 0.95rem;
}

.tab-panel h2.section-gap {
  margin-top: 0.35rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.55rem;
}

.timeline-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.field {
  display: grid;
  gap: 0.35rem;
}

.field > span {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.field em {
  font-style: normal;
  color: var(--gold);
  letter-spacing: 0;
  text-transform: none;
}

.field input[type="text"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #0a0f0d;
  color: var(--text);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  outline: none;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--gold-soft);
}

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

.duration-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
}

.duration-field {
  display: grid;
  gap: 0.25rem;
  text-align: center;
}

.duration-field span {
  font-size: 0.68rem;
  color: var(--muted);
}

.duration-field input {
  width: 100%;
  border: 1px solid var(--line);
  background: #0a0f0d;
  color: var(--text);
  border-radius: 10px;
  padding: 0.55rem 0.35rem;
  text-align: center;
  -moz-appearance: textfield;
}

.duration-field input::-webkit-outer-spin-button,
.duration-field input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--text);
}

.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
}

.color-row {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 0.45rem;
}

.color-row input[type="color"] {
  width: 48px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}

.pos-grid {
  display: grid;
  gap: 0.65rem;
}

.effect-controls {
  display: grid;
  gap: 0.65rem;
  padding: 0.55rem 0.65rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(10, 15, 13, 0.45);
}

.effect-controls[hidden] {
  display: none !important;
}

.layer-select-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: stretch;
}

.layer-select-row select {
  min-width: 0;
}

.layer-select-row .btn-danger {
  padding-inline: 0.85rem;
}

.layers-list-wrap {
  flex-shrink: 0;
  border-top: 1px solid var(--line);
  padding-top: 0.65rem;
  max-height: 28%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.layers-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: auto;
  display: grid;
  gap: 0.35rem;
}

.layers-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
  cursor: pointer;
  background: rgba(10, 15, 13, 0.55);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.layers-list li:hover {
  border-color: rgba(212, 168, 75, 0.45);
}

.layers-list li.is-active {
  border-color: var(--gold-soft);
  background: rgba(212, 168, 75, 0.12);
  box-shadow: 0 0 0 1px rgba(212, 168, 75, 0.12);
}

.layers-list .layer-name {
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.layers-list .layer-type {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.layers-list .layer-del {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 8px;
  font-size: 1.05rem;
  line-height: 1;
}

.hint {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.55);
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal-card {
  width: min(520px, 100%);
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-panel);
  padding: 0.85rem;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.modal-header h2 {
  margin: 0;
  font-size: 1rem;
  color: var(--gold);
}

.modal-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
  text-align: center;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.modal-credit {
  margin: 0.15rem 0 0;
  text-align: center;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: #ffe14a;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.55rem;
  color: var(--text);
  font-size: 0.85rem;
}

.settings-field > span {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.filename-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.4rem;
}

.filename-row input {
  width: 100%;
  border: 1px solid var(--line);
  background: #0a0f0d;
  color: var(--text);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  outline: none;
  font-size: 16px;
}

.filename-row input:focus {
  border-color: var(--gold-soft);
}

.filename-ext {
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.settings-field select {
  width: 100%;
  border: 1px solid var(--line);
  background: #0a0f0d;
  color: var(--text);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  outline: none;
}

.settings-field select:focus {
  border-color: var(--gold-soft);
}

.field-hint {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}

.audio-meta {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
  word-break: break-all;
}

.audio-meta.has-file {
  color: var(--gold);
}

input[type="file"] {
  width: 100%;
  border: 1px solid var(--line);
  background: #0a0f0d;
  color: var(--muted);
  border-radius: 10px;
  padding: 0.45rem;
  font-size: 0.8rem;
}

.export-card {
  position: relative;
  isolation: isolate;
  overflow: visible;
  max-height: none;
  border-color: rgba(240, 213, 138, 0.55);
  box-shadow:
    0 0 0 1px rgba(240, 213, 138, 0.35),
    0 0 28px rgba(232, 201, 106, 0.35),
    0 18px 48px rgba(0, 0, 0, 0.45);
}

.export-card::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: calc(var(--radius) + 3px);
  padding: 2px;
  background: conic-gradient(
    from var(--export-angle, 0deg),
    transparent 0deg,
    transparent 250deg,
    rgba(255, 236, 160, 0.15) 280deg,
    #ffe08a 310deg,
    #f0d58a 330deg,
    #e8c96a 350deg,
    transparent 360deg
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: export-border-spin 2.4s linear infinite;
  pointer-events: none;
  z-index: 0;
  filter: drop-shadow(0 0 8px rgba(240, 213, 138, 0.75));
}

.export-card > * {
  position: relative;
  z-index: 1;
}

@keyframes export-border-spin {
  to {
    --export-angle: 360deg;
  }
}

@property --export-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

.export-blessing {
  margin: 0.35rem 0 0.15rem;
  text-align: center;
  font-size: clamp(1rem, 2.4vw, 1.2rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.55;
  color: #f0d58a;
  text-shadow: 0 0 18px rgba(240, 213, 138, 0.35);
}

.export-setup {
  display: grid;
  gap: 0.35rem;
}

.export-progress {
  display: grid;
  gap: 0.75rem;
  justify-items: center;
  padding: 0.85rem 0.35rem 0.45rem;
}

.export-progress[hidden],
.export-setup[hidden],
.export-done[hidden] {
  display: none !important;
}

.export-progress-pct {
  font-size: clamp(2.4rem, 8vw, 3.2rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.04em;
  color: #f0d58a;
  text-shadow: 0 0 22px rgba(240, 213, 138, 0.55);
  font-variant-numeric: tabular-nums;
}

.export-progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(240, 213, 138, 0.12);
  border: 1px solid rgba(240, 213, 138, 0.35);
  overflow: hidden;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.35);
}

.export-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #c9a227, #f0d58a, #ffe9a8);
  box-shadow: 0 0 14px rgba(240, 213, 138, 0.65);
  transition: width 0.2s ease-out;
}

/* Output mode: hide chrome, only black stage */
body.is-output .topbar,
body.is-output .player-bar,
body.is-output .results-pane {
  display: none !important;
}

body.is-output .editor-layout {
  padding: 0;
}

body.is-output .stage-wrap {
  display: block;
  height: 100%;
}

body.is-output .preview-dock {
  display: contents;
}

body.is-output .preview-chrome {
  height: 100%;
  border: none;
  border-radius: 0;
  padding: 0;
  background: #000;
  display: grid;
  place-items: center;
}

body.is-output .stage-frame {
  height: 100%;
  width: 100%;
  display: grid;
  place-items: center;
}

body.is-output .stage {
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  max-height: 100vh;
  aspect-ratio: 16 / 9;
  border-radius: 0;
  margin: auto;
}

body.is-output .stage.is-portrait {
  width: min(100vw, calc(100vh * 9 / 16));
  height: min(100vh, calc(100vw * 16 / 9));
  max-width: 100vw;
  max-height: 100vh;
  aspect-ratio: 9 / 16;
}

body.is-output .layer {
  outline: none !important;
  cursor: default;
}

body.is-output .layer.is-selected {
  outline: none !important;
}

.support-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 1.1rem;
  background:
    radial-gradient(120% 90% at 50% 10%, rgba(212, 168, 75, 0.18), transparent 55%),
    rgba(4, 8, 7, 0.78);
  backdrop-filter: blur(8px);
  animation: support-fade-in 0.28s ease both;
  overflow: auto;
}

.support-backdrop[hidden] {
  display: none !important;
}

.support-card {
  width: min(380px, 100%);
  max-height: min(92dvh, 100%);
  display: grid;
  gap: 0.7rem;
  justify-items: center;
  text-align: center;
  padding: 1.25rem 1.2rem 1.05rem;
  border-radius: 18px;
  border: 1px solid rgba(232, 201, 110, 0.28);
  background: linear-gradient(180deg, #1a2320 0%, #101614 100%);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  animation: support-pop 0.32s cubic-bezier(0.2, 0.9, 0.2, 1) both;
  box-sizing: border-box;
  overflow: auto;
}

.support-kicker {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}

.support-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.support-copy {
  margin: 0;
  color: rgba(244, 240, 231, 0.78);
  font-size: 0.92rem;
  line-height: 1.5;
  max-width: 28ch;
}

.support-qr-wrap {
  width: min(240px, 72vw, 42dvh);
  aspect-ratio: 1;
  padding: 0.65rem;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  box-sizing: border-box;
}

.support-qr {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 8px;
}

.support-timer {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: rgba(244, 240, 231, 0.55);
  font-variant-numeric: tabular-nums;
}

.support-progress {
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.support-progress span {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #e8c96a, #d4a84b);
  transform-origin: left center;
}

.support-backdrop.is-open .support-progress span {
  animation: support-shrink 10s linear forwards;
}

@keyframes support-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes support-pop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes support-shrink {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

body.is-output .support-backdrop {
  display: none !important;
}

@media (orientation: landscape) and (max-height: 640px) {
  .support-backdrop {
    padding: 0.45rem;
  }

  .support-card {
    width: min(560px, 96vw);
    max-height: calc(100dvh - 0.9rem);
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "kicker qr"
      "title qr"
      "copy qr"
      "timer timer"
      "progress progress";
    gap: 0.28rem 0.85rem;
    justify-items: start;
    text-align: left;
    padding: 0.7rem 0.85rem 0.65rem;
    overflow: hidden;
  }

  .support-kicker { grid-area: kicker; font-size: 0.64rem; }
  .support-title { grid-area: title; font-size: 1.02rem; }
  .support-copy {
    grid-area: copy;
    font-size: 0.78rem;
    line-height: 1.35;
    max-width: none;
  }
  .support-qr-wrap {
    grid-area: qr;
    width: min(118px, 48dvh);
    padding: 0.35rem;
    border-radius: 10px;
    align-self: center;
  }
  .support-timer {
    grid-area: timer;
    width: 100%;
    text-align: center;
  }
  .support-progress { grid-area: progress; }
}

@media (max-width: 900px) {
  html,
  body {
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
  }

  body {
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }

  .app-shell {
    height: 100dvh;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .topbar {
    position: relative;
    z-index: 20;
    min-height: 0;
    flex-shrink: 0;
    padding: 0.45rem 0.7rem;
    gap: 0.5rem;
  }

  .brand {
    flex-direction: row;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
  }

  .brand-name {
    font-size: 0.98rem;
  }

  .brand-credit {
    display: block;
    font-size: 0.62rem;
    color: #ffe14a;
  }

  .status-pill,
  .status-inline {
    display: none;
  }

  .label-wide {
    display: none;
  }

  .label-short {
    display: inline;
  }

  .topbar-actions {
    gap: 0.32rem;
  }

  .topbar-actions .btn {
    padding: 0.4rem 0.62rem;
    font-size: 0.74rem;
    min-height: 36px;
  }

  .editor-layout {
    height: 100%;
    min-height: 0;
    padding: 0.45rem 0.45rem 0.55rem;
    overflow: hidden;
  }

  .stage-wrap {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    overflow: hidden;
    grid-template-columns: none;
    grid-template-rows: none;
  }

  .preview-dock {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    position: relative;
    top: auto;
    z-index: 18;
    background:
      radial-gradient(1200px 600px at 12% -10%, rgba(212, 168, 75, 0.08), transparent 55%),
      var(--bg);
  }

  .preview-chrome {
    grid-column: auto;
    grid-row: auto;
    padding: 0.4rem;
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: none;
  }

  .stage-frame {
    flex: none;
    width: 100%;
    display: grid;
    place-items: center;
  }

  .stage {
    width: min(100%, calc(30dvh * 16 / 9));
    max-width: 100%;
    height: auto;
    min-height: 0;
    max-height: 30dvh;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
  }

  .stage.is-portrait {
    width: min(100%, calc(42dvh * 9 / 16));
    height: auto;
    max-height: 42dvh;
    aspect-ratio: 9 / 16;
  }

  .player-bar {
    grid-column: auto;
    grid-row: auto;
    flex-shrink: 0;
    padding: 0.35rem 0.5rem 0.5rem;
    gap: 0.3rem;
  }

  .player-row {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0.4rem 0.55rem;
  }

  .player-controls {
    grid-column: 1;
  }

  .player-meta {
    grid-column: 2;
    justify-self: end;
    font-size: 0.74rem;
  }

  .player-volume {
    grid-column: 1 / -1;
    margin-left: 0;
    width: 100%;
  }

  .player-volume input[type="range"] {
    flex: 1;
    width: auto;
    min-width: 0;
  }

  .results-pane {
    grid-column: auto;
    grid-row: auto;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.7rem;
  }

  .tab-panels {
    flex: none;
    overflow: visible;
    padding-right: 0;
  }

  .layers-list-wrap {
    max-height: none;
    flex-shrink: 1;
  }

  .duration-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .duration-field input,
  .field input[type="text"],
  .field input[type="number"],
  .field select,
  .field textarea {
    font-size: 16px;
  }

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

  .modal-backdrop {
    padding: 0.65rem;
    align-items: end;
  }

  .modal-card {
    width: 100%;
    max-height: min(92dvh, 100%);
    overflow: auto;
  }

  body.is-output {
    padding: 0;
    height: 100dvh;
    overflow: hidden;
  }

  body.is-output .preview-dock {
    position: static;
    display: contents;
    box-shadow: none;
    background: transparent;
  }

  body.is-output .app-shell,
  body.is-output .editor-layout,
  body.is-output .stage-wrap {
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
  }

  body.is-output .stage {
    width: min(100vw, calc(100dvh * 16 / 9));
    height: min(100dvh, calc(100vw * 9 / 16));
    max-height: 100dvh;
    aspect-ratio: 16 / 9;
  }

  body.is-output .stage.is-portrait {
    width: min(100vw, calc(100dvh * 9 / 16));
    height: min(100dvh, calc(100vw * 16 / 9));
    max-width: 100vw;
    max-height: 100dvh;
    aspect-ratio: 9 / 16;
  }
}

@media (max-width: 900px) and (orientation: landscape),
  (max-height: 540px) and (orientation: landscape) {
  html,
  body {
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
  }

  .app-shell {
    height: 100dvh;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .topbar {
    padding: 0.28rem 0.55rem;
  }

  .brand-name {
    font-size: 0.88rem;
  }

  .brand-credit {
    display: block;
    font-size: 0.58rem;
    color: #ffe14a;
  }

  .topbar-actions .btn {
    min-height: 32px;
    padding: 0.28rem 0.5rem;
    font-size: 0.7rem;
  }

  .editor-layout {
    height: 100%;
    min-height: 0;
    padding: 0.4rem;
    overflow: hidden;
  }

  .stage-wrap {
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(220px, 0.95fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 0.45rem;
  }

  .preview-dock {
    position: relative;
    top: auto;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    box-shadow: none;
  }

  .preview-chrome {
    flex: 1 1 auto;
    min-height: 0;
    padding: 0.35rem;
  }

  .stage-frame {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    place-items: center;
  }

  .stage {
    width: 100%;
    height: auto;
    max-height: 100%;
    aspect-ratio: 16 / 9;
  }

  .stage.is-portrait {
    width: auto;
    height: 100%;
    max-width: 100%;
    aspect-ratio: 9 / 16;
  }

  .player-bar {
    flex-shrink: 0;
    padding: 0.3rem 0.45rem 0.4rem;
  }

  .player-row {
    grid-template-columns: auto 1fr auto;
  }

  .player-volume {
    grid-column: 3;
    width: auto;
    margin-left: 0;
  }

  .player-volume input[type="range"] {
    width: 72px;
    flex: none;
  }

  .player-volume #player-volume-val {
    display: none;
  }

  .results-pane {
    height: 100%;
    min-height: 0;
    overflow: auto;
    padding: 0.55rem;
  }

  body.is-output .stage-wrap {
    display: grid;
    place-items: center;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .topbar-actions .btn {
    padding: 0.38rem 0.5rem;
    font-size: 0.7rem;
  }
}
