:root {
  color-scheme: dark;
  --bg: #141210;
  --panel: #221e1a;
  --ink: #f4efe6;
  --muted: #b7aa9a;
  --line: #3a322b;
  --accent: #e0a45a;
  --accent-ink: #23180c;
  --danger: #d4654f;
  --ok: #8fbf8a;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(224, 164, 90, 0.16), transparent 55%),
    var(--bg);
  color: var(--ink);
}

a { color: inherit; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-family: Palatino, "Iowan Old Style", Georgia, serif;
  font-size: 1.35rem;
  text-decoration: none;
  letter-spacing: -0.03em;
}

nav { display: flex; gap: 8px; }

nav a, .button, button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid transparent;
}

nav a { background: transparent; border-color: var(--line); }

main { padding: 20px; max-width: 1100px; margin: 0 auto; }
main.narrow { max-width: 460px; }

h1, h2 {
  font-family: Palatino, "Iowan Old Style", Georgia, serif;
  font-weight: 500;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
}

.lede, .muted { color: var(--muted); }
.optional { color: var(--muted); font-size: 0.85rem; }

.panel, .card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.panel { padding: 20px; display: grid; gap: 14px; }

.stack, .search, .actions { display: grid; gap: 12px; }
.actions { grid-template-columns: 1fr 1fr; }

label { display: grid; gap: 6px; font-size: 0.92rem; }
fieldset { border: 1px solid var(--line); border-radius: 14px; display: grid; gap: 8px; padding: 12px; }
legend { padding: 0 6px; }

input, textarea, select, button {
  font: inherit;
  color: var(--ink);
}

input, textarea, select {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #16130f;
}

textarea { min-height: 96px; resize: vertical; }

button, .button {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
  cursor: pointer;
}

button.secondary { background: transparent; color: var(--ink); border-color: var(--line); }
button.danger { background: transparent; color: var(--danger); border-color: var(--danger); width: 100%; }

.check { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.check input { width: 20px; height: 20px; min-height: 20px; }

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search { grid-template-columns: 1fr auto; min-width: min(100%, 360px); }

.grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.card { overflow: hidden; display: grid; }
.card-open { display: grid; gap: 8px; padding: 12px 12px 0; text-decoration: none; color: inherit; }
.card .text-action { margin: 4px 12px 12px; }

.thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
  background: #2a241e;
}

.placeholder {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  color: var(--muted);
  border: 1px dashed var(--line);
}

.placeholder.large { min-height: 280px; }

.note {
  margin: 0;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta { color: var(--muted); font-size: 0.85rem; margin: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.8rem;
}

.text-action { color: var(--accent); }

.error { color: #ffb4a8; margin: 0; }
.notice, .callout {
  background: rgba(143, 191, 138, 0.12);
  border: 1px solid rgba(143, 191, 138, 0.4);
  color: var(--ok);
  border-radius: 12px;
  padding: 12px;
}

.callout { color: var(--ink); background: rgba(224, 164, 90, 0.1); border-color: rgba(224, 164, 90, 0.35); }

.detail {
  display: grid;
  grid-template-columns: minmax(240px, 420px) minmax(280px, 1fr);
  gap: 20px;
  align-items: start;
}

.detail-copy, .detail-media { display: grid; gap: 14px; align-content: start; }
.player video { width: 100%; border-radius: 12px; background: black; }
.slides { display: grid; gap: 10px; }
.slides img { width: 100%; border-radius: 12px; }

code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }

@media (max-width: 800px) {
  .detail { grid-template-columns: 1fr; }
  .actions { grid-template-columns: 1fr; }
  .top { align-items: flex-start; }
  nav { flex-wrap: wrap; justify-content: flex-end; }
}
