:root {
  color-scheme: light dark;
  --paper: #f4f0e7;
  --ink: #1c2427;
  --muted: #657076;
  --panel: rgba(255, 255, 255, 0.78);
  --line: rgba(34, 47, 50, 0.18);
  --accent: #8b2e28;
  --accent-strong: #681f1b;
  --accent-soft: rgba(139, 46, 40, 0.1);
  --gold: #ad7a2d;
  --shadow: 0 18px 60px rgba(35, 33, 28, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at 8% 0, rgba(173, 122, 45, 0.15), transparent 32rem),
    linear-gradient(160deg, #f8f5ee 0%, var(--paper) 52%, #ece8de 100%);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font: 15px/1.7 Inter, "Noto Sans SC", "PingFang SC", system-ui, sans-serif;
}

button,
textarea {
  font: inherit;
}

a {
  color: var(--accent);
}

.masthead,
main {
  width: min(900px, calc(100% - 28px));
  margin-inline: auto;
}

.masthead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  padding: 34px 0 22px;
  border-bottom: 1px solid var(--line);
}

.masthead h1,
.section-heading h2,
.notice h2 {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  line-height: 1.25;
}

.masthead h1 {
  margin-top: 6px;
  font-size: clamp(27px, 6vw, 48px);
  letter-spacing: -0.035em;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font: 700 11px/1.3 ui-monospace, "SFMono-Regular", monospace;
  letter-spacing: 0.14em;
}

.muted,
.rank-note,
.viewer-name,
.form-meta,
.comment-time {
  color: var(--muted);
}

.masthead .muted {
  margin: 8px 0 0;
}

.film-link {
  flex: 0 0 auto;
  padding: 8px 0;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}

.film-picker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 18px;
  padding: 14px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.film-picker label {
  font-weight: 700;
}

.film-picker select {
  min-width: min(100%, 280px);
  padding: 9px 34px 9px 11px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 9px;
}

main {
  padding: 24px 0 70px;
}

.composer,
.notice,
.thread {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.composer,
.notice {
  margin-bottom: 22px;
  padding: clamp(18px, 4vw, 28px);
  border-radius: 20px;
}

.notice {
  border-left: 4px solid var(--gold);
}

.notice--error {
  border-left-color: var(--accent);
}

.notice p {
  margin: 8px 0 0;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.section-heading h2 {
  margin-top: 5px;
  font-size: clamp(22px, 4vw, 30px);
}

.viewer-name,
.rank-note {
  margin: 0;
  text-align: right;
  font-size: 13px;
}

form {
  margin-top: 18px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

textarea {
  display: block;
  width: 100%;
  min-height: 122px;
  resize: vertical;
  padding: 13px 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-meta {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin: 7px 0 13px;
  font-size: 12px;
}

.form-meta p {
  max-width: 650px;
  margin: 0;
}

.form-meta output {
  flex: 0 0 auto;
}

.button,
.like-button,
.reply-toggle {
  cursor: pointer;
  border-radius: 999px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 18px;
  color: #fff;
  background: var(--accent);
  border: 0;
  text-decoration: none;
  font-weight: 700;
}

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

.button:disabled,
.like-button:disabled,
.reply-toggle:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.discussion {
  margin-top: 34px;
}

.thread-list,
.reply-list {
  padding: 0;
  list-style: none;
}

.thread-list {
  display: grid;
  gap: 14px;
  margin: 18px 0 0;
}

.thread {
  padding: clamp(16px, 3vw, 22px);
  border-radius: 18px;
}

.comment-header,
.comment-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.comment-author {
  min-width: 0;
  font-weight: 750;
}

.comment-slug {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font: 11px/1.5 ui-monospace, "SFMono-Regular", monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comment-time {
  flex: 0 0 auto;
  font-size: 12px;
}

.comment-body {
  margin: 14px 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.comment-actions {
  justify-content: flex-start;
}

.like-button,
.reply-toggle {
  padding: 5px 11px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  font-size: 13px;
}

.like-button[data-liked="true"] {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(139, 46, 40, 0.3);
}

.reply-list {
  display: grid;
  gap: 10px;
  margin: 16px 0 0 clamp(8px, 5vw, 42px);
}

.reply {
  padding: 13px 15px;
  background: rgba(120, 113, 95, 0.07);
  border-left: 2px solid var(--line);
  border-radius: 0 10px 10px 0;
}

.reply .comment-body {
  margin: 8px 0 10px;
}

.reply-form {
  margin: 15px 0 0 clamp(8px, 5vw, 42px);
  padding: 14px;
  background: rgba(120, 113, 95, 0.07);
  border-radius: 12px;
}

.reply-form textarea {
  min-height: 88px;
}

.reply-form__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 9px;
}

.empty-state {
  margin: 20px 0;
  padding: 28px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 16px;
}

.status {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  max-width: min(420px, calc(100% - 36px));
  padding: 11px 15px;
  color: #fff;
  background: rgba(28, 36, 39, 0.94);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

[hidden] {
  display: none !important;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #111719;
    --ink: #edf1ef;
    --muted: #a5afaf;
    --panel: rgba(25, 33, 35, 0.82);
    --line: rgba(225, 232, 229, 0.16);
    --accent: #e28a80;
    --accent-strong: #ca7168;
    --accent-soft: rgba(226, 138, 128, 0.11);
    --gold: #d5ae6c;
    --shadow: 0 18px 60px rgba(0, 0, 0, 0.26);
  }

  html {
    background:
      radial-gradient(circle at 8% 0, rgba(173, 122, 45, 0.13), transparent 32rem),
      linear-gradient(160deg, #171d1f 0%, var(--paper) 58%, #0d1214 100%);
  }

  textarea {
    background: rgba(7, 11, 12, 0.5);
  }
}

@media (max-width: 620px) {
  .masthead {
    align-items: flex-start;
    padding-top: 22px;
  }

  .masthead,
  .section-heading,
  .form-meta {
    flex-direction: column;
  }

  .masthead,
  .section-heading,
  .form-meta {
    align-items: stretch;
  }

  .viewer-name,
  .rank-note {
    text-align: left;
  }

  .film-link {
    align-self: flex-start;
  }

  .film-picker {
    align-items: stretch;
    flex-direction: column;
  }

  .film-picker select {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
