/* =========================================================
   Crystal Saga Character Atelier
   A charcoal, ivory, and antique-gold equipment planner.
   ========================================================= */

:root {
  --bg: #0c0d0a;
  --bg-deep: #070806;
  --bg-soft: #11120d;
  --panel: #151610;
  --panel-raised: #1a1b13;
  --panel-olive: #232417;
  --panel-olive-deep: #17180f;
  --ivory: #efe8d6;
  --ivory-soft: #d9d2c0;
  --muted: #a29d8c;
  --muted-dim: #777365;
  --gold: #d2b369;
  --gold-bright: #f0d99a;
  --gold-deep: #8a6e35;
  --line: rgba(213, 190, 130, 0.17);
  --line-strong: rgba(213, 190, 130, 0.32);
  --danger: #e0937e;
  --danger-bg: rgba(116, 46, 30, 0.28);
  --warn: #e0b47b;
  --warn-bg: rgba(109, 78, 31, 0.23);
  --ok: #a7c58c;
  --ok-bg: rgba(54, 83, 45, 0.27);
  --rank-0: #b8b3a3;
  --rank-1: #80b3dc;
  --rank-2: #bd91e6;
  --rank-3: #e0b54f;
  --rank-4: #e58457;
  --rank-5: #d9668f;
  --rank-6: #6bcbb9;
  --radius-lg: 20px;
  --radius-md: 13px;
  --radius-sm: 9px;
  --shadow-panel: 0 28px 80px rgba(0, 0, 0, 0.38), 0 2px 0 rgba(255, 255, 255, 0.025) inset;
  --sans: "Segoe UI", "Aptos", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

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

html {
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 18% -5%, rgba(93, 80, 43, 0.14), transparent 32rem),
    radial-gradient(circle at 88% 4%, rgba(67, 73, 45, 0.12), transparent 27rem),
    linear-gradient(180deg, #10110c 0%, var(--bg) 35%, #0a0b08 100%);
  color: var(--ivory);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(210, 179, 105, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(210, 179, 105, 0.018) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(circle at 50% 8%, black, transparent 72%);
}

::selection {
  background: rgba(210, 179, 105, 0.28);
  color: #fffaf0;
}

[hidden] {
  display: none !important;
}

img {
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: var(--gold-bright);
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.015em;
}

:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 10px 14px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: var(--bg-deep);
  color: var(--gold-bright);
  transform: translateY(-160%);
  transition: transform 150ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.ambient-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(4px);
  opacity: 0.55;
}

.ambient-glow-one {
  top: 8rem;
  left: -18rem;
  width: 42rem;
  height: 42rem;
  background: radial-gradient(circle, rgba(101, 90, 48, 0.09), transparent 67%);
}

.ambient-glow-two {
  right: -20rem;
  bottom: -12rem;
  width: 52rem;
  height: 52rem;
  background: radial-gradient(circle, rgba(55, 72, 44, 0.09), transparent 67%);
}

.ambient-runes {
  position: absolute;
  top: 9rem;
  right: 4%;
  width: 16rem;
  height: 16rem;
  border: 1px solid rgba(210, 179, 105, 0.055);
  border-radius: 50%;
  transform: rotate(14deg);
}

.ambient-runes::before,
.ambient-runes::after {
  content: "";
  position: absolute;
  inset: 14%;
  border: 1px dashed rgba(210, 179, 105, 0.05);
  border-radius: 50%;
}

.ambient-runes::after {
  inset: 32%;
  border-style: solid;
}

/* ---------- Header ---------- */

.site-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
  padding: 22px 0 10px;
  border-bottom: 1px solid rgba(213, 190, 130, 0.1);
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.crest {
  width: 42px;
  height: 48px;
  flex: 0 0 auto;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}

.brand-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.eyebrow {
  color: var(--gold);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  line-height: 1.4;
  text-transform: uppercase;
}

.brand-title {
  font-family: var(--serif);
  font-size: 1.36rem;
  letter-spacing: 0.035em;
  line-height: 1.1;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.planner-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid rgba(213, 190, 130, 0.16);
  border-radius: 999px;
  background: rgba(19, 20, 14, 0.72);
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.badge-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(210, 179, 105, 0.8);
}

/* ---------- Buttons ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 15px;
  border: 1px solid rgba(213, 190, 130, 0.21);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0)),
    rgba(22, 23, 16, 0.92);
  color: var(--ivory-soft);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.button:hover:not(:disabled) {
  border-color: rgba(240, 217, 154, 0.48);
  background-color: rgba(38, 39, 28, 0.96);
  color: var(--ivory);
}

.button:active:not(:disabled) {
  transform: translateY(1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.button-primary {
  border-color: rgba(240, 217, 154, 0.55);
  background: linear-gradient(180deg, #e6cd8e 0%, #c5a45e 58%, #ab8945 100%);
  color: #17130b;
  box-shadow: 0 6px 18px rgba(135, 105, 44, 0.16), 0 1px 0 rgba(255, 255, 255, 0.3) inset;
}

.button-primary:hover:not(:disabled) {
  border-color: #f4e2b3;
  background: linear-gradient(180deg, #f0db9f 0%, #d0af68 58%, #b6944e 100%);
  color: #110e08;
}

.button-quiet {
  border-color: rgba(213, 190, 130, 0.13);
  background: rgba(17, 18, 12, 0.5);
  color: var(--muted);
}

.button-small {
  min-height: 33px;
  padding: 6px 12px;
  font-size: 0.72rem;
}

.count-pill {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border: 1px solid rgba(213, 190, 130, 0.22);
  border-radius: 999px;
  background: rgba(210, 179, 105, 0.1);
  color: var(--gold-bright);
  font-size: 0.64rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--line-strong);
  color: var(--ivory);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
  padding: clamp(34px, 5vw, 62px) 0 30px;
}

.hero-copy {
  max-width: 790px;
}

.hero h1 {
  margin-top: 5px;
  color: #f6efdd;
  font-size: clamp(2.65rem, 6vw, 4.8rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.hero h1::after {
  content: "";
  display: block;
  width: 72px;
  height: 2px;
  margin-top: 22px;
  background: linear-gradient(90deg, var(--gold), rgba(210, 179, 105, 0));
}

.lede {
  max-width: 650px;
  margin-top: 18px;
  color: var(--muted);
  font-size: clamp(0.9rem, 1.2vw, 1rem);
  line-height: 1.72;
}

.hero-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 3px;
}

/* ---------- Shared shell ---------- */

main {
  position: relative;
  z-index: 1;
}

.layout,
.lower-grid {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.58fr) minmax(350px, 0.92fr);
  align-items: start;
  gap: 22px;
}

.lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(0, 0.84fr);
  align-items: start;
  gap: 22px;
  margin-top: 22px;
  padding-bottom: 36px;
}

.panel {
  border: 1px solid rgba(213, 190, 130, 0.14);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.022), transparent 38%),
    radial-gradient(circle at 100% 0%, rgba(105, 91, 49, 0.055), transparent 25rem),
    linear-gradient(180deg, #171810 0%, #12130d 100%);
  box-shadow: var(--shadow-panel);
}

.board-panel,
.library-panel,
.summary-panel,
.detail-panel {
  padding: clamp(17px, 2vw, 25px);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.panel-head h2 {
  margin-top: 2px;
  color: var(--ivory);
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  line-height: 1.15;
}

.panel-subtitle {
  margin-top: 9px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.62;
}

.head-chips {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid rgba(213, 190, 130, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.035em;
  white-space: nowrap;
}

.chip-gold {
  border-color: rgba(210, 179, 105, 0.34);
  background: rgba(210, 179, 105, 0.09);
  color: var(--gold-bright);
}

.chip-gold::before {
  content: "✦";
  font-size: 0.68rem;
}

/* ---------- Fields ---------- */

.identity-fields {
  display: grid;
  grid-template-columns: minmax(150px, 1.5fr) minmax(110px, 0.9fr) 88px;
  gap: 10px;
  margin-top: 18px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field > span:not(.sr-only):not(.search-icon) {
  color: var(--muted-dim);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(213, 190, 130, 0.17);
  border-radius: var(--radius-sm);
  background: rgba(8, 9, 6, 0.42);
  color: var(--ivory);
  transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

input,
select {
  height: 39px;
  padding: 0 11px;
}

textarea {
  padding: 10px 11px;
  line-height: 1.5;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #6f6b5d;
}

input:hover,
select:hover,
textarea:hover {
  border-color: rgba(213, 190, 130, 0.28);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(240, 217, 154, 0.58);
  background: rgba(10, 11, 7, 0.62);
  box-shadow: 0 0 0 3px rgba(210, 179, 105, 0.08);
}

select {
  appearance: none;
  padding-right: 31px;
  background-image:
    linear-gradient(45deg, transparent 50%, #b8a36b 50%),
    linear-gradient(135deg, #b8a36b 50%, transparent 50%);
  background-position:
    calc(100% - 15px) calc(50% - 2px),
    calc(100% - 10px) calc(50% - 2px);
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  cursor: pointer;
}

input[type="number"] {
  font-variant-numeric: tabular-nums;
}

input[type="file"] {
  height: auto;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 0.78rem;
}

input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(210, 179, 105, 0.08);
  color: var(--gold-bright);
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
}

/* ---------- Character board ---------- */

.slot-board {
  position: relative;
  margin-top: 18px;
  padding: 13px;
  border: 1px solid rgba(213, 190, 130, 0.16);
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 38%, rgba(118, 101, 54, 0.11), transparent 38%),
    linear-gradient(145deg, #272719 0%, #1c1d12 43%, #14150d 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.035) inset,
    0 -24px 60px rgba(0, 0, 0, 0.12) inset,
    0 12px 36px rgba(0, 0, 0, 0.16);
}

.slot-strip {
  display: grid;
  gap: 8px;
}

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

.slot-strip-bottom {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 10px;
}

.board-core {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
  align-items: stretch;
  margin: 10px 0;
}

.slot-column {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.slot-button {
  --rank-color: var(--rank-0);
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-width: 0;
  min-height: 57px;
  padding: 8px 9px;
  overflow: hidden;
  border: 1px solid rgba(213, 190, 130, 0.13);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0)),
    rgba(15, 16, 10, 0.53);
  color: var(--ivory);
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.slot-button::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: transparent;
  transition: background-color 140ms ease;
}

.slot-button:hover {
  border-color: rgba(213, 190, 130, 0.32);
  background-color: rgba(38, 39, 26, 0.7);
}

.slot-button:active {
  transform: translateY(1px);
}

.slot-button.is-filled {
  border-color: rgba(213, 190, 130, 0.23);
  background:
    linear-gradient(180deg, rgba(240, 217, 154, 0.045), transparent),
    rgba(23, 24, 15, 0.76);
}

.slot-button.is-active {
  border-color: rgba(240, 217, 154, 0.7);
  background:
    linear-gradient(180deg, rgba(240, 217, 154, 0.105), transparent 72%),
    rgba(39, 38, 23, 0.85);
  box-shadow: 0 0 0 1px rgba(210, 179, 105, 0.14), 0 0 24px rgba(173, 137, 61, 0.12);
}

.slot-button.is-active::after {
  background: linear-gradient(180deg, transparent, var(--gold), transparent);
}

.slot-button.is-active .slot-name {
  color: var(--gold-bright);
}

.slot-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  overflow: hidden;
  border: 1px solid rgba(213, 190, 130, 0.2);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 42%, rgba(210, 179, 105, 0.14), transparent 72%),
    rgba(5, 6, 3, 0.48);
}

.pixel-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.icon-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: rgba(230, 209, 155, 0.72);
  font-family: var(--serif);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.slot-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  line-height: 1.22;
}

.slot-name {
  overflow: hidden;
  color: var(--muted-dim);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.slot-item {
  overflow: hidden;
  color: var(--ivory-soft);
  font-size: 0.76rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot-button.is-empty .slot-item {
  color: #706c5e;
  font-weight: 500;
}

.slot-rank {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--rank-color);
  box-shadow: 0 0 7px var(--rank-color);
}

.slot-button.is-empty .slot-rank {
  display: none;
}

.slot-button.rank-0 { --rank-color: var(--rank-0); }
.slot-button.rank-1 { --rank-color: var(--rank-1); }
.slot-button.rank-2 { --rank-color: var(--rank-2); }
.slot-button.rank-3 { --rank-color: var(--rank-3); }
.slot-button.rank-4 { --rank-color: var(--rank-4); }
.slot-button.rank-5 { --rank-color: var(--rank-5); }
.slot-button.rank-6 { --rank-color: var(--rank-6); }

.slot-strip .slot-button {
  min-height: 49px;
  padding: 6px 8px;
  gap: 7px;
}

.slot-strip .slot-icon {
  width: 31px;
  height: 31px;
  flex-basis: 31px;
}

.slot-strip .slot-item {
  font-size: 0.72rem;
}

/* ---------- Mannequin ---------- */

.mannequin {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  margin-top: 18px;
  min-width: 0;
  padding: 16px 18px 12px;
  overflow: hidden;
  border: 1px solid rgba(213, 190, 130, 0.11);
  border-radius: 12px;
  background:
    radial-gradient(circle at 50% 36%, rgba(210, 179, 105, 0.075), transparent 46%),
    linear-gradient(180deg, rgba(9, 10, 6, 0.2), rgba(7, 8, 5, 0.46));
}

.mannequin::before,
.mannequin::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
}

.mannequin::before {
  top: 8%;
  left: 50%;
  width: 68%;
  aspect-ratio: 1;
  border: 1px solid rgba(210, 179, 105, 0.07);
  transform: translateX(-50%);
}

.mannequin::after {
  top: 19%;
  left: 50%;
  width: 44%;
  aspect-ratio: 1;
  border: 1px dashed rgba(210, 179, 105, 0.06);
  transform: translateX(-50%) rotate(24deg);
}

.mannequin-figure {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 100%;
  flex: 0 0 auto;
  min-height: 0;
}

.appearance-stage {
  --appearance-min-height: 560px;
  position: relative;
  width: 100%;
  height: var(--appearance-min-height);
}

.mannequin-figure canvas {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.35));
}

