:root {
  color-scheme: dark;
  --bg: #081014;
  --panel: rgba(16, 31, 38, 0.92);
  --panel-2: rgba(12, 24, 30, 0.94);
  --line: rgba(141, 231, 255, 0.18);
  --text: #ecfbff;
  --muted: #94adb5;
  --cyan: #7de7ff;
  --blue: #77d9ff;
  --yellow: #ffd166;
  --red: #ff766f;
  --green: #8ff0b0;
  --bright-green: #b8ffd2;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(rgba(125, 231, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(125, 231, 255, 0.05) 1px, transparent 1px),
    radial-gradient(circle at 15% 20%, rgba(125, 231, 255, 0.13), transparent 28rem),
    radial-gradient(circle at 90% 10%, rgba(255, 199, 107, 0.08), transparent 24rem),
    var(--bg);
  background-size: 32px 32px, 32px 32px, auto, auto, auto;
}

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

button,
.file-button {
  min-height: 2.5rem;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}

input,
select,
textarea {
  width: 100%;
  min-height: 2.45rem;
  border: 1px solid rgba(141, 231, 255, 0.22);
  border-radius: 8px;
  color: var(--text);
  background: rgba(2, 10, 13, 0.58);
  padding: 0.65rem 0.75rem;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(125, 231, 255, 0.13);
}

