:root {
  --bg: #000000;
  --bg-card: #0c0c0f;
  --steel: #9b9ba3;
  --steel-bright: #e8e8ee;
  --text: #cfcfd5;
  --text-dim: #7d7d86;
  --border: #2a2a30;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 90% 50% at 50% 0%, rgba(160, 160, 175, 0.07), transparent 70%),
    radial-gradient(ellipse 70% 40% at 50% 100%, rgba(160, 160, 175, 0.04), transparent 70%);
  color: var(--text);
  font-family: "EB Garamond", Georgia, serif;
  font-size: 18px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2 {
  font-family: "Cinzel", serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ---------- Header: black game-cover look ---------- */

.site-header {
  position: relative;
  text-align: center;
  padding: 3.5rem 1rem 1rem;
  overflow: hidden;
}

/* Faint embossed seal behind the logo, like the cover's dragon emblem */
.seal {
  position: absolute;
  top: -120px;
  left: 50%;
  transform: translateX(-50%);
  width: 560px;
  height: 560px;
  border-radius: 50%;
  border: 1px solid rgba(220, 220, 230, 0.05);
  box-shadow:
    inset 0 0 60px rgba(220, 220, 230, 0.04),
    0 0 80px rgba(220, 220, 230, 0.03);
  pointer-events: none;
}

.seal::after {
  content: "";
  position: absolute;
  inset: 38px;
  border-radius: 50%;
  border: 1px solid rgba(220, 220, 230, 0.04);
}

.logo {
  width: min(440px, 82vw);
  height: auto;
  /* the source logo is black-on-transparent: invert to silver-white */
  filter: invert(0.92) drop-shadow(0 0 22px rgba(235, 235, 245, 0.22));
}

.app-name {
  font-family: "Cinzel", serif;
  font-size: clamp(1rem, 3vw, 1.4rem);
  letter-spacing: 0.55em;
  text-indent: 0.55em;
  text-transform: uppercase;
  color: var(--steel);
  margin-top: 0.4rem;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.9), 0 0 14px rgba(235, 235, 245, 0.12);
}

.subtitle {
  color: var(--text-dim);
  font-style: italic;
  margin: 0.8rem 0 1.8rem;
  font-size: 1.1rem;
}

.divider {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  max-width: 720px;
  margin: 2.2rem auto 0;
  color: rgba(220, 220, 230, 0.35);
  font-size: 0.8rem;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(200, 200, 215, 0.4));
}

.divider::after {
  background: linear-gradient(90deg, rgba(200, 200, 215, 0.4), transparent);
}

/* ---------- Buttons: brushed-steel ---------- */

.controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-primary,
.btn-secondary {
  font-family: "Cinzel", serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid var(--steel);
  padding: 0.85rem 2rem;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(180deg, rgba(235, 235, 245, 0.16), rgba(235, 235, 245, 0.04) 55%, rgba(235, 235, 245, 0.1));
  color: var(--steel-bright);
  font-size: 1.15rem;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.8);
}

.btn-primary:hover {
  background: linear-gradient(180deg, rgba(235, 235, 245, 0.28), rgba(235, 235, 245, 0.1) 55%, rgba(235, 235, 245, 0.18));
  box-shadow: 0 0 24px rgba(235, 235, 245, 0.25);
  border-color: var(--steel-bright);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
  font-size: 0.95rem;
}

.btn-secondary:hover {
  border-color: var(--steel);
  color: var(--steel-bright);
}

.dragonborn-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-family: "Cinzel", serif;
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.85rem 1.4rem;
  transition: all 0.2s ease;
  user-select: none;
}

.dragonborn-toggle:hover {
  border-color: var(--steel);
  color: var(--steel-bright);
}

.dragonborn-toggle input {
  accent-color: var(--steel);
  width: 1.05rem;
  height: 1.05rem;
  cursor: pointer;
}

.dragonborn-toggle:has(input:checked) {
  border-color: var(--steel);
  color: var(--steel-bright);
  box-shadow: 0 0 18px rgba(235, 235, 245, 0.15);
}

/* ---------- Layout ---------- */

main {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.6rem 1rem 3rem;
}

/* ---------- Narrative ---------- */

