:root {
  --bg: #fff6f9;
  --ink: #5b4760;
  --muted: #9a879e;
  --pink: #ff8fab;
  --pink-deep: #f06c90;
  --lav: #cdb4db;
  --card: #ffffff;
  --line: #f6dbe4;
  --shadow: 0 6px 20px rgba(240, 108, 144, 0.14);
  --radius: 20px;
  --note-pink: #ffd9e3;
  --note-yellow: #fff3b8;
  --note-mint: #cdf5de;
  --note-lavender: #e7dbff;
  --note-peach: #ffe2cc;
  --note-sky: #d4ecff;
  color-scheme: light;
}

* { box-sizing: border-box; }
button, a, label { touch-action: manipulation; }
/* Casual, cute small caps everywhere — except people's and pets' names (.nm). */
body { font-variant-caps: small-caps; }
.nm { font-variant-caps: normal; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Fredoka', system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  background-image: radial-gradient(#ffd6e2 1.2px, transparent 1.2px);
  background-size: 22px 22px;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--pink-deep); }
h1, h2, h3 { margin: 0; font-weight: 600; }
.muted { color: var(--muted); margin: 0; }
.error { color: #d6336c; min-height: 1.2em; margin: 0; font-size: 0.95rem; }

/* ── Floating background hearts ─────────────────────────── */
.floaties { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.floaties span {
  position: absolute; bottom: -40px; color: #ffc2d4; font-size: 22px; opacity: 0.7;
  animation: floatUp 18s linear infinite;
}
.floaties span:nth-child(1) { left: 6%;  animation-delay: 0s; }
.floaties span:nth-child(2) { left: 20%; animation-delay: 5s; color: #d9c2ff; }
.floaties span:nth-child(3) { left: 35%; animation-delay: 10s; }
.floaties span:nth-child(4) { left: 52%; animation-delay: 2s; color: #ffe08a; }
.floaties span:nth-child(5) { left: 68%; animation-delay: 7s; }
.floaties span:nth-child(6) { left: 82%; animation-delay: 12s; color: #b8e6c9; }
.floaties span:nth-child(7) { left: 93%; animation-delay: 4s; }
@keyframes floatUp {
  0%   { transform: translateY(0) rotate(0); opacity: 0; }
  10%  { opacity: 0.7; }
  100% { transform: translateY(-110vh) rotate(40deg); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .floaties, .beat, .wiggle { animation: none !important; }
  .floaties { display: none; }
}

/* ── Buttons & inputs ───────────────────────────────────── */
.btn {
  font: inherit; font-weight: 500; border: 0; cursor: pointer; border-radius: 999px;
  padding: 10px 18px; transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s;
  color: var(--ink); background: #fff; display: inline-flex; align-items: center; gap: 6px;
}
.btn:active { transform: scale(0.96); }
.btn.primary { background: var(--pink); color: #fff; box-shadow: 0 4px 0 var(--pink-deep); }
.btn.primary:hover { background: #ff7d9d; }
.btn.primary:disabled { opacity: 0.6; cursor: wait; }
.btn.ghost { background: #fff; border: 2px solid var(--line); }
.btn.ghost:hover { border-color: var(--pink); }
.btn.small { padding: 6px 12px; font-size: 0.9rem; }
.btn.danger { background: #fff; color: #d6336c; border: 2px solid #ffd0dc; }

input, textarea, select {
  font: inherit; color: var(--ink); width: 100%;
  border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; background: #fff;
}
input:focus, textarea:focus, button:focus-visible { outline: 3px solid #ffc2d4; outline-offset: 1px; border-color: var(--pink); }
textarea { resize: vertical; }
label { display: grid; gap: 4px; font-size: 0.95rem; }
.stack { display: grid; gap: 12px; }

/* ── Avatars ────────────────────────────────────────────── */
.avatar { width: 44px; height: 44px; flex: none; }
.avatar svg { width: 100%; height: 100%; display: block; overflow: visible; }
.avatar.big { width: 92px; height: 92px; }
.avatar.tiny { width: 26px; height: 26px; }
.avatar.huge { width: 72px; height: 72px; }
.wiggle { animation: wiggle 3s ease-in-out infinite; transform-origin: 50% 90%; }
.wiggle.delay { animation-delay: 1.5s; }
@keyframes wiggle { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
.beat { color: var(--pink); display: inline-block; animation: beat 1.4s ease-in-out infinite; font-size: 1.8rem; }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.25); } 30% { transform: scale(1); } }

/* ── Login ──────────────────────────────────────────────── */
.login { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: min(380px, 100%); background: var(--card); border-radius: 28px; padding: 28px 24px;
  box-shadow: var(--shadow); text-align: center; display: grid; gap: 10px;
}
.login-card form { text-align: left; margin-top: 8px; }
.login-avatars { display: flex; align-items: center; justify-content: center; gap: 10px; }

/* ── App shell ──────────────────────────────────────────── */
#app { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: 16px 16px 40px; }
.top {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(6px);
  border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow);
  position: sticky; top: 10px; z-index: 5;
}
.couple { display: flex; align-items: center; gap: 8px; }
.person {
  display: flex; align-items: center; gap: 8px; font: inherit; color: inherit;
  background: none; border: 0; padding: 4px 8px 4px 4px; border-radius: 999px; font-weight: 500;
}
button.person { cursor: pointer; }
button.person:hover { background: #fff0f4; }
.big-heart { font-size: 1.4rem; }
.tabs { display: flex; gap: 6px; background: #fff0f4; padding: 4px; border-radius: 999px; }
.tab {
  font: inherit; border: 0; background: transparent; padding: 8px 16px; border-radius: 999px;
  cursor: pointer; color: var(--muted); font-weight: 500; white-space: nowrap;
}
.tab.active { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(240, 108, 144, 0.18); }
.signout { justify-self: end; }
.panel { margin-top: 20px; }

/* ── Notes ──────────────────────────────────────────────── */
.composer {
  background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
  display: grid; gap: 10px;
}
.composer textarea { border: 0; background: #fff8fa; font-family: 'Caveat', cursive; font-size: 1.5rem; line-height: 1.2; }
.composer-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.composer-row .btn.primary { margin-left: auto; }
.composer-preview { display: flex; align-items: center; gap: 10px; }
.composer-preview img { max-height: 90px; border-radius: 12px; }
.file-btn { cursor: pointer; display: inline-flex; }
.swatches { display: flex; gap: 6px; }
.swatch {
  width: 26px; height: 26px; border-radius: 50%; border: 3px solid #fff; cursor: pointer;
  box-shadow: 0 0 0 2px var(--line); padding: 0;
}
.swatch.active { box-shadow: 0 0 0 3px var(--pink); }

.notes {
  margin-top: 20px; display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); align-items: start;
}
.note {
  --tilt: 0deg;
  position: relative; border-radius: 6px 6px 18px 6px; padding: 22px 16px 12px;
  box-shadow: 0 8px 18px rgba(91, 71, 96, 0.12); transform: rotate(var(--tilt));
  transition: transform 0.2s ease; display: grid; gap: 10px;
  animation: pop 0.35s ease;
}
.note:hover { transform: rotate(0) scale(1.02); }
.note::before {
  content: ''; position: absolute; top: -10px; left: 50%; width: 70px; height: 22px;
  transform: translateX(-50%) rotate(-2deg); background: rgba(255, 255, 255, 0.65);
  border-radius: 3px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
@keyframes pop { from { transform: scale(0.9); opacity: 0; } }
.note-pink { background: var(--note-pink); }
.note-yellow { background: var(--note-yellow); }
.note-mint { background: var(--note-mint); }
.note-lavender { background: var(--note-lavender); }
.note-peach { background: var(--note-peach); }
.note-sky { background: var(--note-sky); }
.note-body { margin: 0; font-family: 'Caveat', cursive; font-size: 1.55rem; line-height: 1.15; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-img { width: 100%; border-radius: 10px; display: block; cursor: zoom-in; }
.note-foot { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--muted); }
.note-foot .spacer { flex: 1; }
.heart-btn {
  font: inherit; border: 0; background: rgba(255, 255, 255, 0.6); border-radius: 999px;
  padding: 4px 10px; cursor: pointer; color: var(--muted); display: inline-flex; align-items: center; gap: 4px;
}
.heart-btn.on { color: var(--pink-deep); background: #fff; }
.heart-btn .avatar.tiny { width: 20px; height: 20px; margin-left: -6px; }
.icon-btn { border: 0; background: none; cursor: pointer; font-size: 1rem; opacity: 0.5; padding: 4px; }
.icon-btn:hover { opacity: 1; }

.empty {
  grid-column: 1 / -1; text-align: center; padding: 40px 16px; color: var(--muted);
  display: grid; justify-items: center; gap: 10px;
}

/* ── Media ──────────────────────────────────────────────── */
.media-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.media-bar .btn.primary { margin-left: auto; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font: inherit; border: 2px solid var(--line); background: #fff; border-radius: 999px;
  padding: 6px 14px; cursor: pointer; color: var(--ink);
}
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.media-grid {
  margin-top: 18px; display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.media-card {
  background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  cursor: pointer; display: flex; flex-direction: column; text-align: left; font: inherit; color: inherit;
  border: 0; padding: 0; transition: transform 0.15s ease; animation: pop 0.35s ease;
}
.media-card:hover { transform: translateY(-3px); }
.poster { position: relative; aspect-ratio: 3 / 2; background: linear-gradient(135deg, #ffd9e3, #e7dbff); display: grid; place-items: center; font-size: 3rem; }
.poster img { width: 100%; height: 100%; object-fit: cover; display: block; position: absolute; inset: 0; }
.poster.tall { aspect-ratio: 2 / 3; }
.kind-badge {
  position: absolute; top: 8px; left: 8px; z-index: 1; background: rgba(255, 255, 255, 0.92);
  border-radius: 999px; padding: 2px 10px; font-size: 0.8rem; font-weight: 500;
}
.media-info { padding: 12px 14px 14px; display: grid; gap: 8px; }
.media-title { font-weight: 600; font-size: 1.05rem; line-height: 1.2; }
.media-title small { color: var(--muted); font-weight: 400; }
.take { display: flex; align-items: flex-start; gap: 8px; font-size: 0.9rem; }
.take-text { display: grid; gap: 1px; min-width: 0; }
.take-text strong { font-weight: 500; }
.take-text span {
  color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* ── Modal ──────────────────────────────────────────────── */
.modal {
  border: 0; border-radius: 26px; padding: 0; width: min(560px, calc(100% - 24px));
  max-height: calc(100vh - 32px); box-shadow: 0 20px 60px rgba(91, 71, 96, 0.3); color: var(--ink);
}
.modal::backdrop { background: rgba(91, 71, 96, 0.35); backdrop-filter: blur(3px); }
.modal-inner { padding: 22px 20px 20px; display: grid; gap: 14px; }
.modal-head { display: flex; align-items: center; gap: 10px; }
.modal-head h2 { flex: 1; font-size: 1.3rem; }
.close-btn { border: 0; background: #fff0f4; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 1.1rem; color: var(--ink); }
.seg { display: flex; background: #fff0f4; border-radius: 999px; padding: 4px; gap: 4px; }
.seg button { flex: 1; font: inherit; border: 0; background: transparent; padding: 8px; border-radius: 999px; cursor: pointer; color: var(--muted); }
.seg button.active { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(240, 108, 144, 0.2); }
.search-row { display: flex; gap: 8px; }
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; max-height: 46vh; overflow: auto; padding: 2px; }
.result {
  border: 2px solid transparent; background: #fff8fa; border-radius: 14px; padding: 0; overflow: hidden;
  cursor: pointer; text-align: left; font: inherit; color: inherit; display: grid;
}
.result:hover { border-color: var(--pink); }
.result .poster { aspect-ratio: 2 / 3; font-size: 2rem; }
.result .poster.wide { aspect-ratio: 3 / 2; }
.result-label { padding: 6px 8px; font-size: 0.82rem; line-height: 1.2; }
.result-label small { color: var(--muted); }
.link-btn { border: 0; background: none; color: var(--pink-deep); cursor: pointer; font: inherit; text-decoration: underline; padding: 0; justify-self: start; }
.reactions { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.reaction {
  font: inherit; border: 2px solid var(--line); background: #fff; border-radius: 14px; padding: 8px 2px;
  cursor: pointer; display: grid; justify-items: center; gap: 2px; font-size: 0.75rem; color: var(--muted);
}
.reaction b { font-size: 1.5rem; font-weight: 400; }
.reaction.active { border-color: var(--pink); background: #fff0f4; color: var(--ink); }
.detail-top { display: grid; grid-template-columns: 120px 1fr; gap: 14px; align-items: start; }
.detail-top .poster { border-radius: 14px; overflow: hidden; }
.their-take { background: #fff8fa; border-radius: 16px; padding: 12px; display: flex; gap: 10px; align-items: flex-start; }
.their-take p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row .grow { flex: 1; }
.animals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.animal-pick { border: 2px solid var(--line); background: #fff; border-radius: 16px; padding: 8px; cursor: pointer; display: grid; place-items: center; }
.animal-pick.active { border-color: var(--pink); background: #fff0f4; }
.zoom-img { width: 100%; border-radius: 16px; display: block; }

/* ── Chat ───────────────────────────────────────────────── */
.tab { position: relative; }
.tab.has-new::after {
  content: ''; position: absolute; top: 5px; right: 7px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--pink-deep); box-shadow: 0 0 0 2px #fff;
  animation: beat 1.4s ease-in-out infinite;
}
.chat {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; height: calc(100vh - 170px); min-height: 380px; overflow: hidden;
  max-width: 760px; margin: 0 auto;
}
.chat-log {
  flex: 1; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 4px;
  background: linear-gradient(180deg, #fffafc, #fff4f8);
  overscroll-behavior: contain;
}
.chat-log .empty { margin: auto; }
.chat-day { text-align: center; margin: 12px 0 6px; }
.chat-day span {
  background: #ffe8ef; color: var(--muted); font-size: 0.78rem; padding: 3px 12px; border-radius: 999px;
}
.msg { display: flex; align-items: flex-end; gap: 6px; max-width: 82%; margin-top: 8px; animation: msgIn 0.25s ease; }
.msg.grouped { margin-top: 2px; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg.theirs { align-self: flex-start; }
.ghost-av { visibility: hidden; }
@keyframes msgIn { from { transform: translateY(6px) scale(0.97); opacity: 0; } }
.bubble {
  position: relative; padding: 8px 12px 6px; border-radius: 18px; line-height: 1.35;
  white-space: pre-wrap; overflow-wrap: anywhere; display: grid; gap: 2px;
}
.msg.theirs .bubble { background: #efe6ff; border-bottom-left-radius: 6px; }
.msg.mine .bubble { background: var(--pink); color: #fff; border-bottom-right-radius: 6px; cursor: pointer; }
.msg.grouped.theirs .bubble { border-top-left-radius: 6px; }
.msg.grouped.mine .bubble { border-top-right-radius: 6px; }
.bubble time { font-size: 0.68rem; opacity: 0.65; justify-self: end; }
.bubble.emoji-only { background: transparent !important; font-size: 2.2rem; padding: 0 4px; line-height: 1.1; }
.bubble.emoji-only time { color: var(--muted); }
.unsend {
  display: none; font: inherit; font-size: 0.75rem; border: 0; border-radius: 999px; cursor: pointer;
  background: #fff; color: #d6336c; padding: 2px 10px; justify-self: end; margin-top: 4px;
}
.bubble.show-actions .unsend { display: inline-block; }
.chat-emojis {
  display: flex; gap: 4px; padding: 6px 10px; overflow-x: auto; border-top: 2px solid #fff0f4;
  scrollbar-width: none;
}
.emoji-btn {
  font-size: 1.3rem; border: 0; background: #fff6f9; border-radius: 12px; padding: 4px 8px;
  cursor: pointer; transition: transform 0.12s ease; flex: none;
}
.emoji-btn:hover { transform: scale(1.2) rotate(-6deg); }
.chat-form { display: flex; gap: 8px; padding: 8px 10px 12px; align-items: flex-end; }
.chat-form textarea { resize: none; border-radius: 20px; padding: 10px 14px; min-height: 44px; max-height: 140px; }
.send-btn { width: 46px; height: 46px; padding: 0; justify-content: center; font-size: 1.1rem; flex: none; }

.media-by { font-size: 0.85rem; font-weight: 400; color: var(--muted); margin-top: 2px; }
.result-by { display: block; }

/* ── Games hub ──────────────────────────────────────────── */
.t-short { display: none; }
.row.center, .center { justify-content: center; text-align: center; justify-items: center; }
.stack.tight { gap: 6px; }
.scoreboard {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px;
  background: linear-gradient(135deg, #ffe3ec, #eadcff); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.sb-side { display: grid; justify-items: center; gap: 2px; }
.sb-num { font-size: 2rem; font-weight: 600; line-height: 1; }
.sb-mid { display: grid; justify-items: center; color: var(--muted); font-size: 0.85rem; }
.games-grid { margin-top: 18px; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.game-tile {
  font: inherit; color: inherit; text-align: left; border: 0; cursor: pointer; background: var(--card);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: grid; gap: 4px;
  transition: transform 0.15s ease; animation: pop 0.35s ease;
}
.game-tile:hover { transform: translateY(-3px) rotate(-0.6deg); }
.game-emoji { font-size: 2.4rem; line-height: 1.1; }
.game-tile small { color: var(--muted); }
.game-stats { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.game-stat {
  display: inline-flex; align-items: center; gap: 4px; background: #fff6f9; border-radius: 999px;
  padding: 2px 8px 2px 2px; font-size: 0.8rem;
}
.game-stat.leader { background: #fff3b8; }
.game-stat.leader::after { content: '👑'; font-size: 0.75rem; }
.recent { margin-top: 18px; background: var(--card); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.recent ul { margin: 6px 0 0; padding-left: 0; list-style: none; display: grid; gap: 4px; color: var(--muted); font-size: 0.9rem; }
.game-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.game-head h2 { font-size: 1.3rem; }
.game-card-big {
  background: var(--card); border-radius: var(--radius); padding: 22px 18px; box-shadow: var(--shadow);
  max-width: 640px; margin: 0 auto;
}
.game-card-big h3 { font-size: 1.3rem; }
.game-card-big p { margin: 0; }
.vs { font-weight: 600; color: var(--pink-deep); font-size: 1.3rem; }
.vibe-grid { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* ── Football ───────────────────────────────────────────── */
.fb-stage { max-width: 900px; margin: 0 auto; }
.fb-hud {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  background: var(--card); border-radius: 18px 18px 0 0; padding: 8px 12px; box-shadow: var(--shadow);
}
.fb-side { display: flex; align-items: center; gap: 6px; font-weight: 500; min-width: 0; }
.fb-side span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-side.right { justify-content: flex-end; }
.fb-side b { font-size: 1.5rem; }
.fb-clock { background: var(--ink); color: #fff; border-radius: 999px; padding: 2px 12px; font-variant-numeric: tabular-nums; }
.fb-wrap { position: relative; }
.fb-canvas {
  display: block; width: 100%; aspect-ratio: 800 / 460; border-radius: 0 0 18px 18px;
  box-shadow: var(--shadow); touch-action: none; background: #b3e0bb;
}
.fb-pad {
  display: flex; justify-content: space-between; align-items: center; padding: 14px 8px 4px;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.joy {
  width: 120px; height: 120px; border-radius: 50%; flex: none;
  background: #ffe3ec; border: 3px solid #fff; box-shadow: var(--shadow);
  display: grid; place-items: center; touch-action: none;
}
.joy-knob { width: 48px; height: 48px; border-radius: 50%; background: rgba(255, 255, 255, 0.9); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15); pointer-events: none; }
.kick-btn {
  width: 92px; height: 92px; border-radius: 50%; flex: none; box-shadow: 0 5px 0 var(--pink-deep);
  border: 3px solid #fff; background: var(--pink); font-size: 2.4rem; touch-action: none;
}
.kick-btn:active { transform: scale(0.92); }
.fb-result {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px;
  background: rgba(255, 246, 249, 0.88); border-radius: 0 0 18px 18px; text-align: center; padding: 16px;
}
.fb-result h3 { font-size: 1.8rem; }
.fb-result p { margin: 0; font-size: 1.1rem; }

/* ── Cookie Quest ───────────────────────────────────────── */
.rpg { max-width: 640px; margin: 0 auto; display: grid; gap: 12px; }
.rpg-big { font-size: 3rem; line-height: 1.1; }
.rpg-top { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.9rem; }
.rpg-arena {
  background: linear-gradient(180deg, #e7dbff 0%, #ffe3ec 60%, #cdf5de 60%, #bfe8c6 100%);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: end; min-height: 260px;
}
.rpg-enemy, .rpg-hero { display: grid; gap: 6px; justify-items: center; text-align: center; }
.rpg-enemy { align-self: start; }
.rpg-sprite { position: relative; font-size: 4.2rem; line-height: 1; animation: bob 2.4s ease-in-out infinite; }
.rpg-sprite.boss { font-size: 5.6rem; }
.rpg-sprite.hit { animation: shake 0.35s ease; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.rpg-float {
  position: absolute; left: 50%; top: -10px; transform: translateX(-50%); font-size: 1.3rem; font-weight: 600;
  animation: floatNum 0.9s ease forwards; pointer-events: none; white-space: nowrap;
}
.rpg-float.dmg { color: #e03e6b; -webkit-text-stroke: 1px #fff; }
@keyframes floatNum { to { transform: translate(-50%, -40px); opacity: 0; } }
.rpg-bar { position: relative; width: 100%; max-width: 200px; height: 16px; border-radius: 999px; background: rgba(255, 255, 255, 0.7); overflow: hidden; }
.rpg-fill { height: 100%; border-radius: 999px; transition: width 0.35s ease; }
.rpg-bar.hp .rpg-fill { background: linear-gradient(90deg, #ff8fab, #ff5d8f); }
.rpg-bar.mp .rpg-fill { background: linear-gradient(90deg, #a2d2ff, #7fb7ff); }
.rpg-bar.enemy .rpg-fill { background: linear-gradient(90deg, #b9fbc0, #6fd58a); }
.rpg-bar span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 0.72rem; font-weight: 500; }
.rpg-log { background: var(--card); border-radius: 16px; padding: 10px 14px; box-shadow: var(--shadow); min-height: 110px; }
.rpg-log p { margin: 2px 0; font-size: 0.92rem; }
.rpg-log p:last-child { font-weight: 500; }
.rpg-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rpg-actions .btn { justify-content: center; }
.rpg-actions .btn:disabled { opacity: 0.5; cursor: default; }
.rpg-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.rpg-choice {
  font: inherit; color: inherit; border: 2px solid var(--line); background: #fff; border-radius: 18px;
  padding: 12px 8px; cursor: pointer; display: grid; justify-items: center; gap: 2px;
}
.rpg-choice:hover { border-color: var(--pink); background: #fff0f4; }
.rpg-choice small { color: var(--muted); }

/* ── Quizzes ────────────────────────────────────────────── */
.quiz { max-width: 640px; margin: 0 auto; background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.quiz-top { display: flex; justify-content: space-between; color: var(--muted); }
.quiz-timer { height: 8px; background: #fff0f4; border-radius: 999px; overflow: hidden; }
.quiz-timer-fill { height: 100%; width: 100%; background: linear-gradient(90deg, var(--pink), var(--lav)); border-radius: 999px; }
.quiz-cat { justify-self: start; background: #efe6ff; border-radius: 999px; padding: 2px 10px; font-size: 0.8rem; text-transform: capitalize; }
.quiz-q { font-size: 1.25rem; line-height: 1.3; }
.quiz-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quiz-answer {
  font: inherit; color: inherit; text-align: left; border: 2px solid var(--line); background: #fff; border-radius: 16px;
  padding: 12px 14px; cursor: pointer; transition: transform 0.1s ease;
}
.quiz-answer:hover:not(:disabled) { border-color: var(--pink); transform: translateY(-2px); }
.quiz-answer:disabled { cursor: default; }
.quiz-answer.right { background: #cdf5de; border-color: #6fd58a; }
.quiz-answer.wrong { background: #ffd9e3; border-color: #ff5d8f; animation: shake 0.35s ease; }
.music-art {
  position: relative; width: 150px; height: 150px; justify-self: center; border-radius: 20px; overflow: hidden;
  background: linear-gradient(135deg, #ffd9e3, #e7dbff); display: grid; place-items: center;
}
.music-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(22px) saturate(1.3); transform: scale(1.2); transition: filter 0.5s ease, transform 0.5s ease; }
.music-art.revealed img { filter: none; transform: none; }
.music-note { position: relative; font-size: 3rem; animation: beat 1.4s ease-in-out infinite; }
.music-art.revealed .music-note { display: none; }

/* ── Pawzeroth (3D) ─────────────────────────────────────── */
.pq {
  --hud: rgba(38, 26, 46, 0.8); --gold: #f2c46d; --cream: #fff6e5;
  position: relative; width: 100%; height: min(74vh, 680px); min-height: 440px; overflow: hidden;
  border-radius: var(--radius); box-shadow: var(--shadow);
  background: linear-gradient(180deg, #8ecdf7 0%, #c6e7ff 45%, #e6f4ff 70%, #fdeaf2 100%);
  user-select: none; -webkit-user-select: none;
}
.pq.big { position: fixed; inset: 0; height: 100dvh; min-height: 0; border-radius: 0; z-index: 100; }
body.pq-lock { overflow: hidden; }
.pq-canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.pq button { font: inherit; }

/* Nameplates */
.pq-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.pq-label {
  position: absolute; left: 0; top: 0; white-space: nowrap; font-size: 0.8rem; font-weight: 600;
  color: #fff; padding: 0 4px; will-change: transform;
  text-shadow: 0 1px 2px rgba(30, 20, 40, 0.9), 0 0 6px rgba(30, 20, 40, 0.5);
}
.pq-label.pet::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--dot, #8fd19e); margin-right: 5px; vertical-align: 0; box-shadow: 0 0 0 1.5px #fff; }
.pq-label.buddy { color: #ffe9a8; }
.pq-label.home { font-size: 0.72rem; opacity: 0.9; }
.pq-label.partner { color: #ffd1e0; font-size: 0.88rem; }
.pq-label.npc { color: #9dff9d; }
.pq-label.place { color: #ffe39a; font-size: 0.85rem; }
.pq-label.qmark {
  font-size: 2.4rem; font-weight: 800; color: #ffd21f; line-height: 1;
  text-shadow: 0 0 3px #5b3a00, 0 2px 0 #8a5a00, 0 0 14px rgba(255, 210, 31, 0.8);
}
.pq-label.float { font-size: 1.5rem; text-shadow: none; }
.pq-label.float.xp { font-size: 1rem; color: #d7b8ff; text-shadow: 0 1px 2px #2b1640; }

/* Player frame */
.pq-unit { position: absolute; top: 10px; left: 10px; display: flex; align-items: center; pointer-events: none; }
.pq-portrait {
  position: relative; width: 62px; height: 62px; border-radius: 50%; background: var(--cream); z-index: 1;
  border: 3px solid var(--gold); box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3); display: grid; place-items: center; flex: none;
}
.pq-portrait .avatar { width: 50px; height: 50px; }
.pq-lvl {
  position: absolute; bottom: -6px; left: -6px; min-width: 26px; height: 26px; border-radius: 50%; padding: 0 4px;
  background: #3b2744; color: var(--gold); border: 2px solid var(--gold); display: grid; place-items: center;
  font-size: 0.8rem; font-weight: 700;
}
.pq-unit-info {
  background: var(--hud); color: var(--cream); border: 2px solid rgba(242, 196, 109, 0.7); border-left: 0;
  border-radius: 0 14px 14px 0; padding: 5px 12px 6px 16px; margin-left: -10px; display: grid; gap: 3px; min-width: 150px;
}
.pq-unit-info strong { font-size: 0.95rem; line-height: 1.1; }
.pq-xp { position: relative; height: 12px; border-radius: 6px; background: rgba(255, 255, 255, 0.15); overflow: hidden; }
.pq-xp-fill { height: 100%; background: linear-gradient(90deg, #a066e8, #d59bff); border-radius: 6px; transition: width 0.4s ease; }
.pq-xp-text { position: absolute; inset: 0; display: grid; place-items: center; font-size: 0.62rem; font-weight: 600; }
.pq-money { font-size: 0.75rem; white-space: pre; opacity: 0.95; }

/* Minimap */
.pq-map { position: absolute; top: 10px; right: 10px; display: grid; justify-items: center; gap: 4px; }
.pq-zone {
  background: var(--hud); color: var(--gold); border: 1.5px solid rgba(242, 196, 109, 0.6); border-radius: 999px;
  padding: 2px 12px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; max-width: 170px; overflow: hidden; text-overflow: ellipsis;
}
.pq-mini-wrap { position: relative; }
.pq-mini {
  display: block; width: 116px; height: 116px; border-radius: 50%; cursor: pointer;
  border: 4px solid var(--gold); box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3), inset 0 0 0 2px #5b3a00;
}
.pq-map-btns { position: absolute; left: -44px; top: 0; display: grid; gap: 6px; }
.pq-round {
  width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--gold); background: var(--hud); color: var(--cream);
  display: grid; place-items: center; font-size: 1.05rem; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* Quest tracker */
.pq-tracker {
  position: absolute; right: 10px; top: 168px; width: 220px; text-align: left; cursor: pointer;
  background: var(--hud); color: var(--cream); border: 1.5px solid rgba(242, 196, 109, 0.5); border-radius: 12px;
  padding: 8px 12px; display: grid; gap: 2px;
}
.pq-q-head { color: var(--gold); font-weight: 700; font-size: 0.7rem; letter-spacing: 0.08em; }
.pq-q-title { color: #ffd21f; font-size: 0.9rem; }
.pq-q-text { font-size: 0.8rem; line-height: 1.3; }
.pq-tracker.ready { border-color: #ffd21f; box-shadow: 0 0 0 2px rgba(255, 210, 31, 0.35), 0 0 16px rgba(255, 210, 31, 0.35); }
.pq-q-dir { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--gold); }
.pq-q-arrow { display: inline-block; font-size: 1rem; transition: transform 0.15s linear; }

/* Banner, cast bar, prompt */
.pq-banner {
  position: absolute; top: 24%; left: 50%; transform: translateX(-50%); pointer-events: none; text-align: center;
  display: grid; gap: 2px; white-space: nowrap;
}
.pq-banner strong { font-size: 1.9rem; color: #fff; text-shadow: 0 2px 0 var(--pink-deep), 0 4px 16px rgba(40, 20, 50, 0.5); }
.pq-banner small { font-size: 1rem; color: #fff; text-shadow: 0 1px 3px rgba(40, 20, 50, 0.8); }
.pq-banner.gold strong { color: #ffd21f; text-shadow: 0 2px 0 #8a5a00, 0 0 20px rgba(255, 210, 31, 0.7); font-size: 2.3rem; }
.pq-banner.zone strong { color: var(--cream); text-shadow: 0 2px 0 #5b3a00, 0 4px 16px rgba(40, 20, 50, 0.6); }
.pq-banner.show { animation: bannerIn 0.5s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes bannerIn { from { transform: translateX(-50%) scale(0.6); opacity: 0; } }
.pq-cast {
  position: absolute; left: 50%; bottom: 128px; transform: translateX(-50%); width: 230px; height: 22px;
  background: var(--hud); border: 2px solid var(--gold); border-radius: 12px; overflow: hidden;
}
.pq-cast-fill { height: 100%; width: 0; background: linear-gradient(90deg, #ffcf40, #ffe89a); }
.pq-cast span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 0.78rem; font-weight: 600; color: #3b2744; }
.pq-prompt {
  position: absolute; left: 50%; bottom: 84px; transform: translateX(-50%); pointer-events: none; white-space: pre;
  background: var(--hud); color: var(--cream); border: 1.5px solid var(--gold); border-radius: 999px; padding: 5px 14px;
  font-size: 0.85rem; font-weight: 600; animation: pop 0.2s ease;
}
.pq-hint {
  position: absolute; bottom: 150px; left: 50%; transform: translateX(-50%); pointer-events: none;
  background: var(--hud); color: var(--cream); font-size: 0.76rem; padding: 4px 12px; border-radius: 999px;
  white-space: nowrap; animation: fadeOut 1s ease 9s forwards;
}
@keyframes fadeOut { to { opacity: 0; } }

/* Action bar */
.pq-bar {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; gap: 6px;
  background: var(--hud); border: 2px solid rgba(242, 196, 109, 0.7); border-radius: 16px; padding: 6px;
}
.pq-slot {
  position: relative; width: 52px; height: 52px; border-radius: 12px; cursor: pointer;
  border: 2px solid #6d5577; background: linear-gradient(180deg, #4d3857, #2f2138);
  display: grid; place-items: center; color: #fff; transition: transform 0.1s ease;
}
.pq-slot:active { transform: scale(0.92); }
.pq-slot-icon { font-size: 1.5rem; line-height: 1; }
.pq-key { position: absolute; top: 2px; right: 5px; font-size: 0.62rem; color: var(--gold); font-weight: 700; }
.pq-cd { position: absolute; inset: 0; border-radius: 10px; background: rgba(0, 0, 0, 0.6); display: grid; place-items: center; font-weight: 700; color: #fff; }
.pq-slot.s-act.ready { border-color: #ffd21f; box-shadow: 0 0 0 2px rgba(255, 210, 31, 0.4), 0 0 14px rgba(255, 210, 31, 0.6); animation: glowPulse 1.2s ease-in-out infinite; }
@keyframes glowPulse { 50% { box-shadow: 0 0 0 3px rgba(255, 210, 31, 0.6), 0 0 22px rgba(255, 210, 31, 0.9); } }
.pq-slot.s-act:not(.ready) .pq-slot-icon { opacity: 0.45; }

.pq-joy { position: absolute; left: 14px; bottom: 16px; width: 120px; height: 120px; background: rgba(38, 26, 46, 0.35); border-color: rgba(242, 196, 109, 0.8); }
.pq-loading { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; background: #c6e7ff; font-weight: 500; }
.pq-loading .beat { font-size: 2.6rem; }

/* Confetti */
.pq-fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 6; }
.pq-confetti {
  position: absolute; top: -12px; left: var(--x); width: 8px; height: 13px; border-radius: 2px;
  animation: confettiFall var(--d) cubic-bezier(0.3, 0.6, 0.5, 1) var(--delay) forwards;
}
@keyframes confettiFall { to { transform: translate(var(--dx), 110%) rotate(var(--r)); top: 105%; opacity: 0.4; } }

/* Parchment quest dialogs */
.pq-card.parch {
  background: linear-gradient(180deg, #fbf1d8, #f3e2bb); color: #4a3524; border: 3px solid #c9a86a;
  box-shadow: 0 0 0 3px #7a5236, 0 20px 50px rgba(40, 20, 10, 0.4); width: min(440px, 100%);
}
.pq-card.parch h4 { margin: 4px 0 0; color: #8a5a00; font-size: 0.85rem; letter-spacing: 0.04em; }
.pq-card.parch .muted, .pq-card.parch small { color: #7d6450; }
.pq-parch-title { color: #6b3f12; font-size: 1.35rem; }
.pq-npc-head { display: flex; align-items: center; gap: 10px; }
.pq-npc-face { font-size: 2rem; width: 50px; height: 50px; border-radius: 50%; background: #e8d6ad; border: 2px solid #c9a86a; display: grid; place-items: center; }
.pq-npc-head > div { display: grid; }
.pq-rewards { display: flex; flex-wrap: wrap; gap: 6px; }
.pq-rewards span { background: rgba(255, 255, 255, 0.55); border: 1.5px solid #c9a86a; border-radius: 10px; padding: 3px 10px; font-weight: 600; font-size: 0.88rem; }
.pq-kicker { color: var(--pink-deep); font-weight: 600; letter-spacing: 0.04em; }
.pq-reward { background: #fff3b8; border-radius: 999px; padding: 2px 10px; font-weight: 600; font-size: 0.85rem; }
.pq-qlist { margin: 0; padding-left: 20px; display: grid; gap: 3px; font-size: 0.9rem; }
.pq-qlist li.done { opacity: 0.6; }
.pq-qlist li.now { font-weight: 700; color: #8a5a00; }
.pq-shop { display: grid; gap: 8px; }
.pq-shop-row { display: flex; align-items: center; gap: 10px; background: #fff8fa; border-radius: 14px; padding: 8px 10px; }
.pq-shop-row .grow { display: grid; }
.pq-shop-emoji { font-size: 1.7rem; width: 36px; text-align: center; }
.small { font-size: 0.85rem; }

/* Phones & touch: thumb-friendly action cluster bottom-right, joystick bottom-left */
.pq.touch .pq-bar {
  left: auto; right: 10px; transform: none; display: grid; gap: 6px; padding: 6px;
  grid-template-columns: repeat(4, 44px); grid-template-areas: "hearth quest dex hat" "act act jump jump";
}
.pq.touch .pq-slot { width: 44px; height: 44px; }
.pq.touch .pq-slot-icon { font-size: 1.25rem; }
.pq.touch .s-hearth { grid-area: hearth; } .pq.touch .s-quest { grid-area: quest; }
.pq.touch .s-dex { grid-area: dex; } .pq.touch .s-hat { grid-area: hat; }
.pq.touch .s-act { grid-area: act; width: 100%; height: 62px; }
.pq.touch .s-jump { grid-area: jump; width: 100%; height: 62px; }
.pq.touch .s-act .pq-slot-icon, .pq.touch .s-jump .pq-slot-icon { font-size: 1.9rem; }
.pq.touch .pq-prompt { left: auto; right: 10px; transform: none; bottom: 150px; }
.pq.touch .pq-cast { bottom: 190px; }
.pq.touch .pq-hint { bottom: auto; top: 46%; }
@media (max-width: 520px) {
  .pq-portrait { width: 50px; height: 50px; }
  .pq-portrait .avatar { width: 40px; height: 40px; }
  .pq-unit-info { min-width: 0; padding: 4px 10px 5px 14px; }
  .pq-unit-info strong { font-size: 0.85rem; }
  .pq-money { font-size: 0.66rem; }
  .pq-mini { width: 84px; height: 84px; border-width: 3px; }
  .pq-map-btns { left: -40px; }
  .pq-round { width: 34px; height: 34px; font-size: 0.95rem; }
  .pq-zone { max-width: 120px; font-size: 0.68rem; padding: 2px 8px; }
  .pq-tracker { top: 78px; left: 10px; right: auto; width: min(58%, 210px); padding: 6px 10px; }
  .pq-q-title { font-size: 0.8rem; }
  .pq-q-text { font-size: 0.72rem; }
  .pq-banner strong { font-size: 1.4rem; }
  .pq-banner.gold strong { font-size: 1.7rem; }
  .pq-label.qmark { font-size: 2rem; }
}
.pq-panel { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(91, 71, 96, 0.25); padding: 12px; z-index: 5; }
.pq-card {
  background: #fff; border-radius: 24px; padding: 18px; width: min(420px, 100%); max-height: 100%; overflow: auto;
  box-shadow: 0 20px 50px rgba(91, 71, 96, 0.3); display: grid; gap: 10px; animation: pop 0.25s ease;
}
.pq-card p { margin: 0; }
.pq-rarity { color: #fff; font-size: 0.75rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.15); }
.pq-new { background: #ff5d8f; color: #fff; font-size: 0.7rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.pq-big-emoji { font-size: 4rem; line-height: 1; animation: bob 2s ease-in-out infinite; }
.pq-ring-area {
  position: relative; width: 210px; height: 210px; justify-self: center; border: 0; border-radius: 50%;
  background: radial-gradient(circle, #fff6f9 0%, #ffe3ec 70%); cursor: pointer; overflow: hidden;
  touch-action: manipulation;
}
.pq-target {
  position: absolute; left: 50%; top: 50%; width: 90px; height: 90px; transform: translate(-50%, -50%);
  border-radius: 50%; border: 6px dashed #cdb4db;
}
.pq-ring {
  position: absolute; left: 50%; top: 50%; width: 90px; height: 90px; border-radius: 50%;
  border: 5px solid var(--pink); transform: translate(-50%, -50%) scale(2);
}
.pq-ring-emoji { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 2.6rem; }
.pq-ring-area.hit { background: radial-gradient(circle, #d8ffe4 0%, #b9f2cc 70%); }
.pq-ring-area.miss { animation: shake 0.3s ease; background: radial-gradient(circle, #ffe0e6 0%, #ffc2cf 70%); }
.pq-hearts { font-size: 1.5rem; letter-spacing: 2px; min-height: 1.8rem; }
.pq-dex { width: min(560px, 100%); }
.pq-dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.pq-dex-cell {
  position: relative; font: inherit; color: var(--muted); border: 2px dashed var(--line); background: #fbf7fa; border-radius: 16px;
  padding: 8px 4px; cursor: pointer; display: grid; justify-items: center; gap: 2px; text-align: center;
}
.pq-dex-cell.have { border: 2px solid var(--rar); background: #fff; color: var(--ink); }
.pq-dex-cell small { font-size: 0.68rem; line-height: 1.1; }
.pq-dex-emoji { font-size: 1.8rem; line-height: 1.1; }
.pq-dex-cell:not(.have) .pq-dex-emoji { filter: grayscale(1); opacity: 0.5; }
.pq-count { position: absolute; top: 2px; right: 6px; font-size: 0.7rem; color: var(--pink-deep); }
.pq-theirs { position: absolute; top: 2px; left: 4px; font-size: 0.7rem; }
.pq-dex-detail { display: grid; gap: 6px; background: #fff6f9; border-radius: 16px; padding: 10px 12px; min-height: 48px; }
.pq-dex-detail:empty::before { content: 'Tap a pet to see more ✨'; color: var(--muted); font-size: 0.9rem; }
.pq-pet-row { display: flex; align-items: center; gap: 6px; }

/* ── Tabs with icons ────────────────────────────────────── */
.tab { display: inline-flex; align-items: center; gap: 6px; }
.t-ic { font-size: 1.05rem; line-height: 1; }

/* ── Book Club ──────────────────────────────────────────── */
.bk-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.bk-head p { margin: 2px 0 0; }
.bk-empty-emoji { font-size: 2.6rem; margin: 0; }
.bk-shelf { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.bk-card {
  font: inherit; color: inherit; text-align: left; border: 0; cursor: pointer; background: var(--card);
  border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); display: flex; gap: 12px; align-items: flex-start;
  transition: transform 0.15s ease; animation: pop 0.35s ease;
}
.bk-card:hover { transform: translateY(-3px); }
.bk-card-info { display: grid; gap: 4px; min-width: 0; }
.bk-card-info strong { line-height: 1.2; }
.bk-cover {
  position: relative; flex: none; width: 74px; aspect-ratio: 2 / 3; border-radius: 6px 10px 10px 6px; overflow: hidden;
  background: linear-gradient(135deg, #cdb4db, #ff8fab); display: grid; place-items: center; padding: 6px;
  box-shadow: inset 4px 0 0 rgba(0, 0, 0, 0.12), 0 4px 10px rgba(91, 71, 96, 0.2);
}
.bk-cover.big { width: 120px; }
.bk-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bk-cover-title { color: #fff; font-size: 0.7rem; font-weight: 600; text-align: center; line-height: 1.15; overflow: hidden; }
.bk-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bk-chip { display: inline-flex; align-items: center; gap: 4px; background: #fff6f9; border-radius: 999px; padding: 2px 8px 2px 2px; font-size: 0.78rem; }
.bk-results { display: grid; gap: 8px; max-height: 50vh; overflow: auto; }
.bk-picks { display: grid; grid-auto-flow: column; grid-auto-columns: 84px; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x mandatory; }
.bk-pick { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; display: grid; gap: 4px; text-align: center; scroll-snap-align: start; }
.bk-pick .bk-cover { width: 84px; }
.bk-pick small { font-size: 0.72rem; line-height: 1.15; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bk-result {
  font: inherit; color: inherit; text-align: left; display: flex; gap: 10px; align-items: center; cursor: pointer;
  border: 2px solid var(--line); background: #fff; border-radius: 14px; padding: 6px;
}
.bk-result:hover { border-color: var(--pink); }
.bk-result img { width: 42px; height: 62px; object-fit: cover; border-radius: 4px; flex: none; background: #f3e8ff; }
.bk-result span { display: grid; }
.bk-book-top { display: flex; gap: 16px; align-items: flex-start; margin: 14px 0; }
.bk-book-top h2 { font-size: 1.4rem; }
.bk-book-top p { margin: 0; }
.bk-chapters { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; background: var(--card); border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow); }
.bk-ch {
  width: 100%; font: inherit; color: inherit; text-align: left; border: 0; background: none; cursor: pointer;
  display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px;
}
.bk-ch:hover { background: #fff6f9; }
.bk-ch-n { width: 28px; height: 28px; border-radius: 50%; background: #f3e8ff; display: grid; place-items: center; font-size: 0.8rem; flex: none; }

.bk-reader { max-width: 720px; margin: 0 auto; background: #fffdf8; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 22px 22px; }
.bk-reader-top { display: grid; gap: 6px; text-align: center; justify-items: center; }
.bk-reader-top h2 { font-size: 1.35rem; }
.bk-nav { display: flex; justify-content: space-between; gap: 8px; width: 100%; margin: 8px 0; }
.bk-help { text-align: center; font-size: 0.85rem; }
.bk-text {
  font-family: 'Lora', Georgia, serif; font-variant-caps: normal; font-size: 1.12rem; line-height: 1.75; color: #3d3141;
  -webkit-user-select: text; user-select: text;
}
.bk-text p { margin: 0 0 1em; text-align: left; }
.bk-hl { border-radius: 3px; padding: 1px 0; cursor: pointer; color: inherit; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.hl-yellow { background: #fff1a8; } .hl-pink { background: #ffc9da; } .hl-blue { background: #cfe6ff; } .hl-green { background: #c9f2d4; }
.bk-hl.both { background-image: linear-gradient(180deg, transparent 70%, rgba(255, 111, 156, 0.55) 70%); }
.bk-hl.talk { border-bottom: 2px dotted #b36a8a; }
.bk-toolbar {
  position: fixed; z-index: 60; display: flex; gap: 6px; background: var(--ink); padding: 6px 8px; border-radius: 999px;
  box-shadow: 0 8px 24px rgba(40, 20, 50, 0.35); animation: pop 0.15s ease;
}
.bk-tool { width: 34px; height: 34px; border-radius: 50%; border: 2px solid #fff; cursor: pointer; font-size: 1rem; display: grid; place-items: center; }
.bk-tool.note { background: #fff; }
.bk-thoughts { border-top: 2px dashed var(--line); margin-top: 10px; padding-top: 14px; display: grid; gap: 10px; }
.bk-thoughts h3 { font-size: 1.05rem; }
.bk-quote {
  font: inherit; color: inherit; text-align: left; border: 0; cursor: pointer; border-radius: 12px; padding: 8px 12px; display: grid; gap: 4px;
}
.bk-quote-text { font-family: 'Lora', Georgia, serif; font-variant-caps: normal; font-style: italic; }
.bk-quote small { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.bk-bigquote { margin: 0; padding: 12px 14px; border-radius: 14px; font-family: 'Lora', Georgia, serif; font-variant-caps: normal; font-style: italic; font-size: 1.05rem; line-height: 1.6; }
.bk-comment { display: flex; gap: 8px; align-items: flex-start; background: #fff6f9; border-radius: 14px; padding: 8px 10px; }
.bk-comment.mine { background: #f3f9ff; }
.bk-comment p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.bk-compose { display: flex; gap: 8px; align-items: flex-end; }
.bk-swatch { width: 30px; height: 30px; }

/* ── Toast ──────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; box-shadow: var(--shadow);
  max-width: calc(100% - 32px);
}

/* ── Phones ─────────────────────────────────────────────── */
@media (max-width: 680px) {
  .top { grid-template-columns: 1fr auto; top: 6px; padding: 8px 12px; }
  /* App-style tab bar at the bottom of the screen */
  .tabs {
    position: fixed; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 40;
    justify-content: space-around; gap: 2px; padding: 5px; border-radius: 22px;
    background: rgba(255, 255, 255, 0.96); box-shadow: 0 6px 24px rgba(91, 71, 96, 0.22); backdrop-filter: blur(8px);
  }
  .tab { flex: 1; flex-direction: column; gap: 1px; padding: 6px 2px; font-size: 0.68rem; border-radius: 16px; min-width: 0; }
  .tab.active { background: #fff0f4; box-shadow: none; color: var(--pink-deep); }
  .t-ic { font-size: 1.3rem; }
  #app { padding-bottom: 96px; }
  .toast { bottom: calc(90px + env(safe-area-inset-bottom)); }
  .bk-reader { padding: 14px 14px 18px; border-radius: 18px; }
  .bk-text { font-size: 1.05rem; }
  .bk-book-top { gap: 12px; }
  .bk-cover.big { width: 92px; }
  .bk-head .row { width: 100%; }
  .bk-head .row .btn { flex: 1; justify-content: center; }
  .t-long { display: none; }
  .t-short { display: inline; }
  .quiz-answers { grid-template-columns: 1fr; }
  .rpg-choices { grid-template-columns: 1fr; }
  .rpg-sprite { font-size: 3.4rem; }
  .fb-hud { font-size: 0.85rem; }
  .game-card-big { padding: 18px 14px; }
  .game-card-big .row .btn { flex: 1 1 100%; justify-content: center; }
  .scoreboard { padding: 12px; }
  .scoreboard .avatar.huge { width: 56px; height: 56px; }
  .games-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .game-tile { padding: 12px; }
  .rpg-arena { min-height: 220px; padding: 12px; gap: 10px; }
  .rpg-actions .btn { padding: 12px 8px; font-size: 0.9rem; }
  .quiz { padding: 14px; }
  .quiz-answer { padding: 14px; }
  .pq { height: calc(100dvh - 200px); min-height: 400px; }
  .pq-ring-area { width: 190px; height: 190px; }
  .chat { height: calc(100dvh - 190px); min-height: 320px; }
  .msg { max-width: 90%; }
  .person .name { display: none; }
  .notes, .media-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
  .note-body { font-size: 1.35rem; }
  .media-bar .btn.primary { margin-left: 0; width: 100%; justify-content: center; }
  .detail-top { grid-template-columns: 90px 1fr; }
  .reaction { font-size: 0.68rem; }
}
