:root {
  --bg: #152215;
  --bg-deep: #0f180f;
  --card: rgba(36, 56, 36, 0.9);
  --card-soft: rgba(28, 44, 29, 0.82);
  --panel: rgba(22, 34, 22, 0.88);
  --panel-strong: rgba(18, 29, 18, 0.94);
  --accent: #8fbc8f;
  --accent-hover: #7ead7e;
  --accent-strong: #be802e;
  --text: #dbeedb;
  --muted: #aebcae;
  --line: rgba(190, 214, 190, 0.14);
  --line-strong: rgba(190, 214, 190, 0.26);
  --danger: #ff7a7a;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

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

body {
  color: var(--text);
  font-family: "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(143, 188, 143, 0.16), transparent 24%),
    radial-gradient(circle at 85% 18%, rgba(190, 128, 46, 0.12), transparent 20%),
    linear-gradient(180deg, rgba(12, 20, 12, 0.68), rgba(12, 20, 12, 0.68)),
    linear-gradient(135deg, #152215 0%, #18281a 42%, #101810 100%);
  background-attachment: fixed;
}

a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s ease, opacity 0.2s ease;
}

a:hover {
  color: var(--accent);
}

button,
input,
select {
  font: inherit;
}

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

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 20px 30px;
  margin-bottom: 34px;
  background:
    linear-gradient(0deg, rgba(41, 56, 42, 0.8), rgba(36, 54, 40, 0.72)),
    radial-gradient(circle at top right, rgba(190, 128, 46, 0.18), transparent 24%),
    linear-gradient(120deg, rgba(55, 74, 57, 0.95), rgba(28, 44, 29, 0.92));
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 18px 18px;
  box-shadow: var(--shadow);
}

.logo {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent-strong);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav li {
  display: flex;
  align-items: center;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  opacity: 0.86;
  font-size: 0.95rem;
  line-height: 1;
}

.site-nav a:hover {
  opacity: 1;
}

.btn-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid rgba(143, 188, 143, 0.34);
  border-radius: 10px;
  color: #0f1a0f;
  background: var(--accent);
  font-weight: 700;
  opacity: 1;
}

.btn-play:hover {
  color: #0f1a0f;
  background: var(--accent-hover);
}

.landing-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 56px;
  margin-bottom: 42px;
}

.appearance-main {
  display: grid;
  gap: 24px;
}

.landing-hero {
  flex: 1;
  min-width: 320px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.eyebrow.subtle {
  color: var(--muted);
}

h1,
h2,
h3,
p,
pre,
legend {
  margin-top: 0;
}

.hero-title {
  margin-bottom: 18px;
  color: var(--accent-strong);
  font-size: clamp(2.6rem, 5vw, 3.4rem);
  line-height: 1.05;
  font-weight: 650;
}

.page-title {
  margin-bottom: 0;
  color: var(--accent-strong);
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1.08;
  font-weight: 650;
}

.hero-copy,
.lead {
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.6;
}

.hero-copy {
  max-width: 540px;
  margin-bottom: 28px;
}

.lead.compact {
  margin-bottom: 0;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.pill {
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.9rem;
}

.game-art {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 560px);
  min-height: 260px;
  overflow: hidden;
  border: 2px dashed rgba(143, 188, 143, 0.42);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 20% 20%, rgba(143, 188, 143, 0.12), transparent 30%),
    radial-gradient(circle at 80% 75%, rgba(190, 128, 46, 0.12), transparent 28%),
    linear-gradient(135deg, var(--card), var(--bg-deep));
  box-shadow: var(--shadow);
}