.appearance-stage #characterWings {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.appearance-companion {
  position: absolute;
  z-index: 1;
  top: 19%;
  left: -2%;
  width: 48%;
  height: 44%;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.65));
  pointer-events: none;
}

.appearance-companion[hidden] {
  display: none;
}

.appearance-genie {
  top: 32%;
  left: auto;
  right: -2%;
}

.mannequin-caption {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  width: 100%;
  padding-top: 14px;
  border-top: 1px solid rgba(213, 190, 130, 0.1);
  text-align: left;
}

.appearance-identity {
  display: grid;
  gap: 3px;
}

.appearance-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.caption-kicker {
  color: var(--gold);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.mannequin-caption strong {
  color: var(--ivory-soft);
  font-family: var(--serif);
  font-size: 0.94rem;
  font-weight: 600;
}

.mannequin-caption span:last-child {
  color: var(--muted-dim);
  font-size: 0.61rem;
}

.appearance-sex {
  width: 120px;
  margin: 0;
  text-align: left;
}

.appearance-sex select {
  min-height: 30px;
  padding: 4px 8px;
  font-size: 0.7rem;
}

.appearance-costume {
  margin: 0;
  font-size: 0.72rem;
}

.appearance-status {
  width: 100%;
  margin: 8px 0 12px;
}

/* ---------- More slots ---------- */

.more-slots {
  margin-top: 12px;
  border: 1px solid rgba(213, 190, 130, 0.12);
  border-radius: 11px;
  background: rgba(10, 11, 7, 0.28);
}

.more-slots summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
}

