* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #1d1d1d;
  color: #f2f2f2;
}

/* =========================
   START / INDEX / SETUP
========================= */

.start-screen {
  min-height: 100vh;
  background: #000;
  color: #f2f2f2;
}

.gate-page,
.setup-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.gate-card,
.setup-card {
  width: 100%;
  max-width: 540px;
  background: #111;
  border: 2px solid #2a2a2a;
  border-radius: 22px;
  padding: 32px 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.gate-logo,
.setup-logo {
  width: min(220px, 60vw);
  max-width: 220px;
  display: block;
  margin: 0 auto 20px;
}

.gate-title,
.setup-title {
  margin: 0 0 8px;
  font-size: 2rem;
}

.gate-subtitle,
.setup-subtitle {
  margin: 0 0 26px;
  color: #cfcfcf;
  line-height: 1.5;
}

.gate-form {
  text-align: left;
}

.gate-label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
}

.gate-input {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid #555;
  font: inherit;
  background: #1f1f1f;
  color: #fff;
  margin-bottom: 14px;
}

.gate-button,
.setup-start-button {
  width: 100%;
  padding: 14px 16px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  background: #f3c96a;
  color: #1d1d1d;
  font-weight: bold;
  font-size: 1rem;
}

.gate-button:disabled,
.setup-start-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.gate-message,
.setup-status {
  margin-top: 14px;
  min-height: 24px;
  color: #d7d7d7;
  text-align: center;
}

.setup-card {
  max-width: 760px;
  text-align: left;
}

.setup-logo {
  margin-bottom: 18px;
}

.setup-title,
.setup-subtitle {
  text-align: center;
}

.setup-section + .setup-section {
  margin-top: 28px;
}

.setup-section-title {
  margin: 0 0 14px;
  font-size: 1.2rem;
}

.setup-choice-grid {
  display: grid;
  gap: 14px;
}

.setup-mode-grid {
  grid-template-columns: 1fr 1fr;
}

.setup-player-grid {
  grid-template-columns: repeat(4, 1fr);
}

.setup-choice-button {
  border: 2px solid #3a3a3a;
  background: #1b1b1b;
  color: #f2f2f2;
  border-radius: 16px;
  padding: 18px 14px;
  cursor: pointer;
  text-align: center;
  transition: 0.2s ease;
}

.setup-choice-button:hover {
  transform: translateY(-2px);
  border-color: #f3c96a;
}

.setup-choice-button.active {
  background: #2a2417;
  border-color: #f3c96a;
}

.setup-choice-title {
  display: block;
  font-size: 1.15rem;
  font-weight: bold;
  margin-bottom: 6px;
}

.setup-choice-text {
  display: block;
  color: #cfcfcf;
  font-size: 0.92rem;
  line-height: 1.4;
}

.setup-footer {
  margin-top: 26px;
}

/* =========================
   QUESTBOX BESTAANDE STIJL
========================= */

.app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.topbar h1 {
  margin: 0 0 6px;
  font-size: 2rem;
}

.topbar p {
  margin: 0;
  color: #cfcfcf;
}

.day-box {
  min-width: 120px;
  text-align: center;
  background: #2b2b2b;
  border: 2px solid #4d4d4d;
  border-radius: 16px;
  padding: 14px;
}

.day-box span {
  display: block;
  font-size: 0.9rem;
  color: #bbbbbb;
}

.day-box strong {
  display: block;
  font-size: 2rem;
  margin-top: 6px;
}

.layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

.board-section {
  min-width: 0;
}

