:root {
  --bg: #f5f2ea;
  --surface: #fcfbf8;
  --surface-strong: #ffffff;
  --text: #1f2933;
  --muted: #52606d;
  --line: #d9d2c3;
  --accent: #0f766e;
  --accent-soft: #dff5f1;
  --warning: #f59e0b;
  --danger: #b91c1c;
  --done: #15803d;
  --shadow: 0 10px 30px rgba(26, 34, 43, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 12% 15%, #fef3c7 0%, transparent 30%),
    radial-gradient(circle at 85% 85%, #dbeafe 0%, transparent 30%), var(--bg);
  min-height: 100vh;
}

.backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(
      120deg,
      rgba(15, 118, 110, 0.05) 0%,
      transparent 45%
    ),
    linear-gradient(20deg, rgba(185, 28, 28, 0.04) 0%, transparent 45%);
}

.app {
  position: relative;
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 20px 32px;
}

.main-menu {
  display: inline-flex;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
}

.menu-link {
  text-decoration: none;
  color: var(--text);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.9rem;
}

.menu-link:hover {
  border-color: var(--line);
}

.menu-link.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.app-header h1 {
  margin: 12px 0 0;
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  letter-spacing: -0.02em;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 700;
}

.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  max-width: 760px;
}

.toolbar {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
}

.view-tabs {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

.category-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.category-filter select {
  min-width: 220px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
}

.film-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.film-search-wrap {
  position: relative;
  min-width: min(340px, 48vw);
}

.film-form input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
}

.film-search-results {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  width: min(460px, calc(100vw - 40px));
  max-height: 360px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.film-search-result {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 10px;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.film-search-result:hover,
.film-search-result:focus-visible {
  outline: none;
  background: var(--accent-soft);
}

.film-search-result img,
.film-search-placeholder {
  flex: 0 0 38px;
  width: 38px;
  height: 56px;
  border-radius: 5px;
  object-fit: cover;
  background: var(--bg);
}

.film-search-result-copy {
  min-width: 0;
}

.film-search-result-title {
  display: block;
  font-weight: 700;
  line-height: 1.25;
}

.film-search-result-meta,
.film-search-message {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
}

.film-search-message {
  padding: 10px;
}

.film-form button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  border-radius: 8px;
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
}

.film-form button:disabled {
  cursor: wait;
  opacity: 0.65;
}

@media (max-width: 720px) {
  .film-form {
    width: 100%;
  }

  .film-search-wrap {
    min-width: 0;
    flex: 1;
  }
}

.view-tab {
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  transition: 140ms ease;
}

.view-tab[aria-selected="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.summary {
  color: var(--muted);
  font-size: 0.95rem;
}

.error-banner {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--danger), white 40%);
  background: color-mix(in srgb, var(--danger), white 92%);
  color: color-mix(in srgb, var(--danger), black 15%);
}

.hidden {
  display: none;
}

.board-root {
  margin-top: 20px;
  overflow-x: auto;
  padding-bottom: 20px;
}

.columns {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  min-width: max-content;
}

.column {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  min-width: 340px;
  width: 340px;
  max-height: calc(100vh - 200px);
  display: flex;
  flex-direction: column;
}

.column.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: -8px;
}

.column-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.column-title {
  font-weight: 700;
}

.count {
  min-width: 28px;
  text-align: center;
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.82rem;
}

.cards {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  flex: 1;
}

.empty {
  color: var(--muted);
  margin: 12px 0;
  font-size: 0.92rem;
}

.card {
  border-bottom: 1px solid var(--line);
  background: var(--surface-strong);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}

.card-click-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  cursor: pointer;
}

.card-title, .card-meta, .card-actions, .card-note, .music-preview {
  position: relative;
  z-index: 10;
}

.card:hover {
  border-color: color-mix(in srgb, var(--accent), white 40%);
}

.card-title {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.35;
}

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

.card-title a:hover {
  color: var(--accent);
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--muted);
}

.badge {
  border-radius: 999px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.72rem;
}

.badge.twitter {
  background: #e0f2fe;
  color: #075985;
  border-color: #7dd3fc;
}

.badge.reddit {
  background: #ffedd5;
  color: #9a3412;
  border-color: #fdba74;
}

.badge.films {
  background: #f3e8ff;
  color: #6b21a8;
  border-color: #d8b4fe;
}

.badge.music {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.badge.music_recs {
  background: #e0f2fe;
  color: #075985;
  border-color: #7dd3fc;
}

.badge.imdb {
  background: #fef3c7;
  color: #92400e;
  border-color: #fbbf24;
}

.badge.recommendation {
  background: #f0fdf4;
  color: #14532d;
  border-color: #86efac;
}

.badge.category {
  background: #eef2ff;
  color: #3730a3;
  border-color: #c7d2fe;
  text-transform: none;
  letter-spacing: 0;
}

.card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.card-actions select,
.card-actions .open-link,
.card-actions .archive-btn {
  font: inherit;
  font-size: 0.86rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 5px 8px;
  background: white;
  color: var(--text);
}

.card-actions .open-link {
  text-decoration: none;
}

.film-poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  max-height: 360px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #e5e7eb;
  position: relative;
  z-index: 10;
}