.more-slots summary::-webkit-details-marker {
  display: none;
}

.more-slots summary::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  margin-right: 7px;
  border: 1px solid rgba(213, 190, 130, 0.2);
  border-radius: 50%;
  color: var(--gold);
  font-size: 0.7rem;
  line-height: 1;
}

.more-slots[open] summary::before {
  content: "−";
}

.more-slots summary > span:first-child {
  margin-right: auto;
}

.summary-meta {
  color: var(--muted-dim);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
}

.more-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  padding: 0 10px 10px;
}

.more-grid .slot-button {
  min-height: 49px;
  padding: 6px 8px;
}

.more-grid .slot-icon {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
}

.more-grid .slot-item {
  font-size: 0.69rem;
}

/* ---------- Companions ---------- */

.companion-section {
  margin-top: 18px;
  padding-top: 17px;
  border-top: 1px solid rgba(213, 190, 130, 0.1);
}

.companion-levels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0 8px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
}

.section-heading h3 {
  margin-top: 1px;
  font-size: 1.08rem;
  line-height: 1.2;
}

.section-heading > p {
  max-width: 300px;
  color: var(--muted-dim);
  font-size: 0.66rem;
  line-height: 1.5;
  text-align: right;
}

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

.companion-tile {
  --rank-color: var(--rank-0);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  min-width: 0;
  min-height: 126px;
  padding: 12px 9px 10px;
  overflow: hidden;
  border: 1px solid rgba(213, 190, 130, 0.13);
  border-radius: 11px;
  background:
    radial-gradient(circle at 50% 24%, rgba(210, 179, 105, 0.075), transparent 6rem),
    rgba(14, 15, 9, 0.42);
  color: var(--ivory);
  text-align: center;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.companion-tile:hover {
  border-color: rgba(213, 190, 130, 0.34);
  background-color: rgba(37, 38, 25, 0.58);
}

.companion-tile.is-active {
  border-color: rgba(240, 217, 154, 0.68);
  background-color: rgba(40, 39, 24, 0.7);
  box-shadow: 0 0 22px rgba(173, 137, 61, 0.11);
}

.companion-tile:active {
  transform: translateY(1px);
}

.companion-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  overflow: hidden;
  border: 1px solid rgba(213, 190, 130, 0.19);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(210, 179, 105, 0.13), transparent 68%),
    rgba(5, 6, 3, 0.5);
}

