/* ==========================================================================
   Close Talk: Question Cards — Stylesheet
   ========================================================================== */

:root {
  --bg: #efece4;
  --surface: #fffdf7;
  --text: #141417;
  --muted: #6d6a73;
  --line: #141417;
  --shadow: #141417;
  --track: rgba(20, 20, 23, .12);
  --c-deep: #4a44ff;  --i-deep: #ffffff;
  --c-rom: #ff5c8f;   --i-rom: #141417;
  --c-spicy: #ff5a36; --i-spicy: #141417;
  --c-fun: #cfff52;   --i-fun: #141417;
  --c-solo: #b79cff;  --i-solo: #141417;
  --c-family: #2fcfae;--i-family: #141417;
  --c-party: #ffd23f; --i-party: #141417;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="candle"]) {
    --bg: #101013;
    --surface: #1b1b21;
    --text: #f4f2ec;
    --muted: #9a98a3;
    --line: #050506;
    --shadow: #34343e;
    --track: rgba(244, 242, 236, .14);
  }
}

:root[data-theme="dark"] {
  --bg: #101013;
  --surface: #1b1b21;
  --text: #f4f2ec;
  --muted: #9a98a3;
  --line: #050506;
  --shadow: #34343e;
  --track: rgba(244, 242, 236, .14);
}

:root[data-theme="candle"],
body.candle {
  --bg: #140a07;
  --surface: #21130d;
  --text: #f7e6d3;
  --muted: #b89a84;
  --line: #060302;
  --shadow: #3d2014;
  --track: rgba(247, 230, 211, .14);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  height: 100%;
  scroll-padding-top: env(safe-area-inset-top, 0px);
}

body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Bricolage Grotesque', 'Space Grotesk', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .5s ease, color .3s ease;
}

button {
  font-family: inherit;
  color: inherit;
  cursor: pointer;
}

#app {
  min-height: 100%;
  max-width: 520px;
  margin: 0 auto;
}

.screen {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  padding: 16px 18px 22px;
}

.screen.active {
  display: flex;
}

/* ---------- shared ---------- */
.icon-btn {
  height: 44px;
  min-width: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 2.5px solid var(--line);
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 700;
  font-size: .95rem;
  box-shadow: 3px 3px 0 var(--shadow);
  transition: transform .08s, box-shadow .08s;
}

.icon-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--shadow);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.press {
  transition: transform .08s, box-shadow .08s;
}

.press:active {
  transform: translate(3px, 3px) !important;
  box-shadow: 1px 1px 0 var(--shadow) !important;
}

/* ---------- home ---------- */
#home {
  padding-top: 12px;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 8px;
}

.top .icon-btn {
  height: 40px;
  min-width: 40px;
  padding: 0 11px;
}

.top-actions {
  display: flex;
  gap: 7px;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.22rem;
  letter-spacing: -.03em;
  white-space: nowrap;
}

.logo-cards {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  margin-right: -2px;
  transition: transform .35s cubic-bezier(.2, .9, .25, 1);
}

.logo:active .logo-cards,
.logo:hover .logo-cards {
  transform: rotate(-8deg) scale(1.08);
}

.lang-btn {
  font-weight: 800;
  font-size: .8rem;
  letter-spacing: .04em;
  padding: 0 10px !important;
  min-width: 40px;
}

#browseBtn span {
  display: none;
}

