:root {
  --bg: #fff6f6; --card: #ffffff; --ink: #161616; --muted: #6b6b6b; --line: #ececec;
  --red: #d63a3f; --red-d: #a8242a; --red-l: #fdeeee; --red-m: #f6c9cc;
  --green: #1f9d55; --green-d: #157140; --green-l: #e6f7ec; --green-m: #bfe8cf;
  --blue: #2f6fd6; --blue-l: #d8e6fb; --yellow: #f5a524; --yellow-l: #fde7bd; --grey: #f1f1f1;
  --font: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background: radial-gradient(130% 60% at 50% 0%, #ffffff 0%, var(--bg) 60%, #ffeef0 100%); background-color: var(--bg);
  color: var(--ink); font-family: var(--font); -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overscroll-behavior: none;
}
button, input { font-family: inherit; }
button { touch-action: manipulation; cursor: pointer; }
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }

.app {
  /* najpierw 100% — zapas dla iOS < 15.4 i Chrome < 108, które nie znają dvh i pominęłyby całą deklarację */
  position: relative; z-index: 1; max-width: 460px; height: 100%; height: 100dvh; margin: 0 auto; display: flex; flex-direction: column;
  padding: max(6px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}
.top { display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; height: 46px; flex: none; }
.brand { grid-column: 2; text-align: center; font: 900 22px/1 var(--font); color: var(--red); letter-spacing: -.01em; white-space: nowrap; }
.sound { grid-column: 3; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--card); box-shadow: 0 2px 0 var(--line), inset 0 0 0 2px var(--line); font-size: 17px; }
.stage { position: relative; flex: 1; min-height: 0; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transform: translateY(8px); transition: opacity .25s, transform .25s, visibility 0s .25s; }
.screen.active { opacity: 1; visibility: visible; transform: none; transition: opacity .25s, transform .25s; }

