:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #5d6875;
  --line: #d8dee6;
  --surface: #ffffff;
  --soft: #f4f7fb;
  --accent: #166f7d;
  --accent-2: #b7502a;
  --good: #247a45;
  --warn: #9a6200;
  --danger: #a33737;
  --shadow: 0 16px 40px rgba(23, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #eef6f7 0%, #f7f4ef 42%, #f8fafc 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 750;
  cursor: pointer;
}

button.secondary {
  background: #e9eef3;
  color: var(--ink);
}

button.warning {
  background: var(--accent-2);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: white;
  color: var(--ink);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.app-shell {
  width: min(1120px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 42px;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 900;
}

.mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: white;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 14px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.panel-body {
  padding: 16px;
}

.hero-panel {
  min-height: 220px;
  display: grid;
  align-items: end;
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(22, 111, 125, 0.92), rgba(183, 80, 42, 0.84)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='640' height='360' viewBox='0 0 640 360'%3E%3Cpath fill='%23ffffff' fill-opacity='.18' d='M0 252c70-58 142-80 216-66 80 15 117 72 195 76 73 4 145-39 229-129v227H0z'/%3E%3Ccircle cx='522' cy='82' r='54' fill='%23fff' fill-opacity='.18'/%3E%3Cpath fill='none' stroke='%23fff' stroke-opacity='.2' stroke-width='16' d='M68 88h210M96 138h152M394 186h132'/%3E%3C/svg%3E");
  background-size: cover;
  color: white;
}

.hero-panel h1 {
  max-width: 650px;
  margin: 0;
  font-size: clamp(2rem, 7vw, 4.25rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.8;
}

.stack {
  display: grid;
  gap: 12px;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

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

.child-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 12px;
}

.child-tab {
  min-width: max-content;
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
}

.child-tab.active {
  background: var(--ink);
  color: white;
}

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

.stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--soft);
}

.stat strong {
  display: block;
  font-size: 1.35rem;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

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

.tabs button {
  min-height: 38px;
  background: #e9eef3;
  color: var(--ink);
}

.tabs button.active {
  background: var(--accent);
  color: white;
}

.character-list,
.story-list,
.store-grid,
.skill-list {
  display: grid;
  gap: 8px;
}

.mini-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: white;
}

.mini-card.locked {
  opacity: 0.68;
}

.slot-name {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.question-card {
  display: grid;
  gap: 12px;
  justify-items: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.session-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  color: var(--muted);
  font-weight: 800;
}

.question-prompt {
  font-size: clamp(2.4rem, 12vw, 5rem);
  font-weight: 950;
  letter-spacing: 0;
}

.answer-input {
  max-width: 240px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 850;
}

.muted {
  color: var(--muted);
}

.message {
  min-height: 24px;
  font-weight: 750;
}

.message.error {
  color: var(--danger);
}

.message.good {
  color: var(--good);
}

.notice {
  border: 1px solid #d8c492;
  border-radius: 8px;
  background: #fff7df;
  padding: 12px;
  color: #4b3a12;
}

.good-notice {
  border-color: #b8d8c2;
  background: #eaf7ee;
  color: #174b2a;
}

.result-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 16px;
}

.result-card h2 {
  margin: 0;
}

.result-card p {
  margin: 0;
}

.row-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.danger-zone {
  border-color: #e4b7b7;
  background: #fff6f6;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding: 16px 4px 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.site-footer a {
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

@media (max-width: 820px) {
  .grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .row-form,
  .session-topline {
    grid-template-columns: 1fr;
    flex-direction: column;
  }
}