.headline {
  font-size: clamp(1.7rem, 8vw, 2.25rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.045em;
  margin: 0 0 6px;
}

.headline em {
  font-style: normal;
  position: relative;
  white-space: nowrap;
  z-index: 0;
  isolation: isolate;
}

.headline em::after {
  content: '';
  position: absolute;
  left: -2px;
  right: -4px;
  bottom: .06em;
  height: .3em;
  background: var(--c-fun);
  z-index: -1;
  border-radius: 4px;
  transform: rotate(-1.2deg);
}

.stats {
  margin: 0 0 12px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
}

.stats b {
  color: var(--text);
}

.bento {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.tile {
  position: relative;
  overflow: hidden;
  text-align: left;
  border: 2.5px solid var(--line);
  border-radius: 22px;
  padding: 12px 13px 11px;
  min-height: 0;
  height: clamp(100px, calc((100vh - 318px) / 4), 150px);
  height: clamp(100px, calc((100svh - 318px) / 4), 150px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  box-shadow: 4px 4px 0 var(--shadow);
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

.tile > * {
  position: relative;
  z-index: 1;
}

.tile.t-deep { background: var(--c-deep); color: var(--i-deep); }
.tile.t-rom { background: var(--c-rom); color: var(--i-rom); }
.tile.t-spicy { background: var(--c-spicy); color: var(--i-spicy); }
.tile.t-fun { background: var(--c-fun); color: var(--i-fun); }
.tile.t-solo { background: var(--c-solo); color: var(--i-solo); }
.tile.t-family { background: var(--c-family); color: var(--i-family); }
.tile.t-party { background: var(--c-party); color: var(--i-party); }
.tile.t-mix { background: var(--surface); color: var(--text); }

.bento.discreet .t-spicy {
  display: none;
}

.bento.discreet .t-party {
  grid-column: auto !important;
}

.bento.discreet .t-mix {
  grid-column: span 2 !important;
}

.t-tag {
  font-size: .64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  opacity: .8;
}

.t-title,
.t-deep .t-title {
  font-size: 1.28rem;
  font-weight: 800;
  line-height: .98;
  letter-spacing: -.035em;
  display: block;
  margin-top: 3px;
}

.t-meta {
  font-size: .72rem;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  opacity: .9;
}

.t-prog {
  height: 5px;
  border-radius: 6px;
  background: rgba(20, 20, 23, .18);
  overflow: hidden;
  margin-top: 5px;
}

.t-deep .t-prog {
  background: rgba(255, 255, 255, .28);
}

.t-mix .t-prog {
  background: var(--track);
}

.t-prog i {
  display: block;
  height: 100%;
  width: 0;
  background: currentColor;
  border-radius: 6px;
  transition: width .4s;
}

/* decorative shapes */
.tile::after {
  content: '';
  position: absolute;
  z-index: 0;
  pointer-events: none;
}

.t-deep::after {
  width: 170px;
  height: 170px;
  right: -70px;
  top: 20%;
  border-radius: 50%;
  background: repeating-radial-gradient(circle, transparent 0 14px, rgba(255, 255, 255, .2) 14px 16.5px);
}

.t-rom::after {
  width: 74px;
  height: 74px;
  right: -14px;
  top: -16px;
  background: rgba(20, 20, 23, .14);
  clip-path: path('M37 66 C8 46 2 30 10 18 C18 6 32 8 37 20 C42 8 56 6 64 18 C72 30 66 46 37 66 Z');
}

.t-spicy::after {
  width: 86px;
  height: 86px;
  right: -20px;
  top: -22px;
  background: rgba(20, 20, 23, .14);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.t-fun::after {
  inset: 0;
  background-image: radial-gradient(rgba(20, 20, 23, .13) 2px, transparent 2.5px);
  background-size: 14px 14px;
  mask-image: linear-gradient(135deg, #000 0%, transparent 60%);
  -webkit-mask-image: linear-gradient(225deg, #000 0%, transparent 55%);
}

.t-solo::after {
  width: 120px;
  height: 120px;
  right: 18px;
  top: -30px;
  border-radius: 50%;
  box-shadow: -26px 20px 0 0 rgba(20, 20, 23, .16);
  background: transparent;
}

.t-family::after {
  width: 22px;
  height: 22px;
  right: 22px;
  top: 18px;
  border-radius: 50%;
  background: rgba(20, 20, 23, .16);
  box-shadow: -28px 8px 0 -2px rgba(20, 20, 23, .16), -52px 16px 0 -6px rgba(20, 20, 23, .16);
}

.t-party::after {
  inset: 0;
  background:
    radial-gradient(circle at 78% 30%, rgba(20, 20, 23, .18) 0 22px, transparent 23px),
    radial-gradient(circle at 90% 70%, rgba(20, 20, 23, .12) 0 12px, transparent 13px),
    radial-gradient(circle at 66% 78%, rgba(20, 20, 23, .12) 0 8px, transparent 9px),
    radial-gradient(circle at 60% 22%, rgba(20, 20, 23, .12) 0 5px, transparent 6px);
}

.t-mix .mixmark {
  position: absolute;
  right: 11px;
  top: 11px;
  width: 28px;
  height: 28px;
  border-radius: 10px 3px 10px 3px;
  border: 2.5px solid var(--line);
  background: conic-gradient(from 45deg, var(--c-deep) 0 90deg, var(--c-rom) 90deg 180deg, var(--c-spicy) 180deg 270deg, var(--c-fun) 270deg 360deg);
  transform: rotate(12deg);
  z-index: 1;
}

/* ---------- settings & home widgets ---------- */
.write-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  margin-bottom: 14px;
  background: var(--surface);
  border: 2.5px dashed var(--line);
  border-radius: 22px;
  padding: 14px 15px;
}

.write-btn .plus {
  width: 40px;
  height: 40px;
  border-radius: 12px 3px 12px 3px;
  border: 2.5px solid var(--line);
  background: var(--c-fun);
  color: #141417;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.write-btn b {
  display: block;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -.02em;
}

.write-btn span {
  font-size: .8rem;
  color: var(--muted);
}

.settings {
  background: var(--surface);
  border: 2.5px solid var(--line);
  border-radius: 22px;
  box-shadow: 4px 4px 0 var(--shadow);
  overflow: hidden;
}

.set-row {
  padding: 14px 15px;
  border-top: 2px solid var(--track);
}

.set-row:first-child {
  border-top: none;
}

.duo-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.duo-head b {
  display: block;
  font-size: .98rem;
  font-weight: 800;
  letter-spacing: -.02em;
}

.duo-head span {
  font-size: .8rem;
  color: var(--muted);
}

.switch {
  position: relative;
  width: 52px;
  height: 30px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  border: 2.5px solid var(--line);
  background: var(--track);
  transition: background .2s;
}

.switch span::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  top: 2.5px;
  left: 3px;
  border-radius: 50%;
  background: var(--text);
  transition: transform .2s;
}

.switch input:checked + span {
  background: var(--c-fun);
}

.switch input:checked + span::after {
  transform: translateX(21px);
  background: #141417;
}

.duo-names {
  display: none;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.duo-names.show {
  display: flex;
}

.duo-names input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  outline: none;
}

.duo-names span {
  font-weight: 800;
  color: var(--muted);
}

.j-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: none;
  border: 0;
  border-top: 2px solid var(--track);
  text-align: left;
  font: inherit;
  color: var(--text);
  cursor: pointer;
}

.j-row b {
  font-weight: 800;
  font-size: .98rem;
  letter-spacing: -.02em;
}

.j-row span {
  font-size: .82rem;
  color: var(--muted);
  font-weight: 700;
}

/* Theme & Backup controls in settings */
.theme-pills {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.theme-pill {
  border: 2px solid var(--line);
  background: var(--bg);
  color: var(--text);
  border-radius: 12px;
  padding: 7px 6px;
  font-weight: 700;
  font-size: .78rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: transform .08s, background .15s;
}

.theme-pill.on {
  background: var(--text);
  color: var(--bg);
}

.backup-btns {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn-sm {
  border: 2px solid var(--line);
  background: var(--bg);
  color: var(--text);
  border-radius: 12px;
  padding: 7px 11px;
  font-weight: 800;
  font-size: .8rem;
  box-shadow: 2px 2px 0 var(--shadow);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.foot {
  margin-top: auto;
  padding-top: 20px;
  text-align: center;
  font-size: .75rem;
  color: var(--muted);
  line-height: 1.6;
}

/* ---------- resume ---------- */
.resume {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 2.5px solid var(--line);
  border-radius: 16px;
  padding: 9px 12px;
  font-weight: 600;
  font-size: .88rem;
  color: var(--text);
  box-shadow: 3px 3px 0 var(--shadow);
}

.resume b {
  font-weight: 800;
  margin-left: -4px;
}

.resume .rs-dot {
  width: 14px;
  height: 14px;
  border-radius: 4px 1px 4px 1px;
  border: 2px solid var(--line);
  flex-shrink: 0;
}

.resume .rs-n {
  margin-left: auto;
  color: var(--muted);
  font-weight: 700;
  font-size: .8rem;
}

/* ---------- sheet ---------- */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
  z-index: 20;
}

.backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0 auto;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  z-index: 21;
  background: var(--surface);
  border: 2.5px solid var(--line);
  border-bottom: none;
  border-radius: 30px 30px 0 0;
  padding: 10px 18px calc(22px + env(safe-area-inset-bottom, 0px));
  transform: translateY(105%);
  transition: transform .32s cubic-bezier(.2, .9, .25, 1);
}

.sheet.open {
  transform: translateY(0);
}

.grab {
  width: 44px;
  height: 5px;
  border-radius: 5px;
  background: var(--track);
  margin: 0 auto 16px;
}

.sheet h3 {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -.035em;
}

.sheet p.sub {
  margin: 4px 0 18px;
  color: var(--muted);
  font-size: .92rem;
}

.opts {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.opt {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  width: 100%;
  background: var(--bg);
  border: 2.5px solid var(--line);
  border-radius: 20px;
  padding: 14px 15px;
  box-shadow: 3px 3px 0 var(--shadow);
}

.swatch {
  width: 40px;
  height: 40px;
  border-radius: 12px 3px 12px 3px;
  border: 2.5px solid var(--line);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.opt .o-main {
  flex: 1;
  min-width: 0;
}

.opt b {
  display: block;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -.02em;
}

.opt span {
  font-size: .8rem;
  color: var(--muted);
}

.opt .o-count {
  font-weight: 800;
  font-size: .85rem;
  color: var(--muted);
}

.opt-hero {
  border-width: 3px;
  padding: 18px 16px;
  box-shadow: 4px 4px 0 var(--shadow);
  margin-bottom: 6px;
}

.opt-hero .o-main b {
  font-size: 1.3rem;
}

.opt-hero .o-main span,
.opt-hero .o-count {
  color: inherit;
  opacity: .8;
}

.hero-ic {
  width: 44px;
  height: 44px;
  border-radius: 14px 4px 14px 4px;
  border: 2.5px solid currentColor;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.hero-ic svg {
  width: 24px;
  height: 24px;
}

.lvl-label {
  text-align: center;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin: 14px 0 10px;
}

.opt-best {
  border-style: dashed;
}

.reset {
  display: block;
  margin: 16px auto 0;
  background: none;
  border: none;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- play ---------- */
#play {
  height: 100vh;
  height: 100svh;
  padding-bottom: 18px;
}

.play-top,
.bar,
.deeper,
.hint,
.actions {
  width: 100%;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.play-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.play-title {
  flex: 1;
  min-width: 0;
}

.play-title b {
  display: block;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.1;
}

.play-title span {
  font-size: .8rem;
  color: var(--muted);
  font-weight: 600;
}

.counter {
  font-weight: 800;
  font-size: .9rem;
  font-variant-numeric: tabular-nums;
}

.bar {
  height: 6px;
  background: var(--track);
  border-radius: 6px;
  margin-top: 14px;
  margin-bottom: 10px;
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 6px;
  background: var(--text);
  transition: width .3s;
}

.turn {
  align-self: center;
  min-height: 30px;
  font-weight: 800;
  font-size: .88rem;
  letter-spacing: -.01em;
  padding: 5px 14px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--surface);
  display: none;
  margin-bottom: 6px;
}

.turn.show {
  display: inline-block;
  animation: pop .3s;
}

.stack {
  position: relative;
  flex: 1;
  width: 100%;
  max-width: 520px;
  min-height: 320px;
  margin: 10px auto 18px;
  transform: perspective(1100px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transform-style: preserve-3d;
}

.qc {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  margin: auto;
  height: min(100%, 480px);
  border: 3px solid var(--line);
  border-radius: 32px;
  box-shadow: 6px 6px 0 var(--shadow);
  padding: 20px 22px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform;
}

.qc.c-deep { background: var(--c-deep); color: var(--i-deep); }
.qc.c-rom { background: var(--c-rom); color: var(--i-rom); }
.qc.c-spicy { background: var(--c-spicy); color: var(--i-spicy); }
.qc.c-fun { background: var(--c-fun); color: var(--i-fun); }
.qc.c-solo { background: var(--c-solo); color: var(--i-solo); }
.qc.c-family { background: var(--c-family); color: var(--i-family); }
.qc.c-party { background: var(--c-party); color: var(--i-party); }
.qc.c-end { background: var(--surface); color: var(--text); }

.qc.d1 {
  transform: translateY(14px) scale(.94) rotate(-2.5deg);
  filter: brightness(.92);
}

.qc.d2 {
  transform: translateY(26px) scale(.88) rotate(3deg);
  filter: brightness(.84);
}

.qc.top.enter {
  animation: rise .32s cubic-bezier(.2, .9, .25, 1);
}

.qc.top.back {
  animation: comeback .32s cubic-bezier(.2, .9, .25, 1);
}

.qc.top::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 29px;
  pointer-events: none;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 28%), rgba(255, 255, 255, .34), rgba(255, 255, 255, 0) 58%);
  mix-blend-mode: soft-light;
}

.qc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.qc-no {
  font-weight: 800;
  font-size: .85rem;
  letter-spacing: .02em;
  opacity: .85;
  font-variant-numeric: tabular-nums;
}

.qc-tag {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  border: 2px solid currentColor;
  border-radius: 999px;
  padding: 4px 10px;
  opacity: .9;
}

.qc .q {
  font-size: clamp(1.2rem, 5.45vw, 1.64rem);
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: -.03em;
  margin: 0;
  padding: 10px 0;
}

.qc.long .q {
  font-size: clamp(1.03rem, 4.5vw, 1.32rem);
}

.qc.c-end .q {
  font-size: clamp(1.36rem, 6.4vw, 1.84rem);
}

.qc-foot {
  font-size: .78rem;
  font-weight: 600;
  opacity: .7;
}

.stamp {
  position: absolute;
  top: 22px;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: .06em;
  padding: 6px 12px;
  border: 3px solid currentColor;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
}

.stamp.l {
  right: 20px;
  transform: rotate(10deg);
}

.stamp.r {
  left: 20px;
  transform: rotate(-10deg);
}

.end-btns {
  display: flex;
  gap: 10px;
}

.end-btns button {
  flex: 1;
  padding: 14px;
  border-radius: 18px;
  border: 2.5px solid var(--line);
  font-weight: 800;
  font-size: .95rem;
  box-shadow: 3px 3px 0 var(--shadow);
  background: var(--bg);
}

.end-btns button.main {
  background: var(--c-fun);
  color: #141417;
}

.hint {
  text-align: center;
  font-size: .78rem;
  color: var(--muted);
  font-weight: 600;
  margin-top: -6px;
  margin-bottom: 12px;
  transition: opacity .4s;
}

.actions {
  display: grid;
  grid-template-columns: auto auto auto 1fr;
  gap: 10px;
}

.act {
  width: 58px;
  height: 58px;
  border-radius: 20px;
  border: 2.5px solid var(--line);
  background: var(--surface);
  display: grid;
  place-items: center;
  box-shadow: 4px 4px 0 var(--shadow);
}

.act svg {
  width: 22px;
  height: 22px;
}

.act.saved svg path {
  fill: var(--c-rom);
  stroke: var(--line);
}

.act.primary {
  width: auto;
  border-radius: 20px;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -.01em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #141417;
  background: var(--c-fun);
}

.act.primary.c-deep { background: var(--c-deep); color: #fff; }
.act.primary.c-rom { background: var(--c-rom); }
.act.primary.c-spicy { background: var(--c-spicy); }
.act.primary.c-fun { background: var(--c-fun); }
.act.primary.c-solo { background: var(--c-solo); }
.act.primary.c-family { background: var(--c-family); }
.act.primary.c-party { background: var(--c-party); }

.act:disabled {
  opacity: .4;
  pointer-events: none;
}

/* card cover (tap to reveal) */
.qc .cover {
  position: absolute;
  inset: 0;
  border-radius: 29px;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  overflow: hidden;
}

.qc.hidden .cover {
  display: flex;
}

.qc.hidden .front {
  visibility: hidden;
}

.cover::before {
  content: '';
  position: absolute;
  inset: 14px;
  border: 2.5px solid currentColor;
  border-radius: 20px;
  opacity: .35;
}

.cover .cv-mark {
  width: 64px;
  height: 64px;
  border-radius: 18px 5px 18px 5px;
  border: 3px solid currentColor;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.8rem;
  transform: rotate(-8deg);
}

.cover .cv-t {
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -.03em;
}

.cover .cv-s {
  font-size: .8rem;
  font-weight: 600;
  opacity: .75;
}

.front {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

.qc.flip {
  animation: flip .34s ease-in-out;
}

@keyframes flip {
  0% { transform: scaleX(1); }
  50% { transform: scaleX(0); }
  100% { transform: scaleX(1); }
}

/* wildcard sticker */
.wild {
  align-self: flex-start;
  margin-top: 12px;
  background: #141417;
  color: #f4f2ec;
  border-radius: 12px;
  padding: 7px 11px;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .01em;
  transform: rotate(-2deg);
  display: inline-flex;
  gap: 6px;
  align-items: center;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, .25);
}

.c-deep .wild {
  background: #f4f2ec;
  color: #141417;
}

/* go deeper & rating */
.deeper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: -4px;
  margin-bottom: 12px;
  min-height: 34px;
}

.deeper .row {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.deeper-btn {
  background: none;
  border: none;
  font-weight: 800;
  font-size: .88rem;
  color: var(--text);
  padding: 6px 10px;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 2px;
}

.bubble {
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 16px 16px 16px 4px;
  padding: 9px 14px;
  font-weight: 700;
  font-size: .92rem;
  max-width: 92%;
  text-align: center;
  animation: pop .25s;
}

.rate {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .82rem;
  font-weight: 700;
  color: var(--muted);
}

.r-btn {
  width: 46px;
  height: 40px;
  border-radius: 14px;
  border: 2.5px solid var(--line);
  background: var(--surface);
  font-size: 1.25rem;
  line-height: 1;
  box-shadow: 3px 3px 0 var(--shadow);
  transition: transform .1s;
}

.r-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--shadow);
}

.r-btn.on {
  background: var(--c-fun);
}

.r-btn[data-r="1"].on {
  background: #ffd23f;
}

.r-btn.burst {
  animation: burst .38s ease-out;
}

@keyframes burst {
  0% { transform: scale(1); }
  40% { transform: scale(1.35) rotate(-8deg); }
  100% { transform: scale(1); }
}

.spark {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 50;
  border: 1.5px solid #141417;
  animation: spark .65s ease-out forwards;
}

@keyframes spark {
  to {
    transform: translate(var(--dx), var(--dy)) scale(.3);
    opacity: 0;
  }
}

/* ---------- saved / journal / browse ---------- */
.saved-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.saved-head h2 {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -.035em;
}

.slist,
.j-list,
.b-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.sitem {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--surface);
  border: 2.5px solid var(--line);
  border-radius: 20px;
  padding: 14px 12px 14px 14px;
  box-shadow: 3px 3px 0 var(--shadow);
  animation: pop .25s;
}

.sitem .dot {
  width: 14px;
  height: 14px;
  border-radius: 4px 1px 4px 1px;
  border: 2px solid var(--line);
  flex-shrink: 0;
  margin-top: 4px;
}

.sitem p {
  margin: 0;
  flex: 1;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.3;
  letter-spacing: -.01em;
}

.sitem button {
  background: none;
  border: none;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--muted);
  padding: 0 4px;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
  font-weight: 600;
  grid-column: 1 / -1;
}

.empty b {
  display: block;
  font-size: 1.3rem;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -.02em;
}

/* writer */
.w-area {
  width: 100%;
  min-height: 96px;
  resize: none;
  font: inherit;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
  background: var(--bg);
  border: 2.5px solid var(--line);
  border-radius: 18px;
  padding: 12px 14px;
  outline: none;
  margin-bottom: 12px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.chip {
  border: 2px solid var(--line);
  background: var(--bg);
  border-radius: 999px;
  padding: 7px 13px;
  font-weight: 700;
  font-size: .85rem;
}

.chip.on {
  background: var(--text);
  color: var(--bg);
}

.w-add {
  width: 100%;
  padding: 15px;
  border-radius: 18px;
  border: 2.5px solid var(--line);
  background: var(--c-fun);
  color: #141417;
  font-weight: 800;
  font-size: 1rem;
  box-shadow: 3px 3px 0 var(--shadow);
}

.w-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 30vh;
  overflow-y: auto;
}

.w-list .sitem {
  box-shadow: none;
  padding: 10px 10px 10px 12px;
}

.w-list .sitem p {
  font-size: .92rem;
}

.mixrow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 2px solid var(--track);
  border-radius: 18px;
}

.mixrow b {
  font-weight: 800;
  font-size: .95rem;
}

/* browse */
.b-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  margin: 0 -2px 6px;
  scrollbar-width: none;
}

.b-tabs::-webkit-scrollbar {
  display: none;
}

.b-tab {
  flex-shrink: 0;
  border: 2.5px solid var(--line);
  border-radius: 999px;
  padding: 9px 15px;
  font-weight: 800;
  font-size: .9rem;
  background: var(--surface);
  box-shadow: 3px 3px 0 var(--shadow);
}

.b-tab.on {
  box-shadow: 1px 1px 0 var(--shadow);
  transform: translate(2px, 2px);
}

.b-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.seg {
  display: flex;
  border: 2.5px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
}

.seg button {
  border: none;
  background: none;
  padding: 8px 13px;
  font-weight: 700;
  font-size: .85rem;
}

.seg button + button {
  border-left: 2px solid var(--line);
}

.seg button.on {
  background: var(--text);
  color: var(--bg);
}

.b-count {
  font-size: .82rem;
  font-weight: 700;
  color: var(--muted);
}

.b-search {
  width: 100%;
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  background: var(--surface);
  border: 2.5px solid var(--line);
  border-radius: 16px;
  padding: 11px 14px;
  outline: none;
  margin-bottom: 14px;
}

.b-list {
  gap: 8px;
}

.b-sec {
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
  margin: 10px 2px 2px;
  grid-column: 1 / -1;
}

.b-cat {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -.02em;
  margin: 18px 2px 4px;
  grid-column: 1 / -1;
}

.b-cat:first-child {
  margin-top: 4px;
}

.b-cat .dot {
  width: 16px;
  height: 16px;
  border-radius: 5px 1px 5px 1px;
  border: 2px solid var(--line);
}

.b-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 12px 10px 12px 12px;
}

