/* ===========================================================
   MARQUEE — token system
   Background: warm ink black. Accents: marquee vermillion +
   brass amber. Display type styled like marquee lettering,
   body/data set in plain, technical faces for a ledger feel.
   =========================================================== */

:root {
  /* color */
  --ink: #110F0D;
  --surface: #1B1815;
  --surface-raised: #221E1A;
  --hairline: #2C2824;
  --vermillion: #C9472B;
  --vermillion-dim: #7A2C1C;
  --amber: #D8A23B;
  --amber-dim: #8A6A2A;
  --paper: #F2EDE4;
  --paper-dim: #8C8378;

  /* type */
  --font-display: 'Bebas Neue', sans-serif;
  --font-body: 'IBM Plex Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  /* layout */
  --radius: 3px;
  --shadow: 0 12px 28px rgba(0,0,0,0.45);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
}

body {
  background-image:
    radial-gradient(ellipse at top, rgba(201,71,43,0.06), transparent 60%);
}

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

::selection { background: var(--vermillion-dim); color: var(--paper); }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------- marquee header ---------- */

.marquee-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, #15120F, #110F0D 90%);
  border-bottom: 1px solid var(--hairline);
  box-shadow: 0 6px 0 rgba(0,0,0,0.2), 0 1px 0 rgba(216,162,59,0.08);
}

.marquee-bar__inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 14px 24px;
  flex-wrap: wrap;
}

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

.wordmark__text {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 0.08em;
  color: var(--paper);
  text-shadow: 0 0 18px rgba(216,162,59,0.35);
}

.wordmark__bulb {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 10px 2px rgba(216,162,59,0.7);
  animation: bulb-flicker 3.2s infinite ease-in-out;
}

@keyframes bulb-flicker {
  0%, 100% { opacity: 1; }
  45% { opacity: 1; }
  50% { opacity: 0.35; }
  55% { opacity: 1; }
}

.tabs {
  display: flex;
  gap: 4px;
  flex: 1;
  flex-wrap: wrap;
}

.tab {
  background: none;
  border: none;
  color: var(--paper-dim);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tab:hover { color: var(--paper); }

.tab.is-active {
  color: var(--paper);
  border-bottom-color: var(--vermillion);
}

.tab__count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--amber);
  margin-left: 4px;
}

.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.02em;
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--paper);
  padding: 10px 16px;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:hover { background: var(--surface-raised); border-color: var(--amber-dim); }
.btn:active { transform: scale(0.98); }

.btn--accent {
  background: var(--vermillion);
  border-color: var(--vermillion);
  color: #fff;
}

.btn--accent:hover { background: #b13f27; }

.btn--ghost {
  background: transparent;
  border-color: var(--hairline);
  color: var(--paper-dim);
}

.btn--small { padding: 6px 10px; font-size: 12px; }

.btn--danger {
  background: transparent;
  border-color: var(--vermillion-dim);
  color: var(--vermillion);
}
.btn--danger:hover { background: rgba(201,71,43,0.12); }

/* ---------- hamburger / mobile nav drawer ---------- */

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 32px;
  height: 32px;
  background: none;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 0 7px;
}

.hamburger span {
  display: block;
  height: 2px;
  background: var(--paper);
  border-radius: 1px;
}

.nav-drawer {
  display: flex;
  align-items: center;
  gap: 18px;
  flex: 1;
  flex-wrap: wrap;
}

/* ---------- screen / views ---------- */

.screen {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px 80px;
}

.view { display: none; }
.view.is-active { display: block; animation: fade-in 0.2s ease; }

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

.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.input, .select {
  font-family: var(--font-body);
  font-size: 14px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  color: var(--paper);
  padding: 10px 12px;
  border-radius: var(--radius);
}

.input { flex: 1; min-width: 220px; }
.input::placeholder { color: var(--paper-dim); }

.select { color: var(--paper); }

.empty-state {
  color: var(--paper-dim);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 60px 0;
  text-align: center;
}
.empty-state strong { color: var(--amber); }