.music-cover {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 300px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #e5e7eb;
  position: relative;
  z-index: 10;
}

.music-preview {
  width: 100%;
  height: 36px;
}

.archive-btn {
  border-color: color-mix(in srgb, var(--danger), white 35%);
  color: var(--danger);
  background: color-mix(in srgb, var(--danger), white 93%);
  cursor: pointer;
}

.card-note {
  width: 100%;
  resize: vertical;
  min-height: 72px;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 8px 10px;
  font: inherit;
  font-size: 0.88rem;
  background: #fffefb;
  color: var(--text);
}

.card-note:focus {
  outline: 2px solid color-mix(in srgb, var(--accent), white 35%);
  outline-offset: 1px;
  border-color: var(--accent);
}

.hint {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.tweet-embed-wrap {
  overflow: hidden;
  background: transparent;
  min-height: 220px;
  color: var(--muted);
  padding: 0;
  position: relative;
  z-index: 0;
}

.tweet-embed-pending {
  border-style: dashed;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}

.tweet-embed {
  width: 100%;
  min-height: 560px;
  border: 0;
}

@media (max-width: 1120px) {
  /* Let flex horizontal scrolling handle it */
}

@media (max-width: 700px) {
  .app {
    padding: 18px 12px 24px;
  }

  .toolbar {
    align-items: flex-start;
  }
}

/* Lightbox Styles */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  overflow-y: auto;
  text-align: center;
  padding: 40px 20px;
  -webkit-overflow-scrolling: touch;
}

.lightbox::before {
  content: "";
  display: inline-block;
  height: 100%;
  vertical-align: middle;
}

.lightbox.hidden {
  display: none;
}

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(5px);
  z-index: 0;
}

.lightbox-content {
  position: relative;
  z-index: 1001;
  display: inline-block;
  vertical-align: middle;
  background: var(--surface-strong);
  border-radius: 16px;
  width: 100%;
  max-width: 600px;
  text-align: left;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.2s;
}

.lightbox-close:hover {
  background: rgba(0, 0, 0, 0.8);
}

#lightbox-body {
  padding: 20px;
}

#lightbox-body .tweet-embed-wrap {
  width: 100%;
  max-width: 550px;
  margin: 0 auto;
  border: none;
}

