:root {
  --artboard-max-width: 1220px;
  --bg: #201714;
  --panel: rgba(47, 34, 29, 0.84);
  --panel-soft: rgba(255, 250, 244, 0.08);
  --border: rgba(255, 237, 214, 0.11);
  --text: #f7eee2;
  --muted: #d2c0af;
  --accent: #ffb266;
  --paper: #f6efe2;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top, rgba(255, 193, 121, 0.16), transparent 28%),
    radial-gradient(circle at 80% 10%, rgba(255, 244, 225, 0.08), transparent 18%),
    linear-gradient(180deg, #2a1d18 0%, #181111 100%);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.stage-topbar h1,
.panel-heading h2 {
  margin: 0;
  font-size: clamp(1.15rem, 1rem + 0.9vw, 1.8rem);
  letter-spacing: -0.04em;
}

.eyebrow {
  margin: 0 0 3px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.topbar-actions,
.stage-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.compact-stage-meta {
  min-width: 0;
}

.primary-button,
.secondary-button,
.tool-button,
.spill-button {
  appearance: none;
  border: 1px solid rgba(255, 242, 228, 0.12);
  border-radius: 14px;
  padding: 9px 11px;
  color: var(--text);
  background: var(--panel-soft);
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.compact-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
}

.button-icon {
  font-size: 1rem;
  line-height: 1;
}

.button-label {
  font-size: 0.88rem;
}

.primary-button {
  background: linear-gradient(180deg, #ffb971 0%, #e59044 100%);
  border-color: rgba(255, 206, 152, 0.6);
  color: #2d1f15;
  font-weight: 700;
}

.primary-button:hover,
.secondary-button:hover,
.tool-button:hover,
.spill-button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 232, 204, 0.35);
}

.tool-button.active,
.spill-button.active {
  background: linear-gradient(180deg, rgba(255, 193, 121, 0.24), rgba(255, 163, 92, 0.14));
  border-color: rgba(255, 200, 141, 0.62);
  box-shadow: inset 0 0 0 1px rgba(255, 223, 190, 0.18);
}

.spill-button.spill-random {
  border-style: dashed;
}

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(210px, 250px) minmax(540px, 1fr) minmax(210px, 250px);
  gap: 12px;
  min-height: 0;
  align-items: start;
}

.side-panel,
.center-stage {
  min-height: 0;
}

.side-panel {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bottom-left-slot {
  margin-top: auto;
}

.panel-heading {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.compact-heading h2 {
  font-size: 1.18rem;
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 44px;
  text-align: left;
}

.tool-icon {
  width: 20px;
  text-align: center;
  flex: 0 0 20px;
  font-size: 1rem;
  line-height: 1;
}

.tool-label {
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.control-stack {
  display: grid;
  gap: 8px;
}

.control-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(255, 248, 240, 0.05);
  border: 1px solid rgba(255, 239, 220, 0.08);
}

.control-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.9rem;
}

.value-pill,
.micro-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 246, 232, 0.09);
  border: 1px solid rgba(255, 237, 214, 0.12);
  color: var(--muted);
  font-size: 0.82rem;
}

input[type="range"] {
  width: 100%;
}

input[type="color"] {
  width: 100%;
  height: 40px;
  border: none;
  border-radius: 10px;
  padding: 0;
  background: transparent;
}

.mini-note,
.status-text {
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.88rem;
  margin: 0;
}

.artboard-label {
  margin-bottom: 0;
}

.center-stage {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.stage-topbar {
  width: min(100%, var(--artboard-max-width));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(47, 34, 29, 0.96), rgba(47, 34, 29, 0.84));
}

.stage-title-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.stage-title-block h1 {
  margin: 0;
}

.board-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 0 4px 4px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 248, 238, 0.05), rgba(255, 248, 238, 0.02)),
    rgba(15, 10, 9, 0.22);
  border: 1px solid rgba(255, 237, 214, 0.08);
  overflow: auto;
}

.board-frame {
  position: relative;
  width: min(100%, var(--artboard-max-width));
  aspect-ratio: 16 / 10;
  border-radius: 24px;
  overflow: hidden;
  background: var(--paper);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.3),
    inset 0 0 0 1px rgba(73, 51, 40, 0.08),
    inset 0 18px 34px rgba(255, 255, 255, 0.22);
}

.board-frame::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 17px;
  border: 1px solid rgba(88, 58, 42, 0.08);
  pointer-events: none;
}

.board-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.board-spill,
.board-spill-fx {
  pointer-events: none;
}

.board-drawing {
  cursor: crosshair;
}

.cursor-ring {
  position: absolute;
  width: 24px;
  height: 24px;
  border: 1.5px solid rgba(68, 45, 34, 0.8);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  mix-blend-mode: multiply;
  opacity: 0;
  transition: opacity 120ms ease;
}

.side-panel-footer {
  margin-top: auto;
  display: flex;
}

.right-panel-footer {
  justify-content: flex-end;
  padding-top: 2px;
}

.side-brand-link {
  color: rgba(255, 233, 212, 0.72);
  text-decoration: none;
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: lowercase;
  padding: 3px 0;
}

.side-brand-link:hover {
  color: #fff4e6;
}

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

  .left-panel,
  .right-panel {
    order: 1;
  }

  .center-stage {
    order: 0;
    min-height: 68vh;
  }
}

@media (max-width: 720px) {
  .stage-topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-actions,
  .stage-meta {
    width: 100%;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .compact-button .button-label {
    display: none;
  }

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

  .tool-label {
    display: none;
  }

  .icon-button {
    justify-content: center;
  }

  .board-wrap {
    padding: 6px;
  }
}


.board-frame:fullscreen {
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto;
  border-radius: 0;
  max-width: none;
  box-shadow: none;
}

.board-frame:fullscreen::before {
  inset: 18px;
  border-radius: 0;
  border-color: rgba(88, 58, 42, 0.1);
}

.board-frame:fullscreen .cursor-ring {
  mix-blend-mode: normal;
}

.board-frame:fullscreen .board-layer {
  width: 100%;
  height: 100%;
}

.board-frame:fullscreen {
  background: var(--paper);
}

.board-frame:fullscreen::backdrop {
  background: var(--paper);
}
