:root {
  --bg: #12100f; --card: #1e1b19; --line: #322d2a;
  --text: #f0ebe6; --dim: #a09890; --gold: #d9a441;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, sans-serif;
  padding: 1rem; max-width: 1000px; margin-inline: auto;
}
h1 { font-size: 1.4rem; margin: 0 0 1rem; letter-spacing: .02em; }
button { font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); padding: .5rem .9rem; }
button.on { background: var(--gold); color: #1a1512; border-color: var(--gold); }
select { font: inherit; padding: .6rem .8rem; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card); color: var(--text); width: 100%; }
input { font: inherit; padding: .6rem .8rem; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card); color: var(--text); width: 100%; }
.error { color: #e2725b; }

#login { max-width: 640px; margin-inline: auto; text-align: center;
  min-height: 100dvh; display: flex; flex-direction: column;
  justify-content: center; padding-block: 2rem; }
#login h1 { font-size: 2.4rem; margin-bottom: 2rem; }
#profiles { display: flex; flex-wrap: wrap; gap: 1.6rem; justify-content: center; }
#profiles button { display: grid; gap: .6rem; justify-items: center; padding: 0;
  border: none; background: none; color: var(--dim); }
#profiles button:hover, #profiles button:focus-visible { color: var(--text); }
.avatar { display: grid; place-items: center; width: 8rem; height: 8rem; border-radius: 8px;
  background: var(--a); color: #1a1512; font-size: 3.4rem; font-weight: 600;
  border: 3px solid transparent; }
#profiles button:hover .avatar, #profiles button:focus-visible .avatar { border-color: var(--text); }
#signin { max-width: 300px; margin-inline: auto; display: grid; gap: .8rem; }
.pw-row { display: flex; gap: .5rem; }
#enter { display: grid; place-items: center; flex: none; width: 2.9rem; padding: 0;
  background: var(--gold); color: #1a1512; border-color: var(--gold); }
#back { background: none; border: none; color: var(--dim); }
#back:hover, #back:focus-visible { color: var(--text); }
@media (max-width: 480px) { .avatar { width: 5.5rem; height: 5.5rem; font-size: 2.4rem; } }

header { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; }
header h1 { margin: 0; }
.search { position: relative; flex: 1; min-width: 240px; }

/* Search sits between title and account, so it takes the full width when
   the header wraps and the other two share a row. */
@media (max-width: 560px) { .search { order: 1; flex-basis: 100%; } }

.account { display: flex; align-items: center; gap: .5rem; }
/* .avatar is sized for the login profiles; shrink it to fit the header. */
.account .avatar { width: 1.9rem; height: 1.9rem; font-size: .9rem; border-radius: 50%; }
#results { position: absolute; z-index: 5; inset-inline: 0; margin: .3rem 0 0; padding: 0;
  list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
#results li { padding: .55rem .8rem; cursor: pointer; }
#results li:hover, #results li:focus-visible { background: var(--line); }

.bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
  justify-content: space-between; margin: 1rem 0; }
.filters, .modes { display: flex; gap: .5rem; }

/* Square button sized around a 1.15rem icon; used in the header, the mode
   switch and the card actions, so they all line up. */
.icon-btn { display: grid; place-items: center; padding: .45rem; line-height: 0; }
.icon-btn .i { width: 1.15rem; height: 1.15rem; }
.icon-btn.danger:hover, .icon-btn.danger:focus-visible { color: #e2725b; }
.ghost { background: none; border: none; color: var(--dim); padding-inline: 0; }
.ghost:hover, .ghost:focus-visible { color: var(--text); }

#empty { color: var(--dim); text-align: center; padding: 2rem 0; }

/* Who's seen it: lit avatar = seen, outline = not. Only your own is a button. */
.seen { display: flex; gap: .3rem; align-items: center; }
.seen .who { display: grid; place-items: center; width: 1.5rem; height: 1.5rem;
  border-radius: 50%; font-size: .7rem; font-weight: 600; padding: 0;
  background: none; color: var(--a); border: 1.5px solid var(--a); opacity: .45; }
.seen .who.on { background: var(--a); color: #1a1512; opacity: 1; }
.seen button.who { cursor: pointer; }
.seen button.who:hover, .seen button.who:focus-visible { opacity: 1; }

/* align-items: start stops a tall card stretching the rest of its row —
   otherwise one long blurb leaves the others as mostly-empty boxes. */
.grid { display: grid; gap: 1rem; align-items: start;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.grid.blurbs { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; display: flex; flex-direction: column; }
.card img { width: 100%; aspect-ratio: 2/3; object-fit: cover; display: block; }
/* Cards in a row are equal height; the actions sit on the bottom edge so a
   watched card's star rows don't leave the grid ragged. */
.card .body { padding: .6rem .7rem; display: grid; gap: .4rem;
  flex: 1; align-content: start; }
.card h3 { margin: 0; font-size: .95rem; }
.card .year, .card p { color: var(--dim); font-size: .85rem; margin: 0; }
.card .actions { display: flex; gap: .4rem; margin-top: auto; padding-top: .2rem; }
.card .actions button { padding: .3rem .6rem; font-size: .8rem; flex: 1; }

.stars { display: flex; gap: .1rem; align-items: center; }
.stars .name { color: var(--dim); font-size: .78rem; width: 4.6em; flex: none; white-space: nowrap; }
.stars.mine .name { color: var(--text); }
.stars.mine .star { cursor: pointer; }
.star { position: relative; width: 1.1em; height: 1.1em; color: var(--line); }
.star svg { position: absolute; inset: 0; width: 100%; height: 100%; fill: currentColor; }
/* .fill clips the gold star to the score. It must be a positioned block:
   width and overflow do nothing on an inline box. */
.star .fill { position: absolute; top: 0; left: 0; bottom: 0; display: block;
  color: var(--gold); overflow: hidden; }
.star .fill svg { width: 1.1em; max-width: none; }
/* Buttons sit above both SVG layers or the fill swallows the clicks. */
.star .hit { position: absolute; top: 0; height: 100%; width: 50%; cursor: pointer;
  background: none; border: 0; padding: 0; z-index: 1; }
.star .hit.right { right: 0; }

.wheel-wrap { position: relative; width: min(320px, 80vw); aspect-ratio: 1; margin: 2rem auto; }
#wheel-disc { width: 100%; height: 100%; border-radius: 50%; border: 3px solid var(--line);
  transition: transform 4s cubic-bezier(.17, .67, .21, 1); }
.pointer { position: absolute; top: -6px; left: 50%; translate: -50% 0;
  border: 10px solid transparent; border-top-color: var(--gold); }
#spin { display: block; margin: 0 auto; }
#winner { text-align: center; font-size: 1.1rem; min-height: 1.5em; }

@media (prefers-reduced-motion: reduce) { #wheel-disc { transition-duration: .01s; } }