.companion-icon .icon-fallback {
  font-size: 0.92rem;
}

.companion-tile .slot-copy {
  align-items: center;
  width: 100%;
  gap: 1px;
}

.companion-tile .slot-name {
  font-size: 0.55rem;
}

.companion-tile .slot-item {
  max-width: 100%;
  font-size: 0.74rem;
}

.companion-tile .companion-sub {
  overflow: hidden;
  max-width: 100%;
  color: var(--muted-dim);
  font-size: 0.59rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.companion-tile::after {
  content: "";
  position: absolute;
  top: 9px;
  right: 9px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--rank-color);
  opacity: 0;
}

.companion-tile.is-filled::after {
  opacity: 1;
}

.board-note {
  margin-top: 13px;
  color: var(--muted-dim);
  font-size: 0.65rem;
  line-height: 1.55;
}

/* ---------- Item library ---------- */

.library-panel {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  scrollbar-color: rgba(210, 179, 105, 0.2) transparent;
  scrollbar-width: thin;
}

.library-head {
  align-items: flex-start;
}

.library-panel::-webkit-scrollbar {
  width: 7px;
}

.library-panel::-webkit-scrollbar-thumb {
  border-radius: 10px;
  background: rgba(210, 179, 105, 0.18);
}

.library-controls {
  display: grid;
  gap: 9px;
  margin: 16px 0 13px;
  padding: 12px;
  border: 1px solid rgba(213, 190, 130, 0.1);
  border-radius: 11px;
  background: rgba(7, 8, 5, 0.23);
}

.search-field {
  position: relative;
  display: block;
}

.search-field input {
  padding-left: 34px;
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 12px;
  z-index: 1;
  color: var(--muted-dim);
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1;
  transform: translateY(-52%);
  pointer-events: none;
}

.filter-row {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 8px;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
  cursor: pointer;
}

.checkbox-field input {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--gold);
}

.library-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
  color: var(--muted-dim);
  font-size: 0.65rem;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.library-meta #activeSlotEquipped {
  overflow: hidden;
  max-width: 58%;
  color: var(--gold);
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-status {
  display: none;
  margin-bottom: 9px;
  padding: 9px 11px;
  border: 1px solid rgba(213, 190, 130, 0.13);
  border-radius: 8px;
  background: rgba(10, 11, 7, 0.32);
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.5;
}

.library-status.is-visible {
  display: block;
}

.library-status.is-warning {
  border-color: rgba(224, 180, 123, 0.28);
  background: var(--warn-bg);
  color: var(--warn);
}

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

.item-card {
  --rank-color: var(--rank-0);
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  min-height: 62px;
  padding: 7px 8px;
  overflow: hidden;
  border: 1px solid rgba(213, 190, 130, 0.11);
  border-radius: 9px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent),
    rgba(11, 12, 8, 0.42);
  color: var(--ivory);
  text-align: left;
  cursor: pointer;
  transition: border-color 130ms ease, background-color 130ms ease, box-shadow 130ms ease;
}

.item-card:hover {
  border-color: rgba(213, 190, 130, 0.34);
  background-color: rgba(38, 39, 25, 0.6);
}

.item-card.is-selected {
  border-color: rgba(240, 217, 154, 0.62);
  background:
    linear-gradient(180deg, rgba(210, 179, 105, 0.09), transparent),
    rgba(35, 35, 21, 0.68);
  box-shadow: 0 0 16px rgba(173, 137, 61, 0.08);
}

.item-card.is-incompatible {
  border-color: rgba(224, 147, 126, 0.2);
}

.item-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  flex: 0 0 37px;
  overflow: hidden;
  border: 1px solid rgba(213, 190, 130, 0.16);
  border-radius: 7px;
  background:
    radial-gradient(circle, rgba(210, 179, 105, 0.1), transparent 70%),
    rgba(4, 5, 3, 0.5);
}

.item-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  padding-right: 10px;
}

.item-name {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ivory-soft);
  font-size: 0.73rem;
  font-weight: 600;
  line-height: 1.24;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.item-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  color: var(--muted-dim);
  font-size: 0.59rem;
  line-height: 1.35;
  white-space: nowrap;
}

.item-rank-label {
  color: var(--rank-color);
  font-weight: 700;
}