/* Refined board system: compact, calm, and intentionally light on the DOM. */
:root {
  --bg: #f2f1ed;
  --surface: #fbfbf8;
  --surface-strong: #ffffff;
  --text: #17191d;
  --muted: #70757a;
  --line: #dedfdb;
  --accent: #a84e38;
  --accent-soft: #f3e4de;
  --danger: #a94a48;
  --shadow: 0 16px 36px rgba(25, 28, 29, 0.07);
  --shadow-soft: 0 8px 18px rgba(25, 28, 29, 0.045);
  --radius-lg: 22px;
  --radius-md: 14px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

html {
  background: var(--bg);
}

body {
  color: var(--text);
  background: radial-gradient(circle at 8% 0%, rgba(237, 215, 198, 0.45), transparent 28rem), var(--bg);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
}

.backdrop {
  opacity: 0.42;
  background: linear-gradient(135deg, rgba(168, 78, 56, 0.045), transparent 38%);
}

.app {
  width: min(1480px, 100%);
  padding: 24px 28px 42px;
}

.main-menu {
  gap: 3px;
  padding: 4px;
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 2px 8px rgba(25, 28, 29, 0.035);
}

.menu-link {
  color: var(--muted);
  padding: 7px 12px;
  font-size: 0.79rem;
  font-weight: 650;
  transition: color 180ms var(--ease), background 180ms var(--ease), transform 180ms var(--ease);
}

.menu-link:hover {
  color: var(--text);
  background: var(--bg);
}

.menu-link.active {
  color: var(--surface-strong);
  background: var(--text);
}

.app-header {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(220px, 0.55fr);
  gap: 48px;
  align-items: end;
  padding: 72px 0 42px;
  border-bottom: 1px solid var(--line);
}

.eyebrow,
.header-index-label,
.film-field > span,
.category-filter > span {
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.app-header h1 {
  max-width: 760px;
  margin: 12px 0 0;
  color: var(--text);
  font-size: clamp(2.4rem, 5.6vw, 5.8rem);
  font-weight: 720;
  letter-spacing: -0.075em;
  line-height: 0.94;
}

.app-header h1 em {
  color: var(--accent);
  font-style: normal;
}

.subtitle {
  max-width: 620px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.header-index {
  display: grid;
  gap: 10px;
  justify-self: end;
  width: min(100%, 260px);
  padding: 18px 0 4px;
  border-top: 1px solid var(--line-strong, #c9cbc7);
}

.header-index strong {
  font-size: 1.12rem;
  letter-spacing: -0.035em;
}

.header-index-rule {
  width: 44px;
  height: 2px;
  margin: 8px 0 4px;
  background: var(--accent);
}

.header-index-note {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.toolbar {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

.toolbar-top,
.toolbar-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.view-tab {
  border-color: transparent;
  border-radius: 999px;
  padding: 9px 14px;
  color: var(--muted);
  background: transparent;
  font-size: 0.86rem;
  font-weight: 650;
  transition: color 180ms var(--ease), background 180ms var(--ease), border 180ms var(--ease), transform 180ms var(--ease);
}

.view-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.56);
}

.view-tab[aria-selected="true"] {
  border-color: var(--text);
  color: var(--surface-strong);
  background: var(--text);
}

.summary {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.71rem;
  letter-spacing: -0.02em;
  text-align: right;
}

.toolbar-controls {
  align-items: end;
  padding: 15px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.category-filter,
.film-field {
  display: grid;
  gap: 7px;
}

.category-filter select,
.film-form input,
.card-actions select,
.card-note {
  border-color: var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.78);
}

.category-filter select,
.film-form input {
  min-height: 42px;
  border-radius: 11px;
  padding: 9px 12px;
  outline: none;
}

.category-filter select {
  min-width: 220px;
}

.category-filter select:focus,
.film-form input:focus,
.card-note:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(168, 78, 56, 0.12);
}

.film-form {
  align-items: end;
  gap: 10px;
  margin-left: auto;
}

.film-search-wrap {
  min-width: min(360px, 36vw);
}

.film-form input {
  width: 100%;
}

.film-form button {
  min-height: 42px;
  border-color: var(--accent);
  border-radius: 11px;
  padding: 9px 14px;
  color: var(--surface-strong);
  background: var(--accent);
  font-size: 0.84rem;
  font-weight: 700;
  transition: background 180ms var(--ease), transform 180ms var(--ease);
}

.film-form button:hover {
  background: #7f3828;
}

.film-search-results {
  top: calc(100% + 8px);
  width: min(460px, calc(100vw - 40px));
  max-height: 320px;
  padding: 6px;
  border-color: var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.film-search-result {
  gap: 10px;
  padding: 8px;
  border-radius: 10px;
  color: var(--text) !important;
  background: transparent !important;
  border: 0;
}

.film-form .film-search-result:hover,
.film-form .film-search-result:focus-visible {
  background: var(--accent-soft) !important;
  color: var(--text);
}

.film-search-result-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.film-search-result-meta,
.film-search-message {
  color: var(--muted);
  font-size: 0.76rem;
}

.error-banner {
  border-color: rgba(169, 74, 72, 0.3);
  border-radius: 11px;
  color: var(--danger);
  background: rgba(169, 74, 72, 0.08);
}

.board-root {
  margin-top: 20px;
}

.columns {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  min-width: 0;
}

.column {
  min-width: 0;
  max-height: calc(100dvh - 300px);
  overflow: hidden;
  border-color: var(--line);
  border-radius: var(--radius-lg);
  background: rgba(251, 251, 248, 0.72);
  box-shadow: none;
}

.column-head {
  padding: 15px 16px 13px;
  border-bottom-color: var(--line);
}

.column-title {
  font-size: 0.89rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.count {
  min-width: 28px;
  padding: 4px 8px;
  border-color: var(--line);
  color: var(--muted);
  background: var(--surface-strong);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem;
}

.cards {
  min-height: 80px;
  gap: 8px;
  padding: 9px;
  scrollbar-color: #c9cbc7 transparent;
  scrollbar-width: thin;
}

.card {
  gap: 9px;
  padding: 12px;
  border-color: var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: border 180ms var(--ease), box-shadow 180ms var(--ease), transform 180ms var(--ease);
  animation: card-in 420ms var(--ease) both;
  animation-delay: calc(var(--card-index, 0) * 18ms);
}

.card:hover {
  border-color: #c9cbc7;
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.card-click-overlay {
  z-index: 1;
}

.card-title,
.card-meta,
.card-actions,
.card-note,
.music-preview {
  z-index: 2;
}

.card-title {
  font-size: 0.89rem;
  font-weight: 700;
}

.card-title a:hover {
  color: var(--accent);
}

.card-meta {
  gap: 5px;
  color: var(--muted);
  font-size: 0.69rem;
}

.badge {
  border-color: var(--line);
  padding: 3px 7px;
  color: var(--muted);
  background: var(--bg);
  font-size: 0.63rem;
}

.badge.films,
.badge.imdb {
  border-color: #e6cfc6;
  color: #7f3828;
  background: var(--accent-soft);
}

.badge.twitter,
.badge.reddit,
.badge.music,
.badge.music_recs,
.badge.recommendation,
.badge.category {
  color: var(--muted);
  background: var(--bg);
}

.card-actions {
  gap: 6px;
}

.card-actions select,
.card-actions .open-link,
.card-actions .archive-btn {
  min-height: 30px;
  border-color: var(--line);
  border-radius: 8px;
  padding: 5px 8px;
  color: var(--muted);
  background: var(--surface-strong);
  font-size: 0.7rem;
}

.card-actions .open-link {
  color: var(--text);
}

.card-actions .open-link:hover {
  color: var(--accent);
  border-color: #d9b7aa;
}

.archive-btn {
  border-color: rgba(169, 74, 72, 0.25) !important;
  color: var(--danger) !important;
  background: rgba(169, 74, 72, 0.06) !important;
}

.card-note {
  min-height: 48px;
  border-radius: 9px;
  padding: 7px 9px;
  font-size: 0.75rem;
}

.film-card {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  align-items: start;
  gap: 7px 10px;
}

.film-card .film-poster {
  grid-row: span 3;
  width: 62px;
  height: 92px;
  object-fit: cover;
}

.film-card .card-actions,
.film-card .card-note {
  grid-column: 1 / -1;
}

.film-poster,
.music-cover {
  border-color: var(--line);
  border-radius: 8px;
  background: var(--bg);
}

.music-cover {
  max-height: 220px;
}

.music-preview {
  height: 32px;
}

.empty,
.hint {
  color: var(--muted);
  font-size: 0.74rem;
}

.load-more {
  width: 100%;
  border: 1px dashed #c9cbc7;
  border-radius: 10px;
  padding: 9px;
  color: #7f3828;
  background: transparent;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
}

.load-more:hover {
  background: var(--accent-soft);
}

.loading-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.loading-column {
  display: grid;
  gap: 9px;
  min-height: 360px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(251, 251, 248, 0.7);
}

.skeleton-line {
  height: 74px;
  border-radius: 12px;
  background: linear-gradient(100deg, #e8e8e3 20%, #f8f8f4 38%, #e8e8e3 56%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  to { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 1100px) {
  .app-header {
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 28px;
  }

  .columns,
  .loading-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .column {
    max-height: 620px;
  }
}

@media (max-width: 720px) {
  .app {
    padding: 18px 14px 28px;
  }

  .app-header {
    display: block;
    padding: 54px 0 30px;
  }

  .app-header h1 {
    font-size: clamp(2.5rem, 14vw, 4.3rem);
  }

  .header-index {
    width: 100%;
    margin-top: 28px;
  }

  .toolbar-top,
  .toolbar-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .summary {
    text-align: left;
  }

  .category-filter,
  .category-filter select,
  .film-form,
  .film-field,
  .film-search-wrap {
    width: 100%;
    min-width: 0;
  }

  .film-form {
    align-items: stretch;
    flex-direction: column;
    margin-left: 0;
  }

  .film-form button {
    width: 100%;
  }

  .film-search-results {
    position: static;
    width: 100%;
    margin-top: 8px;
  }

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

  .column {
    max-height: 560px;
  }
}

/* Social cards keep the original rich reading experience, but hydrate only when visible. */
.social-card {
  overflow: hidden;
  flex: 0 0 auto;
}

.social-embed {
  position: relative;
  z-index: 2;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
}

.social-embed-placeholder {
  display: flex;
  min-height: 154px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.75rem;
}

.social-embed-mark {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 7px;
  color: var(--surface-strong);
  background: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem;
  font-weight: 700;
}

.social-embed-pending {
  background: linear-gradient(100deg, #f5f4ef 20%, #ffffff 38%, #f5f4ef 56%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

.social-embed-pending .social-embed-placeholder {
  background: rgba(255, 255, 255, 0.56);
}

.social-card .card-actions,
.social-card .card-note {
  z-index: 3;
}

.social-embed iframe,
.social-embed-frame {
  display: block;
  width: 100%;
  border: 0;
  background: var(--surface-strong);
}

.tweet-embed-wrap {
  min-height: 190px;
  padding: 0;
}

.tweet-embed-wrap > iframe {
  min-height: 220px;
}

.reddit-embed-wrap {
  min-height: 230px;
}

.reddit-embed-wrap blockquote {
  margin: 0 !important;
  max-width: none !important;
}

.reddit-embed-wrap script {
  display: none;
}

.social-embed-fallback {
  display: flex;
  min-height: 150px;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
}

.reddit-embed-frame {
  min-height: 300px;
}

@media (max-width: 720px) {
  .reddit-embed-frame {
    min-height: 260px;
  }
}
