:root {
  color-scheme: light;
  --bg: #f5efe3;
  --bg-alt: #ede3d1;
  --surface: rgba(255, 255, 255, 0.84);
  --surface-strong: #fff9f0;
  --text: #1f1a17;
  --muted: #6d6158;
  --accent: #8f4f2a;
  --accent-2: #284b63;
  --border: rgba(31, 26, 23, 0.12);
  --shadow: 0 24px 50px rgba(47, 29, 12, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(143, 79, 42, 0.16), transparent 30%),
    radial-gradient(circle at top right, rgba(40, 75, 99, 0.13), transparent 28%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-alt) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
  background-size: 30px 30px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent 80%);
}

.page-shell {
  width: min(1400px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.hero {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.7fr);
  align-items: end;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.77rem;
  color: var(--accent-2);
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
}

h1 {
  font-size: clamp(2.6rem, 4vw, 4.7rem);
  line-height: 0.95;
  max-width: 10ch;
}

.lede {
  max-width: 68ch;
  margin: 16px 0 0;
  font-size: 1.03rem;
  line-height: 1.6;
  color: var(--muted);
}

.stats-panel,
.controls-card,
.note-card,
.table-card {
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.stats-panel {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, 1fr);
  padding: 18px;
  border-radius: 24px;
}

.stat-label,
.muted {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
}

.stats-panel strong {
  display: block;
  margin-top: 4px;
  font-size: 1.7rem;
  font-family: "IBM Plex Mono", monospace;
}

.controls-card,
.note-card,
.table-card {
  border-radius: 28px;
}

.controls-card {
  padding: 18px;
  margin-bottom: 16px;
}

.proficiency-fieldset {
  grid-column: 1 / -1;
  margin: 0;
  padding: 14px 0 0;
  border: 0;
}

.proficiency-fieldset legend {
  padding: 0;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.proficiency-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.proficiency-fieldset + .proficiency-fieldset {
  margin-top: 14px;
}

.checkbox-chip {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(31, 26, 23, 0.14);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text) !important;
  font-size: 0.92rem;
  cursor: pointer;
}

.checkbox-chip input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  align-items: start;
}

.filters label {
  display: grid;
  gap: 7px;
}

.filters span {
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 600;
}

input,
select,
button,
.ghost-button {
  font: inherit;
}

input,
select {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(31, 26, 23, 0.16);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  padding: 12px 14px;
  outline: none;
}

input:focus,
select:focus {
  border-color: rgba(143, 79, 42, 0.55);
  box-shadow: 0 0 0 4px rgba(143, 79, 42, 0.12);
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  grid-column: 1 / -1;
  justify-self: end;
  width: fit-content;
}

button,
.ghost-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 46px;
  border-radius: 14px;
  padding: 0 16px;
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 700;
}

button {
  background: linear-gradient(135deg, var(--accent), #b76b34);
  color: white;
  box-shadow: 0 12px 24px rgba(143, 79, 42, 0.24);
}

.ghost-button {
  border-color: rgba(31, 26, 23, 0.16);
  color: var(--text);
  background: rgba(255, 255, 255, 0.65);
}

.note-card {
  padding: 16px 18px;
  margin-bottom: 16px;
}

.note-card p {
  margin: 0;
  line-height: 1.6;
}

.table-card {
  overflow: hidden;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  position: sticky;
  top: 0;
  background: rgba(255, 249, 240, 0.97);
  text-align: left;
  font-size: 0.83rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

tbody td {
  vertical-align: top;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(31, 26, 23, 0.08);
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.4);
}

.item-name {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge.magic {
  background: rgba(40, 75, 99, 0.12);
  color: var(--accent-2);
}

.badge.mundane {
  background: rgba(143, 79, 42, 0.12);
  color: var(--accent);
}

.badge.craftable {
  background: rgba(34, 118, 72, 0.14);
  color: #1f6d42;
}

.badge.locked {
  background: rgba(120, 38, 38, 0.12);
  color: #8a3737;
}

.summary-card {
  margin-top: -4px;
}

.requirements {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
}

.requirements li + li {
  margin-top: 4px;
}

.time-stack strong {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.05rem;
}

.time-stack .muted {
  margin-top: 4px;
}

.empty-state {
  padding: 44px 18px;
  text-align: center;
}

.empty-state p {
  margin: 10px auto 0;
  max-width: 52ch;
  color: var(--muted);
}

code {
  font-family: "IBM Plex Mono", monospace;
  background: rgba(31, 26, 23, 0.08);
  padding: 0.15rem 0.35rem;
  border-radius: 6px;
}

@media (max-width: 1100px) {
  .hero,
  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100vw - 20px, 100%);
    padding-top: 18px;
  }

  .hero,
  .filters,
  .stats-panel {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 2.7rem;
  }

  .table-card {
    border-radius: 20px;
  }
}