:root {
  --ink: #201713;
  --cream: #f5eddb;
  --paper: #fffaf0;
  --rust: #9f2f25;
  --gold: #d69a35;
  --line: #d5c5a8;
  --muted: #75685b;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(25, 16, 10, 0.92), rgba(25, 16, 10, 0.92)),
    url("../images/bg-tile.gif") repeat 0 / 420px;
  font-family: "Lora", Georgia, serif;
  min-height: 100vh;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.25rem clamp(1rem, 4vw, 4rem);
  color: var(--cream);
  background: #120b07;
  border-bottom: 4px solid var(--gold);
}

h1,
h2,
button {
  font-family: "Alfa Slab One", Georgia, serif;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
}

h2 {
  margin-bottom: 0.5rem;
  color: var(--rust);
}

.eyebrow {
  margin-bottom: 0.25rem;
  color: var(--gold);
  font: 700 0.78rem/1.2 "Courier Prime", monospace;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  gap: 1rem;
}

.header-actions a {
  color: var(--cream);
  font-family: "Courier Prime", monospace;
}

main {
  width: min(1180px, calc(100% - 2rem));
  margin: 2rem auto 5rem;
}

.auth-panel,
.admin-section {
  padding: clamp(1.25rem, 3vw, 2.5rem);
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.auth-panel {
  max-width: 680px;
  margin: 4rem auto;
}

.admin-section + .admin-section {
  margin-top: 2rem;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--gold);
}

form {
  display: grid;
  gap: 1rem;
}

label {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font: 700 0.84rem/1.2 "Courier Prime", monospace;
  text-transform: uppercase;
}

input {
  width: 100%;
  padding: 0.75rem 0.85rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 2px;
  font: 1rem/1.3 "Lora", Georgia, serif;
}

button {
  padding: 0.72rem 1rem;
  color: var(--cream);
  background: var(--rust);
  border: 0;
  border-radius: 2px;
  cursor: pointer;
  font-size: 0.82rem;
  text-transform: uppercase;
}

button:hover {
  filter: brightness(1.08);
}

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

button.danger {
  background: #551d19;
}

.text-button {
  color: var(--rust);
  background: transparent;
  font-family: "Courier Prime", monospace;
}

.editor-form {
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  background: #f1e5ce;
  border: 1px solid var(--line);
}

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

.wide {
  grid-column: span 2;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.checkbox input {
  width: auto;
}

.form-actions,
.record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.form-hint {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.notice {
  display: none;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  background: #e9f1dc;
  border-left: 4px solid #587c2b;
}

.notice.visible,
.notice.error {
  display: block;
}

.notice.error {
  background: #f5dcda;
  border-color: var(--rust);
}

.setup-result {
  margin-top: 1.5rem;
}

pre {
  overflow-x: auto;
  padding: 1rem;
  background: #211713;
  color: #f8edda;
  white-space: pre-wrap;
  word-break: break-all;
}

.record-list {
  display: grid;
  gap: 0.75rem;
}

.record {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(180px, 1fr) minmax(220px, 1.4fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  background: #fffdf7;
}

.record p {
  margin-bottom: 0;
}

.record-date,
.record-meta {
  font-family: "Courier Prime", monospace;
}

.record-meta {
  color: var(--muted);
  font-size: 0.88rem;
}

.poster-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.poster-record {
  padding: 0.75rem;
  background: #fffdf7;
  border: 1px solid var(--line);
}

.poster-record img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  display: block;
  margin-bottom: 0.75rem;
  background: #e8dcc5;
}

.poster-record h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.poster-record .record-actions {
  margin-top: 0.75rem;
}

@media (max-width: 760px) {
  .admin-header,
  .section-heading {
    align-items: flex-start;
  }

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

  .wide {
    grid-column: auto;
  }
}