.item-requirements {
  overflow: hidden;
  color: #d49a7f;
  font-size: 0.58rem;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-check {
  position: absolute;
  top: 5px;
  right: 6px;
  display: none;
  place-items: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--gold);
  color: #17130b;
  font-size: 0.55rem;
  font-weight: 900;
  line-height: 1;
}

.item-card.is-selected .item-check {
  display: grid;
}

.load-more {
  width: 100%;
  margin-top: 11px;
  border-style: dashed;
}

.load-more[hidden] {
  display: none;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 28px 20px;
  border: 1px dashed rgba(213, 190, 130, 0.19);
  border-radius: 10px;
  background: rgba(8, 9, 6, 0.2);
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ivory-soft);
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 600;
}

.empty-state p {
  margin: 0 auto;
  max-width: 340px;
  font-size: 0.73rem;
  line-height: 1.55;
}

/* ---------- Lower panels ---------- */

.summary-panel {
  min-height: 260px;
}

.attribute-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin-top: 17px;
}

.attribute-block h4,
.detail-section h4 {
  margin-bottom: 8px;
  color: var(--gold);
  font-family: var(--sans);
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.attribute-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(213, 190, 130, 0.1);
}

.attribute-row:last-child {
  border-bottom: 0;
}

.attribute-label {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.74rem;
}

.attribute-value {
  flex: 0 0 auto;
  color: var(--ivory);
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.attribute-tag {
  padding: 1px 5px;
  border: 1px solid rgba(213, 190, 130, 0.16);
  border-radius: 999px;
  color: var(--muted-dim);
  font-size: 0.49rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.notice {
  margin-top: 12px;
  padding: 9px 11px;
  border: 1px solid rgba(213, 190, 130, 0.14);
  border-radius: 8px;
  background: rgba(10, 11, 7, 0.28);
  color: var(--muted);
  font-size: 0.69rem;
  line-height: 1.55;
}

.notice-warning {
  border-color: rgba(224, 180, 123, 0.26);
  background: var(--warn-bg);
  color: var(--warn);
}

.notice-danger {
  border-color: rgba(224, 147, 126, 0.28);
  background: var(--danger-bg);
  color: var(--danger);
}

.summary-empty {
  margin-top: 18px;
  padding: 26px 18px;
  border: 1px dashed rgba(213, 190, 130, 0.16);
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
}

.summary-empty strong {
  display: block;
  margin-bottom: 3px;
  color: var(--ivory-soft);
  font-family: var(--serif);
  font-size: 1rem;
}

.summary-empty p {
  font-size: 0.72rem;
}

.worn-details {
  margin-top: 15px;
  border-top: 1px solid rgba(213, 190, 130, 0.1);
  padding-top: 12px;
}

.worn-details summary {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.worn-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.worn-chip {
  padding: 3px 7px;
  border: 1px solid rgba(213, 190, 130, 0.11);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted-dim);
  font-size: 0.62rem;
}

.worn-chip b {
  color: var(--muted);
  font-weight: 600;
}

/* ---------- Detail panel ---------- */

.detail-panel {
  min-height: 300px;
}

.detail-empty {
  margin-top: 18px;
  padding: 30px 18px;
  border: 1px dashed rgba(213, 190, 130, 0.16);
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
}

.detail-empty strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ivory-soft);
  font-family: var(--serif);
  font-size: 1.02rem;
}

.detail-empty p {
  max-width: 290px;
  margin: 0 auto;
  font-size: 0.72rem;
  line-height: 1.55;
}

.detail-hero {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-top: 15px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(213, 190, 130, 0.1);
}

.detail-icon {
  width: 68px;
  height: 68px;
  flex: 0 0 68px;
  border-radius: 10px;
}

.detail-heading {
  min-width: 0;
}

.detail-heading h3 {
  overflow: hidden;
  margin-top: 1px;
  font-size: 1.26rem;
  line-height: 1.18;
  text-overflow: ellipsis;
}

.detail-code {
  margin-top: 2px;
  color: var(--muted-dim);
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.03em;
}

.detail-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 11px;
}

.detail-chips .chip {
  min-height: 23px;
  padding: 3px 8px;
  font-size: 0.61rem;
}

.detail-section {
  margin-top: 14px;
}

.detail-section:first-of-type {
  margin-top: 15px;
}

.attribute-list {
  display: grid;
}