/* ---------- poster grid + ticket-stub cards ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 18px;
}

.card {
  position: relative;
  cursor: pointer;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--hairline);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: var(--amber-dim);
}

.card__poster-wrap {
  position: relative;
  aspect-ratio: 2 / 3;
  background: var(--surface-raised);
}

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

.card__poster-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--paper-dim);
  text-align: center;
  padding: 10px;
}

.card__stub {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--vermillion);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 2px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.card__stub--amber { background: var(--amber); color: #211a07; }

.card__body {
  padding: 10px 10px 12px;
}

.card__title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 4px;
  color: var(--paper);
}

.card__meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--paper-dim);
}

/* ---------- modals ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8,7,6,0.75);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.modal {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 480px;
  max-height: 86vh;
  overflow-y: auto;
  padding: 24px;
}

.modal--wide { max-width: 820px; }

.modal__close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: var(--paper-dim);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}
.modal__close:hover { color: var(--paper); }

.search-results {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 50vh;
  overflow-y: auto;
}

.result-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px;
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.result-row:hover { border-color: var(--amber-dim); background: var(--surface-raised); }

.result-row__poster {
  width: 40px;
  height: 60px;
  object-fit: cover;
  border-radius: 2px;
  background: var(--surface-raised);
  flex-shrink: 0;
}

.result-row__title { font-weight: 600; font-size: 14px; }
.result-row__year { font-family: var(--font-mono); font-size: 12px; color: var(--paper-dim); }

/* ---------- film detail ---------- */

.detail {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
}

@media (max-width: 600px) {
  .detail { grid-template-columns: 1fr; }
}

.detail__poster {
  width: 100%;
  border-radius: var(--radius);
  background: var(--surface-raised);
  aspect-ratio: 2/3;
  object-fit: cover;
}

.detail__title {
  font-family: var(--font-display);
  font-size: 30px;
  letter-spacing: 0.02em;
  margin: 0 0 2px;
}

.detail__tagline {
  color: var(--amber);
  font-style: italic;
  font-size: 13px;
  margin-bottom: 12px;
}

.detail__meta-row {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--paper-dim);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.detail__overview { font-size: 14px; color: var(--paper); margin-bottom: 16px; }

.detail__section-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--paper-dim);
  border-bottom: 1px dashed var(--hairline);
  padding-bottom: 4px;
  margin: 16px 0 8px;
}

.watch-log {
  list-style: none;
  margin: 0;
  padding: 0;
}

.watch-log li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dotted var(--hairline);
  font-family: var(--font-mono);
  font-size: 13px;
}

.watch-log li:last-child { border-bottom: none; }

.detail__actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.field label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--paper-dim);
}

/* ---------- dashboard ---------- */

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}

.dashboard-col .panel__title { margin-bottom: 4px; }

.dashboard-subtitle {
  color: var(--paper-dim);
  font-size: 13px;
  margin: 0 0 14px;
}

.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.activity-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.activity-card__poster {
  width: 36px;
  height: 54px;
  object-fit: cover;
  border-radius: 2px;
  background: var(--surface-raised);
  flex-shrink: 0;
}

.activity-card__poster-fallback {
  width: 36px;
  height: 54px;
  border-radius: 2px;
  background: var(--surface-raised);
  flex-shrink: 0;
}

.activity-card__text { font-size: 13px; line-height: 1.4; }
.activity-card__text strong { color: var(--amber); font-weight: 600; }

.activity-card__meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--paper-dim);
  margin-top: 2px;
}

/* ---------- settings ---------- */

.settings-section {
  margin-bottom: 28px;
}

.table-scroll {
  overflow-x: auto;
}

/* ---------- stats ---------- */

.counter-strip {
  display: flex;
  gap: 28px;
  align-items: flex-end;
  margin-bottom: 36px;
  flex-wrap: wrap;
}

.counter__digits {
  font-family: var(--font-display);
  font-size: 64px;
  letter-spacing: 0.04em;
  color: var(--paper);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 4px 16px;
  display: inline-block;
  text-shadow: 0 0 16px rgba(201,71,43,0.45);
}

.counter--small .counter__digits { font-size: 36px; padding: 2px 12px; }

.counter__label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--paper-dim);
  margin-top: 6px;
  text-align: center;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

@media (max-width: 720px) {
  .stats-grid { grid-template-columns: 1fr; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.panel__title {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.04em;
  margin: 0 0 14px;
  color: var(--paper);
}

.bars { display: flex; flex-direction: column; gap: 10px; }

.bar-row { display: flex; align-items: center; gap: 10px; }

.bar-row__label {
  width: 90px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--paper-dim);
  flex-shrink: 0;
}

.bar-row__track {
  flex: 1;
  height: 10px;
  background: var(--surface-raised);
  border-radius: 4px;
  overflow: hidden;
}

.bar-row__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--vermillion), var(--amber));
  border-radius: 4px;
}

