:root {
  --bg: #201611;
  --bg-soft: #2b1f18;
  --panel: #241b17;
  --panel-2: #30241d;
  --panel-3: #3a2b1e;
  --panel-4: #1c1410;
  --ink: #f6efe6;
  --ink-soft: #d2c1b0;
  --ink-dim: #a4907e;
  --gold: #f7c84a;
  --gold-soft: rgba(247, 200, 74, 0.16);
  --gold-line: rgba(247, 200, 74, 0.28);
  --sky: #8fc8ef;
  --leaf: #9acb8a;
  --berry: #ef9e86;
  --danger: #d97d62;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-y: auto;
  color: var(--ink);
  font-family: "Nunito", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(247, 200, 74, 0.08), transparent 28%),
    radial-gradient(circle at top right, rgba(143, 200, 239, 0.08), transparent 24%),
    linear-gradient(180deg, #281b14 0%, #1a120e 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  content: "";
  opacity: 0.18;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 26px 26px;
}

#app {
  width: min(1600px, calc(100% - 28px));
  margin: 18px auto 28px;
}

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

.main-column,
.sidebar {
  min-width: 0;
}

.panel,
.table-card,
.gm-panel,
.tracker-card,
.selection-card,
.info-card,
.result-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
}

.panel,
.gm-panel {
  border-radius: var(--radius-xl);
}

.panel {
  padding: 20px;
}

.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
  padding: 20px;
  margin-bottom: 18px;
  background:
    radial-gradient(circle at top right, rgba(247, 200, 74, 0.08), transparent 24%),
    linear-gradient(180deg, #241914 0%, #1c1410 100%);
}

.hero-copy {
  padding: 6px 8px 4px;
}

.hero .eyebrow,
.section-eyebrow {
  margin: 0 0 12px;
  font-size: 0.86rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
}

.hero h1,
.section-title,
.table-card h3,
.sidebar-title,
.mini-title {
  margin: 0;
  font-family: "Anton", sans-serif;
  letter-spacing: 0.02em;
  font-weight: 400;
  text-transform: uppercase;
}

.hero h1 {
  font-size: clamp(2.6rem, 4.4vw, 4.6rem);
  line-height: 0.96;
}

.hero p {
  color: var(--ink-soft);
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.hero-art {
  position: relative;
  border-radius: 26px;
  padding: 16px;
  background: linear-gradient(180deg, #3a5777 0%, #2d4866 100%);
}

.hero-art img {
  display: block;
  width: 100%;
  border-radius: 16px;
}

.section {
  margin-bottom: 18px;
}

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

.section-title {
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 0.96;
}

.section-copy {
  max-width: 820px;
  margin: 10px 0 0;
  color: var(--ink-soft);
  line-height: 1.55;
}

.collapse-button,
.button,
.tiny-button,
.counter-button,
.modal-close {
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.collapse-button,
.button,
.tiny-button,
.modal-close {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

.collapse-button {
  padding: 12px 18px;
}

.button {
  padding: 13px 20px;
  font-weight: 800;
}

.button-primary {
  color: #2a1d12;
  background: linear-gradient(180deg, #ffd56f 0%, #f1be42 100%);
}

.button-secondary {
  color: #d9effc;
  background: rgba(143, 200, 239, 0.14);
}

.button-ghost {
  background: transparent;
}

.collapsed .section-body {
  display: none;
}

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

.table-card {
  min-width: 0;
  padding: 22px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #261d18 0%, #211815 100%);
}

.table-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.table-card h3 {
  font-size: 1.95rem;
  line-height: 1.08;
}

.subtitle {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 1rem;
}

.tiny-button {
  min-width: 88px;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 800;
  white-space: nowrap;
}

.result-card {
  margin: 16px 0 20px;
  padding: 18px 20px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(247, 200, 74, 0.16), rgba(247, 200, 74, 0.12));
  color: var(--ink);
}

.result-card.empty {
  color: var(--ink-soft);
}

.option-list {
  display: grid;
  gap: 12px;
}

.option-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 14px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.02);
}

.option-row.active {
  border-color: var(--gold-line);
  background: var(--gold-soft);
}

.option-number {
  font-size: 2rem;
  line-height: 1;
  font-family: "Anton", sans-serif;
  color: var(--gold);
}

.option-text {
  font-size: 0.98rem;
  line-height: 1.4;
}

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

.selection-card,
.info-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #261d18 0%, #211815 100%);
}

.selection-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.role-chip {
  align-self: flex-start;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 800;
}

.role-chip.gold {
  background: rgba(247, 200, 74, 0.18);
  color: #ffdd83;
}

.role-chip.sky {
  background: rgba(143, 200, 239, 0.18);
  color: #c6e9ff;
}

.role-chip.leaf {
  background: rgba(154, 203, 138, 0.18);
  color: #d2f0c8;
}

.role-chip.berry {
  background: rgba(239, 158, 134, 0.18);
  color: #ffd0c2;
}

.selection-card p,
.info-card p,
.gm-panel p,
.tracker-card p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.5;
}

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