.detail-description {
  margin: 0;
  padding: 10px 11px;
  border-left: 2px solid rgba(210, 179, 105, 0.32);
  border-radius: 0 7px 7px 0;
  background: rgba(255, 255, 255, 0.018);
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.58;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

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

.stat-tile {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid rgba(213, 190, 130, 0.1);
  border-radius: 8px;
  background: rgba(8, 9, 5, 0.25);
}

.stat-tile span {
  display: block;
  color: var(--muted-dim);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.stat-tile strong {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: var(--ivory-soft);
  font-size: 0.9rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
}

.stat-tile small {
  display: block;
  margin-top: 1px;
  color: var(--muted-dim);
  font-size: 0.58rem;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 15px;
  padding-top: 12px;
  border-top: 1px solid rgba(213, 190, 130, 0.1);
}

/* ---------- Load error ---------- */

.load-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto 18px;
  padding: 15px 17px;
  border-color: rgba(224, 147, 126, 0.3);
  background: linear-gradient(180deg, rgba(78, 37, 27, 0.36), rgba(31, 20, 15, 0.7));
  color: var(--danger);
  font-size: 0.78rem;
}

.load-error[hidden] {
  display: none;
}

.load-error strong {
  color: #f0b8a7;
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 600;
}

.load-error p {
  margin-top: 2px;
  color: #c99282;
  font-size: 0.72rem;
}

/* ---------- Footer ---------- */

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
  padding: 18px 0 30px;
  border-top: 1px solid rgba(213, 190, 130, 0.08);
  color: #6e6a5c;
  font-size: 0.65rem;
  line-height: 1.5;
}

.site-footer p {
  max-width: 780px;
}

.footer-mark {
  flex: 0 0 auto;
  color: rgba(210, 179, 105, 0.5);
  font-size: 0.57rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  white-space: nowrap;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  max-width: min(390px, calc(100vw - 40px));
  padding: 11px 14px;
  border: 1px solid rgba(213, 190, 130, 0.26);
  border-radius: 9px;
  background: #1b1c13;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.45);
  color: var(--ivory-soft);
  font-size: 0.75rem;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 170ms ease, transform 170ms ease;
}

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

.toast[data-kind="success"] {
  border-color: rgba(167, 197, 140, 0.34);
  color: var(--ok);
}

.toast[data-kind="warning"] {
  border-color: rgba(224, 180, 123, 0.36);
  color: var(--warn);
}

.toast[data-kind="error"] {
  border-color: rgba(224, 147, 126, 0.4);
  color: var(--danger);
}

/* ---------- Modal ---------- */

.modal {
  width: min(570px, calc(100vw - 28px));
  max-height: calc(100vh - 40px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--ivory);
}

.modal::backdrop {
  background: rgba(4, 5, 3, 0.78);
  backdrop-filter: blur(4px);
}

.modal-card {
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: clamp(18px, 3vw, 26px);
  border: 1px solid rgba(213, 190, 130, 0.22);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 100% 0%, rgba(113, 96, 49, 0.11), transparent 22rem),
    linear-gradient(180deg, #1a1b13, #11120c);
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.55);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
}

.modal-head h2 {
  margin-top: 2px;
  font-size: 1.5rem;
}

.modal-note {
  margin: 10px 0 16px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 19px;
  padding-top: 15px;
  border-top: 1px solid rgba(213, 190, 130, 0.1);
}

#importDialog .field {
  margin-top: 11px;
}

#importText {
  font-family: var(--mono);
  font-size: 0.68rem;
}

.import-feedback {
  display: none;
  margin-top: 12px;
  padding: 9px 11px;
  border: 1px solid rgba(224, 147, 126, 0.3);
  border-radius: 8px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 0.71rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.import-feedback.is-visible {
  display: block;
}

.import-feedback.is-warning {
  border-color: rgba(224, 180, 123, 0.28);
  background: var(--warn-bg);
  color: var(--warn);
}

.saved-list {
  display: grid;
  gap: 7px;
}

.saved-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 11px;
  border: 1px solid rgba(213, 190, 130, 0.12);
  border-radius: 9px;
  background: rgba(8, 9, 6, 0.25);
}

.saved-copy {
  min-width: 0;
}

.saved-copy strong {
  display: block;
  overflow: hidden;
  color: var(--ivory-soft);
  font-family: var(--serif);
  font-size: 0.94rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-copy span {
  display: block;
  overflow: hidden;
  color: var(--muted-dim);
  font-size: 0.63rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-actions {
  display: flex;
  flex-shrink: 0;
  gap: 5px;
}

.saved-actions .button {
  min-height: 31px;
  padding: 5px 10px;
  font-size: 0.66rem;
}

.saved-empty {
  padding: 22px 16px;
  border: 1px dashed rgba(213, 190, 130, 0.15);
  border-radius: 9px;
  color: var(--muted);
  text-align: center;
  font-size: 0.75rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 1120px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .library-panel {
    position: static;
    max-height: none;
  }

  .lower-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr);
  }
}

