/* ───────── Themes: swap by changing data-theme on <html> ───────── */
/* Oni 鬼: blood on black, cold steel */
:root,
:root[data-theme="oni"] {
  --bg: #07060a;
  --bg2: #0d0b12;
  --card: #121018;
  --card2: #1a1721;
  --text: #ebe7ee;
  --muted: #8a8596;
  --border: #29242f;
  --accent: #c1121f;
  --accent2: #9fb0c3;
  --on-accent: #ffffff;
  --glow: 0 0 34px -6px rgba(193, 18, 31, 0.65);
  --moon: radial-gradient(circle, #e5383b 0%, #b0121c 38%, rgba(120, 8, 16, 0.35) 62%, transparent 72%);
  --hero: radial-gradient(800px 420px at 50% -8%, rgba(193, 18, 31, 0.2), transparent 65%),
    radial-gradient(600px 400px at 0% 100%, rgba(159, 176, 195, 0.06), transparent 60%);
}
/* Yūrei 幽: cold spectral blue */
:root[data-theme="yurei"] {
  --bg: #04070c;
  --bg2: #080e16;
  --card: #0c141e;
  --card2: #121e2c;
  --text: #e4eef8;
  --muted: #7b92a8;
  --border: #1d2e40;
  --accent: #5cc8ff;
  --accent2: #a78bfa;
  --on-accent: #03121c;
  --glow: 0 0 34px -6px rgba(92, 200, 255, 0.6);
  --moon: radial-gradient(circle, #dff4ff 0%, #8fd6ff 30%, rgba(70, 120, 190, 0.3) 60%, transparent 72%);
  --hero: radial-gradient(800px 420px at 50% -8%, rgba(92, 200, 255, 0.16), transparent 65%),
    radial-gradient(600px 400px at 100% 100%, rgba(167, 139, 250, 0.1), transparent 60%);
}
/* Ronin 浪: ash and old gold */
:root[data-theme="ronin"] {
  --bg: #0a0a0b;
  --bg2: #111112;
  --card: #151514;
  --card2: #1e1d1a;
  --text: #ece6da;
  --muted: #8f8878;
  --border: #2d2a24;
  --accent: #c9a227;
  --accent2: #b3402a;
  --on-accent: #130f00;
  --glow: 0 0 34px -6px rgba(201, 162, 39, 0.5);
  --moon: radial-gradient(circle, #f2dd8b 0%, #c9a227 36%, rgba(120, 90, 15, 0.3) 62%, transparent 72%);
  --hero: radial-gradient(800px 420px at 50% -8%, rgba(201, 162, 39, 0.14), transparent 65%),
    radial-gradient(600px 400px at 0% 100%, rgba(179, 64, 42, 0.1), transparent 60%);
}

/* ───────── Base ───────── */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Noto Sans JP", system-ui, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, .brand-name { font-family: "Shippori Mincho B1", "Noto Sans JP", serif; letter-spacing: 0.01em; }
.muted { color: var(--muted); font-size: 0.9rem; }
.hint { color: var(--muted); font-size: 0.8rem; text-align: center; margin-top: 0.75rem; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.22em; font-size: 0.72rem; color: var(--accent2); font-weight: 600; }
/* On the hero the eyebrow sits over the bright moon, so it needs real contrast. */
.hero .eyebrow { color: var(--text); font-size: 0.8rem; text-shadow: 0 1px 14px #000, 0 0 3px #000; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }

/* ───────── Buttons: slanted like a blade cut ───────── */
.btn {
  --cut: 10px;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  border: 0; background: var(--card2); color: var(--text);
  padding: 0.7rem 1.5rem; font: inherit; font-weight: 600; letter-spacing: 0.04em;
  cursor: pointer; transition: transform 0.15s, filter 0.15s;
  clip-path: polygon(var(--cut) 0, 100% 0, calc(100% - var(--cut)) 100%, 0 100%);
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.2); }
.btn.primary { background: linear-gradient(120deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #000)); color: var(--on-accent); box-shadow: none; }
/* A slanted clip-path cuts off borders, so the ghost style is a tint instead of an outline. */
.btn.ghost { background: color-mix(in srgb, var(--text) 11%, transparent); }
.btn.discord { background: #4752c4; color: #fff; width: 100%; box-shadow: none; }
.btn.discord:disabled { opacity: 0.5; cursor: not-allowed; transform: none; filter: none; }
.btn.big { padding: 0.95rem 2rem; font-size: 1.02rem; --cut: 14px; }
.btn.small { padding: 0.45rem 1.1rem; font-size: 0.88rem; --cut: 8px; }

/* ───────── Navbar ───────── */
.nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1.25rem; padding: 0.7rem 1.25rem;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px); border-bottom: 1px solid var(--border);
}
.nav::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 7rem; height: 1px; background: linear-gradient(90deg, var(--accent), transparent); }
.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 800; font-size: 1.3rem; }
.brand-mark {
  display: grid; place-items: center; width: 2.1rem; height: 2.1rem;
  background: var(--accent); color: var(--on-accent);
  font-family: "Shippori Mincho B1", "Noto Sans JP", serif; font-weight: 800;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); /* diamond, like a kamon crest */
  font-size: 1.05rem;
}
.brand-mark.huge { width: 5.2rem; height: 5.2rem; font-size: 2.6rem; margin: 0 auto 0.8rem; box-shadow: none; }
.nav-links { display: flex; gap: 0.25rem; margin-left: 0.5rem; }
.nav-links a { padding: 0.45rem 0.85rem; color: var(--muted); font-weight: 500; position: relative; }
.nav-links a:hover { color: var(--text); }
.nav-links a[aria-current="page"] { color: var(--text); }
.nav-links a[aria-current="page"]::after { content: ""; position: absolute; left: 0.85rem; right: 0.85rem; bottom: 0; height: 2px; background: var(--accent); box-shadow: var(--glow); transform: skewX(-30deg); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 0.9rem; }
.theme-switch { display: flex; gap: 0.45rem; }
.theme-btn { width: 1.15rem; height: 1.15rem; border: 1px solid var(--border); cursor: pointer; padding: 0; transform: rotate(45deg); }
.theme-btn.active { outline: 1px solid var(--accent); outline-offset: 3px; }
.theme-btn[data-theme-preview="oni"] { background: linear-gradient(135deg, #121018 50%, #c1121f 50%); }
.theme-btn[data-theme-preview="yurei"] { background: linear-gradient(135deg, #0c141e 50%, #5cc8ff 50%); }
.theme-btn[data-theme-preview="ronin"] { background: linear-gradient(135deg, #151514 50%, #c9a227 50%); }

/* ───────── Gold vector warriors (oni, tengu, ronin, samurai) ───────── */
:root { --gold: #d4af37; }
.bg-art { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
/* ───────── Gold ink warriors (PNG, gold on transparent) ───────── */
.bg-art .art {
  position: absolute; display: block; width: auto; max-width: none; user-select: none;
  filter: drop-shadow(0 0 14px rgba(212, 175, 55, 0.28));
  opacity: var(--o); animation: breathe 8s ease-in-out infinite;
}
@keyframes breathe { 0%, 100% { opacity: calc(var(--o) * 0.7); } 50% { opacity: var(--o); } }

/* Oni swordsman: full-height on the left edge. */
.art.oni { --o: 0.32; left: 0; top: var(--nav-h); height: calc(100vh - var(--nav-h)); height: calc(100dvh - var(--nav-h)); }
/* Wild-haired swordsman: top right. */
.art.tengu { --o: 0.27; right: 0; top: calc(var(--nav-h) + 1rem); height: 56vh; animation-delay: -2s; }
/* Armoured samurai: bottom right. The poster is cropped on its left edge, so fade it in. */
.art.samurai {
  --o: 0.2; right: 0; bottom: 0; height: 54vh; animation-delay: -4s;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 38%);
  mask-image: linear-gradient(to right, transparent 0%, #000 38%);
}
/* Hannya-masked geisha: bottom, between the oni and the content. Cropped on three sides, so vignette it. */
.art.hannya {
  --o: 0.27; left: 21vw; bottom: 0; height: 40vh; animation-delay: -1s;
  -webkit-mask-image: radial-gradient(ellipse 78% 80% at 50% 48%, #000 52%, transparent 100%);
  mask-image: radial-gradient(ellipse 78% 80% at 50% 48%, #000 52%, transparent 100%);
}

@media (max-width: 1279px) {
  .art.hannya { left: 24vw; height: 34vh; }
}
@media (max-width: 1023px) {
  .art.hannya { display: none; }
  .art.oni { left: -4vw; }
  .art.tengu { height: 42vh; }
  .art.samurai { height: 44vh; }
}
@media (max-width: 767px) {
  .art.tengu { display: none; }
  .art.oni { --o: 0.22; height: 72vh; left: -16vw; top: auto; bottom: 3.6rem; }
  .art.samurai { --o: 0.16; height: 36vh; right: -16vw; bottom: 3.6rem; }
}
.nav { z-index: 20; }

/* ───────── Layout ───────── */
.main { position: relative; z-index: 1; max-width: 1040px; margin: 0 auto; padding: 0 1.25rem 4rem; }
.who { color: var(--muted); font-size: 0.85rem; max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.error { color: #ff7a7a; font-size: 0.9rem; border-left: 3px solid #ff5c5c; padding: 0.4rem 0.8rem; background: rgba(255, 92, 92, 0.08); text-align: left; }
.chip.emoji-pick { font-size: 1.25rem; padding: 0.2rem 0.55rem; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
button:disabled, input:disabled { opacity: 0.5; cursor: not-allowed; }
.page { padding-top: 2rem; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 1.25rem; }
.page-head h2 { font-size: 1.9rem; }
.page-head h2::after { content: ""; display: block; width: 3.2rem; height: 3px; margin-top: 0.35rem; background: var(--accent); transform: skewX(-35deg); box-shadow: var(--glow); }
.section { padding-top: 3.8rem; }
.section h2 { font-size: 1.8rem; margin-bottom: 1.4rem; display: flex; align-items: center; gap: 1rem; }
.section h2::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--accent), transparent 70%); }

/* ───────── Hero: blood moon, embers, vertical kanji ───────── */
.hero { position: relative; padding: 6rem 0 3rem; text-align: center; background: var(--hero); overflow: hidden; }
.hero > *:not(.deco) { position: relative; z-index: 2; }
.deco { position: absolute; pointer-events: none; user-select: none; }
.moon { top: -9rem; left: 50%; width: 30rem; height: 30rem; transform: translateX(-50%); background: var(--moon); opacity: 0.55; filter: blur(2px); z-index: 0; border-radius: 50%; }
.hero-kanji { inset: 0; display: grid; place-items: center; z-index: 1; font-family: "Shippori Mincho B1", "Noto Sans JP", serif; font-weight: 800; font-size: clamp(15rem, 42vw, 28rem); color: var(--text); opacity: 0.045; }
.vert { top: 5rem; z-index: 1; writing-mode: vertical-rl; font-family: "Shippori Mincho B1", "Noto Sans JP", serif; font-size: 1.15rem; letter-spacing: 0.7em; color: var(--muted); opacity: 0.55; }
.vert.left { left: 0.5rem; }
.vert.right { right: 0.5rem; }
.embers { inset: 0; overflow: hidden; z-index: 1; }
.embers i { position: absolute; bottom: -10px; width: 3px; height: 3px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 9px var(--accent); opacity: 0; animation: rise 9s linear infinite; }
.embers i:nth-child(1) { left: 6%; animation-delay: 0s; animation-duration: 8s; }
.embers i:nth-child(2) { left: 14%; animation-delay: 2s; animation-duration: 11s; }
.embers i:nth-child(3) { left: 23%; animation-delay: 5s; animation-duration: 9s; }
.embers i:nth-child(4) { left: 31%; animation-delay: 1s; animation-duration: 12s; }
.embers i:nth-child(5) { left: 40%; animation-delay: 6s; animation-duration: 8s; }
.embers i:nth-child(6) { left: 49%; animation-delay: 3s; animation-duration: 10s; }
.embers i:nth-child(7) { left: 58%; animation-delay: 7s; animation-duration: 9s; }
.embers i:nth-child(8) { left: 66%; animation-delay: 0.5s; animation-duration: 11s; }
.embers i:nth-child(9) { left: 74%; animation-delay: 4s; animation-duration: 8s; }
.embers i:nth-child(10) { left: 82%; animation-delay: 8s; animation-duration: 12s; }
.embers i:nth-child(11) { left: 90%; animation-delay: 2.5s; animation-duration: 10s; }
.embers i:nth-child(12) { left: 96%; animation-delay: 5.5s; animation-duration: 9s; }
@keyframes rise {
  0% { transform: translate(0, 0) scale(1); opacity: 0; }
  12% { opacity: 0.95; }
  100% { transform: translate(34px, -560px) scale(0.3); opacity: 0; }
}
.hero h1 { font-size: clamp(2.3rem, 6.4vw, 4.4rem); line-height: 1.1; font-weight: 800; margin: 0.9rem auto 1rem; max-width: 15ch; text-shadow: 0 2px 30px rgba(0, 0, 0, 0.7); }
.grad { background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { color: var(--muted); font-size: 1.1rem; max-width: 46ch; margin: 0 auto 2rem; }
.cta { display: flex; gap: 0.9rem; justify-content: center; flex-wrap: wrap; }
.stats { display: flex; justify-content: center; gap: 3rem; margin-top: 3rem; flex-wrap: wrap; }
.stats div { display: flex; flex-direction: column; }
.stats b { font-size: 1.8rem; font-family: "Shippori Mincho B1", serif; color: var(--accent); }
.stats span { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.14em; }

.steps, .grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.step, .feature { position: relative; background: var(--card); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 3px; padding: 1.35rem; transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s; }
.step:hover, .feature:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--glow); }
.step h4, .feature h4 { margin: 0.5rem 0 0.3rem; font-size: 1.05rem; }
.step p, .feature p { color: var(--muted); font-size: 0.92rem; }
.num { display: inline-grid; place-items: center; width: 2rem; height: 2rem; background: var(--accent); color: var(--on-accent); font-weight: 700; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.f-icon { font-size: 1.7rem; filter: grayscale(0.3); }
.soon { font-style: normal; font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.12em; margin-left: 0.5rem; padding: 0.1rem 0.5rem; border: 1px solid var(--border); color: var(--accent2); vertical-align: middle; }
.footer { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 4rem; padding-top: 1.5rem; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.85rem; }
.status-pill { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.3rem 0.8rem; border: 1px solid var(--border); background: var(--card); font-size: 0.8rem; }
.dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; display: inline-block; }
.dot.ok { background: #35d07f; box-shadow: 0 0 8px #35d07f; }
.dot.wait { background: #f5b942; }
.dot.bad { background: #ff5c5c; }

/* ───────── Avatars, chips ───────── */
.avatar { display: grid; place-items: center; width: 2.8rem; height: 2.8rem; border-radius: 50%; font-size: 1.4rem; flex: none;
  background: linear-gradient(135deg, hsl(var(--h) 55% 38%), hsl(calc(var(--h) + 40) 55% 16%)); box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--border); }
.avatar.big { width: 5rem; height: 5rem; font-size: 2.6rem; box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip { display: inline-block; padding: 0.22rem 0.7rem; background: var(--card2); border: 1px solid var(--border); font-size: 0.78rem; letter-spacing: 0.03em; color: var(--text); font-family: inherit; border-radius: 2px; }
.chip.pick { cursor: pointer; color: var(--muted); transition: all 0.15s; }
.chip.pick:hover { border-color: var(--accent); color: var(--text); }
.chip.pick.on { background: var(--accent); border-color: transparent; color: var(--on-accent); font-weight: 600; }

/* ───────── Profile card / swipe deck ───────── */
.deck { display: grid; place-items: center; min-height: 31rem; }
.pcard {
  position: relative; width: min(100%, 25rem); border-radius: 4px; padding: 1.6rem 1.5rem;
  background: linear-gradient(160deg, color-mix(in srgb, hsl(var(--h) 60% 40%) 14%, var(--card)), var(--card) 55%);
  border: 1px solid var(--border); border-top: 2px solid var(--accent);
  box-shadow: 0 30px 60px -30px #000, 0 0 40px -22px var(--accent);
  animation: pop 0.35s ease-out; transition: transform 0.28s ease-in, opacity 0.28s ease-in;
}
/* katana-guard corner brackets */
.pcard::before, .pcard::after { content: ""; position: absolute; width: 1.1rem; height: 1.1rem; border: 2px solid var(--accent); pointer-events: none; }
.pcard::before { left: -1px; bottom: -1px; border-right: 0; border-top: 0; }
.pcard::after { right: -1px; bottom: -1px; border-left: 0; border-top: 0; }
.pcard.static { animation: none; }
.pcard.fly-right { transform: translateX(130%) rotate(14deg); opacity: 0; }
.pcard.fly-left { transform: translateX(-130%) rotate(-14deg); opacity: 0; }
@keyframes pop { from { transform: scale(0.95); opacity: 0; } to { transform: none; opacity: 1; } }
.pcard-top { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.pcard-top h3 { font-size: 1.6rem; }
.bio { margin-bottom: 1rem; color: color-mix(in srgb, var(--text) 85%, transparent); font-style: italic; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-top: 1.1rem; font-size: 0.86rem; color: var(--muted); }
.stamp { position: absolute; top: 1.2rem; right: 1.2rem; border: 3px solid; padding: 0.05rem 0.6rem; font-family: "Shippori Mincho B1", serif; font-weight: 800; letter-spacing: 0.18em; font-size: 1rem; transform: rotate(8deg); opacity: 0; transition: opacity 0.2s; background: rgba(0, 0, 0, 0.35); }
.stamp.like { color: var(--accent); border-color: var(--accent); text-shadow: var(--glow); }
.stamp.nope { color: var(--muted); border-color: var(--muted); right: auto; left: 1.2rem; transform: rotate(-8deg); }
.pcard.fly-right .stamp.like, .pcard.fly-left .stamp.nope { opacity: 1; }
.actions { display: flex; justify-content: center; gap: 2rem; margin-top: 1.5rem; }
/* hanko seal buttons */
.round { width: 4.2rem; height: 4.2rem; border-radius: 50%; border: 2px solid var(--border); background: var(--card); font-family: "Shippori Mincho B1", "Noto Sans JP", serif; font-weight: 800; font-size: 1.7rem; cursor: pointer; transition: transform 0.15s, box-shadow 0.2s; color: var(--muted); }
.round:hover { transform: scale(1.1) rotate(-4deg); }
.round.like { color: var(--on-accent); background: var(--accent); border-color: transparent; box-shadow: var(--glow); }
.round.nope:hover { color: var(--text); border-color: var(--muted); }

.empty { text-align: center; padding: 3rem 1rem; display: grid; gap: 0.7rem; justify-items: center; }
.empty .emoji { font-size: 3rem; filter: grayscale(0.4); }

/* ───────── Modal (pact sealed) ───────── */
.modal-back { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(0, 0, 0, 0.78); backdrop-filter: blur(6px); padding: 1rem; }
.modal { background: var(--card); border: 1px solid var(--accent); border-radius: 4px; padding: 2.2rem 2rem; max-width: 26rem; width: 100%; text-align: center; box-shadow: var(--glow); animation: pop 0.3s ease-out; }
.modal h2 { margin: 0.7rem 0 1.4rem; font-size: 1.6rem; }
.pair { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-bottom: 1.6rem; }
.spark { font-size: 1.8rem; color: var(--accent); text-shadow: var(--glow); }
.modal .row { justify-content: center; }

/* ───────── Lists ───────── */
.list { display: grid; gap: 0.7rem; }
.row-item { display: flex; align-items: center; gap: 1rem; padding: 0.9rem 1rem; background: var(--card); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 3px; transition: transform 0.15s, box-shadow 0.2s; }
.row-item:hover { transform: translateX(4px); box-shadow: var(--glow); }

/* ───────── Chat ───────── */
.chat { max-width: 40rem; margin: 0 auto; }
.chat-head { display: flex; align-items: center; gap: 0.9rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.back { font-size: 1.4rem; padding: 0.2rem 0.6rem; }
.back:hover { color: var(--accent); }
.bubbles { display: flex; flex-direction: column; gap: 0.5rem; padding: 1.2rem 0; min-height: 18rem; }
.bubble { max-width: 75%; padding: 0.6rem 0.95rem; border-radius: 3px 14px 14px 14px; background: var(--card2); border: 1px solid var(--border); align-self: flex-start; animation: pop 0.2s ease-out; }
.bubble.mine { align-self: flex-end; background: linear-gradient(120deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #000)); color: var(--on-accent); border-color: transparent; border-radius: 14px 3px 14px 14px; }
.composer { display: flex; gap: 0.6rem; }

/* ───────── Forms ───────── */
.editor { display: grid; grid-template-columns: 1.1fr 1fr; gap: 2rem; align-items: start; }
.form { display: grid; gap: 1.1rem; }
.field { display: grid; gap: 0.4rem; }
.field > span { font-size: 0.74rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.14em; }
input[type="text"], textarea, select {
  width: 100%; background: var(--bg2); color: var(--text); border: 1px solid var(--border);
  border-radius: 3px; padding: 0.7rem 0.9rem; font: inherit; outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
input[type="text"]:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.check { display: flex; align-items: center; gap: 0.6rem; cursor: pointer; }
.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }
.saved { color: #35d07f; font-weight: 600; }
.preview { position: sticky; top: 5rem; display: grid; gap: 0.8rem; }

/* ───────── Login / 404 ───────── */
.center-card { max-width: 24rem; margin: 5rem auto 0; text-align: center; display: grid; gap: 0.9rem; background: var(--card); border: 1px solid var(--border); border-top: 2px solid var(--accent); border-radius: 4px; padding: 2.4rem 1.6rem; box-shadow: 0 0 60px -30px var(--accent); }
.divider { display: flex; align-items: center; gap: 0.8rem; color: var(--muted); font-size: 0.8rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ───────── Full-screen fluid layout ─────────
   Breakpoints (desktop-first, then scaled up):
   xs  < 480     phone
   sm  < 768     large phone, bottom tab bar
   md  < 1024    tablet
   lg  < 1280    laptop
   xl  >= 1280   desktop
   2xl >= 1536   large desktop   (root font 112.5%)
   3xl >= 1920   full HD+        (root font 125%)
   4xl >= 2560   QHD / 4K        (root font 156%)
   Everything is in rem, so raising the root font size scales the whole UI. */
:root { --gutter: clamp(1rem, 4.5vw, 7rem); --nav-h: 3.6rem; }
html { font-size: 100%; }
body { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; overflow-x: hidden; }

.main { max-width: none; width: 100%; flex: 1; padding: 0 0 4rem; }
.nav { padding-inline: var(--gutter); }
.page { padding: 2rem var(--gutter) 0; }
.section { padding: 3.8rem var(--gutter) 0; }
.footer { margin: 4rem var(--gutter) 0; }

/* The hero fills the first screen edge to edge. */
.hero {
  min-height: calc(100vh - var(--nav-h)); min-height: calc(100dvh - var(--nav-h));
  display: grid; align-content: center; justify-items: center;
  padding: 4rem var(--gutter) 3rem;
}
.hero h1 { font-size: clamp(2.3rem, 6vw, 5.4rem); max-width: 16ch; }
.lead { font-size: clamp(1.05rem, 1.4vw, 1.35rem); max-width: 52ch; }
.vert.left { left: var(--gutter); }
.vert.right { right: var(--gutter); }

/* Grids adapt to any width without per-breakpoint rules. */
.steps { grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.grid { grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }
.list { grid-template-columns: repeat(auto-fill, minmax(22rem, 1fr)); }

/* Swipe deck sizes to the viewport height so it never overflows short screens. */
.deck { min-height: min(34rem, 62vh); min-height: min(34rem, 62dvh); }
.pcard { width: min(100%, 26rem); }

.editor { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 4rem); }
.chat { max-width: 44rem; }
.center-card { width: min(100% - 2rem, 26rem); max-width: none; }


/* ───────── xl and up: more room, larger UI ───────── */
@media (min-width: 1280px) {
  .pcard { width: min(100%, 28rem); }
  .chat { max-width: 50rem; }
}
@media (min-width: 1536px) {
  html { font-size: 112.5%; }
  .chat { max-width: 56rem; }
}
@media (min-width: 1920px) {
  html { font-size: 125%; }
}
@media (min-width: 2560px) {
  html { font-size: 156%; }
}

/* ───────── lg: laptop ───────── */
@media (max-width: 1279px) {
  .hero h1 { max-width: 14ch; }
}

/* ───────── md: tablet ───────── */
@media (max-width: 1023px) {
  .editor { grid-template-columns: 1fr; }
  .preview { position: static; order: -1; }
  .vert { display: none; }
  .nav-links a { padding: 0.45rem 0.6rem; }
  .stats { gap: 2rem; }
  .moon { width: 24rem; height: 24rem; top: -7rem; }
}

/* ───────── sm: phone, bottom tab bar ───────── */
@media (max-width: 767px) {
  /* backdrop-filter would make .nav the containing block of the fixed tab bar below,
     pinning the tabs inside the top bar instead of the screen bottom. */
  .nav { gap: 0.6rem; backdrop-filter: none; background: var(--bg); }
  .brand-name { display: none; }
  .who { display: none; }
  .nav-links {
    position: fixed; bottom: 0; left: 0; right: 0; margin: 0;
    padding: 0.4rem 0.4rem calc(0.4rem + env(safe-area-inset-bottom));
    justify-content: space-around; z-index: 30;
    background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
  }
  .nav-links a { flex: 1; text-align: center; padding: 0.6rem 0.4rem; }
  .main { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
  .page { padding-top: 1.2rem; }
  .section { padding-top: 2.6rem; }
  .hero { padding-top: 2.5rem; padding-bottom: 2rem; }
  .moon { width: 18rem; height: 18rem; top: -5rem; }
  .list { grid-template-columns: 1fr; }
  .two { grid-template-columns: 1fr; }
  .actions { gap: 1.6rem; }
  .footer { justify-content: center; text-align: center; }
}

/* ───────── xs: small phone ───────── */
@media (max-width: 479px) {
  .nav-right { gap: 0.5rem; }
  .btn.big { width: 100%; }
  .cta { flex-direction: column; align-items: stretch; width: 100%; }
  .stats { gap: 1.2rem; }
  .facts { grid-template-columns: 1fr; }
  .pcard { padding: 1.2rem 1.1rem; }
  .modal { padding: 1.6rem 1.2rem; }
  .round { width: 3.8rem; height: 3.8rem; }
  .section h2, .page-head h2 { font-size: 1.5rem; }
}

/* Short landscape screens (phones on their side, small laptops). */
@media (max-height: 520px) {
  .hero { min-height: auto; padding-block: 2rem; }
  .deck { min-height: 24rem; }
}

@media (prefers-reduced-motion: reduce) {
  .embers i, .pcard, .modal, .bubble, .bg-art .art { animation: none; }
}

/* ───────── Chat, safety and ranking additions ───────── */
.badge {
  display: inline-grid; place-items: center; min-width: 1.2rem; height: 1.2rem; padding: 0 0.35rem; margin-left: 0.4rem;
  border-radius: 99px; background: var(--accent); color: var(--on-accent); font-size: 0.7rem; font-weight: 700; line-height: 1;
  box-shadow: var(--glow);
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* "Why you" reasons on a swipe card */
.why { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin-bottom: 0.8rem; }
.why-label { font-size: 0.66rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); margin-right: 0.2rem; }
.why-chip { font-size: 0.74rem; padding: 0.15rem 0.6rem; border: 1px solid var(--accent); color: var(--text); border-radius: 2px;
  background: color-mix(in srgb, var(--accent) 16%, transparent); }

/* Quiet text buttons (report / block) */
.link { background: none; border: 0; padding: 0.3rem 0.5rem; font: inherit; font-size: 0.82rem; color: var(--muted); cursor: pointer; }
.link:hover { color: var(--text); text-decoration: underline; }
.card-links { display: flex; justify-content: center; gap: 1.2rem; margin-top: 0.8rem; }
.btn.danger { background: linear-gradient(120deg, #b3202c, #6e0f17); color: #fff; }

/* Dialogs */
.modal.left { text-align: left; display: grid; gap: 0.9rem; }
.modal.left h2 { margin: 0; }
.modal.left .field, .modal.left .check { margin: 0; }
.row.end { justify-content: flex-end; }

/* Matches list */
.row-item .side { display: grid; justify-items: end; gap: 0.3rem; font-size: 0.75rem; }
.row-item .side .badge { margin-left: 0; }
.preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview.strong { color: var(--text); font-weight: 600; }
.row-item.static:hover { transform: none; box-shadow: none; }

/* Chat room: header fixed, messages scroll, composer pinned */
.page.chat { display: flex; flex-direction: column; height: calc(100vh - var(--nav-h)); height: calc(100dvh - var(--nav-h)); padding-bottom: 1rem; }
.chat-head .conn { font-size: 0.72rem; color: var(--muted); white-space: nowrap; }
.chat-head .conn.on { color: #35d07f; }
.head-actions { display: flex; gap: 0.2rem; }
.bubbles { flex: 1; min-height: 0; overflow-y: auto; padding: 1.2rem 0.2rem; gap: 0.7rem; scroll-behavior: smooth; }
.msg { display: flex; flex-direction: column; align-items: flex-start; gap: 0.2rem; }
.msg.mine { align-items: flex-end; }
.msg .meta { font-size: 0.7rem; color: var(--muted); padding: 0 0.3rem; }
.bubble { word-break: break-word; white-space: pre-wrap; }
.older { align-self: center; margin-bottom: 0.4rem; }
.typing { display: flex; align-items: center; gap: 0.3rem; color: var(--muted); font-size: 0.8rem; padding: 0 0.3rem; }
.typing span { width: 0.4rem; height: 0.4rem; border-radius: 50%; background: var(--accent); animation: bounce 1.1s ease-in-out infinite; }
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
.typing em { margin-left: 0.3rem; font-style: normal; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-0.3rem); opacity: 1; } }
.composer input[type="text"] { flex: 1; }

/* Profile page extras */
.check.age { padding: 0.7rem 0.9rem; border: 1px solid var(--border); border-left: 3px solid var(--accent); background: var(--bg2); }
.blocked { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.blocked h3 { margin-bottom: 0.8rem; }

@media (max-width: 767px) {
  .page.chat { height: calc(100dvh - var(--nav-h) - 4.4rem); padding-bottom: 0; }
  .head-actions { flex-direction: column; }
  .chat-head .conn { display: none; }
}
@media (prefers-reduced-motion: reduce) { .typing span { animation: none; } .bubbles { scroll-behavior: auto; } }

/* The Discord button is a link (full-page redirect), so it needs button-like text styling. */
a.btn { text-decoration: none; }
a.btn.discord { width: 100%; }

/* Discord pictures */
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.check.discord-avatar { display: flex; align-items: center; gap: 0.8rem; padding: 0.7rem 0.9rem; border: 1px solid var(--border); border-left: 3px solid #5865f2; background: var(--bg2); }
.check.discord-avatar .da-img { width: 2.6rem; height: 2.6rem; border-radius: 50%; object-fit: cover; flex: none; }
.welcome-note { margin: 0 0 1.5rem; padding: 1rem 1.2rem; border: 1px solid var(--border); border-left: 3px solid #5865f2; background: var(--card); max-width: 46rem; }
.welcome-note p:last-child { color: var(--muted); font-size: 0.92rem; margin-top: 0.3rem; }

/* ───────── Steam game picker ───────── */
.picker { display: grid; gap: 0.6rem; }
.picker-search { width: 100%; background: var(--bg2); color: var(--text); border: 1px solid var(--border); border-radius: 3px; padding: 0.7rem 0.9rem; font: inherit; outline: none; }
.picker-search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.picker .count { font-size: 0.8rem; }
.picked { display: flex; flex-wrap: wrap; gap: 0.5rem; min-height: 2.2rem; }
.picked-game { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.2rem 0.6rem 0.2rem 0.2rem; border: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--card)); color: var(--text); font: inherit; font-size: 0.8rem; cursor: pointer; border-radius: 2px; }
.picked-game img { height: 1.7rem; width: auto; border-radius: 2px; display: block; }
.picked-game b { color: var(--muted); font-weight: 400; }
.picked-game:hover b { color: var(--accent); }
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0.6rem; transition: opacity 0.2s; }
.game-grid.busy { opacity: 0.5; }
.game-tile { position: relative; display: block; padding: 0; border: 2px solid var(--border); background: var(--card); color: var(--text); cursor: pointer; overflow: hidden; text-align: left; font: inherit; border-radius: 3px; transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s; }
.game-tile:hover { transform: translateY(-2px); border-color: var(--muted); }
.game-tile img { display: block; width: 100%; aspect-ratio: 460 / 215; object-fit: cover; background: var(--card2); }
.game-tile .g-name { display: block; padding: 0.4rem 0.55rem; font-size: 0.78rem; line-height: 1.25; min-height: 2.3rem; }
.game-tile .g-check { position: absolute; top: 0.4rem; right: 0.4rem; width: 1.5rem; height: 1.5rem; display: none; place-items: center; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-weight: 800; box-shadow: var(--glow); }
.game-tile.on { border-color: var(--accent); box-shadow: var(--glow); }
.game-tile.on .g-check { display: grid; }
.chip.game { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.15rem 0.55rem 0.15rem 0.15rem; }
.chip.game .gthumb { height: 1.3rem; width: auto; border-radius: 2px; display: block; }

/* ───────── Friends page, invite and notices ───────── */
.panel { background: var(--card); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 3px; padding: 1.2rem 1.4rem; margin-bottom: 1.4rem; display: grid; gap: 0.8rem; max-width: 56rem; }
.panel h3 { font-size: 1.25rem; }
.panel .sub { margin-top: 0.6rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); }
.copy-row { display: flex; gap: 0.6rem; align-items: stretch; }
.copy-row input[type="text"] { flex: 1; min-width: 0; }
.plain-list { margin: 0; padding-left: 1.2rem; color: var(--muted); font-size: 0.9rem; display: grid; gap: 0.25rem; }
.notice { display: flex; align-items: center; justify-content: space-between; gap: 1rem; max-width: 56rem; margin: 0.8rem var(--gutter) 0; padding: 0.7rem 1rem; border: 1px solid var(--accent); border-left-width: 4px; background: color-mix(in srgb, var(--accent) 14%, var(--card)); position: relative; z-index: 5; }
.check.servers-opt { align-items: flex-start; font-size: 0.82rem; color: var(--muted); text-align: left; }
.check.servers-opt input { margin-top: 0.2rem; flex: none; }
@media (max-width: 479px) { .copy-row { flex-direction: column; } .game-grid { grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); } }

/* A banner that fails to load hides itself (the `hidden` attribute alone loses to display rules). */
img[hidden] { display: none !important; }

/* Banner frame: keeps the tile's shape (and a subtle backdrop) even if a banner is missing. */
.game-tile .g-art { display: block; position: relative; aspect-ratio: 460 / 215; background: var(--card2); }
.game-tile .g-art img { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; object-fit: cover; }

/* Games that are not on Steam have no banner: a tile in a colour taken from the game, with initials. */
.g-fallback { display: grid; place-items: center; font-weight: 800; letter-spacing: 0.04em; color: hsl(var(--gh) 70% 82%);
  background: linear-gradient(135deg, hsl(var(--gh) 45% 16%), hsl(var(--gh) 55% 30%)); }
.g-art .g-fallback { position: absolute; inset: 0; font-size: 1.8rem; }
.gthumb.g-fallback { width: 1.6rem; height: 1.6rem; font-size: 0.6rem; border-radius: 3px; flex: none; }
.picked-game .g-fallback { width: 2.2rem; height: 1.1rem; font-size: 0.6rem; flex: none; }
.shelf-title { margin-top: 1.2rem; }