/* ---------------------------------------------------------------- wspólne */
.btn { width: 100%; max-width: 340px; min-height: 50px; padding: 0 18px; border-radius: 16px; border: 0; font: 800 17px var(--font); color: var(--ink); }
.btn-red { background: var(--red-m); box-shadow: inset 0 0 0 3px var(--red), 0 4px 0 var(--red-d); }
.btn-red:active { transform: translateY(3px); box-shadow: inset 0 0 0 3px var(--red), 0 1px 0 var(--red-d); }
.btn-outline { background: var(--card); color: var(--blue); box-shadow: inset 0 0 0 3px var(--blue), 0 4px 0 #b7cdf1; }
.btn-outline:active { transform: translateY(3px); box-shadow: inset 0 0 0 3px var(--blue), 0 1px 0 #b7cdf1; }
.btn-ghost { background: none; min-height: 40px; color: var(--muted); font-size: 15px; text-decoration: underline; }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 34px; padding: 0 13px; border-radius: 99px; font: 800 16px var(--font); }
.pill-streak { background: var(--yellow-l); }
.pill.bump { animation: bump .4s cubic-bezier(.3,1.8,.5,1); }
@keyframes bump { 40% { transform: scale(1.15); } }

/* czat i karty */
.chat-head { display: flex; align-items: center; gap: 12px; width: 100%; padding: 4px 4px 10px; border-bottom: 2px solid var(--line); flex: none; }
.ava { width: 50px; height: 50px; flex: none; display: grid; place-items: center; border-radius: 50%; background: #d4e3f8; font-size: 28px; line-height: 1; }
.who { display: flex; flex-direction: column; min-width: 0; }
.who b { font: 900 19px/1.15 var(--font); }
.who small { font: 700 14px/1.3 var(--font); color: #16a34a; }
.bubble { position: relative; max-width: 86%; border-radius: 20px; font: 600 16px/1.3 var(--font); overflow-wrap: anywhere; }
.bubble.mine { align-self: flex-end; padding: 8px 14px; background: var(--blue-l); border-bottom-right-radius: 6px; }
.bubble.theirs { align-self: flex-start; background: var(--grey); box-shadow: inset 0 0 0 2px #e2e2e2; border-bottom-left-radius: 8px; }
.bubble.big { padding: 18px 22px 26px; font: 800 26px/1.18 var(--font); max-width: 94%; }
.bubble.big .tm { position: absolute; right: 14px; bottom: 6px; font: 600 12px var(--font); color: #8a8a8a; }
.bubble.flag-r { background: var(--red-l); box-shadow: inset 0 0 0 3px var(--red); }
.bubble.flag-g { background: var(--green-l); box-shadow: inset 0 0 0 3px var(--green); }
.stamp { position: absolute; top: -30px; right: -6px; padding: 3px 10px; border-radius: 10px; font: 900 21px/1.1 var(--font); font-style: normal; letter-spacing: .02em; white-space: nowrap;
  color: var(--red); background: rgba(255,255,255,.92); box-shadow: inset 0 0 0 4px currentColor; transform: rotate(-11deg); }
.stamp.r { color: var(--red); }
.stamp.g { color: var(--green); }
.stamp.in { animation: stamp-in .4s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes stamp-in { 0% { transform: rotate(-11deg) scale(2.2); opacity: 0; } 100% { transform: rotate(-11deg) scale(1); opacity: 1; } }
#stamp:empty { display: none; }
#card.has-ctx .stamp { top: auto; bottom: -24px; } /* nad kartą jest dymek gracza — pieczątka schodzi na dół */

/* ---------------------------------------------------------------- powitanie */
.hero { display: flex; flex-direction: column; align-items: center; gap: 22px; width: 100%; max-width: 360px; margin-top: -4vh; }
.hero-chat { display: flex; flex-direction: column; gap: 14px; width: 100%; padding: 14px; border-radius: 26px; background: var(--card); box-shadow: 0 10px 30px rgba(214,58,63,.12), inset 0 0 0 2px var(--line); }
.hero-chat .bubble.big { margin-top: 10px; animation: wobble 3s ease-in-out infinite; }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-1.5deg) translateX(-4px); } }
.hero-sub { margin: 0; text-align: center; font: 700 16px var(--font); color: var(--muted); }

/* ---------------------------------------------------------------- menu */
#s-menu { gap: 10px; justify-content: flex-start; overflow-y: auto; overflow-x: hidden; padding: 6px 0 10px; }
#s-menu::before, #s-menu::after { content: ''; flex: 1 1 0; } /* wyśrodkowanie, a przy braku miejsca — przewijanie */
.title { margin: 0; font: 900 30px/1 var(--font); letter-spacing: -.01em; text-align: center; }
.lead { margin: 0 0 4px; max-width: 360px; text-align: center; font: 500 15px/1.4 var(--font); color: var(--muted); }
.lead b { color: var(--ink); }
.mode { display: flex; align-items: center; gap: 14px; width: 100%; max-width: 360px; min-height: 66px; padding: 9px 16px; border-radius: 20px; border: 0; text-align: left; color: var(--ink); flex: none;
  background: var(--red-m); box-shadow: inset 0 0 0 3px var(--red), 0 5px 0 var(--red-d); }
.mode:active { transform: translateY(3px); box-shadow: inset 0 0 0 3px var(--red), 0 2px 0 var(--red-d); }
.mode.daily { background: var(--green-m); box-shadow: inset 0 0 0 3px var(--green), 0 5px 0 var(--green-d); }
.mode.daily:active { box-shadow: inset 0 0 0 3px var(--green), 0 2px 0 var(--green-d); }
.mode.spicy { background: linear-gradient(100deg, #ffe3cf, #ffd0d6); box-shadow: inset 0 0 0 3px #ef6a2e, 0 5px 0 #b8481a; }
.mode.spicy:active { box-shadow: inset 0 0 0 3px #ef6a2e, 0 2px 0 #b8481a; }
.m-ico { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 14px; background: rgba(255,255,255,.75); font-size: 22px; }
.m-txt { display: flex; flex-direction: column; min-width: 0; }
.m-txt b { font: 900 19px/1.15 var(--font); }
.m-txt small { font: 600 13px/1.3 var(--font); color: #3b3b3b; }
.age-badge { display: inline-block; margin-left: 4px; padding: 1px 6px; border-radius: 6px; background: var(--ink); color: #fff; font: 800 11px/1.4 var(--font); font-style: normal; vertical-align: 3px; }
.stages-box { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 6px; flex: none; }
.stages-lbl { font: 700 12.5px var(--font); color: var(--muted); text-align: center; }
.stages { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.st { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 2px 6px; border-radius: 14px; border: 0; background: var(--card); box-shadow: inset 0 0 0 2px var(--red-m); color: var(--ink); }
.st .st-ico { font-size: 21px; line-height: 1; }
.st .st-name { width: 100%; padding: 0 2px; font: 700 10.5px/1.15 var(--font); text-align: center; overflow-wrap: normal; word-break: normal; overflow: hidden; }
.st.locked { background: #f4f4f4; box-shadow: inset 0 0 0 2px var(--line); color: #a3a3a3; }
.st.locked .st-ico { filter: grayscale(1); opacity: .45; }
.st.locked::after { content: '🔒'; position: absolute; top: -5px; right: -3px; font-size: 13px; }
.st:not(.locked):active { transform: translateY(2px); }
.name-row { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 360px; padding: 8px 12px; border-radius: 16px; background: var(--card); box-shadow: inset 0 0 0 2px var(--line); font: 700 13px var(--font); color: var(--muted); flex: none; }
.name-row span { flex: none; max-width: 48%; }
.name-row input { flex: 1; min-width: 0; height: 34px; padding: 0 10px; border-radius: 10px; border: 2px solid var(--line); font: 700 15px var(--font); color: var(--ink); outline: none; user-select: text; -webkit-user-select: text; }
.name-row input:focus { border-color: var(--red); }
.rules { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.rules span { padding: 5px 10px; border-radius: 99px; background: var(--card); box-shadow: inset 0 0 0 2px var(--line); font: 700 12px var(--font); color: var(--muted); }
.duel-invite { width: 100%; max-width: 360px; padding: 12px; border-radius: 20px; background: var(--card); box-shadow: inset 0 0 0 3px var(--green), 0 5px 0 var(--green-d); display: flex; flex-direction: column; gap: 10px; flex: none; animation: bump .5s ease; }
.di-top { display: flex; align-items: center; gap: 12px; }
.di-ava { width: 50px; height: 50px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--green-l); box-shadow: inset 0 0 0 3px var(--green); font-size: 26px; }
.di-top b { display: block; font: 900 16px/1.2 var(--font); }
.di-top span { font: 600 13px/1.3 var(--font); color: var(--muted); }
.duel-invite .btn { max-width: none; }

/* ---------------------------------------------------------------- gra */
#s-play { justify-content: flex-start; gap: 6px; }
.hud { display: flex; align-items: center; justify-content: space-between; width: 100%; flex: none; gap: 8px; }
.hearts { font-size: 19px; letter-spacing: 1px; white-space: nowrap; }
.hearts i { font-style: normal; display: inline-block; }
.hearts i.lost { filter: grayscale(1); opacity: .3; }
.hearts i.pop { animation: heart-out .6s ease; }
@keyframes heart-out { 30% { transform: scale(1.5); } }
.dashes { display: flex; gap: 5px; }
.dashes i { width: 22px; height: 8px; border-radius: 4px; background: #e6e6e6; }
.dashes i.on { background: var(--red); }
.dashes i.cur { background: #f2a3a6; animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .45; } }
.meta { display: flex; justify-content: space-between; align-items: center; width: 100%; flex: none; font: 800 12px var(--font); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.score-lbl { text-transform: none; letter-spacing: 0; font-size: 15px; color: var(--ink); }
.score-lbl.bump { display: inline-block; animation: bump .4s cubic-bezier(.3,1.8,.5,1); }
.chat { display: flex; flex-direction: column; width: 100%; flex: 1; min-height: 0; }
.chat-body { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 14px 0 8px; }
.card-wrap { display: flex; flex-direction: column; width: 100%; }
#card { touch-action: none; cursor: grab; will-change: transform; transition: transform .35s cubic-bezier(.2,1.3,.4,1), opacity .3s; }
#card.dragging { transition: none; cursor: grabbing; }
#card.fly { transition: transform .38s cubic-bezier(.5,0,.9,.5), opacity .38s; opacity: 0; }
#card.enter { animation: card-in .38s cubic-bezier(.2,1.3,.4,1) both; }
@keyframes card-in { from { transform: translateY(26px) scale(.94); opacity: 0; } }
#card.s-m { font-size: 23px; }
#card.s-s { font-size: 20px; }
#card.s-xs { font-size: 18px; }
/* fragment profilu: karta „O mnie” zamiast dymka */
#card.profile { align-self: center; text-align: center; min-width: 70%; padding: 30px 22px 24px; border-radius: 26px; background: var(--card); box-shadow: inset 0 0 0 2px #f0d6d8, 0 6px 0 #f3dfe1; }
#card.profile.tag { font-size: 32px; }
#card.profile .tm { display: none; }
#card.profile.flag-r { background: var(--red-l); box-shadow: inset 0 0 0 3px var(--red), 0 6px 0 #f3c9cc; }
#card.profile.flag-g { background: var(--green-l); box-shadow: inset 0 0 0 3px var(--green), 0 6px 0 #c8ead6; }
.about { position: absolute; top: 9px; left: 0; right: 0; text-align: center; font: 800 11px var(--font); letter-spacing: .14em; text-transform: uppercase; color: var(--red); opacity: .7; }
.drag-tag { position: absolute; top: 50%; font-size: 46px; font-style: normal; opacity: 0; transform: translateY(-50%); pointer-events: none; }
.drag-tag.r { left: -6px; }
.drag-tag.g { right: -6px; }
.ask { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; flex: none; padding-bottom: 4px; }
.question { margin: 0; font: 800 17px var(--font); color: #3b3b3b; }
.choices { display: flex; justify-content: center; gap: 54px; }
.choice { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 0; background: none; padding: 0; color: var(--muted); }
.choice .c-ico { width: 74px; height: 74px; display: grid; place-items: center; border-radius: 50%; background: var(--card); font-size: 34px; transition: transform .12s; }
.choice.red .c-ico { box-shadow: inset 0 0 0 4px var(--red), 0 4px 0 var(--red-m); }
.choice.green .c-ico { box-shadow: inset 0 0 0 4px var(--green), 0 4px 0 var(--green-m); }
.choice:active .c-ico, .choice.hot .c-ico { transform: scale(1.12); }
.choice.red.hot .c-ico { background: var(--red-l); }
.choice.green.hot .c-ico { background: var(--green-l); }
.choice small { font: 700 13px var(--font); }
.verdict { display: flex; flex-direction: column; gap: 10px; width: 100%; flex: none; animation: card-in .35s cubic-bezier(.2,1.3,.4,1) both; }
.v-box { display: flex; flex-direction: column; gap: 4px; padding: 12px 16px 13px; border-radius: 18px; background: var(--red-l); box-shadow: inset 6px 0 0 var(--red); text-align: center; }
.v-box.g { background: var(--green-l); box-shadow: inset 6px 0 0 var(--green); }
.v-head { font: 900 17px/1.25 var(--font); }
.v-phrase { font: 800 17px/1.25 var(--font); }
.v-expl { font: 600 15px/1.35 var(--font); color: #3b3b3b; }
.v-btns { display: flex; gap: 10px; }
.v-btns .btn { flex: 1; min-height: 48px; border-radius: 99px; font-size: 16px; }
.floats { position: fixed; inset: 0; pointer-events: none; z-index: 35; }
.float { position: absolute; left: 50%; padding: 6px 14px; border-radius: 99px; font: 900 18px var(--font); white-space: nowrap; transform: translateX(-50%); animation: float-up 1.1s ease-out forwards; }
.float.good { background: var(--green-m); color: #0f4d2b; }
.float.bad { background: var(--red-m); color: #6b1418; }
@keyframes float-up { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.8); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.05); } 100% { opacity: 0; transform: translate(-50%, -46px); } }
.stage-up { position: absolute; left: 50%; top: 38%; z-index: 6; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 240px; padding: 16px 22px; border-radius: 22px;
  background: var(--card); box-shadow: 0 14px 40px rgba(214,58,63,.25), inset 0 0 0 3px var(--red); text-align: center; transform: translate(-50%, -50%); animation: su-in .45s cubic-bezier(.2,1.5,.4,1) both; }
.stage-up b { font: 900 20px var(--font); color: var(--red); }
.stage-up span { font: 700 15px var(--font); }
.su-ico { font-size: 36px; }
@keyframes su-in { from { opacity: 0; transform: translate(-50%, -50%) scale(.6); } }

/* ---------------------------------------------------------------- finał */
#s-final { gap: 8px; }
.f-label { margin: 0; font: 800 19px var(--font); color: #4a4a4a; }
.gauge { position: relative; width: 250px; height: 150px; }
.gauge svg { width: 100%; height: auto; display: block; }
#gauge-arc { transition: stroke-dasharray 1.4s cubic-bezier(.3,.8,.3,1); }
.g-pct { position: absolute; left: 0; right: 0; bottom: 18px; text-align: center; font: 900 54px/1 var(--font); }
.f-title { display: inline-block; padding: 8px 18px; border-radius: 99px; background: #fbdcdf; font: 900 20px var(--font); }
.f-stage { margin: 0; font: 600 15px var(--font); color: var(--muted); text-align: center; }
.duel { width: 100%; max-width: 340px; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px; border-radius: 20px; background: var(--card); box-shadow: inset 0 0 0 2px var(--line); }
.duel-agree { font: 900 17px var(--font); color: var(--green-d); text-align: center; }
.duel-row { display: flex; align-items: center; justify-content: space-around; width: 100%; }
.duel-p { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 90px; padding-top: 18px; }
.duel-p b { font: 700 14px var(--font); color: var(--muted); }
.duel-p strong { font: 900 30px var(--font); }
.crown { position: absolute; top: -6px; font-size: 20px; line-height: 1; opacity: 0; }
.crown.on { opacity: 1; }
.vs { font: 900 16px var(--font); color: var(--red); }
.duel-out { font: 800 15px var(--font); }
.final-stats { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.final-stats span { padding: 6px 12px; border-radius: 99px; background: var(--card); box-shadow: inset 0 0 0 2px var(--line); font: 700 14px var(--font); }
.grid-daily { font-size: 22px; letter-spacing: 2px; }
.grid-daily:empty { display: none; }

/* ---------------------------------------------------------------- okna */
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; background: rgba(40,12,16,.45); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.modal-card { width: 100%; max-width: 340px; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 22px 20px 14px; border-radius: 24px; background: var(--card); text-align: center; animation: su-in2 .35s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes su-in2 { from { opacity: 0; transform: scale(.85); } }
.modal-title { font: 900 21px var(--font); }
.modal-card p { margin: 0 0 6px; font: 600 15px/1.4 var(--font); color: #444; }

/* niskie ekrany */
@media (max-height: 660px) {
  .top { height: 40px; }
  .brand { font-size: 20px; }
  .ava { width: 42px; height: 42px; font-size: 24px; }
  .who b { font-size: 17px; }
  .chat-head { padding-bottom: 7px; }
  .chat-body { gap: 10px; padding-top: 12px; }
  .bubble.big { padding: 14px 18px 22px; font-size: 23px; }
  #card.s-m { font-size: 21px; } #card.s-s { font-size: 18px; } #card.s-xs { font-size: 16.5px; }
  #card.profile { padding: 26px 18px 20px; }
  #card.profile.tag { font-size: 28px; }
  .choice .c-ico { width: 64px; height: 64px; font-size: 30px; }
  .question { font-size: 16px; }
  .v-box { padding: 10px 14px; }
  .v-head, .v-phrase { font-size: 16px; }
  .v-expl { font-size: 14px; }
  .mode { min-height: 58px; }
  .m-ico { width: 38px; height: 38px; font-size: 19px; }
  .m-txt b { font-size: 17px; }
  .lead { font-size: 14px; }
  .title { font-size: 26px; }
  .gauge { width: 220px; height: 132px; }
  .g-pct { font-size: 46px; bottom: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