.roll-station {
  display: grid;
  grid-template-columns: 0.95fr 1.2fr 1fr;
  gap: 18px;
}

.roll-box {
  padding: 20px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #261d18 0%, #211815 100%);
}

.difficulty-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.difficulty-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.difficulty-row.active {
  background: rgba(247, 200, 74, 0.12);
  border-color: var(--gold-line);
}

.difficulty-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--ink-soft);
}

.difficulty-row.active .difficulty-dot {
  border-color: var(--gold);
  background: var(--gold);
}

.roll-face {
  margin: 12px 0 0;
  font-family: "Anton", sans-serif;
  font-size: 5rem;
  line-height: 0.9;
  color: var(--gold);
}

.sidebar {
  position: sticky;
  top: 18px;
}

.gm-panel {
  padding: 22px;
  background:
    radial-gradient(circle at top right, rgba(247, 200, 74, 0.08), transparent 25%),
    linear-gradient(180deg, #1c1410 0%, #18110d 100%);
}

.sidebar-title {
  font-size: clamp(2.1rem, 3vw, 3.4rem);
  line-height: 0.94;
}

.tracker-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 22px 0 28px;
}

.tracker-card {
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.03);
}

.tracker-value {
  margin: 10px 0 18px;
  font-size: 3rem;
  line-height: 1;
  font-weight: 800;
}

.counter-row {
  display: flex;
  gap: 12px;
}

.counter-button {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  font-size: 1.6rem;
  background: rgba(255, 255, 255, 0.04);
}

.gm-section {
  margin-top: 28px;
}

.mini-title {
  font-size: 1.9rem;
  line-height: 1;
  margin-bottom: 10px;
}

.locked-list {
  display: grid;
  gap: 10px;
}

.locked-item {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
}

.locked-item.empty {
  color: var(--ink-dim);
}

.visited-count {
  float: right;
  color: var(--ink);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
}

.dice-modal {
  width: min(1040px, 100%);
  padding: 28px;
  border-radius: 34px;
  background: linear-gradient(180deg, #1d1511 0%, #16100d 100%);
  border: 1px solid var(--gold-line);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.45);
}

.dice-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.modal-kicker {
  margin: 0 0 10px;
  font-size: 0.95rem;
  color: var(--gold);
}

.modal-title {
  margin: 0;
  font-family: "Anton", sans-serif;
  font-size: clamp(2.4rem, 5vw, 4.4rem);
  line-height: 0.96;
  text-transform: uppercase;
}

.modal-close {
  padding: 14px 22px;
}

.dice-frame {
  padding: 24px;
  border-radius: 30px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01)),
    #090807;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.dice-screen {
  padding: 22px 22px 26px;
  border-radius: 30px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    #0d0d0d;
  border: 10px solid rgba(247, 200, 74, 0.78);
  box-shadow:
    inset 0 0 0 6px rgba(247, 200, 74, 0.12),
    0 0 0 10px rgba(247, 200, 74, 0.06);
}

