:root {
  color-scheme: light;
  --bg: #f7f4ee;
  --panel: #fffdf8;
  --panel-strong: #ffffff;
  --text: #241f1a;
  --muted: #6b6258;
  --line: #ded6c9;
  --accent: #db3f30;
  --accent-soft: #ffe1d8;
  --gold: #f3b33d;
  --green: #4f8b63;
  --shadow: 0 18px 50px rgba(44, 34, 22, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(243, 179, 61, 0.18), transparent 34rem),
    linear-gradient(180deg, #fff9ed 0%, var(--bg) 22rem);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem clamp(1rem, 4vw, 2.5rem);
  background: rgba(255, 253, 248, 0.9);
  border-bottom: 1px solid rgba(222, 214, 201, 0.8);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  place-items: center;
  flex: 0 0 auto;
  border: 2px solid #33271d;
  border-radius: 50%;
  background: linear-gradient(145deg, #fff6c9, #f3b33d);
  color: #33271d;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  overflow: hidden;
  max-width: 42vw;
  font-size: 0.98rem;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand small {
  color: var(--muted);
  font-size: 0.72rem;
}

.top-nav {
  display: flex;
  gap: 0.35rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffaf0;
}

.top-nav a {
  min-width: 4.2rem;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.top-nav a[aria-current="page"] {
  background: var(--text);
  color: #fffdf8;
}

.page-shell {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(1.6rem, 4vw, 3rem) 0 4rem;
}

.page-shell.narrow {
  width: min(760px, calc(100% - 2rem));
}

.page-intro {
  max-width: 720px;
  margin-bottom: 1.5rem;
}

.page-intro.compact {
  margin-bottom: 1rem;
}

.eyebrow {
  margin: 0 0 0.3rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.55rem;
  font-size: clamp(2rem, 6vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 1rem;
}

h3 {
  margin-bottom: 0.4rem;
  font-size: 1.15rem;
  line-height: 1.2;
}

.page-intro p:not(.eyebrow) {
  max-width: 42rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.status-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.status-row > div {
  min-width: 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.78);
}

.label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.status-row strong {
  overflow-wrap: anywhere;
}

.today-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(18rem, 0.65fr);
  gap: 1rem;
  align-items: start;
}

.focus-panel,
.section-block,
.entity-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.focus-panel {
  min-height: 25rem;
  padding: clamp(1.1rem, 3vw, 2rem);
}

.event-type {
  display: inline-flex;
  margin-bottom: 1rem;
  padding: 0.22rem 0.58rem;
  border: 1px solid #e7c08c;
  border-radius: 999px;
  background: #fff3cf;
  color: #75510d;
  font-size: 0.78rem;
  font-weight: 900;
}

.event-title {
  margin-bottom: 0.8rem;
  font-size: clamp(1.55rem, 4vw, 2.8rem);
  line-height: 1.08;
}

.event-summary {
  color: #4d443b;
  font-size: 1.08rem;
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.35rem;
}

.meta-pill,
.character-chip {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: #f1eadf;
  color: #453c33;
  font-size: 0.86rem;
  font-weight: 800;
}

.side-stack {
  display: grid;
  gap: 1rem;
}

.section-block {
  padding: 1rem;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.7rem;
}

.chip-list,
.memory-list {
  display: grid;
  gap: 0.5rem;
}

.character-chip {
  justify-content: space-between;
  width: 100%;
  border: 1px solid #eadfce;
  background: var(--panel-strong);
}

.character-chip span:last-child {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.location-note {
  padding: 0.8rem;
  border-left: 4px solid var(--green);
  border-radius: 6px;
  background: #eef7ef;
  color: #2d4d36;
  font-weight: 800;
}

.memory-item {
  padding: 0.8rem;
  border: 1px solid #eadfce;
  border-radius: 8px;
  background: var(--panel-strong);
}

.memory-item strong {
  display: block;
  margin-bottom: 0.2rem;
}

.memory-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

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

.entity-card {
  min-height: 13rem;
  padding: 1rem;
}

.entity-top {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  margin-bottom: 0.9rem;
}

.avatar {
  display: grid;
  width: 3rem;
  height: 3rem;
  place-items: center;
  flex: 0 0 auto;
  border: 2px solid #34261c;
  border-radius: 50%;
  background: #fff1b8;
  color: #34261c;
  font-weight: 900;
}

.entity-card p {
  color: var(--muted);
}

.entity-details {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.9rem;
  color: #4d443b;
  font-size: 0.92rem;
}

.empty-state,
.loading-line {
  display: block;
  color: var(--muted);
  font-weight: 700;
}

.admin-form {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.admin-warning {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid #e2a24c;
  border-left: 5px solid #c76624;
  border-radius: 8px;
  background: #fff1d6;
  color: #593611;
  font-weight: 900;
}

.admin-form label,
.admin-form fieldset {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
  margin: 0;
  color: var(--text);
  font-weight: 800;
}

.admin-form fieldset {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-form legend {
  padding: 0 0.4rem;
}

.admin-form input,
.admin-form textarea,
.admin-form select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid #cfc5b6;
  border-radius: 8px;
  background: #fffdf8;
  color: var(--text);
  font: inherit;
  font-weight: 600;
}

.admin-form textarea {
  resize: vertical;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.checkbox-card {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem;
  border: 1px solid #eadfce;
  border-radius: 8px;
  background: #fffdf8;
}

.checkbox-card input {
  width: 1.1rem;
  min-height: 1.1rem;
}

.primary-button {
  min-height: 2.9rem;
  border: 0;
  border-radius: 8px;
  background: var(--text);
  color: #fffdf8;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

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

.admin-result a {
  color: var(--accent);
  font-weight: 900;
}

@media (max-width: 820px) {
  .site-header {
    position: static;
    align-items: stretch;
    flex-direction: column;
  }

  .brand strong {
    max-width: 100%;
  }

  .top-nav {
    width: 100%;
  }

  .top-nav a {
    flex: 1;
    min-width: 0;
    padding-inline: 0.45rem;
  }

  .today-layout,
  .card-grid {
    grid-template-columns: 1fr;
  }

  .focus-panel {
    min-height: auto;
  }
}

@media (max-width: 520px) {
  .page-shell {
    width: min(100% - 1rem, 1120px);
    padding-top: 1rem;
  }

  .status-row {
    grid-template-columns: 1fr;
  }

  .top-nav a {
    padding-inline: 0.45rem;
    font-size: 0.8rem;
  }

  .checkbox-grid {
    grid-template-columns: 1fr;
  }
}