.narrative {
  background: linear-gradient(180deg, #101013, #0a0a0d);
  border: 1px solid var(--steel);
  padding: 1.4rem 1.8rem;
  margin-bottom: 1.4rem;
  clip-path: polygon(
    12px 0, calc(100% - 12px) 0, 100% 12px,
    100% calc(100% - 12px), calc(100% - 12px) 100%,
    12px 100%, 0 calc(100% - 12px), 0 12px
  );
}

.narrative h2 {
  font-size: 0.8rem;
  color: var(--steel);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  margin-bottom: 0.8rem;
}

.narrative p {
  font-style: italic;
  line-height: 1.65;
  font-size: 1.08rem;
}

/* ---------- Cards ---------- */

.build-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.2rem;
}

.card {
  background: linear-gradient(180deg, #0e0e11, #0a0a0c);
  border: 1px solid var(--border);
  padding: 1.2rem 1.4rem;
  position: relative;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  clip-path: polygon(
    12px 0, calc(100% - 12px) 0, 100% 12px,
    100% calc(100% - 12px), calc(100% - 12px) 100%,
    12px 100%, 0 calc(100% - 12px), 0 12px
  );
}

.card:hover {
  border-color: #3d3d45;
  transform: translateY(-2px);
}

.card.locked {
  border-color: var(--steel);
  box-shadow:
    inset 0 0 28px rgba(235, 235, 245, 0.06),
    0 0 18px rgba(235, 235, 245, 0.08);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  margin-bottom: 0.8rem;
}

.card-header h2 {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 600;
}

.card.locked .card-header h2 {
  color: var(--steel-bright);
}

.card-actions {
  display: flex;
  gap: 0.3rem;
}

.icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.45;
  transition: opacity 0.15s ease, transform 0.15s ease;
  line-height: 1;
  filter: grayscale(1) brightness(1.4);
}

.icon-btn:hover {
  opacity: 1;
  transform: scale(1.15);
}

.icon-btn.active {
  opacity: 1;
}

.card-value {
  font-family: "Cinzel", serif;
  font-size: 1.25rem;
  color: var(--steel-bright);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.8);
  margin-top: 0.4rem;
}

.card-value:first-of-type {
  margin-top: 0;
}

.card-desc {
  color: var(--text-dim);
  font-size: 0.95rem;
  font-style: italic;
  margin-top: 0.15rem;
}

/* ---------- Options modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 10;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: linear-gradient(180deg, #101013, #0a0a0d);
  border: 1px solid var(--steel);
  width: min(640px, 100%);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 60px rgba(235, 235, 245, 0.12);
  clip-path: polygon(
    12px 0, calc(100% - 12px) 0, 100% 12px,
    100% calc(100% - 12px), calc(100% - 12px) 100%,
    12px 100%, 0 calc(100% - 12px), 0 12px
  );
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.4rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 0.9rem;
  color: var(--steel);
  font-weight: 600;
}

.modal-header .icon-btn {
  color: var(--text);
  font-size: 1.1rem;
  filter: none;
}

.modal-hint {
  padding: 0.7rem 1.4rem 0;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--text-dim);
}

.modal-hint-warning {
  color: var(--steel-bright);
  text-shadow: 0 0 10px rgba(235, 235, 245, 0.25);
}

.modal-body {
  overflow-y: auto;
  padding: 1rem 1.4rem 1.4rem;
}

.modal-option {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  cursor: pointer;
  padding: 0.55rem 0.5rem;
  transition: background 0.15s ease;
}

.modal-option:hover {
  background: rgba(235, 235, 245, 0.07);
}

.modal-option.current {
  background: rgba(235, 235, 245, 0.05);
  border-left: 2px solid var(--steel);
}

.modal-option:last-child {
  border-bottom: none;
}

.modal-option .card-value {
  font-size: 1.05rem;
}

/* Non-clickable rows for the setup-file tutorial */
.modal-step {
  padding: 0.7rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-step:last-child {
  border-bottom: none;
}

.modal-step .card-value {
  font-size: 1.05rem;
}

.modal-step .card-desc {
  font-style: normal;
  line-height: 1.5;
  margin-top: 0.3rem;
}

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

.site-footer {
  text-align: center;
  padding: 1.5rem 1rem 2rem;
  color: var(--text-dim);
  font-size: 0.95rem;
  border-top: 1px solid var(--border);
}

.site-footer a {
  color: var(--steel);
}

.fine-print {
  margin-top: 0.6rem;
  font-size: 0.78rem;
  color: #55555e;
}
