:root {
  color-scheme: dark;
  --page: #090a0b;
  --panel: #121416;
  --panel-2: #181b1e;
  --line: #2d3135;
  --line-soft: #22262a;
  --text: #f5f1e8;
  --muted: #a6aaa8;
  --accent: #ff5c35;
  --accent-dark: #df3f1c;
  --paper: #f5f1e8;
  --black: #111315;
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 78% 10%, rgba(255, 92, 53, 0.09), transparent 24rem),
    var(--page);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="range"],
input[type="color"] {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
.art-stage:focus-visible {
  outline: 3px solid rgba(255, 92, 53, 0.42);
  outline-offset: 3px;
}

.app-shell {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 0 28px 28px;
}

.topbar {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line-soft);
}

.topbar-meta {
  display: flex;
  align-items: flex-end;
  gap: 18px;
}

.site-nav,
.site-footer nav {
  display: flex;
  align-items: center;
  gap: 15px;
}

.site-nav a,
.site-footer a {
  color: #c5c7c4;
  text-decoration: none;
  font-size: 0.8rem;
}

.site-nav a:hover,
.site-footer a:hover {
  color: var(--text);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 9px;
  font-family: Georgia, serif;
  font-size: 1.25rem;
  line-height: 1;
  transform: rotate(180deg);
}

.privacy-note {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: #c5c7c4;
  font-size: 0.83rem;
}

.privacy-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 92, 53, 0.12);
}

.studio {
  min-height: calc(100vh - 103px);
  display: grid;
  grid-template-columns: minmax(360px, 430px) minmax(0, 1fr);
  gap: 18px;
  padding-top: 18px;
}

.control-panel,
.preview-panel {
  height: calc(100vh - 110px);
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(18, 20, 22, 0.94);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.26);
}

.control-panel {
  padding: 22px;
  overflow: auto;
}

.panel-heading,
.controls-heading,
.preview-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.13em;
}

h1,
h2,
.preview-title {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: clamp(1.42rem, 2.3vw, 1.85rem);
  letter-spacing: -0.035em;
}

h2 {
  font-size: 1.08rem;
  letter-spacing: -0.015em;
}

.status-chip {
  padding: 6px 9px;
  border: 1px solid rgba(255, 92, 53, 0.55);
  border-radius: 999px;
  color: #ff9b7c;
  background: rgba(255, 92, 53, 0.08);
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
}

.field-stack {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.field-stack label {
  color: #d9d9d5;
  font-size: 0.86rem;
  font-weight: 650;
}

.field-stack label span {
  color: var(--muted);
  font-weight: 450;
}

.text-input-wrap {
  position: relative;
}

.text-input-wrap input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid #363b3f;
  border-radius: 11px;
  background: #0d0f10;
  color: var(--text);
  transition: border-color 160ms ease, background 160ms ease;
}

.text-input-wrap input {
  padding: 10px 50px 10px 14px;
  text-transform: uppercase;
  font-size: 1.05rem;
  font-weight: 760;
  letter-spacing: 0.055em;
}

.text-input-wrap span {
  position: absolute;
  top: 50%;
  right: 13px;
  transform: translateY(-50%);
  color: #73797b;
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 0.77rem;
}

.text-input-wrap input:hover,
.text-input-wrap input:focus,
select:hover,
select:focus {
  border-color: #646b6f;
}

select {
  appearance: none;
  padding: 0 42px 0 13px;
  background-image:
    linear-gradient(45deg, transparent 50%, #aeb2b1 50%),
    linear-gradient(135deg, #aeb2b1 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 21px,
    calc(100% - 13px) 21px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.field-help,
.form-error,
.trust-line,
.drag-hint {
  font-size: 0.78rem;
}

.field-help {
  margin: 9px 0 0;
  color: #848a8b;
}

.form-error {
  min-height: 1.25rem;
  margin: 4px 0 2px;
  color: #ff9679;
}

.primary-button,
.download-button {
  width: 100%;
  min-height: 49px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 11px;
  padding: 0 15px;
  font-weight: 760;
  transition: transform 160ms ease, background 160ms ease;
}

.primary-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #17100d;
}

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

.primary-button:hover {
  background: #ff704e;
}

.divider {
  height: 1px;
  margin: 24px -22px 20px;
  background: var(--line-soft);
}

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

.field-span {
  grid-column: 1 / -1;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 3px;
  border: 1px solid #363b3f;
  border-radius: 11px;
  background: #0d0f10;
}

.segmented-control label {
  position: relative;
}

.segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  min-height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #979d9c;
  font-size: 0.76rem;
  font-weight: 650;
  transition: background 160ms ease, color 160ms ease;
  cursor: pointer;
}

.segmented-control input:checked + span {
  background: #2b2f32;
  color: var(--text);
}

.segmented-control input:focus-visible + span {
  outline: 2px solid var(--accent);
}

.color-field {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid #363b3f;
  border-radius: 11px;
  background: #0d0f10;
}

.color-field input {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
}

.color-field output {
  color: #b4b8b6;
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 0.78rem;
}

.download-block {
  margin-top: 20px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #0d0f10;
}

.output-specs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
  margin: 0 0 14px;
}

.output-specs div {
  min-width: 0;
}

.output-specs dt {
  color: #73797b;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.output-specs dd {
  margin: 2px 0 0;
  color: #d8dad7;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.download-button {
  border: 1px solid #404549;
  background: #202428;
  color: var(--text);
}

