:root {
  --bg: #140d1f;
  --surface: #1d1430;
  --surface-2: #271a3f;
  --line: rgba(255, 255, 255, .1);
  --text: #f5eefb;
  --muted: #a897c2;
  --accent: #ff4d6d;
  --accent-soft: rgba(255, 77, 109, .16);
  --gold: #ffc857;
  --good: #4ade80;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(900px 500px at 15% -8%, rgba(255, 77, 109, .18), transparent 65%),
    radial-gradient(700px 420px at 92% 4%, rgba(120, 90, 255, .18), transparent 60%);
  background-attachment: fixed;
  min-height: 100dvh;
}

#app {
  max-width: 720px;
  margin: 0 auto;
  /* Bottom padding clears the floating Recommend button. */
  padding: max(20px, env(safe-area-inset-top)) 16px calc(104px + env(safe-area-inset-bottom));
}

h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.02em; }
p { margin: 0; }
a { color: var(--accent); }

/* ------------------------------------------------------------- primitives */

button {
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 16px;
  cursor: pointer;
  transition: transform .1s ease, filter .15s ease, background .15s ease;
  -webkit-tap-highlight-color: transparent;
}
button:active { transform: scale(.97); }
button:disabled { opacity: .5; cursor: default; }

button.primary {
  background: linear-gradient(135deg, var(--accent), #ff7a4d);
  border-color: transparent;
  color: #24060e;
}
button.ghost { background: transparent; }
button.link {
  background: none; border: none; padding: 4px 2px;
  color: var(--muted); font-weight: 500; text-decoration: underline;
}
button.danger { color: #ff8fa3; }

input, select, textarea {
  font: inherit;
  width: 100%;
  color: var(--text);
  background: rgba(0, 0, 0, .28);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
select { appearance: none; background-image: linear-gradient(transparent, transparent); }
textarea { resize: vertical; min-height: 84px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 6px 2px; }
::placeholder { color: #6f5f88; }

.field { margin-bottom: 14px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.stack { display: grid; gap: 12px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

/* ---------------------------------------------------------------- landing */

.hero { text-align: center; padding: 26px 0 8px; }
.hero .mask { font-size: 54px; line-height: 1; }
.hero h1 { font-size: 34px; margin: 12px 0 8px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { color: var(--muted); max-width: 30ch; margin: 0 auto; }

.tabs { display: flex; gap: 6px; background: rgba(0, 0, 0, .3); padding: 5px; border-radius: 14px; margin-bottom: 16px; }
.tabs button { flex: 1; background: transparent; border: none; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--surface-2); color: var(--text); }

.code-input { text-transform: uppercase; letter-spacing: .32em; text-align: center; font-size: 22px; font-weight: 700; }

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

.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.topbar h1 { font-size: 24px; }
.topbar .who {
  color: var(--muted); font-size: 13px; margin-top: 4px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px;
}
.topbar .who .sep { color: #5d4d78; }

.sharebar {
  display: flex; align-items: center; gap: 10px;
  background: var(--accent-soft);
  border: 1px dashed rgba(255, 77, 109, .45);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
}
.sharebar .code { font-size: 20px; font-weight: 800; letter-spacing: .18em; }
.sharebar .grow { flex: 1; min-width: 0; }

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

.counts { display: flex; gap: 8px; margin-bottom: 16px; }
.counts div {
  flex: 1; text-align: center;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 6px;
}
.counts b { display: block; font-size: 20px; }
.counts span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

/* ---------------------------------------------------------------- filters */

.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 14px;
  background: var(--surface);
  color: var(--muted);
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: transparent; color: #24060e; }

/* ------------------------------------------------------------------- recs */

.recs { display: grid; gap: 12px; }

.rec {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.rec.mine { border-color: rgba(255, 77, 109, .4); }
.rec.skip { opacity: .82; }

.rec h3 { font-size: 18px; }
.rec .meta { color: var(--muted); font-size: 13px; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.rec .pitch { margin-top: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.rec .byline { margin-top: 12px; font-size: 13px; color: var(--muted); }
.rec .byline b { color: var(--text); }

.stars { color: var(--gold); font-size: 15px; letter-spacing: .06em; white-space: nowrap; }
.stars .off { color: #4b3d63; }

.tag {
  display: inline-block;
  font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 9px;
}
.tag.warn { background: rgba(255, 77, 109, .16); border-color: rgba(255, 77, 109, .4); color: #ffb0be; }

.marks { display: flex; gap: 8px; margin-top: 14px; }
.marks button { flex: 1; padding: 9px 8px; font-size: 14px; }
.marks button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.marks button.seen[aria-pressed="true"] { background: rgba(74, 222, 128, .14); border-color: var(--good); }

.who-list { margin-top: 10px; font-size: 13px; color: var(--muted); display: grid; gap: 3px; }

.owner-actions { display: flex; gap: 12px; margin-top: 12px; }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty .mask { font-size: 40px; }

/* ------------------------------------------------------------------ modal */

.sheet-backdrop {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(8, 4, 14, .7);
  backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: min(720px, 100%);
  max-height: 92dvh; overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px 22px 0 0;
  padding: 20px 18px calc(24px + env(safe-area-inset-bottom));
  animation: rise .22s ease;
}
@keyframes rise { from { transform: translateY(18px); opacity: .4; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } button:active { transform: none; } }

.rating-picker { display: flex; gap: 6px; }
.rating-picker button {
  flex: 1; padding: 12px 4px; font-size: 15px;
  display: grid; gap: 3px; justify-items: center;
}
.rating-picker button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.rating-picker small { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.fab {
  position: fixed; z-index: 10;
  right: max(16px, calc(50vw - 344px)); bottom: calc(20px + env(safe-area-inset-bottom));
  border-radius: 999px; padding: 15px 22px; font-size: 16px; font-weight: 700;
  box-shadow: 0 10px 26px rgba(255, 77, 109, .4);
}

.error { color: #ffb0be; font-size: 14px; margin-bottom: 12px; }

.toast {
  position: fixed; z-index: 40;
  left: 50%; bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: #fff; color: #17102a;
  font-weight: 600; font-size: 14px;
  padding: 10px 18px; border-radius: 999px;
  box-shadow: var(--shadow);
}
