:root {
  color-scheme: dark;
  --night: #16110e;
  --panel: #211a15;
  --panel-2: #2a211a;
  --cream: #f2e7d3;
  --muted: #ad9e89;
  --line: #564535;
  --rose: #c97a78;
  --green: #93ad91;
  background: var(--night);
  color: var(--cream);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 12% 10%, rgba(150, 74, 60, .14), transparent 28rem),
    radial-gradient(circle at 88% 44%, rgba(73, 99, 85, .12), transparent 32rem),
    var(--night);
}

button,
select,
input {
  font: inherit;
}

button,
select,
.file-button {
  min-height: 44px;
}

button:focus-visible,
select:focus-visible,
.file-button:focus-within {
  outline: 2px solid #f2bd8c;
  outline-offset: 3px;
}

main {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(32px, 6vw, 84px) 0 72px;
}

.masthead {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, .8fr);
  gap: clamp(28px, 6vw, 90px);
  align-items: end;
  margin-bottom: clamp(28px, 4vw, 52px);
}

.eyebrow,
.label,
label,
legend {
  margin: 0 0 10px;
  color: #d7bea0;
  font: 650 10px/1.4 ui-monospace, "SFMono-Regular", Consolas, monospace;
  letter-spacing: 1.8px;
}

.identity-origin {
  color: inherit;
  text-transform: uppercase;
  text-underline-offset: 3px;
}

h1 {
  max-width: 850px;
  margin: 0;
  font: 400 clamp(36px, 6vw, 80px)/.98 Georgia, "Times New Roman", serif;
  letter-spacing: -.04em;
}

.lede {
  max-width: 540px;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: clamp(15px, 1.45vw, 19px);
  line-height: 1.65;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(290px, .72fr);
  gap: clamp(18px, 2.6vw, 38px);
  align-items: start;
}

.stage-shell {
  position: relative;
  min-width: 0;
  padding: clamp(10px, 1.25vw, 18px);
  border: 1px solid #44372b;
  border-radius: 18px;
  background: #0d0a08;
  box-shadow: 0 32px 90px rgba(0, 0, 0, .36);
}

daeryeok-window {
  width: 100%;
}

.stage-note {
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 13px 4px 0;
  color: #a99782;
  font: 600 9px/1.4 ui-monospace, "SFMono-Regular", Consolas, monospace;
  letter-spacing: 1.4px;
}

#live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b89068;
  box-shadow: 0 0 0 4px rgba(184, 144, 104, .1);
}

#live-dot[data-live="true"] {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(147, 173, 145, .12), 0 0 12px rgba(147, 173, 145, .5);
}

.controls {
  display: grid;
  gap: 12px;
}

.control-block,
.actions,
.state-card {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: linear-gradient(145deg, rgba(48, 38, 30, .92), rgba(30, 24, 20, .95));
}

.control-block {
  min-width: 0;
  margin: 0;
  padding: 16px;
}

fieldset.control-block {
  padding-top: 10px;
}

legend {
  padding: 0 7px;
}

.control-block p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

select {
  width: 100%;
  border: 1px solid #725d48;
  border-radius: 8px;
  padding: 0 12px;
  background: #19130f;
  color: var(--cream);
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.button-grid.compact {
  grid-template-columns: repeat(3, 1fr);
}

.button-grid button,
.actions button,
.file-button {
  border: 1px solid #66513f;
  border-radius: 8px;
  background: #1a1410;
  color: #d5c6b1;
  cursor: pointer;
  font: 600 10px/1 ui-monospace, "SFMono-Regular", Consolas, monospace;
  letter-spacing: .55px;
  text-transform: uppercase;
}

.button-grid button:hover,
.actions button:hover,
.file-button:hover {
  border-color: #a17a5d;
  background: #261c16;
}

.button-grid button[aria-pressed="true"] {
  border-color: var(--rose);
  background: rgba(201, 122, 120, .18);
  color: #f5d9d0;
}

.image-control {
  display: grid;
}

.file-button {
  display: grid;
  place-items: center;
  padding: 0 14px;
}

#image-file {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.text-button {
  min-height: 34px;
  margin-top: 8px;
  border: 0;
  background: transparent;
  color: #d9ae8c;
  cursor: pointer;
  font: 600 10px ui-monospace, monospace;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px;
}

.actions button {
  padding: 0 10px;
}

.state-card {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: clamp(24px, 5vw, 70px);
  margin-top: clamp(24px, 4vw, 48px);
  padding: clamp(20px, 3vw, 34px);
}

dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

dl div {
  min-width: 0;
  border-top: 1px solid #5c4938;
  padding-top: 10px;
}

dt {
  color: #8f7d69;
  font: 600 9px ui-monospace, monospace;
  letter-spacing: 1px;
  text-transform: uppercase;
}

dd {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  color: #e0d2bf;
  font: 500 11px/1.45 ui-monospace, monospace;
}

.api-note p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

code {
  color: #e7bb96;
  font-family: ui-monospace, monospace;
}

@media (max-width: 980px) {
  .masthead,
  .workbench,
  .state-card {
    grid-template-columns: 1fr;
  }

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

  .actions {
    align-self: stretch;
  }
}

@media (max-width: 620px) {
  main {
    width: min(100% - 22px, 1440px);
    padding-top: 26px;
  }

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

  .button-grid,
  .button-grid.compact {
    grid-template-columns: repeat(3, 1fr);
  }

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

  daeryeok-window::part(caption) {
    display: none;
  }
}