label {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem max(1rem, calc((100vw - 1420px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(8, 16, 20, 0.86);
  backdrop-filter: blur(14px);
}

.topbar h1 {
  margin-top: 0.15rem;
  font-size: clamp(1.55rem, 2vw, 2.15rem);
}

.top-actions,
.section-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.eyebrow {
  color: var(--cyan);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.required {
  color: var(--red);
}

.pilot-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 1rem;
  align-items: start;
  width: min(1420px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1rem 0 2rem;
}

.summary-panel {
  position: sticky;
  top: 6.4rem;
  grid-column: 2;
  grid-row: 1 / span 4;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 1rem;
}

.section-head,
.slot-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-head h2 {
  margin-top: 0.15rem;
  font-size: 1.08rem;
}

.section-head.compact {
  margin-bottom: 0.8rem;
}

.identity-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.photo-uploader {
  display: grid;
  gap: 0.6rem;
}

.photo-preview {
  display: grid;
  place-items: center;
  width: 180px;
  aspect-ratio: 1;
  border: 1px solid rgba(141, 231, 255, 0.3);
  border-radius: 8px;
  color: var(--muted);
  background:
    linear-gradient(135deg, rgba(125, 231, 255, 0.08), transparent),
    rgba(2, 10, 13, 0.42);
  overflow: hidden;
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.identity-grid,
.two-col,
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

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

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

.inventory-grid label:last-child {
  grid-column: 1 / -1;
}

.background-field textarea {
  min-height: 18rem;
  resize: vertical;
}

.attribute-grid,
.skill-groups,
.trait-list,
.pilot-equipment {
  display: grid;
  gap: 0.8rem;
}

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

.attribute-card,
.skill-group,
.trait-card,
.slot {
  border: 1px solid rgba(141, 231, 255, 0.14);
  border-radius: 8px;
  background: rgba(2, 10, 13, 0.24);
  padding: 0.8rem;
}

.attribute-card {
  display: grid;
  gap: 0.65rem;
  min-width: 0;
  min-height: 12.5rem;
}

.attribute-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.6rem;
}

.attribute-card strong,
.skill-group strong,
.slot strong {
  font-size: 0.95rem;
}

.attribute-card input[type="range"] {
  min-height: 1.4rem;
  padding: 0;
  accent-color: var(--cyan);
}

.attribute-value {
  color: var(--cyan);
  font-size: 2rem;
  font-weight: 900;
}

.modifier-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-width: 3.1rem;
  min-height: 1.65rem;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  font-size: 0.85rem;
  font-weight: 900;
}

.mod-blue {
  color: var(--blue);
  background: rgba(119, 217, 255, 0.1);
  border: 1px solid rgba(119, 217, 255, 0.28);
}

.mod-yellow {
  color: var(--yellow);
  background: rgba(255, 209, 102, 0.12);
  border: 1px solid rgba(255, 209, 102, 0.34);
}

.mod-red {
  color: var(--red);
  background: rgba(255, 118, 111, 0.12);
  border: 1px solid rgba(255, 118, 111, 0.34);
}

.mod-green {
  color: var(--green);
  background: rgba(143, 240, 176, 0.1);
  border: 1px solid rgba(143, 240, 176, 0.28);
}

.mod-bright {
  color: #062414;
  background:
    radial-gradient(circle at 20% 30%, #ffffff 0 2px, transparent 3px),
    radial-gradient(circle at 75% 35%, #ffffff 0 1px, transparent 2px),
    linear-gradient(135deg, #e7fff0, var(--bright-green));
  border: 1px solid rgba(184, 255, 210, 0.9);
  box-shadow: 0 0 18px rgba(184, 255, 210, 0.42);
}

.skill-groups,
.pilot-equipment {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.skill-group {
  display: grid;
  gap: 0.7rem;
}

.skill-rows {
  display: grid;
  gap: 0.5rem;
}

.skill-choice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.3rem;
  color: #cdeaf0;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.skill-choice input {
  width: 1.05rem;
  min-height: 1.05rem;
  accent-color: var(--cyan);
}

.skill-name {
  min-width: 0;
}

.info-button,
.roll-button {
  min-width: 1.75rem;
  min-height: 1.75rem;
  border-color: rgba(141, 231, 255, 0.28);
  color: var(--cyan);
  background: rgba(125, 231, 255, 0.08);
  padding: 0;
  font-weight: 900;
}

.roll-button {
  min-width: 3.25rem;
  padding: 0 0.55rem;
}

.skill-level {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1rem;
  min-height: 1.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--cyan);
  background: rgba(125, 231, 255, 0.07);
  font-weight: 900;
}

.trait-list {
  display: grid;
  gap: 1rem;
}

.trait-group {
  display: grid;
  gap: 0.65rem;
  border-top: 1px solid rgba(141, 231, 255, 0.12);
  padding-top: 0.85rem;
}

.trait-group:first-child {
  border-top: 0;
  padding-top: 0;
}

.trait-group h3 {
  color: var(--cyan);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.trait-group-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.trait-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 0.6rem;
  color: #cdeaf0;
  font-size: 0.83rem;
  line-height: 1.4;
  text-transform: none;
}

.trait-card input,
.check-option input {
  width: 1.05rem;
  min-height: 1.05rem;
  margin-top: 0.15rem;
  accent-color: var(--cyan);
}

.trait-card strong {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.88rem;
}

.slot-title {
  margin-bottom: 0.7rem;
}

.slot-title span,
.slot-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.compact-list,
.check-grid {
  display: grid;
  gap: 0.45rem;
  color: #cdeaf0;
  font-size: 0.83rem;
  line-height: 1.4;
}

.check-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 0.55rem;
  color: #cdeaf0;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.stat-card {
  min-height: 5.2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  padding: 0.75rem;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.stat-card strong {
  display: block;
  margin-top: 0.35rem;
  color: var(--cyan);
  font-size: 1.45rem;
}

.stat-card.warning strong {
  color: var(--red);
}

.export-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-top: 1rem;
}

.export-actions .file-button {
  grid-column: 1 / -1;
}

.primary-button,
.ghost-button,
.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  color: #021016;
  background: var(--cyan);
  border-color: rgba(125, 231, 255, 0.7);
  padding: 0.6rem 0.8rem;
  font-weight: 900;
}

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

.slim-button {
  min-height: 2.1rem;
  padding: 0.35rem 0.65rem;
}

.file-button input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 1.7rem;
  border: 1px solid rgba(143, 240, 176, 0.28);
  border-radius: 999px;
  color: var(--green);
  background: rgba(143, 240, 176, 0.08);
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 900;
}

.readout {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.readout h3 {
  margin-bottom: 0.6rem;
  font-size: 0.92rem;
}

.readout-list {
  display: grid;
  gap: 0.45rem;
  color: #cdeaf0;
  font-size: 0.84rem;
  line-height: 1.4;
}

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

@media (max-width: 1100px) {
  .pilot-shell {
    grid-template-columns: 1fr;
  }

  .summary-panel {
    position: static;
    grid-column: auto;
    grid-row: auto;
  }
}

@media (max-width: 820px) {
  .pilot-shell {
    width: min(100% - 1rem, 1420px);
  }

  .topbar,
  .section-head,
  .slot-title,
  .section-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .top-actions > * {
    width: 100%;
  }

  .identity-layout,
  .identity-grid,
  .two-col,
  .inventory-grid,
  .attribute-grid,
  .skill-groups,
  .trait-group-grid,
  .pilot-equipment,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .photo-preview {
    width: 100%;
    max-width: 220px;
  }
}
