:root {
  --bg: #f7f2ea;
  --paper: #fffdf8;
  --ink: #1f1b18;
  --accent: #b4512c;
  --accent-soft: #eec4af;
  --line: #e7d4c6;
}

body[data-theme="dark"] {
  --bg: #171715;
  --paper: #242321;
  --ink: #f3eee7;
  --accent: #d1794f;
  --accent-soft: #5a3a2a;
  --line: #4f433a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.45;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, #fde7d4 0%, var(--bg) 42%, #f1e9de 100%),
    linear-gradient(120deg, rgba(255, 255, 255, 0.5), rgba(238, 196, 175, 0.2));
}

body[data-theme="dark"] {
  background:
    radial-gradient(circle at top right, #2b2b29 0%, var(--bg) 50%, #121211 100%),
    linear-gradient(120deg, rgba(255, 255, 255, 0.04), rgba(209, 121, 79, 0.08));
}

main {
  width: min(1180px, 94vw);
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.hero {
  padding: 1.5rem;
  background:
    linear-gradient(135deg, color-mix(in oklab, var(--paper) 90%, #ffffff), color-mix(in oklab, var(--paper) 82%, var(--accent-soft)));
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 10px 35px rgba(58, 24, 13, 0.08);
}

.moderation-link-btn,
.back-home-btn {
  display: inline-block;
  margin-top: 0.5rem;
  text-decoration: none;
  border-radius: 999px;
  padding: 0.6rem 1rem;
  font-weight: 700;
  background: linear-gradient(135deg, #a7441f, #cb6a42);
  color: #fff;
  box-shadow: 0 8px 18px rgba(130, 48, 20, 0.25);
}

.theme-toggle-btn {
  margin-top: 0.75rem;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.theme-toggle-btn:hover {
  background: color-mix(in oklab, var(--paper) 75%, var(--accent-soft));
}

.moderation-link-btn:hover,
.back-home-btn:hover {
  background: linear-gradient(135deg, #8e3a1a, #b85c36);
}

h1,
h2 {
  margin: 0 0 0.75rem;
}

.grid {
  margin-top: 1.5rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 8px 24px rgba(58, 24, 13, 0.06);
}

.card h2:not(:first-child) {
  margin-top: 1.3rem;
  padding-top: 0.8rem;
  border-top: 1px dashed var(--line);
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.toolbar label {
  margin-top: 0;
}

.pager {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.pager button {
  margin-top: 0;
}

label {
  display: block;
  margin-top: 0.75rem;
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  margin-top: 0.35rem;
  border: 1px solid #ccb19d;
  border-radius: 10px;
  background: #fff;
  padding: 0.65rem 0.75rem;
  font: inherit;
}

textarea {
  min-height: 140px;
  resize: vertical;
}

button {
  margin-top: 0.9rem;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  padding: 0.65rem 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(90, 32, 10, 0.22);
}

button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.turnstile-wrap {
  margin-top: 0.9rem;
}

#status {
  margin-top: 0.6rem;
  min-height: 1.3rem;
}

.confession-item + .confession-item {
  border-top: 1px dashed var(--line);
  margin-top: 0.8rem;
  padding-top: 0.8rem;
}

.confession-item {
  border-radius: 10px;
  padding: 0.6rem;
}

.confession-item:hover {
  background: color-mix(in oklab, var(--paper) 88%, #ffffff);
}

.jump-highlight {
  animation: jumpFlash 1.6s ease;
  border-left: 4px solid #e07b39;
  background: color-mix(in oklab, var(--paper) 78%, #ffd7b8);
}

@keyframes jumpFlash {
  0% {
    box-shadow: 0 0 0 rgba(224, 123, 57, 0);
  }
  25% {
    box-shadow: 0 0 0 4px rgba(224, 123, 57, 0.38);
  }
  100% {
    box-shadow: 0 0 0 rgba(224, 123, 57, 0);
  }
}

.meta {
  font-size: 0.9rem;
  color: #5f4d42;
}

body[data-theme="dark"] .meta {
  color: #d5c8bd;
}

.confession-item h3 a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: color-mix(in oklab, var(--accent) 60%, transparent);
}

dialog {
  width: min(520px, 90vw);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
}

dialog::backdrop {
  background: rgba(31, 27, 24, 0.45);
}

body[data-theme="dark"] dialog {
  background: #2a2927;
  border-color: #5a4d43;
  color: #f3eee7;
}

body[data-theme="dark"] dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
}

.report-form {
  padding: 1rem;
}

.rules-form {
  padding: 1rem;
}

.report-form h2,
.report-form label,
.rules-form h2,
.rules-form h3,
.rules-form p,
.rules-form li {
  color: var(--ink);
}

body[data-theme="dark"] .report-form h2,
body[data-theme="dark"] .report-form label,
body[data-theme="dark"] .rules-form h2,
body[data-theme="dark"] .rules-form h3,
body[data-theme="dark"] .rules-form p,
body[data-theme="dark"] .rules-form li {
  color: #f3eee7;
}

body[data-theme="dark"] .report-form textarea,
body[data-theme="dark"] .report-form input,
body[data-theme="dark"] .rules-form textarea,
body[data-theme="dark"] .rules-form input {
  background: #1f1e1c;
  border-color: #6a5b50;
  color: #f5efe8;
}

body[data-theme="dark"] .report-form textarea::placeholder,
body[data-theme="dark"] .report-form input::placeholder,
body[data-theme="dark"] .rules-form textarea::placeholder,
body[data-theme="dark"] .rules-form input::placeholder {
  color: #c7bbb1;
}

#report-status {
  min-height: 1.3rem;
}

body[data-theme="dark"] #report-status {
  color: #ffd7bf;
}

.rules-content {
  margin: 1rem 0;
  font-size: 0.95rem;
  line-height: 1.5;
}

.rules-content h3 {
  margin: 1rem 0 0.4rem;
  font-size: 1rem;
}

.rules-content ul {
  margin: 0.4rem 0 0.8rem;
  padding-left: 1.2rem;
}

.rules-content li {
  margin-bottom: 0.4rem;
}

.flagged-item {
  border-left: 4px solid var(--accent);
  background: color-mix(in oklab, var(--paper) 95%, var(--accent-soft));
}

.flag-badge {
  display: inline-block;
  margin-top: 0.4rem;
  padding: 0.2rem 0.5rem;
  background: var(--accent);
  color: var(--paper);
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
}

.toxic-item {
  border-left: 4px solid #ff0000;
  background: color-mix(in oklab, var(--paper) 90%, #ffcccc);
}

.toxicity-badge {
  display: inline-block;
  margin-top: 0.4rem;
  padding: 0.2rem 0.5rem;
  background: #ff0000;
  color: var(--paper);
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
}

.dialog-close-btn {
  margin-top: 0.8rem;
}

.dialog-actions {
  margin-top: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.alerts-section {
  margin: 1rem 0;
  padding: 0.8rem;
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 8px;
}

body[data-theme="dark"] .alerts-section {
  background: #4f4624;
  border-color: #8f7740;
}

.alert-banner {
  margin: 0;
}

.alert-banner h3 {
  margin: 0 0 0.5rem;
  color: #856404;
}

.alert-item {
  padding: 0.5rem;
  margin: 0.3rem 0;
  background: #ffe8cc;
  border-left: 3px solid #ff6b6b;
  border-radius: 4px;
  font-size: 0.95rem;
}

body[data-theme="dark"] .alert-item {
  background: #5a4f2e;
  border-left-color: #e0b54b;
}

.alert-item strong {
  display: block;
  margin-bottom: 0.2rem;
}

.alert-item p {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.8;
}

.stats-summary {
  padding: 1rem;
  background: color-mix(in oklab, var(--paper) 98%, #4caf50);
  border: 1px solid #4caf50;
  border-radius: 8px;
  margin-bottom: 1rem;
}

body[data-theme="dark"] .stats-summary {
  border-color: #4b8d56;
  background: color-mix(in oklab, var(--paper) 96%, #3b7a47);
}

.stats-summary p {
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.stats-summary ul {
  margin: 0;
  padding-left: 1.2rem;
}

.stats-summary li {
  margin: 0.3rem 0;
}

.stats-table {
  font-size: 0.9rem;
}

#users-list table,
#policies-list table,
.stats-table {
  display: block;
  width: 100%;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}

.token-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.6rem;
}

#logout-admin {
  background: #8a8a8a;
}

#logout-admin:hover {
  background: #6f6f6f;
}

details {
  margin: 0.5rem 0;
  padding: 0.5rem;
  background: color-mix(in oklab, var(--paper) 98%, var(--accent-soft));
  border: 1px solid var(--line);
  border-radius: 8px;
}

details summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.5rem;
  margin: -0.5rem;
}

details summary:hover {
  background: rgba(180, 81, 44, 0.1);
  border-radius: 4px;
}

details > :not(summary) {
  margin-top: 0.55rem;
}

details > div {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  align-items: stretch;
  padding: 0.5rem;
}

details label {
  font-weight: 600;
  font-size: 0.9rem;
}

details input,
details select {
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.9rem;
}

details input:focus,
details select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(180, 81, 44, 0.2);
}

details button {
  background: var(--accent);
  color: var(--paper);
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
}

details button:hover {
  background: #8b3d1f;
}

.card details,
.card details summary,
.card details button,
.card details input,
.card details select {
  width: 100%;
}

.card details > div,
.card details .toolbar {
  width: 100%;
}

details > summary {
  list-style: none;
}

details > summary::-webkit-details-marker {
  display: none;
}

.report-form,
.rules-form {
  max-width: 100%;
}

@media (max-width: 699px) {
  main {
    width: 96vw;
    padding: 1.1rem 0 2.4rem;
  }

  h1 {
    font-size: 1.55rem;
  }

  h2 {
    font-size: 1.2rem;
  }

  p {
    font-size: 0.95rem;
  }

  .hero p {
    margin: 0.35rem 0;
  }

  input,
  textarea,
  select,
  button {
    font-size: 16px;
  }

  button {
    width: 100%;
  }

  .token-actions {
    flex-direction: column;
  }

  .pager {
    flex-wrap: nowrap;
  }

  .card {
    padding: 0.9rem;
  }

  .hero {
    padding: 1.1rem;
  }

  .confession-item {
    padding: 0.7rem 0.55rem;
  }

  .confession-item h3 {
    font-size: 1rem;
    line-height: 1.35;
  }

  .meta {
    font-size: 0.86rem;
  }

  .report-form,
  .rules-form {
    padding: 0.85rem;
  }

  dialog {
    width: min(520px, 96vw);
  }
}

@media (max-width: 420px) {
  .card {
    padding: 0.78rem;
    border-radius: 12px;
  }

  details {
    padding: 0.42rem;
  }

  details summary {
    font-size: 0.95rem;
  }
}

