:root {
  color-scheme: dark;
  --bg: #161413;
  --surface: #201d1b;
  --border: #3a322f;
  --text: #f7efe9;
  --muted: #bcafa8;
  --accent: #ff9478;
  --accent-dark: #2b1712;
  --focus: #ffc2af;
  font: 100%/1.5 "Helvetica Neue", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
a { color: inherit; }
p, h1, h2, h3 { margin: 0; }
.wrap { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--border); }
.topbar { min-height: 72px; display: flex; align-items: center; gap: 42px; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-size: 1.28rem; font-weight: 750; letter-spacing: -.055em; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-dark); font-size: 1.12rem; }
nav { display: flex; align-self: stretch; gap: 25px; }
nav a { display: grid; place-items: center; position: relative; color: var(--muted); font-weight: 650; text-decoration: none; font-size: .9rem; white-space: nowrap; }
nav a[aria-current] { color: var(--text); }
nav a[aria-current]::after { position: absolute; content: ""; bottom: 0; height: 2px; width: 100%; background: var(--accent); border-radius: 2px 2px 0 0; }
.header-add { margin-left: auto; white-space: nowrap; }
.primary, .secondary { border-radius: 9px; padding: 10px 16px; font-weight: 700; font-size: .9rem; min-height: 44px; }
.primary { background: var(--accent); color: var(--accent-dark); border: 1px solid var(--accent); }
.primary:hover { background: #ffad97; }
.secondary { background: transparent; border: 1px solid var(--border); color: var(--text); }
.secondary:hover, .icon-button:hover { background: #322a26; border-color: #6d5449; }
.hero { position: relative; overflow: hidden; min-height: 335px; display: flex; align-items: center; margin-top: 33px; border: 1px solid var(--border); border-radius: 20px; isolation: isolate; background: #2b1917 radial-gradient(ellipse at 80% 35%, #73382c 0%, #2b1917 48%, #1e1715 88%); }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, #160f0eea 0%, #160f0ed6 35%, #160f0e12 76%), url('cinema.jpg') center 51% / cover; }
.hero-copy { max-width: 660px; padding: 34px clamp(24px, 5vw, 64px); }
.eyebrow { color: var(--accent); font-weight: 750; font-size: .84rem; letter-spacing: .14em; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; letter-spacing: -.045em; }
.hero h1, .library h1 { font-size: clamp(2.7rem, 6.5vw, 5.35rem); line-height: .99; margin: 13px 0 17px; }
.hero h1 em { display: block; color: #ffa98f; font-weight: 400; }
.hero-copy > p:last-child { color: #ebdcd3; max-width: 375px; font-size: 1.03rem; }
.picker { background: var(--surface); border: 1px solid var(--border); margin-top: 24px; padding: clamp(16px, 3vw, 26px); border-radius: 15px; }
fieldset { padding: 0; margin: 0; border: 0; min-inline-size: 0; }
legend { padding: 0; margin-bottom: 10px; font-size: .93rem; font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 6px 13px; min-height: 36px; border-radius: 20px; color: var(--muted); background: transparent; border: 1px solid #50413a; font-size: .86rem; }
.chip:hover { color: var(--text); border-color: #a46c5a; }
.chip[aria-pressed="true"] { background: #44271f; border-color: var(--accent); color: #ffbfae; }
.picker-bottom { display: grid; grid-template-columns: 1fr 172px auto; gap: 12px; align-items: end; margin-top: 20px; }
.field { display: block; font-size: .89rem; font-weight: 650; min-width: 0; }
.optional { color: var(--muted); font-weight: 400; }
input, select, textarea { width: 100%; display: block; margin-top: 6px; color: var(--text); background-color: #171514; border: 1px solid var(--border); border-radius: 8px; padding: 10px 11px; min-height: 44px; }
input::placeholder, textarea::placeholder { color: #a5968d; opacity: 1; }
select { appearance: none; padding-right: 31px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='m3 5 4 4 4-4' fill='none' stroke='%23bcafa8' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-position: right 11px center; background-repeat: no-repeat; }
textarea { resize: vertical; }
.results { margin-top: 34px; }
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.section-header h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.13; }
.section-header p, .metadata, .summary { color: var(--muted); }
.section-header p { margin-top: 5px; }
.movie-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.movie-card { --card-tint: #37241f; display: flex; flex-direction: column; align-items: flex-start; border: 1px solid var(--border); border-radius: 14px; background: linear-gradient(160deg, var(--card-tint), var(--surface) 63%); padding: 19px; min-height: 240px; overflow-wrap: anywhere; }
.movie-card:nth-child(3n+2) { --card-tint: #292b33; }
.movie-card:nth-child(3n+3) { --card-tint: #303323; }
.card-header { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 8px; }
.genre { color: #f5aa94; font-weight: 700; font-size: .81rem; }
.icon-button { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; background: #19151481; border: 1px solid #6a5549; color: var(--text); font-size: 1.18rem; line-height: 1; flex: 0 0 auto; }
.movie-card h3 { font-size: 1.7rem; line-height: 1.08; margin-top: 9px; }
.metadata { font-size: .85rem; margin-top: 4px; }
.summary { margin: 12px 0; font-size: .96rem; }
.why { color: #ffb9a4; font-size: .87rem; margin: auto 0 10px; }
.text-button { border: 0; border-bottom: 1px solid #6f554d; padding: 4px 0; background: transparent; color: var(--text); font-size: .86rem; font-weight: 700; }
.text-button:hover { color: var(--accent); }
.library { margin-top: 43px; min-height: 51vh; }
.library h1 { font-size: clamp(2.7rem, 6vw, 4.2rem); }
.library-search { max-width: 430px; margin-bottom: 16px; }
.library-list { display: grid; gap: 10px; margin-top: 18px; }
.library-row, .empty { background: var(--surface); border: 1px solid var(--border); padding: 15px 18px; border-radius: 11px; }
.library-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; overflow-wrap: anywhere; }
.library-row h3 { font-size: 1.5rem; }
.library-row p { color: var(--muted); white-space: pre-wrap; }
.empty { color: var(--muted); grid-column: 1 / -1; }
.site-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 7px 20px; margin-top: 45px; padding: 17px 0; color: var(--muted); border-top: 1px solid var(--border); font-size: .84rem; }
dialog { max-width: min(530px, calc(100% - 24px)); width: 100%; padding: 23px; border: 1px solid #73584b; border-radius: 16px; background: var(--surface); color: var(--text); }
dialog::backdrop { background: #100d0bd6; }
dialog form > .field, dialog fieldset { margin-top: 15px; }
.title-row { display: grid; grid-template-columns: 1fr 105px; gap: 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 17px; }
.dangerous, .form-error { color: #ffad9b; }
.form-error { margin-top: 10px; }
.notice { position: fixed; z-index: 1; right: 22px; bottom: 22px; max-width: calc(100% - 44px); border: 1px solid #8b5b4b; border-radius: 9px; background: #38231d; color: var(--text); padding: 10px 15px; box-shadow: 0 5px 20px #0006; }
@media (max-width: 760px) {
  .wrap { width: calc(100% - 38px); }
  .topbar { gap: 17px; }
  nav { gap: 15px; }
  .hero { min-height: 290px; }
  .movie-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .picker-bottom { grid-template-columns: 1fr auto; }
  .picker-bottom .field:first-child { grid-column: 1 / -1; }
}
@media (max-width: 510px) {
  .wrap { width: calc(100% - 28px); }
  .topbar { min-height: 64px; flex-wrap: wrap; gap: 0 12px; padding-top: 10px; }
  nav { order: 3; width: 100%; height: 42px; }
  .hero { margin-top: 20px; min-height: 260px; }
  .hero::before { background-position: 64% center; }
  .hero-copy { padding: 24px 18px; }
  .hero h1 { font-size: clamp(2.5rem, 10vw, 3.6rem); }
  .movie-grid { grid-template-columns: 1fr; }
  .library .section-header { align-items: flex-start; }
}

.title-search { display: grid; grid-template-columns: minmax(0, 440px) auto; gap: 10px; align-items: end; justify-content: start; margin-bottom: 19px; }
.chart-source, .chart-link { font-size: .85rem; }
.chart-source a, .chart-link, #search-area a { color: var(--accent); }
.chart-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.chart-row:has(.chart-rank) { grid-template-columns: 36px minmax(0, 1fr) auto; }
.chart-rank { font-variant-numeric: tabular-nums; color: var(--muted); }
.chart-actions { display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.import-button { margin: 16px 0 0; }
#signed-out-panel > .field { margin-top: 14px; }
#account-button { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 620px) {
  .chart-row { grid-template-columns: minmax(0, 1fr); }
  .chart-row:has(.chart-rank) { grid-template-columns: 28px minmax(0, 1fr); }
  .chart-row:has(.chart-rank) .chart-actions { grid-column: 2; }
  .chart-actions { flex-wrap: wrap; }
}
.tmdb-credits { margin-top: 15px; display: flex; gap: 10px; align-items: center; color: var(--muted); }
.tmdb-credits img { display: block; }