.b-item .n {
  font-weight: 800;
  font-size: .78rem;
  color: var(--muted);
  min-width: 24px;
  padding-top: 2px;
  font-variant-numeric: tabular-nums;
}

.b-item p {
  margin: 0;
  flex: 1;
  font-weight: 600;
  font-size: .97rem;
  line-height: 1.32;
  letter-spacing: -.01em;
}

.b-item.seen p {
  opacity: .55;
}

.b-item .seenmark {
  font-size: .7rem;
  font-weight: 800;
  color: var(--muted);
  display: block;
  margin-top: 4px;
  opacity: 1;
}

.b-item .mine {
  font-size: .7rem;
  font-weight: 800;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1.5px solid currentColor;
}

.b-heart {
  background: none;
  border: none;
  padding: 2px 4px;
  flex-shrink: 0;
}

.b-heart svg {
  width: 22px;
  height: 22px;
}

.b-heart.on svg path {
  fill: var(--c-rom);
  stroke: var(--line);
}

/* solo + journal */
.write-ans {
  background: var(--c-solo);
  color: #141417;
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  font-weight: 800;
  font-size: .86rem;
  box-shadow: 2px 2px 0 var(--shadow);
}

.j-open {
  width: 100%;
  margin-top: 12px;
  padding: 14px;
  border-radius: 18px;
  border: 2.5px solid var(--line);
  background: var(--bg);
  font-weight: 800;
  font-size: .98rem;
  box-shadow: 3px 3px 0 var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.j-q {
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.3;
  letter-spacing: -.01em;
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--c-solo);
  color: #141417;
  border: 2px solid var(--line);
}