@media (max-width: 900px) {
  .board-core {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 760px) {
  .site-header,
  .hero,
  .layout,
  .lower-grid,
  .load-error,
  .site-footer {
    width: min(1440px, calc(100% - 28px));
  }

  .site-header {
    align-items: flex-start;
    padding-top: 17px;
  }

  .planner-badge {
    display: none;
  }

  .hero {
    display: block;
    padding: 32px 0 24px;
  }

  .hero-actions {
    margin-top: 20px;
    padding-bottom: 0;
  }

  .hero-actions .button {
    flex: 1 1 auto;
  }

  .layout {
    gap: 16px;
  }

  .lower-grid {
    gap: 16px;
    margin-top: 16px;
  }

  .attribute-groups {
    gap: 17px;
  }

  .section-heading {
    align-items: flex-start;
  }

  .site-footer {
    display: block;
  }

  .footer-mark {
    margin-top: 9px;
  }
}

@media (max-width: 620px) {
  .companion-levels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .companion-levels > .field:first-child {
    grid-column: 1 / -1;
  }

  .mannequin {
    padding: 10px 12px;
  }

  .appearance-stage {
    --appearance-min-height: 380px;
  }

  .appearance-controls {
    gap: 12px;
  }

  .site-header {
    gap: 13px;
  }

  .brand-title {
    font-size: 1.15rem;
  }

  .crest {
    width: 35px;
    height: 41px;
  }

  .header-actions {
    gap: 5px;
  }

  .header-actions .button {
    min-height: 34px;
    padding: 7px 11px;
    font-size: 0.72rem;
  }

  .identity-fields {
    grid-template-columns: minmax(0, 1.2fr) minmax(74px, 0.8fr);
  }

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

  .slot-board {
    padding: 10px;
  }

  .board-core {
    gap: 7px;
  }

  .slot-column {
    gap: 6px;
  }

  .slot-strip {
    gap: 6px;
  }

  .slot-button {
    min-height: 53px;
    padding: 6px 7px;
    gap: 7px;
  }

  .slot-icon {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .slot-item {
    font-size: 0.71rem;
  }

  .slot-name {
    font-size: 0.53rem;
  }

  .slot-strip .slot-button {
    min-height: 46px;
    padding: 5px 6px;
  }

  .slot-strip .slot-icon {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
  }

  .slot-strip .slot-item {
    font-size: 0.67rem;
  }

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

  .companion-tile {
    min-height: 118px;
    padding: 10px 6px 8px;
  }

  .companion-icon {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
  }

  .item-grid {
    gap: 6px;
  }

  .attribute-groups {
    grid-template-columns: minmax(0, 1fr);
  }

  .modal-card {
    padding: 17px;
  }

  .saved-item {
    align-items: flex-start;
  }
}

@media (max-width: 470px) {
  .site-header {
    flex-wrap: wrap;
  }

  .header-actions {
    width: 100%;
    justify-content: stretch;
  }

  .header-actions .button {
    flex: 1 1 auto;
  }

  .brand {
    width: 100%;
  }

  .hero h1 {
    font-size: clamp(2.2rem, 12vw, 3rem);
  }

  .hero h1::after {
    margin-top: 16px;
  }

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

  .slot-strip .slot-copy {
    gap: 0;
  }

  .slot-strip .slot-name {
    font-size: 0.48rem;
  }

  .slot-strip .slot-item {
    font-size: 0.61rem;
  }

  .slot-strip .slot-icon {
    width: 25px;
    height: 25px;
    flex-basis: 25px;
  }

  .slot-strip .slot-icon .icon-fallback {
    font-size: 0.62rem;
  }

  .companion-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .companion-tile {
    flex-direction: row;
    justify-content: flex-start;
    min-height: 72px;
    padding: 8px 10px;
    text-align: left;
  }

  .companion-tile .slot-copy {
    align-items: flex-start;
    width: auto;
  }

  .companion-icon {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }

  .companion-tile::after {
    top: 50%;
    right: 11px;
  }

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

  .saved-item {
    display: block;
  }

  .saved-actions {
    margin-top: 8px;
  }

  .saved-actions .button {
    flex: 1 1 auto;
  }

  .site-footer {
    font-size: 0.62rem;
  }

  .toast {
    right: 14px;
    bottom: 14px;
    left: 14px;
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
