/* ───────────────────────── базовое ───────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  background: #100c15;
  color: #f4eef6;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
  -webkit-user-select: none;
}

/* ── палитра разделов ── */
body {
  --m1: #f6c338; --m1l: #ffe08a; --m1d: #c2860f;
  --m2: #f4699a; --m2l: #ffa8c6; --m2d: #c33c70;
  --accent: #f6c338;
  --accent2: #f4699a;
  --aura1: rgba(246,195,56,.30);
  --aura2: rgba(244,105,154,.30);
  --sat: 1; --bri: 1; --glow: 0;
}
body[data-cat='fun'] {
  --m1: #f6c338; --m1l: #ffe08a; --m1d: #c2860f;
  --m2: #edb42a; --m2l: #ffd873; --m2d: #b47b0c;
  --accent: #f6c338; --accent2: #ffd873;
  --aura1: rgba(246,195,56,.32); --aura2: rgba(255,176,32,.16);
}
body[data-cat='romance'] {
  --m1: #f4699a; --m1l: #ffa8c6; --m1d: #c33c70;
  --m2: #ee5b93; --m2l: #ff9dbf; --m2d: #b93068;
  --accent: #f4699a; --accent2: #ff9dbf;
  --aura1: rgba(244,105,154,.34); --aura2: rgba(196,44,110,.18);
}
body[data-level='0'] { --sat: 1;   --bri: 1;   --glow: 14px; --auraA: .7; }  /* вне уровней */
body[data-level='1'] { --sat: .78; --bri: .9;  --glow: 0px;  --auraA: .4; }
body[data-level='2'] { --sat: 1.02;--bri: 1;   --glow: 12px; --auraA: .75; }
body[data-level='3'] { --sat: 1.25;--bri: 1.14;--glow: 30px; --auraA: 1; }

/* ── фоновое свечение ── */
.aura {
  position: fixed; inset: -20%;
  background:
    radial-gradient(42% 34% at 28% 22%, var(--aura1), transparent 70%),
    radial-gradient(46% 38% at 76% 78%, var(--aura2), transparent 72%);
  opacity: var(--auraA, .6);
  filter: blur(10px);
  transition: opacity .6s ease, background .6s ease;
  animation: drift 18s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes drift { from { transform: translate3d(-2%, -1%, 0) scale(1); } to { transform: translate3d(3%, 2%, 0) scale(1.06); } }

/* ───────────────────────── экраны ───────────────────────── */
.screen {
  position: fixed; inset: 0;
  display: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: max(14px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
}
body[data-screen='setup']  #s-setup,
body[data-screen='home']   #s-home,
body[data-screen='levels'] #s-levels,
body[data-screen='game']   #s-game { display: block; animation: screenIn .42s cubic-bezier(.2,.9,.3,1); }
@keyframes screenIn { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }

.wrap { max-width: 460px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; gap: 14px; }
.game-wrap { gap: 10px; }

/* ───────────────────────── шапки ───────────────────────── */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.icon-btn {
  width: 42px; height: 42px; flex: none;
  border-radius: 14px; border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.05); color: #fff;
  font-size: 20px; line-height: 1; cursor: pointer;
  transition: transform .15s, background .2s;
}
.icon-btn:active { transform: scale(.9); background: rgba(255,255,255,.12); }
.icon-btn.ghost { opacity: 0; pointer-events: none; border: 0; background: none; }
.brand-mini, .lvpill {
  font-weight: 700; letter-spacing: .04em; font-size: 15px;
  color: var(--accent); text-transform: uppercase;
}
.lvpill {
  padding: 8px 14px; border-radius: 999px; text-transform: none; font-size: 13px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 34%, transparent);
}