.board {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  background: #d9c9ac;
  border: 8px solid #b08a5a;
  border-radius: 18px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.quadrant {
  padding: 18px;
  border: 2px solid rgba(70, 45, 20, 0.35);
  color: #1c140d;
  overflow: auto;
}

.quadrant h2 {
  margin-top: 0;
  margin-bottom: 8px;
}

.panel-subtitle {
  margin-top: 0;
  color: #4b3a2b;
  font-size: 0.95rem;
}

.story {
  background: rgba(255, 244, 210, 0.7);
}

.interaction {
  background: rgba(236, 235, 213, 0.7);
}

.combat {
  background: rgba(245, 222, 216, 0.7);
}

.campfire {
  background: rgba(255, 236, 204, 0.7);
}

.center-day {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: 180px;
  height: 180px;
  background: #f6eddc;
  border: 6px solid #9a774c;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
}

.center-day-inner {
  text-align: center;
  color: #271c13;
}

.center-day-inner span {
  display: block;
  font-size: 0.95rem;
}

.center-day-inner strong {
  display: block;
  font-size: 3rem;
  margin: 10px 0;
}

.center-day-inner small {
  font-size: 0.9rem;
}

.result-box {
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(70, 45, 20, 0.2);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
}

.small-info {
  color: #3f3021;
  font-size: 0.95rem;
}

textarea {
  width: 100%;
  resize: vertical;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #8d7658;
  font: inherit;
  background: #fffdf8;
  color: #1c140d;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: #2b2b2b;
  border: 2px solid #444;
  border-radius: 16px;
  padding: 16px;
}

.card h2 {
  margin-top: 0;
}

.stats-list,
.status-list {
  display: grid;
  gap: 10px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #383838;
  border-radius: 10px;
  padding: 10px 12px;
}

.stat-row.hp {
  border-left: 6px solid #c0392b;
}

.stat-row.mp {
  border-left: 6px solid #2980b9;
}

.stat-row.gold {
  border-left: 6px solid #d4ac0d;
}

.stat-row.xp {
  border-left: 6px solid #27ae60;
}

.stat-row.level {
  border-left: 6px solid #8e44ad;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.actions button {
  padding: 10px 14px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background: #f3c96a;
  color: #1d1d1d;
  font-weight: bold;
}

.actions button.secondary {
  background: #d7d7d7;
}

.actions button.danger {
  background: #e57c73;
}

.actions button.magic {
  background: #7aa7ff;
}

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

.log {
  max-height: 320px;
  overflow: auto;
  background: #1f1f1f;
  border-radius: 12px;
  padding: 12px;
  border: 1px solid #3f3f3f;
}

.log-entry {
  padding: 8px 0;
  border-bottom: 1px solid #3b3b3b;
  font-size: 0.95rem;
}

.log-entry:last-child {
  border-bottom: none;
}

.combat-grid,
.campfire-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
}

input {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #8d7658;
  font: inherit;
  background: #fffdf8;
  color: #1c140d;
  margin-bottom: 12px;
}

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

  .board {
    aspect-ratio: auto;
    min-height: 720px;
  }
}

@media (max-width: 768px) {
  .setup-mode-grid {
    grid-template-columns: 1fr;
  }

  .setup-player-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 700px) {
  .combat-grid,
  .campfire-grid {
    grid-template-columns: 1fr;
  }

  .center-day {
    width: 140px;
    height: 140px;
  }

  .center-day-inner strong {
    font-size: 2.3rem;
  }
}

.mobile-shell {
  display: none;
}

@media (max-width: 768px) {
  .layout {
    display: none;
  }

  .mobile-shell {
    display: grid;
    gap: 12px;
  }

  .topbar {
    margin-bottom: 12px;
  }

  .topbar h1 {
    font-size: 1.2rem;
  }

  .topbar p,
  .day-box {
    display: none;
  }

  .mobile-stats-bar {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
  }

  .mobile-stat {
    background: #2b2b2b;
    border: 1px solid #444;
    border-radius: 10px;
    padding: 8px 4px;
    text-align: center;
    font-size: 0.78rem;
  }

  .mobile-stat strong {
    display: block;
    font-size: 1rem;
    margin-top: 2px;
  }

  .mobile-board {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 6px;
    background: #d9c9ac;
    border: 4px solid #b08a5a;
    border-radius: 16px;
  }

  .mobile-tile {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8px;
    border-radius: 12px;
    font-weight: bold;
    color: #1c140d;
    border: 2px solid rgba(70, 45, 20, 0.2);
    background: rgba(255, 255, 255, 0.45);
  }

  .mobile-tile.active {
    outline: 3px solid #1d1d1d;
    background: #f3c96a;
  }

  .mobile-center-badge {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 88px;
    height: 88px;
    border-radius: 16px;
    background: #f6eddc;
    border: 4px solid #9a774c;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #271c13;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  }

  .mobile-active-card,
  .mobile-log-card {
    background: #2b2b2b;
    border: 2px solid #444;
    border-radius: 16px;
    padding: 14px;
  }

  .mobile-active-card h2 {
    margin-top: 0;
    margin-bottom: 10px;
  }

  .mobile-active-card .result-box {
    margin-bottom: 10px;
  }

  .mobile-active-card textarea,
  .mobile-active-card input {
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid #8d7658;
    font: inherit;
    background: #fffdf8;
    color: #1c140d;
    margin-bottom: 10px;
  }

  .mobile-log-card summary {
    cursor: pointer;
    font-weight: bold;
    margin-bottom: 10px;
  }

  .mobile-log-card .log {
    margin-top: 10px;
    max-height: 180px;
  }
}