:root {
  --ink: #1c1915;
  --muted: #5c564c;
  --line: #e4dccf;
  --paper: #f3efe6;
  --card: #fffcf7;
  --accent: #0c5c56;
  --accent-ink: #f6fffd;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

body {
  font-family: "Avenir Next", "Segoe UI", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  min-height: 100vh;
}

.top, main, footer {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.top {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 28px;
  padding: 36px 0 12px;
  border-bottom: 1px solid var(--line);
}

.mark {
  margin: 6px 0 0;
  font-family: Palatino, "Iowan Old Style", "Songti SC", serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

h1 {
  margin: 0;
  font-family: Palatino, "Iowan Old Style", "Songti SC", serif;
  font-weight: 500;
  font-size: clamp(2rem, 4vw, 3.1rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.lede, .status, footer p, .stall, .meta {
  color: var(--muted);
}

.lede { margin: 12px 0 0; max-width: 38rem; line-height: 1.5; }

main { padding: 22px 0 48px; }

.status { min-height: 1.4em; margin: 0 0 18px; }

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

.card {
  background: var(--card);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.shot {
  aspect-ratio: 1;
  background: #ebe4d8;
  overflow: hidden;
}

.shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.shot .empty-shot {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.body { padding: 14px 14px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }

.stall {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
}

.meta { margin: 0; font-variant-numeric: tabular-nums; }

.ask {
  margin-top: auto;
  align-self: flex-start;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  padding: 8px 12px;
  font-size: 0.88rem;
}

.ask:hover { background: #094843; }

footer {
  padding: 8px 0 36px;
  border-top: 1px solid var(--line);
}

footer p { margin: 16px 0 0; font-size: 0.88rem; line-height: 1.45; max-width: 40rem; }

.mark a { color: inherit; text-decoration: none; }

.nav {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-top: 18px;
}

.nav a, .nav button {
  color: var(--ink);
  background: transparent;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}

.nav a[aria-current="page"], .nav button:hover, .nav a:hover { color: var(--accent); }

.nav input[type="file"] { display: none; }

.sheet {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(28, 25, 21, 0.45);
  display: grid;
  place-items: end center;
}

.sheet[hidden] { display: none; }

.sheet-card {
  width: min(920px, 100%);
  max-height: min(92vh, 900px);
  overflow: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 22px 22px 28px;
}

.sheet-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.sheet-bar button {
  background: transparent;
  border: 0;
  font: inherit;
  cursor: pointer;
}

.film, .details {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.film img, .details img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #ebe4d8;
  display: block;
}

.facts {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 6px 12px;
  margin: 0 0 16px;
}

.facts dt { color: var(--muted); }

button.ask { border: 0; cursor: pointer; font: inherit; }

.sea-chat {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: min(380px, calc(100vw - 24px));
  height: min(560px, calc(100vh - 32px));
  background: var(--card);
  border: 1px solid var(--line);
  z-index: 20;
  display: flex;
  flex-direction: column;
}

.sea-chat[hidden] { display: none; }

.sea-chat-bar, .desk aside header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.sea-chat-bar button, .desk aside header button, .sea-who button {
  background: transparent;
  border: 0;
  font: inherit;
  cursor: pointer;
  color: var(--accent);
}

.sea-chat-body, #desk-chat { display: flex; flex-direction: column; min-height: 0; flex: 1; padding: 12px 14px 14px; }

.sea-login, .sea-compose { display: grid; gap: 10px; }

.sea-login label { display: grid; gap: 4px; font-size: 0.88rem; }

.sea-login input, .sea-compose textarea {
  font: inherit;
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px 10px;
}

.sea-login button, .sea-compose button {
  justify-self: start;
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
}

.sea-error { color: #8a2b2b; min-height: 1.2em; margin: 0; }

.sea-who, .sea-peer { margin: 0 0 8px; color: var(--muted); font-size: 0.88rem; }

.sea-log {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  overflow: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 180px;
}

.sea-log li { max-width: 85%; padding: 8px 10px; white-space: pre-wrap; }

.sea-log .mine { align-self: flex-end; background: var(--accent); color: var(--accent-ink); }

.sea-log .theirs { align-self: flex-start; background: #efe8dc; }

.desk {
  display: grid;
  grid-template-columns: minmax(220px, 300px) 1fr;
  min-height: 62vh;
  background: var(--card);
  border: 1px solid var(--line);
}

.desk aside header p { margin: 0; }

.desk aside ol { list-style: none; margin: 0; padding: 0; }

.desk aside li button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  font: inherit;
  cursor: pointer;
}

.desk section { display: flex; min-width: 0; }

@media (max-width: 680px) {
  .top { grid-template-columns: 1fr; gap: 8px; width: min(1120px, calc(100% - 28px)); }
  main, footer { width: min(1120px, calc(100% - 28px)); }
  .desk { grid-template-columns: 1fr; }
}