.j-item {
  background: var(--surface);
  border: 2.5px solid var(--line);
  border-radius: 20px;
  padding: 14px 14px 12px;
  box-shadow: 3px 3px 0 var(--shadow);
}

.j-item .j-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 6px;
}

.j-item .j-date {
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
}

.j-item .j-top button {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  padding: 0 4px;
}

.j-item .j-qq {
  font-weight: 800;
  font-size: .95rem;
  letter-spacing: -.01em;
  margin: 0 0 6px;
  padding-left: 10px;
  border-left: 4px solid var(--c-solo);
}

.j-item .j-a {
  margin: 0;
  font-size: .98rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.j-item .j-edit {
  margin-top: 8px;
  background: none;
  border: none;
  font-weight: 800;
  font-size: .8rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0;
}

/* ---------- toast & effects ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  z-index: 30;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
  font-size: .9rem;
  padding: 10px 18px;
  border-radius: 999px;
  transition: opacity .2s, transform .2s;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  overflow: hidden;
}

.confetti i {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 14px;
  border: 2px solid #141417;
  border-radius: 3px;
  animation: fall linear forwards;
}

@keyframes fall {
  to { transform: translateY(110vh) rotate(720deg); }
}

/* ---------- candlelight ambient effects ---------- */
:root[data-theme="candle"] body,
body.candle {
  background: #140a07;
}

:root[data-theme="candle"] #app,
body.candle #play {
  position: relative;
  isolation: isolate;
}

