@font-face {
  font-family: "PixelLocal";
  src:
    url("./fonts/pixel.ttf") format("truetype"),
    url("./fonts/pixel.woff2") format("woff2");
  font-display: swap;
}

:root {
  --ui-text: #f6e6b0;
  --ui-text-dim: rgba(246, 230, 176, 0.72);
  --ui-text-soft: rgba(246, 230, 176, 0.48);
  --ui-void: #050403;
  --ui-panel: #11100d;
  --ui-panel-strong: #17130e;
  --ui-line: #b88942;
  --ui-line-dim: rgba(184, 137, 66, 0.35);
  --ui-gold: #f0c86a;
  --ui-red: #8c3027;
  --ui-blue: #8797b5;
  --pixel-cut: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
  --ui-heading-font: "PixelLocal", "Cascadia Mono", "Consolas", "Courier New", monospace;
  --ui-body-font: "PixelLocal", "Cascadia Mono", "Consolas", "Courier New", monospace;
}

html, body, #app {
  margin: 0;
  width: 100%;
  min-height: 100%;
  background: var(--ui-void);
  color: var(--ui-text);
  font-family: var(--ui-body-font);
  image-rendering: pixelated;
}

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

button,
input,
select,
summary {
  font-family: var(--ui-body-font);
  image-rendering: pixelated;
  -webkit-font-smoothing: none;
}

body {
  overflow: auto;
}
body.planet-gen-page {
  overflow: auto;
  background:
    linear-gradient(rgba(240, 200, 106, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(240, 200, 106, 0.035) 1px, transparent 1px),
    #070604;
  background-size: 16px 16px, 16px 16px, auto;
}

body.planet-gen-page.planet-gen-dark {
  background:
    linear-gradient(rgba(240, 200, 106, 0.024) 1px, transparent 1px),
    linear-gradient(90deg, rgba(240, 200, 106, 0.024) 1px, transparent 1px),
    #000;
  background-size: 16px 16px, 16px 16px, auto;
}

body.planet-gen-page #app {
  min-height: 100svh;
  height: auto;
  overflow: visible;
}

.planet-gen-app {
  position: relative;
  min-height: 100svh;
  box-sizing: border-box;
  padding: 32px 20px;
  overflow: visible;
}

.planet-gen-app::before,
.planet-gen-app::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.planet-gen-app::before {
  opacity: 0.28;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.38) 2px, transparent 2px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.38) 2px, transparent 2px);
  background-size: 8px 8px;
}

.planet-gen-app::after {
  display: none;
}

.planet-gen-shell {
  position: relative;
  z-index: 1;
  width: min(1320px, 100%);
  margin: 0 auto;
}

.planet-gen-hero {
  max-width: 780px;
  margin-bottom: 18px;
}

.planet-gen-eyebrow {
  margin: 0 0 12px;
  color: rgba(241, 210, 132, 0.84);
  font-family: var(--ui-heading-font);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-shadow: 0 0 18px rgba(217, 155, 75, 0.34);
}

.planet-gen-hero h1,
.planet-gen-preview-meta h2 {
  margin: 0;
  font-family: var(--ui-heading-font);
  line-height: 1.02;
}

.planet-gen-hero h1 {
  color: #fff4d6;
  font-size: clamp(28px, 3.5vw, 42px);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow:
    3px 3px 0 #000;
}

.planet-gen-copy,
.planet-gen-caption {
  margin: 14px 0 0;
  max-width: 86ch;
  color: var(--ui-text-dim);
  font-size: 13px;
  line-height: 1.55;
}

.planet-gen-copy {
  padding: 10px 12px;
  border: 2px solid var(--ui-line-dim);
  background: #0d0b08;
  box-shadow: 4px 4px 0 #000;
  clip-path: var(--pixel-cut);
}

.planet-gen-layout {
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  gap: 18px;
}

.planet-gen-panel {
  position: relative;
  border: 2px solid var(--ui-line-dim);
  border-radius: 0;
  background: var(--ui-panel);
  box-shadow: 6px 6px 0 #000;
  backdrop-filter: none;
  clip-path: var(--pixel-cut);
}

.planet-gen-panel::before {
  display: none;
}

.planet-gen-panel--controls {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 16px;
  overflow: hidden;
}

.planet-gen-panel--preview {
  padding: 16px;
  overflow: hidden;
}

.planet-gen-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.planet-gen-field {
  display: grid;
  gap: 8px;
}

