/* Tarot Party: luxe Victorian parlor. Burgundy, black, antique gold, deep teal, cream. */

@font-face {
  font-family: 'Cormorant Garamond';
  src: url('fonts/cormorant-garamond-latin-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Cormorant Garamond';
  src: url('fonts/cormorant-garamond-latin-500-italic.woff2') format('woff2');
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Cormorant Garamond';
  src: url('fonts/cormorant-garamond-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Cormorant Garamond';
  src: url('fonts/cormorant-garamond-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IM Fell English SC';
  src: url('fonts/im-fell-english-sc-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

:root {
  --black: #0d0708;
  --bg: #140c0e;
  --panel: #1f1416;
  --panel-2: #2a1a1c;
  --burgundy: #6e1a26;
  --burgundy-bright: #8e2333;
  --gold: #c9a45c;
  --gold-soft: #a88a52;
  --gold-line: #6b5530;
  --teal: #0f3a3c;
  --teal-line: #2a6a6c;
  --cream: #efe4cf;
  --cream-dim: #d9cbb0;
  --muted: #c2b293;
  --danger: #f0a8a8;
  --radius: 6px;
  --display: 'IM Fell English SC', 'Cormorant Garamond', Georgia, serif;
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; font-size: 18px; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 50% -10%, rgba(110, 26, 38, 0.45), transparent 60%),
    radial-gradient(ellipse at 50% 120%, rgba(15, 58, 60, 0.35), transparent 55%);
  background-attachment: fixed;
  color: var(--cream);
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 500;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
}

main { flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: 16px; }

h1, h2, h3 { font-family: var(--display); color: var(--gold); font-weight: 400; margin: 0; }
h1 { font-size: 2.4rem; line-height: 1.05; }
h2 { font-size: 1.6rem; line-height: 1.15; }
h3 { font-size: 1.2rem; }

a { color: var(--gold); }
p { margin: 0.5em 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

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

.flourish { color: var(--gold); letter-spacing: 0.5em; font-size: 1rem; }
.rule { height: 1px; background: linear-gradient(90deg, transparent, var(--gold-line), transparent); margin: 20px auto; max-width: 280px; }
.muted { color: var(--muted); }
.gold { color: var(--gold); font-weight: 700; }
.italic { font-style: italic; }
.center { text-align: center; }

/* Buttons and inputs: 44px+ tap targets */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 20px;
  font-family: var(--serif); font-size: 1.1rem; font-weight: 700;
  color: var(--cream); background: transparent;
  border: 1px solid var(--gold-line); border-radius: var(--radius);
  cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--gold); }
.btn-primary { background: var(--burgundy); border-color: var(--gold); color: #f3dfa9; }
.btn-primary:hover { background: var(--burgundy-bright); }
.btn-block { width: 100%; }
.btn-small { min-height: 40px; padding: 6px 14px; font-size: 1rem; }
.btn[aria-busy='true'] { opacity: 0.6; pointer-events: none; }
.link-btn {
  background: none; border: none; padding: 8px 4px; min-height: 40px;
  color: var(--gold); font: inherit; text-decoration: underline; cursor: pointer;
}

label { display: block; margin: 14px 0 6px; color: var(--cream-dim); font-weight: 600; }
input[type='text'], input[type='email'], input[type='password'], select {
  width: 100%; min-height: 48px; padding: 10px 12px;
  font-family: var(--serif); font-size: 1.15rem; font-weight: 600; color: var(--cream);
  background: var(--black); border: 1px solid var(--gold-line); border-radius: var(--radius);
}
input:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 2px rgba(201, 164, 92, 0.35); }

.code-input {
  text-align: center; letter-spacing: 0.4em; text-transform: uppercase;
  font-size: 1.5rem !important; max-width: 240px; margin: 0 auto; display: block;
}

.error { color: var(--danger); min-height: 1.4em; margin: 8px 0; }
.notice {
  background: var(--teal); border: 1px solid var(--teal-line); border-radius: var(--radius);
  padding: 10px 14px; margin: 12px 0;
}

/* Landing */
.landing { max-width: 440px; margin: 6vh auto 0; text-align: center; }
.landing .date { font-size: 1.25rem; margin-top: 8px; }
.landing .vibe { font-style: italic; font-size: 1.2rem; }
.landing form { margin-top: 28px; }

/* Choice buttons (RSVP) */
.choices { display: grid; gap: 10px; margin: 8px 0; }
.choices.two { grid-template-columns: 1fr 1fr; }
.choice {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 10px; text-align: center;
  border: 1px solid var(--gold-line); border-radius: var(--radius);
  background: var(--panel); cursor: pointer; margin: 0; color: var(--cream);
}
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.choice:has(input:checked) { background: var(--burgundy); border-color: var(--gold); color: #f3dfa9; }
.choice:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }
.choice:has(input:disabled) { opacity: 0.45; cursor: not-allowed; }
.choice small { display: block; color: var(--muted); font-size: 0.85rem; }
.choice:has(input:checked) small { color: var(--cream-dim); }

.card-panel {
  background: var(--panel); border: 1px solid var(--gold-line); border-radius: 10px;
  padding: 18px; max-width: 520px; margin: 16px auto;
}

/* Deck */
.deck-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.whoami { color: var(--muted); font-size: 1rem; }
.mine {
  display: grid; gap: 6px; margin: 12px 0;
  background: rgba(15, 58, 60, 0.6); border: 1px solid var(--teal-line); border-radius: var(--radius);
  padding: 10px 14px;
}
.mine-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.mine-row b { color: var(--gold); font-weight: 700; }

.filters { margin: 14px 0 6px; }
.filter-label { font-size: 0.9rem; color: var(--muted); margin: 8px 0 4px; }
.chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px;
  scrollbar-width: thin; -webkit-overflow-scrolling: touch;
}
.chip {
  flex: 0 0 auto; min-height: 40px; padding: 6px 14px;
  font-family: var(--serif); font-size: 1.02rem; font-weight: 600; color: var(--cream);
  background: var(--panel); border: 1px solid var(--gold-line); border-radius: 3px; cursor: pointer;
  box-shadow: inset 0 0 0 2px var(--panel), inset 0 0 0 3px rgba(201, 164, 92, 0.25);
}
.chip[aria-pressed='true'] { background: var(--burgundy); border-color: var(--gold); color: #f3dfa9; box-shadow: inset 0 0 0 2px var(--burgundy), inset 0 0 0 3px rgba(243, 223, 169, 0.45); }
.chip.deck[aria-pressed='true'] { background: var(--teal); box-shadow: inset 0 0 0 2px var(--teal), inset 0 0 0 3px rgba(243, 223, 169, 0.45); }

.deck-status { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 8px 0; color: var(--cream-dim); }
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; margin: 0; color: var(--cream-dim); min-height: 40px; }
.toggle input { width: 22px; height: 22px; accent-color: var(--burgundy-bright); }

.group-title { margin: 18px 0 8px; font-size: 1.25rem; border-bottom: 1px solid var(--gold-line); padding-bottom: 4px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 14px; } }

.tile {
  position: relative; display: block; width: 100%; padding: 0; margin: 0;
  background: none; border: none; cursor: pointer; color: var(--cream); text-align: center; font: inherit;
}
.tile .frame {
  position: relative; display: block; aspect-ratio: 500 / 860; border-radius: 6px; overflow: hidden;
  border: 1px solid var(--gold-line); background: var(--panel-2);
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .name { display: block; font-weight: 600; font-size: 0.92rem; line-height: 1.2; margin-top: 4px; color: var(--cream-dim); }
.tile.sealed .frame { background: #1a0f11; }
.tile.sealed img.art { filter: brightness(0.18) saturate(0.4); }
.tile .seal { position: absolute; left: 10%; top: 26%; width: 80%; height: auto; }
.tile.own .frame { border: 2px solid var(--gold); box-shadow: 0 0 0 2px rgba(201, 164, 92, 0.25); }
.tile .badge {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 2px;
  background: rgba(13, 7, 8, 0.85); color: var(--gold); font-size: 0.85rem;
}

.empty { text-align: center; padding: 30px 10px; }

/* Preview dialog */
dialog.preview {
  width: min(460px, calc(100vw - 24px)); max-height: calc(100vh - 24px);
  padding: 0; border: 1px solid var(--gold); border-radius: 12px;
  background: var(--black); color: var(--cream);
}
dialog.preview::backdrop { background: rgba(0, 0, 0, 0.75); }
.preview-body { padding: 18px; }
.preview-img { display: block; height: auto; width: 52%; max-width: 220px; margin: 0 auto; border-radius: 6px; border: 1px solid var(--gold-line); }
.preview h2 { text-align: center; margin-top: 12px; }
.preview .sub { text-align: center; color: var(--muted); font-size: 0.95rem; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 8px 0; }
.tag { font-size: 0.85rem; padding: 2px 10px; border: 1px solid var(--gold-line); border-radius: 3px; color: var(--cream-dim); }
.meaning { font-style: italic; text-align: center; font-size: 1.15rem; margin: 10px 0; }
.oncard { color: var(--cream-dim); }
.oncard b { color: var(--gold); font-weight: 700; }
.two-note { color: var(--gold-soft); text-align: center; font-size: 0.95rem; }
.actions { display: grid; gap: 10px; margin-top: 16px; }
.sealed-msg { text-align: center; font-family: var(--display); font-size: 1.5rem; color: var(--gold); margin: 6px 0; }

footer { text-align: center; padding: 24px 16px 28px; color: var(--muted); font-size: 0.95rem; }
footer a { color: var(--muted); }

/* Host view */
.host main { max-width: 1100px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 14px 0; }
.metric { background: var(--panel); border: 1px solid var(--gold-line); border-radius: var(--radius); padding: 10px 14px; }
.metric b { display: block; font-size: 1.8rem; color: var(--gold); font-weight: 700; }
.metric span { color: var(--muted); font-size: 0.95rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.invite {
  background: var(--panel); border: 1px solid var(--gold-line); border-radius: var(--radius);
  margin: 10px 0; padding: 12px 14px;
}
.invite-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: baseline; }
.invite-name { font-size: 1.25rem; font-weight: 700; }
.pill { font-size: 0.85rem; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--gold-line); }
.pill.yes { background: #1f4a3a; border-color: #3f7a62; }
.pill.maybe { background: #4a3a14; border-color: #7a6224; }
.pill.no { background: #3a1a22; border-color: #6a2a36; }
.pill.changed { border-color: var(--gold); color: var(--gold); }
.code { font-family: ui-monospace, Consolas, monospace; letter-spacing: 0.15em; color: var(--gold); }
.invite details { margin-top: 8px; }
.invite summary { cursor: pointer; color: var(--gold); min-height: 40px; display: flex; align-items: center; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.row > * { flex: 1 1 180px; }
.check { display: flex; align-items: center; gap: 8px; margin: 10px 0; color: var(--cream); }
.check input { width: 22px; height: 22px; accent-color: var(--burgundy-bright); }
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--teal); border: 1px solid var(--teal-line); color: var(--cream);
  padding: 10px 18px; border-radius: var(--radius); z-index: 10; max-width: calc(100vw - 32px);
}

b, strong { font-weight: 700; }
.btn { flex-wrap: wrap; text-align: center; }
.btn .muted { flex-basis: 100%; font-size: 0.85em; color: var(--cream-dim); }