.bar-row__value {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--paper);
  width: 28px;
  text-align: right;
}

.rank-list { margin: 0; padding: 0; list-style: none; counter-reset: rank; }

.rank-list li {
  counter-increment: rank;
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px dotted var(--hairline);
  font-size: 13px;
}

.rank-list li:last-child { border-bottom: none; }

.rank-list li::before {
  content: counter(rank, decimal-leading-zero) '  ';
  font-family: var(--font-mono);
  color: var(--amber);
  margin-right: 8px;
}

.rank-list li span:last-child {
  font-family: var(--font-mono);
  color: var(--paper-dim);
}

/* ---------- import ---------- */

.import-intro {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 20px;
}

.import-intro p { color: var(--paper-dim); max-width: 640px; }

.import-progress {
  display: inline-block;
  margin-left: 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--amber);
}

.import-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.import-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--paper-dim);
  border-bottom: 1px solid var(--hairline);
  padding: 8px 6px;
}

.import-table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: middle;
}

.import-table select {
  background: var(--surface-raised);
  border: 1px solid var(--hairline);
  color: var(--paper);
  font-size: 12px;
  border-radius: 2px;
  padding: 4px 6px;
  max-width: 280px;
}

.confidence {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 2px;
  text-transform: uppercase;
}

.confidence--high { background: rgba(216,162,59,0.18); color: var(--amber); }
.confidence--medium { background: rgba(201,71,43,0.18); color: var(--vermillion); }
.confidence--low { background: rgba(255,255,255,0.08); color: var(--paper-dim); }

.import-actions {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

#import-summary {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--paper-dim);
}

/* ---------- auth screen ---------- */

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-image: radial-gradient(ellipse at top, rgba(201,71,43,0.08), transparent 60%);
}

.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 28px 26px;
  box-shadow: var(--shadow);
}

.auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--hairline);
}

.auth-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--paper-dim);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 0;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.auth-tab.is-active { color: var(--paper); border-bottom-color: var(--vermillion); }

.auth-form .btn { width: 100%; margin-top: 6px; }

.auth-error {
  color: var(--vermillion);
  font-family: var(--font-mono);
  font-size: 12px;
  margin-top: 10px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  color: var(--paper-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--hairline);
}

.btn--google {
  width: 100%;
  background: var(--paper);
  border-color: var(--paper);
  color: #1a1a1a;
}

.btn--google:hover { background: #ddd6cb; }

/* ---------- account area (header) ---------- */

.account-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-name {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--paper-dim);
}

#invites-table { margin-top: 16px; }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-raised);
  border: 1px solid var(--amber-dim);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 10px 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 100;
}

/* ---------- mobile ---------- */

@media (max-width: 720px) {
  .dashboard-grid { grid-template-columns: 1fr; gap: 32px; }
}

@media (max-width: 680px) {
  .marquee-bar__inner { padding: 12px 16px; gap: 10px; }
  .wordmark__text { font-size: 22px; }

  .hamburger { display: flex; order: 3; }

  .nav-drawer {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--hairline);
    box-shadow: var(--shadow);
    padding: 8px 16px 14px;
  }

  .nav-drawer.is-open { display: flex; }

  .tabs {
    flex-direction: column;
    gap: 0;
  }

  .tab {
    text-align: left;
    padding: 12px 4px;
    border-bottom: 1px solid var(--hairline);
    border-left: 2px solid transparent;
  }

  .tab.is-active {
    border-bottom-color: var(--hairline);
    border-left-color: var(--vermillion);
    background: var(--surface-raised);
  }

  .account-area {
    justify-content: space-between;
    padding-top: 12px;
    margin-top: 4px;
  }

  .toolbar .input { min-width: 0; flex-basis: 100%; }

  .counter-strip { gap: 16px; }
  .counter__digits { font-size: 44px; padding: 2px 12px; }
  .counter--small .counter__digits { font-size: 28px; padding: 2px 10px; }

  .modal { padding: 20px 16px; }
  .auth-card { padding: 22px 18px; }
}