.planet-gen-hint {
  margin: 0;
  color: var(--ui-text-soft);
  font-size: 12px;
  line-height: 1.45;
}

.planet-gen-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ui-text-soft);
  min-height: 22px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.planet-gen-toggle input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--ui-gold);
  filter: drop-shadow(0 0 8px rgba(241, 210, 132, 0.25));
}

.planet-gen-toggle span {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
}

.planet-gen-field span {
  color: rgba(241, 210, 132, 0.76);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.planet-gen-field input,
.planet-gen-field select,
.planet-gen-actions button {
  width: 100%;
  box-sizing: border-box;
  border: 2px solid var(--ui-line-dim);
  border-radius: 0;
  color: var(--ui-text);
  background: #080705;
  font: inherit;
  clip-path: var(--pixel-cut);
}

.planet-gen-field input[type="text"],
.planet-gen-field select {
  min-height: 38px;
  padding: 0 10px;
  box-shadow:
    3px 3px 0 #000,
    inset 0 -8px 0 rgba(240, 200, 106, 0.03);
}

.planet-gen-field input::placeholder {
  color: rgba(244, 234, 210, 0.32);
}

.planet-gen-field input:focus,
.planet-gen-field select:focus,
.planet-gen-actions button:focus-visible,
.planet-gen-extras summary:focus-visible {
  outline: 2px solid rgba(241, 210, 132, 0.78);
  outline-offset: 2px;
}

.planet-gen-field select {
  -webkit-appearance: none;
  appearance: none;
  color-scheme: dark;
  padding-right: 36px;
  background-color: #080705;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ui-gold) 50%),
    linear-gradient(135deg, var(--ui-gold) 50%, transparent 50%),
    linear-gradient(90deg, transparent, rgba(240, 200, 106, 0.1));
  background-position:
    calc(100% - 18px) 16px,
    calc(100% - 12px) 16px,
    calc(100% - 34px) 0;
  background-repeat: no-repeat;
  background-size: 6px 6px, 6px 6px, 34px 100%;
}

.planet-gen-field input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 24px;
  padding: 0;
  border: 0;
  accent-color: var(--ui-gold);
  background: transparent;
  cursor: pointer;
}

.planet-gen-field input[type="range"]::-webkit-slider-runnable-track {
  height: 10px;
  border: 2px solid var(--ui-line-dim);
  background:
    repeating-linear-gradient(90deg, rgba(240, 200, 106, 0.22) 0 2px, transparent 2px 8px),
    #080705;
  box-shadow: 2px 2px 0 #000;
}

.planet-gen-field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 18px;
  margin-top: -6px;
  border: 2px solid #2b1607;
  background: var(--ui-gold);
  box-shadow: 2px 2px 0 #000;
}

.planet-gen-field input[type="range"]::-moz-range-track {
  height: 10px;
  border: 2px solid var(--ui-line-dim);
  background:
    repeating-linear-gradient(90deg, rgba(240, 200, 106, 0.22) 0 2px, transparent 2px 8px),
    #080705;
  box-shadow: 2px 2px 0 #000;
}

.planet-gen-field input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 16px;
  border: 2px solid #2b1607;
  border-radius: 0;
  background: var(--ui-gold);
  box-shadow: 2px 2px 0 #000;
}

.planet-gen-field input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  min-height: 38px;
  padding: 4px;
  cursor: pointer;
  box-shadow: 3px 3px 0 #000;
}

.planet-gen-field input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.planet-gen-field input[type="color"]::-webkit-color-swatch {
  border: 2px solid rgba(0, 0, 0, 0.72);
  border-radius: 0;
}

.planet-gen-field input[type="color"]::-moz-color-swatch {
  border: 2px solid rgba(0, 0, 0, 0.72);
  border-radius: 0;
}

.planet-gen-toggle input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  display: inline-grid;
  place-content: center;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border: 2px solid var(--ui-line);
  background: #080705;
  box-shadow:
    2px 2px 0 #000,
    inset 0 0 0 2px #080705;
  filter: none;
  clip-path: var(--pixel-cut);
}

.planet-gen-toggle input[type="checkbox"]::before {
  content: "";
  width: 8px;
  height: 8px;
  transform: scale(0);
  background: var(--ui-gold);
  box-shadow: 0 0 0 2px rgba(240, 200, 106, 0.2);
}

.planet-gen-toggle input[type="checkbox"]:checked::before {
  transform: scale(1);
}

.planet-gen-field input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

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