.logo-row { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
.logo { width: 68px; height: 68px; border-radius: 20px; box-shadow: 0 8px 26px rgba(0,0,0,.45); }
.brand { margin: 0; font-size: 34px; letter-spacing: .02em;
  background: linear-gradient(100deg, #f6c338, #f4699a);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-sub { margin: 2px 0 0; font-size: 13px; opacity: .55; }

.title { margin: 2px 0 0; font-size: 21px; font-weight: 700; text-align: center; }

/* ───────────────────────── маскот ───────────────────────── */
.mascot-slot { display: flex; justify-content: center; }
.mascot-slot .cham { width: 190px; height: 190px; }
.mascot-slot.big .cham { width: 230px; height: 230px; }
.mascot-slot.game .cham { width: 128px; height: 128px; }
.sheet-mascot .cham { width: 110px; height: 110px; }

.cham {
  filter: saturate(var(--sat)) brightness(var(--bri))
          drop-shadow(0 0 var(--glow) color-mix(in srgb, var(--accent) 55%, transparent));
  transition: filter .55s ease;
  animation: bob 4.6s ease-in-out infinite;
  overflow: visible;
}
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-7px) rotate(-1.4deg); }
}
.cham .body { transform-origin: 98px 168px; animation: breathe 3.4s ease-in-out infinite; }
@keyframes breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.03, .975); } }
.cham .tail { transform-origin: 78px 158px; animation: tailwag 5.2s ease-in-out infinite; }
@keyframes tailwag { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(-8deg); } }
.cham .head, .cham .crest, .cham .crest-teeth {
  animation: headtilt 6.5s ease-in-out infinite; transform-origin: 102px 104px; }
@keyframes headtilt { 0%,100% { transform: rotate(0deg); } 35% { transform: rotate(3.2deg); } 70% { transform: rotate(-2.6deg); } }
.cham .leaf { transform-origin: 196px 166px; animation: leafwave 4.2s ease-in-out infinite; }
@keyframes leafwave { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(-7deg); } }
.cham .pupil { transform: translate(var(--px, 0), var(--py, 0)); transition: transform .35s cubic-bezier(.2,.9,.3,1); }
.cham .lid { transform-origin: center; transform: scaleY(0); animation: blink 5.4s infinite; }
@keyframes blink {
  0%, 92%, 100% { transform: scaleY(0); }
  94%, 96%      { transform: scaleY(1.05); }
}
.cham .arm-l { transform-origin: 76px 118px; animation: waveL 5s ease-in-out infinite; }
@keyframes waveL { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(-7deg); } }
.cham .arm-r { transform-origin: 124px 122px; animation: waveR 5.8s ease-in-out infinite; }
@keyframes waveR { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(6deg); } }
.cham .halo { animation: halo 5s ease-in-out infinite; transform-origin: 100px 100px; }
@keyframes halo { 0%,100% { opacity: .55; transform: scale(.94); } 50% { opacity: .95; transform: scale(1.04); } }
.cham .qmark {
  font: 800 40px/1 -apple-system, 'SF Pro Display', sans-serif;
  fill: var(--m1l); paint-order: stroke; stroke: var(--m1d); stroke-width: 2.4px;
}
.cham .heart { fill: #ef3b52; stroke: #b81f36; stroke-width: 2px; }
.cham .hold { animation: hold 3.8s ease-in-out infinite; }
.cham .hold-h { animation-delay: -1.6s; }
@keyframes hold { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-5px) rotate(4deg); } }

/* предмет в лапе зависит от раздела */
body[data-cat='fun']     .cham .hold-h { display: none; }
body[data-cat='romance'] .cham .hold-q { display: none; }

/* ── раздумья ── */
.cham .think { opacity: 0; }
.cham .think-d, .cham .think-bubble ellipse { fill: #fffdf7; }
.cham .think-q { font: 800 24px/1 -apple-system, 'SF Pro Display', sans-serif;
  fill: var(--m2d); text-anchor: middle; }
.cham.is-thinking .think { opacity: 1; }
.cham.is-thinking .think-d,
.cham.is-thinking .think-bubble { transform-box: fill-box; transform-origin: center; }
.cham.is-thinking .think-d { animation: thinkPop .32s both; }
.cham.is-thinking .think-d + .think-d { animation-delay: .13s; }
.cham.is-thinking .think-bubble { animation: thinkPop .36s .26s both, bubbleFloat 1.3s .62s ease-in-out infinite; }
@keyframes thinkPop { from { opacity: 0; transform: scale(.2); } to { opacity: 1; transform: scale(1); } }
@keyframes bubbleFloat { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-5px) rotate(3deg); } }
.cham.is-thinking .head, .cham.is-thinking .crest, .cham.is-thinking .crest-teeth {
  animation: thinkTilt .9s ease-in-out infinite alternate; }
