:root {
  color-scheme: light;
  --bg: #f3eee4;
  --ink: #241b16;
  --muted: #77695d;
  --card: #fffaf1;
  --accent: #8b3f2f;
  --accent-dark: #5f281e;
  --line: #dfd0bd;
  --gold: #d79a2b;
  font-family: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: 4.5rem;
  background:
    radial-gradient(circle at top left, rgba(215, 154, 43, 0.2), transparent 32rem),
    linear-gradient(135deg, #f8f0df 0%, var(--bg) 55%, #ead8c0 100%);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 0.8rem 1.1rem;
  background: var(--accent);
  color: #fffaf1;
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  background: var(--accent-dark);
}

button.secondary {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--accent-dark);
}

button.secondary:hover {
  background: #f2e2cf;
}

button.small {
  padding: 0.55rem 0.85rem;
  font-size: 0.9rem;
}

.hero {
  max-width: 980px;
  margin: 0 auto;
  padding: 4rem 1rem 2rem;
}

.hero h1 {
  margin: 0;
  font-size: clamp(3rem, 10vw, 7rem);
  line-height: 0.9;
}

.hero p:last-child {
  max-width: 680px;
  font-size: 1.2rem;
  line-height: 1.6;
}

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.login-menu {
  position: relative;
  z-index: 10;
}

.auth-panel {
  position: absolute;
  top: calc(100% + 0.7rem);
  right: 0;
  width: min(92vw, 360px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fffdf8;
  box-shadow: 0 22px 60px rgba(68, 43, 22, 0.22);
  padding: 1rem;
}

.auth-section h2 {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
}

.subtle-admin {
  margin-top: 0.75rem;
  opacity: 0.82;
}

.compact-form {
  display: grid;
  gap: 0.75rem;
}

.layout {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 1rem 4rem;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 250, 241, 0.86);
  box-shadow: 0 20px 60px rgba(68, 43, 22, 0.12);
  padding: 1.4rem;
}

.current-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  border-color: rgba(139, 63, 47, 0.35);
}

.current-card h2,
.section-heading h2,
.form-card h2,
.rules-card h2 {
  margin: 0.15rem 0 0.4rem;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-card {
  display: grid;
  gap: 0.9rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fffdf8;
  color: var(--ink);
  padding: 0.8rem 0.9rem;
}

textarea {
  resize: vertical;
}

.rules-card ol {
  padding-left: 1.2rem;
  line-height: 1.6;
}

.admin-form {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}

.section-heading,
.entry-main,
.entry-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.button-row {
  display: flex;
  gap: 0.6rem;
}

.entries {
  display: grid;
  gap: 0.9rem;
  margin-top: 1rem;
}

.entry {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fffdf8;
  padding: 1rem;
}

.entry-title {
  margin: 0.1rem 0 0.25rem;
  font-size: 1.35rem;
}

.entry-author,
.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.entry-meta,
.muted {
  color: var(--muted);
}

.title-suggestions {
  margin-bottom: 0;
}

.entry-note {
  margin: 0.8rem 0;
  line-height: 1.55;
}

.entry-full-text {
  border-left: 4px solid var(--gold);
  margin: 0.9rem 0;
  padding: 0.75rem 0.9rem;
  background: rgba(215, 154, 43, 0.1);
  border-radius: 14px;
}

.entry-full-text-content {
  margin: 0.45rem 0 0;
  white-space: pre-wrap;
  line-height: 1.55;
}

.story-panel {
  margin-bottom: 1rem;
  border-color: rgba(215, 154, 43, 0.65);
}

.story-content {
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fffdf8;
  padding: 1rem;
  line-height: 1.6;
  font-family: inherit;
}

.sheet-tabs {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  border-top: 1px solid var(--line);
  background: rgba(255, 250, 241, 0.96);
  padding: 0.5rem 1rem;
  box-shadow: 0 -12px 36px rgba(68, 43, 22, 0.12);
}

.tabs {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
}

.tab-button {
  border-radius: 12px 12px 0 0;
  border: 1px solid var(--line);
  background: #f2e2cf;
  color: var(--accent-dark);
  white-space: nowrap;
}

.tab-button.active {
  background: var(--accent);
  color: #fffaf1;
}

.tab-menu {
  position: fixed;
  z-index: 30;
  display: grid;
  gap: 0.25rem;
  min-width: 230px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fffdf8;
  box-shadow: 0 18px 46px rgba(68, 43, 22, 0.24);
  padding: 0.45rem;
}

.tab-menu button {
  width: 100%;
  border-radius: 12px;
  background: transparent;
  color: var(--accent-dark);
  text-align: left;
}

.tab-menu button:hover {
  background: #f2e2cf;
}

.entry-score,
.score-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(215, 154, 43, 0.18);
  color: #6c4310;
  padding: 0.5rem 0.8rem;
  font-weight: 800;
}

@media (max-width: 760px) {
  .hero {
    padding-top: 2.5rem;
  }

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

  .auth-panel {
    position: fixed;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    width: auto;
    max-height: calc(100vh - 2rem);
    overflow: auto;
  }

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

  .current-card,
  .section-heading,
  .entry-main,
  .entry-actions,
  .button-row {
    align-items: stretch;
    flex-direction: column;
  }

  button {
    width: 100%;
  }

  .sheet-tabs button {
    width: auto;
  }
}