.dice-question {
  margin: 0 0 22px;
  text-align: center;
  color: var(--gold);
  font-size: clamp(1.5rem, 3vw, 2.7rem);
  font-weight: 800;
  text-transform: uppercase;
}

.die-wrap {
  display: grid;
  place-items: center;
  min-height: 280px;
}

.die {
  position: relative;
  display: grid;
  place-items: center;
  width: min(320px, 76vw);
  aspect-ratio: 1 / 1;
  font-family: "Anton", sans-serif;
  font-size: clamp(4.8rem, 12vw, 7.2rem);
  line-height: 1;
  color: #fffaf4;
  border-radius: 34px;
  border: 1px solid rgba(255, 233, 198, 0.35);
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 238, 212, 0.34), transparent 24%),
    radial-gradient(circle at 70% 72%, rgba(255, 197, 92, 0.18), transparent 28%),
    linear-gradient(180deg, #8c1f18 0%, #c63e26 42%, #8c2119 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    inset 0 -14px 28px rgba(50, 5, 5, 0.34),
    0 24px 40px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.die::before,
.die::after {
  position: absolute;
  inset: 16px;
  content: "";
  border-radius: 24px;
  pointer-events: none;
}

.die::before {
  border: 1px solid rgba(255, 243, 224, 0.26);
  box-shadow: inset 0 0 0 1px rgba(255, 184, 70, 0.18);
}

.die::after {
  inset: auto 24px 18px 24px;
  height: 22px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 205, 126, 0.45), rgba(255, 205, 126, 0));
  filter: blur(10px);
  opacity: 0.9;
}

.die.d20 {
  border-radius: 0;
  clip-path: polygon(50% 0%, 84% 12%, 100% 50%, 84% 88%, 50% 100%, 16% 88%, 0% 50%, 16% 12%);
}

.die.d20::before {
  border-radius: 0;
  clip-path: polygon(50% 0%, 84% 12%, 100% 50%, 84% 88%, 50% 100%, 16% 88%, 0% 50%, 16% 12%);
}

.die.is-jitter {
  transform: translateY(3px) rotate(-3deg) scale(0.985);
}

.die-result {
  margin-top: 18px;
  text-align: center;
  color: var(--ink);
  font-size: clamp(1.4rem, 2.8vw, 2.1rem);
  font-weight: 800;
}

.die-result-meta {
  margin-top: 10px;
  text-align: center;
  color: var(--gold);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.die-result-meta.is-waiting {
  color: #ffd979;
}

.result-card {
  margin: 22px auto 0;
  max-width: 760px;
  padding: 18px 24px 22px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
    rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease, opacity 220ms ease;
}

.result-card.is-pending {
  opacity: 0.78;
  transform: scale(0.985);
}

.result-card.is-ready {
  border-color: rgba(247, 200, 74, 0.4);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 12px 28px rgba(0, 0, 0, 0.22);
}

.result-card-label {
  margin-bottom: 10px;
  text-align: center;
  color: rgba(247, 200, 74, 0.9);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.result-card-body {
  text-align: center;
  color: var(--ink-soft);
  font-size: clamp(1.3rem, 2.3vw, 2rem);
  line-height: 1.35;
}

@media (max-width: 1380px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }
}

@media (max-width: 1120px) {
  .hero,
  .card-grid,
  .info-grid,
  .roll-station,
  .selection-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  #app {
    width: min(100% - 14px, 1600px);
    margin-top: 10px;
  }

  .panel,
  .gm-panel,
  .table-card,
  .selection-card,
  .info-card,
  .roll-box {
    padding: 16px;
  }

  .section-header {
    flex-direction: column;
  }

  .dice-modal {
    padding: 18px;
  }

  .die {
    width: min(230px, 72vw);
    font-size: 4.5rem;
  }

  .die.d20 {
    width: min(220px, 70vw);
  }

  .result-card {
    padding: 16px 16px 18px;
  }
}