@keyframes thinkTilt { from { transform: rotate(-5deg); } to { transform: rotate(5deg); } }

/* ── указание лапой ── */
.cham .point-arm { display: none; }
.cham.point-left  .point-arm-l { display: block; transform-origin: 76px 120px;
  animation: pointL .5s cubic-bezier(.2,1.5,.4,1) both, jabL .5s .5s ease-in-out 2; }
.cham.point-right .point-arm-r { display: block; transform-origin: 124px 120px;
  animation: pointR .5s cubic-bezier(.2,1.5,.4,1) both, jabR .5s .5s ease-in-out 2; }
.cham.point-left .arm-l, .cham.point-right .arm-r { display: none; }
@keyframes pointL { 0% { opacity: 0; transform: rotate(38deg) scale(.55); } 100% { opacity: 1; transform: none; } }
@keyframes pointR { 0% { opacity: 0; transform: rotate(-38deg) scale(.55); } 100% { opacity: 1; transform: none; } }
@keyframes jabL { 0%,100% { transform: translateX(0); } 50% { transform: translateX(-7px); } }
@keyframes jabR { 0%,100% { transform: translateX(0); } 50% { transform: translateX(7px); } }

.cham.is-pop { animation: pop .55s cubic-bezier(.3,1.4,.4,1); }
@keyframes pop {
  0% { transform: scale(1); } 35% { transform: scale(1.12, .9) translateY(4px); }
  65% { transform: scale(.95, 1.08) translateY(-8px); } 100% { transform: scale(1); }
}
.cham.is-shake { animation: shake .6s ease-in-out; }
@keyframes shake {
  0%,100% { transform: translateX(0) rotate(0); }
  20% { transform: translateX(-8px) rotate(-4deg); }
  45% { transform: translateX(7px) rotate(4deg); }
  70% { transform: translateX(-4px) rotate(-2deg); }
}
@media (prefers-reduced-motion: reduce) { .cham, .cham * { animation: none !important; } }

/* ───────────────────────── формы ───────────────────────── */
.field { background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08);
  border-radius: 20px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.field label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; opacity: .5; }