.download-button:hover {
  background: #292e32;
}

.trust-line {
  margin: 9px 0 0;
  text-align: center;
  color: #747a7b;
}

.preview-panel {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(380px, 1fr) auto auto;
  gap: 14px;
  padding: 18px;
  overflow: hidden;
}

.preview-toolbar {
  align-items: center;
}

.preview-title {
  max-width: 60vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #d4d6d3;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.035em;
}

.angle-readout {
  min-width: 58px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--accent);
  background: #0d0f10;
  text-align: center;
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 0.8rem;
}

.canvas-wrap {
  position: relative;
  min-height: 380px;
  display: grid;
  place-items: center;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  border: 1px solid #34393c;
  border-radius: 14px;
  background: #e8e6df;
  isolation: isolate;
}

.canvas-grid {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.3;
  background-image:
    linear-gradient(45deg, #b9bbb6 25%, transparent 25%),
    linear-gradient(-45deg, #b9bbb6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #b9bbb6 75%),
    linear-gradient(-45deg, transparent 75%, #b9bbb6 75%);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

.art-stage {
  width: min(72vh, 84%);
  max-width: 760px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  transform: rotate(0deg);
  transform-origin: center;
  transition: transform 90ms linear;
  will-change: transform;
  cursor: grab;
}

.art-stage.is-dragging {
  cursor: grabbing;
  transition: none;
}

#svgMount,
#svgMount svg {
  width: 100%;
  height: 100%;
  display: block;
}

.orientation-label {
  position: absolute;
  left: 50%;
  z-index: 2;
  transform: translateX(-50%);
  color: rgba(16, 18, 19, 0.52);
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  pointer-events: none;
}

.orientation-top {
  top: 12px;
}

.orientation-bottom {
  bottom: 12px;
  transform: translateX(-50%) rotate(180deg);
}

.rotation-controls {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 64px;
  align-items: center;
  gap: 12px;
}

.icon-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #191c1f;
  color: #d1d3d0;
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 0.76rem;
}

.icon-button:hover {
  border-color: #4c5256;
}

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

.drag-hint {
  margin: 0;
  color: #858a8a;
  text-align: center;
}

.drag-hint span {
  margin-right: 6px;
  color: var(--accent);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10;
  max-width: min(360px, calc(100vw - 48px));
  padding: 11px 14px;
  border: 1px solid #484e51;
  border-radius: 11px;
  background: #1b1f22;
  color: var(--text);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.4);
  font-size: 0.84rem;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 4px 2px;
  color: #848a8b;
  font-size: 0.8rem;
}

.site-footer p {
  margin: 0;
}

.content-shell {
  width: min(820px, calc(100% - 32px));
  margin: 0 auto;
  padding-bottom: 48px;
}

.content-shell .topbar {
  margin-bottom: 42px;
}

.content-card {
  padding: clamp(24px, 6vw, 54px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(18, 20, 22, 0.94);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.26);
}

.content-card h1 {
  margin-bottom: 22px;
  font-size: clamp(2rem, 6vw, 3.7rem);
}

.content-card h2 {
  margin: 32px 0 10px;
  font-size: 1.2rem;
}

.content-card p,
.content-card li {
  color: #c5c7c4;
}

.content-card p {
  margin: 0 0 16px;
}

.content-card ul {
  margin: 0 0 18px;
  padding-left: 1.25rem;
}

.content-card a {
  color: #ff9b7c;
}

.content-card .lede {
  color: var(--text);
  font-size: 1.15rem;
}

.content-card .updated {
  color: #848a8b;
  font-size: 0.8rem;
}

@media (max-width: 920px) {
  .app-shell {
    padding: 0 16px 18px;
  }

  .topbar {
    min-height: 68px;
  }

  .privacy-note {
    max-width: 380px;
    text-align: right;
  }

  .topbar-meta {
    align-items: flex-end;
    flex-direction: column;
    gap: 5px;
  }

  .studio {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .control-panel {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .preview-panel {
    height: auto;
    min-height: min(760px, 86vh);
  }
}

@media (max-width: 600px) {
  .app-shell {
    padding: 0 10px 10px;
  }

  .topbar {
    min-height: 86px;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 11px 4px;
  }

  .topbar-meta {
    width: 100%;
    align-items: flex-start;
  }

  .site-nav {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }

  .privacy-note {
    max-width: none;
    align-items: flex-start;
    text-align: left;
    font-size: 0.76rem;
  }

  .privacy-dot {
    flex: 0 0 auto;
    margin-top: 5px;
  }

  .studio {
    gap: 10px;
    padding-top: 10px;
  }

  .control-panel,
  .preview-panel {
    border-radius: 14px;
  }

  .control-panel {
    padding: 17px;
  }

  .divider {
    margin-right: -17px;
    margin-left: -17px;
  }

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

  .field-span {
    grid-column: auto;
  }

  .preview-panel {
    min-height: 580px;
    grid-template-rows: auto minmax(310px, 1fr) auto auto;
    padding: 12px;
  }

  .canvas-wrap {
    min-height: 310px;
  }

  .art-stage {
    width: 92%;
  }

  .output-specs {
    grid-template-columns: 1fr 1fr;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    padding: 20px 4px 8px;
  }

  .content-shell {
    width: min(100% - 20px, 820px);
  }

  .content-shell .topbar {
    margin-bottom: 18px;
  }
}

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