:root[data-theme="candle"] #app::before,
body.candle #play::before {
  content: '';
  position: fixed;
  inset: -10%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 45% at 50% 42%, rgba(255, 138, 56, .22), transparent 70%),
    radial-gradient(ellipse 40% 30% at 50% 100%, rgba(255, 90, 54, .16), transparent 70%);
  animation: flicker 3.2s ease-in-out infinite alternate;
}

:root[data-theme="candle"] #app::after,
body.candle #play::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(rgba(255, 210, 150, .5) 1px, transparent 1.5px);
  background-size: 120px 160px;
  opacity: .18;
  animation: embers 14s linear infinite;
}

:root[data-theme="candle"] .qc,
body.candle .qc {
  box-shadow: 6px 6px 0 var(--shadow), 0 18px 60px rgba(255, 120, 50, .22);
}

:root[data-theme="candle"] .bar i,
body.candle .bar i {
  background: linear-gradient(90deg, #ff5a36, #ffd23f);
}

@keyframes flicker {
  0% { opacity: .75; transform: scale(1); }
  35% { opacity: .95; }
  60% { opacity: .8; transform: scale(1.03); }
  100% { opacity: 1; transform: scale(.99); }
}

@keyframes embers {
  from { background-position: 0 0; }
  to { background-position: 40px -320px; }
}

/* ---------- double-tap heart ---------- */
.big-heart {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 110px;
  height: 110px;
  margin: -55px 0 0 -55px;
  pointer-events: none;
  z-index: 5;
  animation: heartpop .8s ease-out forwards;
}

.big-heart svg {
  width: 100%;
  height: 100%;
}

.big-heart path {
  fill: #ff5c8f;
  stroke: #141417;
  stroke-width: 1.4;
  stroke-linejoin: round;
}

.big-heart.off path {
  fill: transparent;
  stroke: currentColor;
}

@keyframes heartpop {
  0% { transform: scale(.2); opacity: 0; }
  25% { transform: scale(1.15); opacity: 1; }
  55% { transform: scale(.95); }
  100% { transform: scale(1.25); opacity: 0; }
}

/* ---------- how to ---------- */
.howto {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.howto div {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--bg);
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 11px 13px;
}

.howto span {
  font-size: 1.35rem;
  width: 30px;
  text-align: center;
  flex-shrink: 0;
}

.howto p {
  margin: 0;
  font-size: .95rem;
  line-height: 1.3;
}

@keyframes rise {
  from { transform: translateY(14px) scale(.94) rotate(-2.5deg); }
  to { transform: none; }
}

@keyframes comeback {
  from { transform: translate(-120%, -10px) rotate(-16deg); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@keyframes pop {
  from { transform: scale(.92); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* ==========================================================================
   Responsive Desktop & Tablet Layout (>= 768px)
   ========================================================================== */
@media (min-width: 768px) {
  #app {
    max-width: 980px;
  }

  .screen {
    padding: 24px 32px 36px;
  }

  #home {
    padding-top: 24px;
  }

  .top {
    margin-bottom: 24px;
  }

  .logo {
    font-size: 1.45rem;
  }

  .logo-cards {
    width: 36px;
    height: 36px;
  }

  #browseBtn span {
    display: inline;
  }

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

  .headline {
    font-size: clamp(2.2rem, 4vw, 3rem);
    margin-bottom: 10px;
  }

  .stats {
    font-size: .92rem;
    margin-bottom: 18px;
  }

  .bento {
    gap: 14px;
    margin-bottom: 0;
  }

  .tile {
    height: clamp(124px, 16vh, 160px);
    padding: 15px 16px 14px;
    transition: transform .14s ease, box-shadow .14s ease;
  }

  .tile:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 var(--shadow);
  }

  .t-title,
  .t-deep .t-title {
    font-size: 1.45rem;
  }

  .t-tag {
    font-size: .7rem;
  }

  .t-meta {
    font-size: .78rem;
  }

  /* Center sheet as modal dialog on tablet/desktop */
  .sheet {
    bottom: auto;
    top: 50%;
    max-width: 500px;
    border-bottom: 2.5px solid var(--line);
    border-radius: 28px;
    padding: 16px 24px 24px;
    box-shadow: 8px 8px 0 var(--shadow);
    transform: translateY(100vh);
    opacity: 0;
    pointer-events: none;
    transition: transform .28s cubic-bezier(.2, .9, .25, 1), opacity .2s ease;
  }

  .sheet.open {
    transform: translateY(-50%);
    opacity: 1;
    pointer-events: auto;
  }

  /* Two-column lists for Browse, Journal, and Saved on desktop */
  .slist,
  .j-list,
  .b-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 12px;
  }

  /* Comfortable card dimensions on desktop play screen */
  .play-top,
  .bar,
  .deeper,
  .hint,
  .actions,
  .stack {
    max-width: 560px;
  }

  .qc {
    height: min(100%, 460px);
    padding: 26px 28px;
    cursor: grab;
  }

  .qc:active {
    cursor: grabbing;
  }

  .qc .q {
    font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  }

  .qc.long .q {
    font-size: clamp(1.15rem, 1.8vw, 1.42rem);
  }
}