.cat-shape {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 50% 50% 42% 42%;
  background: var(--accent);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.cat-shape::before,
.cat-shape::after {
  content: "";
  position: absolute;
  top: -12px;
  width: 22px;
  height: 22px;
  background: var(--accent);
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.cat-shape::before {
  left: 6px;
  transform: rotate(-15deg);
}

.cat-shape::after {
  right: 6px;
  transform: rotate(15deg);
}

.art-caption {
  position: absolute;
  bottom: 16px;
  color: rgba(219, 238, 219, 0.64);
  font-size: 0.82rem;
}

.auth-card,
.panel,
.saved-box,
.preview-card,
.editor-section,
.account-card {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.auth-card {
  width: min(100%, 408px);
  padding: 34px;
  border-radius: var(--radius);
  background: var(--card);
}

.auth-card-head,
.panel-head,
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.auth-card-head,
.panel-head {
  align-items: flex-start;
  margin-bottom: 22px;
}

.section-head {
  align-items: baseline;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.06);
  white-space: nowrap;
  font-size: 0.82rem;
}

.chip.muted {
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 18px;
  margin-bottom: 26px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.08);
}

.tab-btn {
  padding: 0 0 10px;
  border: 0;
  color: var(--muted);
  background: none;
  cursor: pointer;
  font-size: 1rem;
  transition: color 0.2s ease, border-color 0.2s ease;
  border-bottom: 2px solid transparent;
}

.tab-btn.is-active {
  margin-bottom: -2px;
  color: var(--text);
  border-bottom-color: var(--accent);
}

.stack {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span,
.section-note {
  color: var(--muted);
  font-size: 0.92rem;
}

input,
select,
.natural-color-button,
.natural-color-hex,
.natural-color-copy,
.auth-switch-button,
.slot-button {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: var(--text);
  background: var(--panel-strong);
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

input:focus,
select:focus,
.natural-color-hex:focus,
.natural-color-button:focus-visible {
  outline: none;
  border-color: var(--accent);
}

input[type="color"] {
  min-height: 52px;
  padding: 6px;
}

input.native-color-input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

select option {
  color: var(--text);
  background: #182418;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.button:hover,
.slot-button:hover,
.natural-color-copy:hover,
.natural-color-button:hover {
  transform: translateY(-1px);
}

.button:disabled,
select:disabled,
.slot-button:disabled,
.natural-color-button:disabled,
.natural-color-hex:disabled,
.natural-color-copy:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
}

.button.primary {
  color: #0f1a0f;
  background: linear-gradient(135deg, var(--accent) 0%, #b7d2a4 100%);
}

.button.secondary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.auth-submit {
  width: 100%;
  margin-top: 6px;
}

.status {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--muted);
}

.compact-status {
  min-height: 0;
  margin-top: 12px;
}

.hint-text {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.account-card,
.saved-box,
.editor-section,
.preview-card,
.panel {
  background: var(--card-soft);
}

.account-card {
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  border-radius: 18px;
}

.account-card strong {
  font-size: 1.12rem;
}

.account-meta-line {
  color: var(--muted);
  font-size: 0.92rem;
}

.saved-box {
  margin-top: 18px;
  padding: 20px;
  border-radius: 22px;
}

.saved-box .button {
  width: 100%;
}

.saved-box pre {
  margin: 0;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.workspace {
  display: grid;
  gap: 24px;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  align-items: flex-start;
}

.appearance-account-card {
  min-width: min(100%, 320px);
  flex: 1 1 320px;
}

.lock-notice {
  margin-bottom: 20px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 122, 122, 0.24);
  border-radius: 16px;
  color: #ffd2d2;
  background: rgba(255, 122, 122, 0.08);
}

.panel {
  padding: 26px;
  border-radius: 28px;
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.editor-section {
  padding: 18px;
  border-radius: 22px;
}

.section-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pattern-slots {
  display: grid;
  gap: 12px;
}

.pattern-slot {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
}

.pattern-slot-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.pattern-slot-title {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.slot-actions {
  display: flex;
  gap: 8px;
}

.slot-button {
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  cursor: pointer;
}

.slot-button-add {
  font-size: 22px;
  line-height: 1;
}

.slot-button-remove {
  color: var(--danger);
}

.slot-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px;
  gap: 10px;
  align-items: end;
}

.natural-color-control {
  position: relative;
  width: 100%;
}

.natural-color-button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  cursor: pointer;
}

.natural-color-swatch {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.natural-color-text {
  color: var(--muted);
  font-size: 13px;
  font-family: "Consolas", "SFMono-Regular", monospace;
  letter-spacing: 0.04em;
}

.natural-color-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  display: none;
  width: 264px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: rgba(19, 30, 19, 0.98);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(16px);
}

.natural-color-control.is-open .natural-color-panel {
  display: grid;
  gap: 10px;
}

.natural-color-meta {
  display: grid;
  gap: 8px;
}

.natural-color-meta-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.natural-color-hex {
  min-height: 40px;
  font-family: "Consolas", "SFMono-Regular", monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.natural-color-copy {
  min-width: 68px;
  min-height: 40px;
  padding: 0 12px;
  color: var(--text);
  cursor: pointer;
}

.natural-color-canvas {
  display: block;
  width: 240px;
  height: 156px;
  border-radius: 12px;
  cursor: crosshair;
}

.natural-color-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.preview-column {
  display: grid;
  gap: 18px;
}

.preview-card {
  padding: 18px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 30% 18%, rgba(143, 188, 143, 0.08), transparent 22%),
    linear-gradient(180deg, rgba(28, 44, 29, 0.76) 0%, rgba(18, 29, 18, 0.92) 100%);
}

.preview-stage {
  display: grid;
  place-items: center;
  min-height: 680px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, rgba(143, 188, 143, 0.06) 100%),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.04) 0,
      rgba(255, 255, 255, 0.04) 1px,
      transparent 1px,
      transparent 64px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.04) 0,
      rgba(255, 255, 255, 0.04) 1px,
      transparent 1px,
      transparent 64px
    );
}

#character-preview {
  display: block;
  width: min(100%, 640px);
  height: auto;
  image-rendering: auto;
}

.preview-caption {
  display: grid;
  gap: 6px;
  margin-top: 16px;
}

.preview-caption strong {
  font-size: 20px;
}

.preview-caption span {
  color: var(--muted);
  font-size: 14px;
}

.is-hidden {
  display: none !important;
}

@media (max-width: 1080px) {
  .site-shell {
    width: min(100% - 24px, 1200px);
  }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-nav ul {
    justify-content: flex-start;
  }

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

  .preview-stage {
    min-height: 520px;
  }
}

@media (max-width: 768px) {
  .landing-main {
    gap: 28px;
  }

  .auth-card,
  .panel {
    padding: 22px;
  }

  .editor-toolbar .button {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .site-shell {
    width: min(100% - 20px, 1200px);
  }

  .site-header {
    padding: 18px 18px 20px;
  }

  .site-nav ul {
    gap: 12px;
  }

  .tabs {
    gap: 12px;
  }

  .slot-fields {
    grid-template-columns: 1fr;
  }

  .natural-color-panel {
    width: min(264px, calc(100vw - 48px));
  }

  .natural-color-canvas {
    width: 100%;
    height: auto;
  }
}