.planet-gen-actions button {
  min-height: 40px;
  padding: 0 12px;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--ui-gold);
  color: #130d07;
  box-shadow: 4px 4px 0 #000;
}

.planet-gen-actions button:hover {
  filter: none;
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #000;
}

.planet-gen-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.planet-gen-section-title {
  margin: 2px 0 -4px;
  color: #fff0cc;
  font-family: var(--ui-heading-font);
  font-size: 13px;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
}

.planet-gen-stats > div {
  padding: 10px;
  border: 2px solid rgba(184, 137, 66, 0.22);
  border-radius: 0;
  background: #0b0907;
  box-shadow: 3px 3px 0 #000;
  clip-path: var(--pixel-cut);
}

.planet-gen-stats span {
  display: block;
  color: var(--ui-text-soft);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.planet-gen-stats strong {
  display: block;
  margin-top: 4px;
  color: var(--ui-text);
  font-size: 13px;
}

.planet-gen-preview-meta {
  display: grid;
  grid-template-columns: max-content minmax(220px, 1fr);
  align-items: start;
  gap: 14px;
  margin-bottom: 12px;
}

.planet-gen-preview-meta h2 {
  max-width: 11ch;
  overflow-wrap: anywhere;
  font-size: clamp(20px, 2.4vw, 30px);
  color: #fff0cc;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #000;
}

.planet-gen-trait-note {
  margin: 0;
  min-height: 42px;
  padding: 8px 10px;
  border: 2px solid rgba(184, 137, 66, 0.28);
  color: var(--ui-text-dim);
  background: #0b0907;
  box-shadow: 3px 3px 0 #000;
  clip-path: var(--pixel-cut);
  font-size: 11px;
  line-height: 1.45;
}

.planet-gen-canvas-wrap {
  position: relative;
  overflow: hidden;
  border: 2px solid rgba(184, 137, 66, 0.28);
  border-radius: 0;
  background: #050505;
  min-height: 620px;
  box-shadow: 5px 5px 0 #000;
  clip-path: var(--pixel-cut);
}

body.planet-gen-dark .planet-gen-canvas-wrap {
  background: #000;
}

.planet-gen-canvas-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(240, 200, 106, 0.04) 2px, transparent 2px),
    linear-gradient(90deg, rgba(240, 200, 106, 0.04) 2px, transparent 2px);
  background-size: 16px 16px;
  mix-blend-mode: normal;
  pointer-events: none;
}

.planet-gen-canvas-wrap::before {
  content: "";
  position: absolute;
  inset: 12px;
  z-index: 1;
  border: 2px solid rgba(184, 137, 66, 0.2);
  pointer-events: none;
}

.planet-gen-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  image-rendering: pixelated;
  cursor: crosshair;
}

.planet-gen-extras {
  border: 2px solid rgba(184, 137, 66, 0.26);
  border-radius: 0;
  background: #0b0907;
  box-shadow: 4px 4px 0 #000;
  clip-path: var(--pixel-cut);
}

.planet-gen-extras summary {
  min-height: 42px;
  box-sizing: border-box;
  padding: 14px 12px;
  color: rgba(241, 210, 132, 0.82);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  list-style: none;
  text-transform: uppercase;
}

.planet-gen-extras summary::-webkit-details-marker {
  display: none;
}

.planet-gen-extras summary::after {
  content: "+";
  float: right;
  color: var(--ui-gold);
}

.planet-gen-extras[open] summary::after {
  content: "-";
}

.planet-gen-extras-body {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.planet-gen-extra-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 2px solid rgba(184, 137, 66, 0.18);
  border-radius: 0;
  background: #100d09;
  box-shadow: 3px 3px 0 #000;
  clip-path: var(--pixel-cut);
}

.planet-gen-extra-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.planet-gen-extra-head span {
  color: rgba(241, 210, 132, 0.72);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.planet-gen-extra-head strong {
  color: #fff0cc;
  font-size: 12px;
}

@media (max-width: 980px) {
  .planet-gen-app {
    padding: 20px 12px;
  }

  .planet-gen-layout {
    grid-template-columns: 1fr;
  }

  .planet-gen-preview-meta {
    grid-template-columns: 1fr;
  }

  .planet-gen-canvas-wrap {
    min-height: auto;
  }
}

@media (max-width: 640px) {
  .planet-gen-row,
  .planet-gen-actions,
  .planet-gen-stats {
    grid-template-columns: 1fr;
  }
}