.field input {
  background: transparent; border: 0; border-bottom: 2px solid rgba(255,255,255,.14);
  color: #fff; font-size: 19px; padding: 6px 2px; outline: none; font-family: inherit;
  user-select: text; -webkit-user-select: text;
}
.field input:focus { border-color: var(--accent); }
.seg { display: flex; gap: 8px; }
.seg button {
  flex: 1; padding: 11px; border-radius: 13px; font-size: 15px; font-family: inherit;
  border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.04);
  color: #fff; cursor: pointer; transition: .2s;
}
.seg button.on { background: color-mix(in srgb, var(--accent) 22%, transparent);
  border-color: var(--accent); color: #fff; font-weight: 600; }

/* ───────────────────────── кнопки ───────────────────────── */
.btn {
  width: 100%; padding: 17px; border-radius: 19px; border: 0;
  font-family: inherit; font-size: 17px; font-weight: 650; color: #1a1119;
  cursor: pointer; transition: transform .14s ease, filter .2s, opacity .2s;
}
.btn:active { transform: scale(.965); filter: brightness(1.08); }
.btn-primary { background: linear-gradient(100deg, var(--accent), var(--accent2)); }
.btn-ghost { background: rgba(255,255,255,.07); color: #fff; border: 1px solid rgba(255,255,255,.1); }
.btn-truth { background: linear-gradient(120deg, #7ad0ff, #4aa8f0); color: #06212f; }
.btn-dare  { background: linear-gradient(120deg, #ffcf5c, #ff9d4d); color: #2f1b02; }
body[data-cat='romance'] .btn-truth { background: linear-gradient(120deg, #ffb3d0, #f4699a); color: #34071b; }
body[data-cat='romance'] .btn-dare  { background: linear-gradient(120deg, #ff8ab0, #e0417d); color: #fff; }
.btn-done { background: linear-gradient(120deg, #8fe6a3, #4bc47a); color: #06280f; }
.btn-fail { background: rgba(255,255,255,.07); color: #ffd4d4; border: 1px solid rgba(255,120,120,.3); font-size: 15px; }

/* ───────────────────────── главная ───────────────────────── */
.mode {
  display: flex; align-items: center; gap: 15px; width: 100%; text-align: left;
  padding: 18px; border-radius: 24px; cursor: pointer; font-family: inherit;
  border: 1px solid rgba(255,255,255,.1); color: #fff;
  background: rgba(255,255,255,.045);
  transition: transform .16s, border-color .25s, background .25s;
}
.mode:active { transform: scale(.975); }
.mode-fun { border-color: rgba(246,195,56,.36); background: linear-gradient(100deg, rgba(246,195,56,.18), rgba(246,195,56,.05)); }
.mode-romance { border-color: rgba(244,105,154,.36); background: linear-gradient(100deg, rgba(244,105,154,.2), rgba(244,105,154,.05)); }
.mode-emoji { font-size: 32px; }
.mode-text { display: flex; flex-direction: column; gap: 3px; }
.mode-name { font-size: 20px; font-weight: 700; }
.mode-desc { font-size: 13px; opacity: .6; }
.tag18 { font-size: 11px; padding: 2px 7px; border-radius: 7px; background: #e0417d; vertical-align: middle; margin-left: 6px; }
.players-line { text-align: center; font-size: 13px; opacity: .45; margin: auto 0 4px; }

/* ───────────────────────── уровни ───────────────────────── */
.level {
  display: flex; align-items: center; gap: 16px; width: 100%; text-align: left;
  padding: 16px 18px; border-radius: 22px; cursor: pointer; font-family: inherit; color: #fff;
  border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.045);
  transition: transform .16s, border-color .25s;
}
.level:active { transform: scale(.975); }
.level-num {
  width: 46px; height: 46px; flex: none; border-radius: 16px;
  display: grid; place-items: center; font-size: 21px; font-weight: 800; color: #1a1119;
  background: linear-gradient(120deg, var(--accent), var(--accent2));
}
.level[data-lv='1'] .level-num { opacity: .55; }
.level[data-lv='2'] .level-num { opacity: .8; }
.level[data-lv='3'] .level-num { box-shadow: 0 0 22px color-mix(in srgb, var(--accent) 60%, transparent); }
.level-text { display: flex; flex-direction: column; gap: 3px; }
.level-text b { font-size: 17px; }
.level-text i { font-style: normal; font-size: 13px; opacity: .55; }

/* ───────────────────────── игра ───────────────────────── */
.turn { text-align: center; font-size: 15px; opacity: .85; }
.turn span { font-weight: 700; color: var(--accent); font-size: 18px; }
.turn i { font-style: normal; opacity: .55; margin-left: 6px; }

.stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 0; }

.card {
  width: 100%; border-radius: 26px; padding: 24px 22px;
  background: linear-gradient(160deg, rgba(255,255,255,.11), rgba(255,255,255,.04));
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 18px 50px rgba(0,0,0,.45);
  display: flex; flex-direction: column; gap: 16px; align-items: center;
  min-height: 190px; justify-content: center;
  opacity: 0; transform: rotateX(-90deg) translateY(20px); transform-origin: top center;
  pointer-events: none;
}
.card.show { opacity: 1; transform: none; pointer-events: auto;
  animation: cardIn .55s cubic-bezier(.2,1.1,.35,1); }
@keyframes cardIn {
  0%   { opacity: 0; transform: rotateX(-80deg) translateY(24px) scale(.94); }
  60%  { opacity: 1; transform: rotateX(8deg) translateY(0) scale(1.01); }
  100% { transform: none; }
}
.card-kind {
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700;
  padding: 6px 13px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--accent2);
}
.card-kind.punish { background: rgba(255,86,86,.16); border-color: rgba(255,86,86,.4); color: #ff9d9d; }
.card-text { margin: 0; font-size: 20px; line-height: 1.42; text-align: center; font-weight: 500; }

.timer {
  display: flex; align-items: center; gap: 12px; padding: 10px 18px 10px 10px;
  border-radius: 999px; cursor: pointer; font-family: inherit; font-size: 15px; color: #fff;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14);
  transition: transform .15s;
}
.timer:active { transform: scale(.95); }
.timer.run { border-color: var(--accent); }
.timer-ring { position: relative; width: 40px; height: 40px; display: grid; place-items: center; }
.timer-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.timer-ring circle { fill: none; stroke-width: 3.4; }
.tr-bg { stroke: rgba(255,255,255,.14); }
.tr-fg { stroke: var(--accent); stroke-dasharray: 100.5; stroke-dashoffset: 0; stroke-linecap: round; transition: stroke-dashoffset .95s linear; }
.timer-ring b { font-size: 13px; font-weight: 700; position: relative; }
.timer.done { border-color: #4bc47a; }
.timer.done .tr-fg { stroke: #4bc47a; }

.choices { display: flex; gap: 12px; }
.resolve { display: flex; flex-direction: column; gap: 10px; }

/* ───────────────────────── передача хода ───────────────────────── */
.turnover {
  position: fixed; inset: 0; z-index: 45; display: grid; place-items: center;
  background: rgba(9,6,13,.88);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  animation: fade .28s ease;
}
.turnover.out { animation: fadeOut .32s ease forwards; }
@keyframes fadeOut { to { opacity: 0; } }
.to-inner { width: 100%; max-width: 460px; padding: 0 14px;
  display: flex; flex-direction: column; align-items: center; gap: 20px; }
.to-row { display: flex; align-items: center; justify-content: center; gap: 4px; width: 100%; }
.to-mascot { flex: none; }
.to-mascot .cham { width: 168px; height: 168px; }
.to-chip {
  flex: 1; min-width: 0; text-align: center; padding: 15px 8px; border-radius: 18px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.09);
  font-size: 17px; font-weight: 650; color: #fff; opacity: .38;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: opacity .45s ease, transform .55s cubic-bezier(.2,1.5,.35,1),
              background .45s ease, border-color .45s ease, box-shadow .45s ease;
}
.to-chip.picked {
  opacity: 1; transform: scale(1.12);
  background: color-mix(in srgb, var(--accent) 26%, transparent);
  border-color: var(--accent);
  box-shadow: 0 0 34px color-mix(in srgb, var(--accent) 45%, transparent);
}
.to-caption { margin: 0; font-size: 15px; opacity: .55; min-height: 26px; transition: .35s; text-align: center; }
.to-caption.strong { opacity: 1; font-size: 20px; font-weight: 700; color: var(--accent); }

/* ───────────────────────── модалки ───────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: end center;
  background: rgba(8,5,11,.66); backdrop-filter: blur(9px); -webkit-backdrop-filter: blur(9px);
  animation: fade .3s ease;
  padding: 16px;
}
.modal[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  width: 100%; max-width: 460px; border-radius: 28px; padding: 24px 20px max(24px, env(safe-area-inset-bottom));
  background: linear-gradient(170deg, #241a2b, #17111d);
  border: 1px solid rgba(255,255,255,.12);
  display: flex; flex-direction: column; gap: 12px; align-items: center;
  animation: sheetIn .42s cubic-bezier(.2,1,.3,1);
}
@keyframes sheetIn { from { transform: translateY(60px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet h3 { margin: 0; font-size: 20px; text-align: center; }
.sheet p { margin: 0; font-size: 15px; opacity: .65; text-align: center; line-height: 1.45; }
.sheet .btn { margin-top: 4px; }

.score { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.score-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px; border-radius: 17px; background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
}
.score-row b { font-size: 17px; }
.score-nums { display: flex; gap: 14px; font-size: 14px; }
.score-nums span { opacity: .75; }
.score-nums i { font-style: normal; font-weight: 700; }
.score-nums .ok i { color: #7fe0a0; }
.score-nums .no i { color: #ff9d9d; }

.row-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; border-radius: 16px; background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08); font-size: 15px;
}
.row-toggle input { width: 46px; height: 28px; appearance: none; -webkit-appearance: none;
  background: rgba(255,255,255,.16); border-radius: 999px; position: relative; transition: .25s; cursor: pointer; }
.row-toggle input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; transition: .25s; }
.row-toggle input:checked { background: var(--accent); }
.row-toggle input:checked::after { transform: translateX(18px); }

@media (max-height: 700px) {
  .mascot-slot .cham { width: 150px; height: 150px; }
  .mascot-slot.big .cham { width: 176px; height: 176px; }
  .mascot-slot.game .cham { width: 98px; height: 98px; }
  .card-text { font-size: 18px; }
}
