:root{
  --bg-deep: #23091a;
  --bg-mid: #33101f;
  --velvet: #3a1220;
  --gold: #d8b168;
  --gold-bright: #f3d99a;
  --blush: #f3d7d0;
  --cream: #f8ece0;
  --ink: #1c0b12;

  --common: #d9a8b3;
  --rare: #8fb8c9;
  --epic: #b58ce0;
  --legendary-a: #ffd77a;
  --legendary-b: #ff9a56;

  --radius: 18px;
  --shadow-soft: 0 20px 45px rgba(0,0,0,.45);
  --font-display: "Playfair Display", "Georgia", serif;
  --font-body: "Inter", "Segoe UI", sans-serif;
}

*{ box-sizing: border-box; }

html{ font-size: 18px; }

html,body{
  margin:0;
  padding:0;
  min-height:100%;
  background:
    radial-gradient(circle at 20% 0%, rgba(216,177,104,.10), transparent 45%),
    radial-gradient(circle at 90% 20%, rgba(181,140,224,.10), transparent 40%),
    linear-gradient(180deg, var(--bg-deep), var(--bg-mid) 55%, var(--velvet));
  color: var(--cream);
  font-family: var(--font-body);
  overflow-x:hidden;
  -webkit-tap-highlight-color: transparent;
}

body::before{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  background-image: radial-gradient(rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 3px 3px;
  opacity:.5;
  z-index:0;
}

#app{ position:relative; z-index:1; min-height:100vh; display:flex; flex-direction:column; }

/* ---------- TOPBAR ---------- */
.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 16px 18px;
}
.brand{
  font-family:var(--font-display);
  font-size: 1.15rem;
  letter-spacing:.03em;
  color: var(--gold-bright);
  display:flex;
  align-items:center;
  gap:8px;
}
.brand .dot{ color: var(--gold); }

.topbar-right{ display:flex; gap:10px; align-items:center; }

.pill{
  display:flex; align-items:center; gap:8px;
  background: linear-gradient(160deg, rgba(216,177,104,.18), rgba(216,177,104,.06));
  border:1px solid rgba(216,177,104,.45);
  color: var(--gold-bright);
  padding:10px 16px;
  border-radius: 999px;
  font-size:1.05rem;
  font-weight:600;
  cursor:default;
}

.icon-btn{
  position:relative;
  width:50px; height:50px;
  border-radius:16px;
  border:1px solid rgba(216,177,104,.45);
  background: linear-gradient(160deg, rgba(216,177,104,.18), rgba(216,177,104,.06));
  color: var(--gold-bright);
  font-size:1.35rem;
  display:flex; align-items:center; justify-content:center;
  cursor:pointer;
  transition: transform .25s cubic-bezier(.34,1.3,.4,1), box-shadow .25s ease;
}
.icon-btn:active{ transform: scale(.92); }
.icon-btn:hover{ box-shadow: 0 0 0 4px rgba(216,177,104,.18); }

.badge{
  position:absolute;
  top:-7px; right:-7px;
  min-width:22px; height:22px;
  border-radius:999px;
  background: linear-gradient(135deg, var(--legendary-a), var(--legendary-b));
  color:#3a1a00;
  font-size:.72rem;
  font-weight:800;
  display:flex; align-items:center; justify-content:center;
  padding:0 5px;
  box-shadow: 0 2px 8px rgba(255,154,86,.5);
}
.badge.hidden{ display:none; }

/* ---------- HERO ---------- */
.hero{
  flex:1;
  display:flex;
  flex-direction:column;
  align-items:center;
  text-align:center;
  padding: 10px 20px 40px;
}
.hero h1{
  font-family: var(--font-display);
  font-weight:600;
  font-size: clamp(1.6rem, 6vw, 2.4rem);
  margin: 6px 0 4px;
  color: var(--cream);
}
.hero h1 span{ color: var(--gold-bright); }
.hero p.sub{
  color: rgba(248,236,224,.65);
  font-size:.95rem;
  max-width: 360px;
  margin: 0 0 28px;
}

/* ---------- CASE / REEL STAGE ---------- */
.case-stage{
  position:relative;
  width:100%;
  max-width: 480px;
  margin-bottom: 30px;
}

.reel-viewport{
  position:relative;
  width:100%;
  height:200px;
  overflow:hidden;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(0,0,0,.35), rgba(0,0,0,.15));
  border:1px solid rgba(216,177,104,.3);
  box-shadow: inset 0 0 30px rgba(0,0,0,.5), 0 0 0 rgba(216,177,104,0);
  display:none;
}
.reel-viewport.active{
  display:block;
  animation: reelAppear .4s cubic-bezier(.2,.9,.3,1);
  box-shadow: inset 0 0 30px rgba(0,0,0,.5), 0 0 26px rgba(216,177,104,.18);
}
@keyframes reelAppear{ from{ opacity:0; transform: scale(.97); } to{ opacity:1; transform: scale(1); } }
.reel-viewport::before, .reel-viewport::after{
  content:"";
  position:absolute; top:0; bottom:0; width:80px; z-index:3; pointer-events:none;
}
.reel-viewport::before{ left:0; background:linear-gradient(90deg, var(--bg-mid), transparent); }
.reel-viewport::after{ right:0; background:linear-gradient(270deg, var(--bg-mid), transparent); }

.pointer{
  position:absolute;
  left:50%; top:-6px; bottom:-6px;
  width:4px;
  background: var(--gold-bright);
  transform: translateX(-50%) translateZ(0);
  z-index:4;
  box-shadow: 0 0 16px var(--gold-bright);
  will-change: opacity;
}
.reel-viewport.active .pointer{ animation: pointerPulse 1s ease-in-out infinite; }
@keyframes pointerPulse{
  0%,100%{ opacity:.8; }
  50%{ opacity:1; }
}

.reel-track{
  position:absolute;
  top:50%;
  left:0;
  display:flex;
  gap:14px;
  padding: 0 14px;
  transform: translate3d(0,-50%,0);
  will-change: transform;
  backface-visibility: hidden;
}

.reel-item{
  flex: 0 0 140px;
  height:160px;
  border-radius:16px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:8px;
  font-size:2.6rem;
  background: rgba(255,255,255,.03);
  border:1px solid;
}
.reel-item small{ font-size:.7rem; font-weight:700; letter-spacing:.05em; text-transform:uppercase; opacity:.85; }

/* Gift box (idle state) */
.gift-box{
  width: 240px; height:190px;
  margin: 0 auto;
  position:relative;
  display:flex; align-items:center; justify-content:center;
  cursor:pointer;
  user-select:none;
}
.gift-box .box-body{
  width:190px; height:126px;
  border-radius: 14px;
  background: linear-gradient(160deg, #5c1c33, #3a1220);
  border: 1px solid rgba(216,177,104,.5);
  box-shadow: var(--shadow-soft), 0 0 40px rgba(216,177,104,.08);
  position:absolute; bottom:0;
  transition: transform .3s cubic-bezier(.34,1.3,.4,1), box-shadow .5s ease;
  will-change: transform;
}
.gift-box .box-lid{
  width:212px; height:42px;
  border-radius: 12px;
  background: linear-gradient(160deg, var(--gold), #a9803f);
  position:absolute; top:48px;
  box-shadow: 0 6px 14px rgba(0,0,0,.35);
  transition: transform .55s cubic-bezier(.25,1.3,.4,1), opacity .5s ease;
  transform-origin: left center;
  will-change: transform, opacity;
}
.gift-box .ribbon-v{
  width:20px; height:190px; position:absolute; top:0;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  opacity:.9;
}
.gift-box .wax-seal{
  position:absolute; top:76px;
  width:58px; height:58px;
  border-radius:50%;
  background: radial-gradient(circle at 35% 30%, #c23b4a, #7d1a26);
  display:flex; align-items:center; justify-content:center;
  font-size:1.4rem;
  box-shadow: 0 4px 10px rgba(0,0,0,.4);
  transition: transform .5s cubic-bezier(.34,1.3,.4,1), opacity .45s ease;
}
.gift-box:hover .box-body{ transform: translateY(-3px) translateZ(0); }
.gift-box.opening .box-lid{ transform: translate3d(-52px,-70px,0) rotate(-38deg); opacity:0; }
.gift-box.opening .wax-seal{ transform: scale(0) rotate(200deg) translateZ(0); opacity:0; }
/* box-shadow больше не анимируется покадрово (это грузит CPU repaint) —
   вместо этого статичный box-shadow + отдельный слой-накладка гоняет только opacity (GPU-composited) */
.gift-box.opening .box-body{
  box-shadow: var(--shadow-soft), 0 0 65px rgba(216,177,104,.4);
  position:absolute; bottom:0;
}
.gift-box.opening .box-body::after{
  content:"";
  position:absolute; inset:-14px;
  border-radius: 20px;
  box-shadow: 0 0 55px 12px rgba(216,177,104,.55);
  will-change: opacity;
  animation: boxGlowPulse 1.6s ease-in-out infinite;
  pointer-events:none;
}
@keyframes boxGlowPulse{
  0%,100%{ opacity:.45; }
  50%{ opacity:1; }
}

/* Buttons */
.btn-primary{
  font-family: var(--font-body);
  font-weight:700;
  font-size:1.12rem;
  letter-spacing:.02em;
  color: var(--ink);
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  border:none;
  padding:17px 40px;
  border-radius: 999px;
  cursor:pointer;
  box-shadow: 0 10px 25px rgba(216,177,104,.3);
  transition: transform .25s cubic-bezier(.34,1.3,.4,1), box-shadow .25s ease, opacity .2s ease;
}
.btn-primary:active{ transform: scale(.96); }
.btn-primary:disabled{ opacity:.4; cursor:not-allowed; box-shadow:none; }

.btn-ghost{
  font-family: var(--font-body);
  font-weight:600;
  font-size:1rem;
  color: var(--cream);
  background: rgba(255,255,255,.05);
  border:1px solid rgba(255,255,255,.15);
  padding:13px 26px;
  border-radius: 999px;
  cursor:pointer;
  transition: transform .2s cubic-bezier(.34,1.3,.4,1), background .25s ease;
}
.btn-ghost:hover{ background: rgba(255,255,255,.09); }
.btn-ghost:active{ transform: scale(.96); }
.btn-ghost:disabled{ opacity:.35; cursor:not-allowed; }

.btn-danger{
  background: linear-gradient(135deg, #e0637a, #a12f45);
  color:#fff; border:none; font-weight:700;
  padding:13px 26px; border-radius:999px; cursor:pointer;
  font-size:1rem;
  transition: transform .2s cubic-bezier(.34,1.3,.4,1), box-shadow .25s ease;
}
.btn-danger:active{ transform: scale(.96); }

.hint{ margin-top:14px; font-size:.9rem; color: rgba(248,236,224,.55); }
.hidden{ display:none !important; }

/* ---------- RARITY THEMES ---------- */
.r-common{ border-color: var(--common); color: var(--common); }
.r-rare{ border-color: var(--rare); color: var(--rare); }
.r-epic{ border-color: var(--epic); color: var(--epic); }
.r-legendary{
  border-color: var(--legendary-a);
  color: var(--legendary-a);
  background: linear-gradient(160deg, rgba(255,215,122,.12), rgba(255,154,86,.05)) !important;
}
.glow-legendary{ box-shadow: 0 0 22px rgba(255,183,90,.55); }

.rarity-tag{
  display:inline-block;
  font-size:.7rem;
  font-weight:800;
  letter-spacing:.08em;
  text-transform:uppercase;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid currentColor;
}

/* ---------- MODALS ---------- */
.modal{
  position:fixed; inset:0; z-index:50;
  display:flex; align-items:flex-end; justify-content:center;
  background: rgba(10,3,7,.65);
  backdrop-filter: blur(3px);
  padding: 0;
  animation: fadeIn .2s ease;
  will-change: opacity;
}
@keyframes fadeIn{ from{opacity:0;} to{opacity:1;} }

.modal-card{
  width:100%;
  max-width: 540px;
  max-height: 88vh;
  overflow-y:auto;
  display:flex;
  flex-direction:column;
  background: linear-gradient(180deg, #3a1220, #2a0c17);
  border: 1px solid rgba(216,177,104,.3);
  border-bottom:none;
  border-radius: 26px 26px 0 0;
  padding: 26px 24px 32px;
  box-shadow: 0 -10px 40px rgba(0,0,0,.5);
  animation: slideUp .4s cubic-bezier(.16,.9,.24,1.05);
  will-change: transform, opacity;
}
/* Крестик закрытия — не часть скроллящегося контента (.modal-card больше не
   скроллится сам, скроллится только .modal-scroll внутри), поэтому крестик
   всегда виден в верхнем углу, даже если список сертификатов пролистан вниз. */
.modal-close{ flex-shrink:0; }
.modal-title{ flex-shrink:0; }
.modal-scroll{
  overflow-y:auto;
  flex:1 1 auto;
  min-height:0;
}
@media (min-width: 560px){
  .modal{ align-items:center; }
  .modal-card{ border-radius:26px; border-bottom:1px solid rgba(216,177,104,.3); }
}
@keyframes slideUp{ from{ transform: translateY(50px); opacity:0;} to{ transform:translateY(0); opacity:1; } }

.modal-title{
  font-family: var(--font-display);
  font-size:1.55rem;
  color: var(--gold-bright);
  margin: 4px 0 14px;
  text-align:center;
}
.modal-close{
  position:absolute; top:16px; right:18px;
  background:none; border:none; color: rgba(248,236,224,.6);
  font-size:1.5rem; cursor:pointer;
  transition: transform .2s ease, color .2s ease;
}
.modal-close:hover{ color: var(--gold-bright); transform: rotate(90deg); }
.modal-card{ position:relative; }

.modal-actions{ display:flex; gap:12px; justify-content:center; margin-top:20px; flex-wrap:wrap; }

/* Result modal certificate card */
.cert-reveal{
  display:flex; flex-direction:column; align-items:center; text-align:center;
  padding: 12px 6px 4px;
  animation: certPop .55s cubic-bezier(.2,1.4,.3,1);
  will-change: transform, opacity;
}
@keyframes certPop{
  0%{ transform: scale(.6); opacity:0; }
  60%{ transform: scale(1.08); opacity:1; }
  100%{ transform: scale(1); }
}
.cert-reveal .icon{ font-size:4.2rem; margin-bottom:8px; filter: drop-shadow(0 6px 14px rgba(0,0,0,.4)); }
.cert-reveal .name{ font-family: var(--font-display); font-size:1.7rem; margin:6px 0; }
.cert-reveal .desc{ font-size:1rem; color: rgba(248,236,224,.75); max-width:360px; }

/* Inventory */
.inv-grid{ display:grid; grid-template-columns: repeat(2,1fr); gap:14px; margin-top:16px; }
@media (min-width:420px){ .inv-grid{ grid-template-columns: repeat(2,1fr); } }

.inv-card{
  border:1px solid; border-radius:18px; padding:16px 14px;
  background: rgba(255,255,255,.03);
  display:flex; flex-direction:column; gap:10px;
  text-align:center;
  transition: transform .25s cubic-bezier(.34,1.3,.4,1), box-shadow .25s ease;
  will-change: transform, opacity;
  contain: layout style;
}
.inv-card.card-enter{
  animation: cardIn .35s cubic-bezier(.2,.9,.3,1) both;
}
@keyframes cardIn{ from{ opacity:0; transform: translateY(10px) scale(.97);} to{ opacity:1; transform:translateY(0) scale(1);} }
.inv-card:hover{ transform: translateY(-3px); box-shadow: 0 10px 22px rgba(0,0,0,.3); }
.inv-card .icon{ font-size:2.5rem; }
.inv-card .name{ font-family: var(--font-display); font-size:1.15rem; color: var(--cream); }
.inv-card .desc{ font-size:.8rem; color: rgba(248,236,224,.6); min-height:30px; }
.inv-card .row{ display:flex; gap:8px; margin-top:6px; }
.inv-card .row button{
  flex:1; font-size:.8rem; padding:10px 6px; border-radius:12px; border:none; cursor:pointer; font-weight:700;
  transition: transform .18s cubic-bezier(.34,1.3,.4,1);
}
.inv-card .row button:active{ transform: scale(.94); }
.inv-card .btn-act{ background: linear-gradient(135deg, var(--gold-bright), var(--gold)); color: var(--ink); }
.inv-card .btn-up{ background: rgba(255,255,255,.08); color: var(--cream); border:1px solid rgba(255,255,255,.2) !important; }

.empty-state{ text-align:center; padding: 30px 10px; color: rgba(248,236,224,.55); font-size:.9rem; }

.section-label{
  font-size:.75rem; text-transform:uppercase; letter-spacing:.08em;
  color: rgba(248,236,224,.45); margin: 22px 0 4px; text-align:left;
}

.history-list{ display:flex; flex-direction:column; gap:8px; margin-top:8px; }
.history-item{
  display:flex; align-items:center; gap:10px;
  background: rgba(255,255,255,.02);
  border:1px solid rgba(255,255,255,.08);
  border-radius:12px; padding:8px 12px;
  font-size:.8rem; color: rgba(248,236,224,.6);
}
.history-item .icon{ font-size:1.1rem; }

/* burning animation for failed upgrade */
.inv-card.burning{
  animation: burn 1.3s cubic-bezier(.3,.1,.4,1) forwards;
  position:relative;
  will-change: filter, transform, opacity;
}
@keyframes burn{
  0%{ filter:none; transform:scale(1); opacity:1; }
  25%{ filter: sepia(1) saturate(4) hue-rotate(-20deg) brightness(1.1); transform: scale(1.04); }
  55%{ filter: sepia(1) saturate(5) hue-rotate(-25deg) brightness(.7); transform: scale(1.01) rotate(-2deg); }
  100%{ filter: brightness(.15) contrast(2); transform: scale(.65) rotate(7deg); opacity:0; }
}

/* activation glow for successfully used certificate */
.inv-card.activating{
  animation: activateGlow .9s cubic-bezier(.2,.9,.3,1) forwards;
  pointer-events:none;
  position:relative;
  will-change: filter, transform, opacity;
}
.inv-card.activating::after{
  content:"";
  position:absolute; inset:-10px;
  border-radius:22px;
  box-shadow: 0 0 55px 14px rgba(255,215,122,.85);
  opacity:0;
  will-change: opacity;
  animation: activateGlowRing .9s cubic-bezier(.2,.9,.3,1) forwards;
  pointer-events:none;
}
@keyframes activateGlow{
  0%{ filter:none; transform:scale(1); }
  40%{ filter:brightness(1.35) saturate(1.25); transform:scale(1.06); }
  100%{ filter:brightness(1.9); transform:scale(1.15) translateY(-16px); opacity:0; }
}
@keyframes activateGlowRing{
  0%{ opacity:0; }
  40%{ opacity:.6; }
  100%{ opacity:1; }
}

/* golden sparkle burst — certificate activation */
.sparkle-piece{
  position:fixed; width:7px; height:7px; border-radius:50%;
  z-index:70; pointer-events:none;
  box-shadow:0 0 8px 3px rgba(255,230,160,.85);
  animation: sparkleBurst .9s ease-out forwards;
  will-change: transform, opacity;
}
@keyframes sparkleBurst{
  0%{ transform: translate3d(0,0,0) scale(1); opacity:1; }
  100%{ transform: translate3d(var(--dx), var(--dy), 0) scale(0); opacity:0; }
}

/* ember burst — certificate burning on failed upgrade */
.ember-piece{
  position:fixed; width:8px; height:10px; border-radius:50% 50% 50% 0;
  z-index:70; pointer-events:none;
  box-shadow: 0 0 6px 1px rgba(255,120,60,.6);
  animation: emberRise 1.1s ease-out forwards;
  will-change: transform, opacity;
}
@keyframes emberRise{
  0%{ opacity:1; transform:translate3d(0,0,0) rotate(0deg) scale(1); }
  70%{ opacity:.85; }
  100%{ opacity:0; transform: translate3d(var(--dx), calc(var(--dy) - 50px), 0) rotate(160deg) scale(.25); }
}

/* soft smoke puff accompanying embers */
.smoke-piece{
  position:fixed; width:26px; height:26px; border-radius:50%;
  background: radial-gradient(circle, rgba(90,90,90,.35), transparent 70%);
  z-index:69; pointer-events:none;
  animation: smokeRise 1.3s ease-out forwards;
  will-change: transform, opacity;
}
@keyframes smokeRise{
  0%{ opacity:.6; transform: translate3d(0,0,0) scale(.6); }
  100%{ opacity:0; transform: translate3d(var(--dx), calc(var(--dy) - 70px), 0) scale(1.8); }
}

/* Upgrade modal */
.upgrade-source{ display:flex; align-items:center; gap:14px; justify-content:center; margin-bottom:12px; }
.upgrade-source .icon{ font-size:2.4rem !important; }
.upgrade-arrow{ font-size:1.6rem; color: var(--gold-bright); }
.upgrade-targets{ display:flex; flex-direction:column; gap:10px; margin-top:12px; max-height:260px; overflow-y:auto; }
.target-opt{
  display:flex; align-items:center; gap:12px;
  border:1px solid rgba(255,255,255,.15); border-radius:14px; padding:13px 14px;
  cursor:pointer; background: rgba(255,255,255,.02);
  transition: border-color .2s ease, background .2s ease, transform .2s cubic-bezier(.34,1.3,.4,1);
}
.target-opt:active{ transform: scale(.98); }
.target-opt.selected{ border-color: var(--gold-bright); background: rgba(216,177,104,.1); }
.target-opt .icon{ font-size:1.7rem; }
.target-opt .meta{ flex:1; text-align:left; }
.target-opt .meta .n{ font-weight:700; font-size:1rem; display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.target-opt .meta .c{ font-size:.8rem; opacity:.6; }
.target-opt .chance{ font-weight:800; font-size:.95rem; color: var(--gold-bright); }
.dir-tag{
  font-size:.65rem; font-weight:700; text-transform:uppercase; letter-spacing:.03em;
  padding:2px 7px; border-radius:999px; white-space:nowrap;
}
.dir-tag.dir-up{ color: var(--gold-bright); background: rgba(216,177,104,.15); }
.dir-tag.dir-down{ color: #bdf3c6; background: rgba(90,220,130,.15); }
.dir-tag.dir-side{ color: var(--blush); background: rgba(255,255,255,.1); }

.chance-line{ text-align:center; margin: 16px 0 6px; font-size:1.05rem; }
.chance-line b{ color: var(--gold-bright); font-size:1.3rem; }

.wheel-wrap{ display:flex; flex-direction:column; align-items:center; margin: 28px 0 10px; }

/* Stage: gives the wheel a perspective so the tilt/spin reads as 3D */
.wheel-stage{
  position:relative;
  width: clamp(240px, 68vw, 320px);
  aspect-ratio: 1;
  perspective: 1100px;
}

/* slow-rotating spotlight glow behind the wheel */
.wheel-stage::before{
  content:"";
  position:absolute;
  inset:-20%;
  z-index:0;
  border-radius:50%;
  background: conic-gradient(from 0deg,
    rgba(243,217,154,.4), transparent 22%,
    rgba(181,140,224,.28) 50%, transparent 72%,
    rgba(243,217,154,.4));
  filter: blur(28px);
  animation: wheelAura 9s linear infinite;
}
@keyframes wheelAura{ to{ transform: rotate(360deg); } }

/* Tilt layer: constant rotateX so the wheel reads as a plate viewed
   at an angle. Wobble class adds a gentle rock while spinning. */
.wheel-tilt{
  position:absolute; inset:0; z-index:1;
  transform-style: preserve-3d;
  transform: rotateX(18deg);
}
.wheel-tilt.wobble{ animation: wheelWobble 2.1s ease-in-out infinite; }
@keyframes wheelWobble{
  0%,100%{ transform: rotateX(18deg) rotateY(0deg); }
  25%{ transform: rotateX(14deg) rotateY(-2.4deg); }
  75%{ transform: rotateX(21deg) rotateY(2.4deg); }
}

/* Static metallic rim underneath the spinning face */
.wheel-rim{
  position:absolute; inset:0; z-index:1;
  border-radius:50%;
  background: conic-gradient(from 90deg,
    #8a6a34, #f3d99a 12%, #d8b168 27%, #8a6a34 42%,
    #f3d99a 58%, #d8b168 73%, #8a6a34 88%, #f3d99a 100%);
  box-shadow:
    0 18px 44px rgba(0,0,0,.55),
    inset 0 2px 5px rgba(255,255,255,.55),
    inset 0 -8px 14px rgba(0,0,0,.55);
}
.wheel-rim::after{
  content:"";
  position:absolute; inset:9px;
  border-radius:50%;
  box-shadow: inset 0 0 0 2px rgba(28,11,18,.65);
  pointer-events:none;
}

/* Circular mask that clips the spinning face and its glass overlay */
.wheel-face-mask{
  position:absolute; inset:10px; z-index:2;
  border-radius:50%;
  overflow:hidden;
  box-shadow: inset 0 0 32px rgba(0,0,0,.5);
  transform: translateZ(2px);
}

/* The part that actually spins (rotated via JS) */
.wheel-spin{
  width:100%; height:100%;
  position:relative;
  will-change: transform;
  backface-visibility: hidden;
}
.wheel-spin::before{
  content:"";
  position:absolute; inset:0;
  background: repeating-conic-gradient(rgba(28,11,18,.35) 0deg 1deg, transparent 1deg 9deg);
  mix-blend-mode: multiply;
  pointer-events:none;
}

/* Non-rotating glass sheen that sweeps across the wheel for extra shine */
.wheel-glass{
  position:absolute; inset:0; z-index:3;
  border-radius:50%;
  pointer-events:none;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.38) 46%, rgba(255,255,255,.06) 54%, transparent 72%);
  background-size: 260% 260%;
  animation: wheelSheen 3.4s ease-in-out infinite;
}
@keyframes wheelSheen{
  0%{ background-position: 130% 0%; opacity:.18; }
  50%{ background-position: -10% 100%; opacity:.55; }
  100%{ background-position: 130% 0%; opacity:.18; }
}

.wheel-center{
  position:absolute; top:50%; left:50%; z-index:4;
  width: 15%; aspect-ratio:1;
  transform: translate(-50%,-50%) translateZ(16px);
  border-radius:50%;
  background: radial-gradient(circle at 35% 30%, #fff6da, var(--gold-bright) 45%, var(--gold) 85%);
  box-shadow: 0 0 0 4px rgba(28,11,18,.6), 0 6px 16px rgba(0,0,0,.5), 0 0 16px rgba(243,217,154,.6);
  animation: coreGlow 1.8s ease-in-out infinite;
}
@keyframes coreGlow{
  0%,100%{ box-shadow: 0 0 0 4px rgba(28,11,18,.6), 0 6px 16px rgba(0,0,0,.5), 0 0 12px rgba(243,217,154,.5); }
  50%{ box-shadow: 0 0 0 4px rgba(28,11,18,.6), 0 6px 16px rgba(0,0,0,.5), 0 0 26px rgba(243,217,154,.95); }
}

.wheel-needle{
  position:absolute; top:-16px; left:50%; z-index:5;
  transform: translateX(-50%) translateZ(34px);
  transform-origin: 50% 6px;
  transition: transform .1s ease-out;
  width:0; height:0;
  border-left:15px solid transparent;
  border-right:15px solid transparent;
  border-top:28px solid var(--gold-bright);
  filter: drop-shadow(0 3px 6px rgba(0,0,0,.6)) drop-shadow(0 0 8px rgba(243,217,154,.55));
}
.wheel-needle.tick{ transform: translateX(-50%) translateZ(34px) rotate(-16deg); }

.wheel-flash{
  position:absolute; inset:-10px; z-index:6;
  border-radius:50%;
  pointer-events:none;
  opacity:0;
}
.wheel-flash.success{
  box-shadow: 0 0 0 0 rgba(243,217,154,.9);
  animation: flashSuccess .9s ease-out;
}
.wheel-flash.fail{
  box-shadow: 0 0 0 0 rgba(255,90,70,.9);
  animation: flashFail .9s ease-out;
}
@keyframes flashSuccess{
  0%{ opacity:1; box-shadow: 0 0 0 0 rgba(243,217,154,.85); }
  100%{ opacity:0; box-shadow: 0 0 0 46px rgba(243,217,154,0); }
}
@keyframes flashFail{
  0%{ opacity:1; box-shadow: 0 0 0 0 rgba(255,90,70,.85); }
  100%{ opacity:0; box-shadow: 0 0 0 46px rgba(255,90,70,0); }
}

.upgrade-result{ text-align:center; font-family: var(--font-display); font-size:1.4rem; margin-top:20px; }

/* ---------- DAILY TASKS FLOATING WIDGET ---------- */
.tasks-widget{
  position:fixed;
  left:14px; bottom:14px;
  z-index:40;
  max-width: 260px;
}
.tasks-toggle{
  display:flex; align-items:center; gap:8px;
  background: linear-gradient(160deg, rgba(58,18,32,.95), rgba(42,12,23,.95));
  border:1px solid rgba(216,177,104,.4);
  color: var(--gold-bright);
  padding:12px 16px;
  border-radius: 999px;
  font-size:.9rem;
  font-weight:700;
  cursor:pointer;
  box-shadow: var(--shadow-soft);
  transition: transform .2s cubic-bezier(.34,1.3,.4,1);
}
.tasks-toggle:active{ transform: scale(.96); }
.tasks-panel{
  margin-top:8px;
  background: linear-gradient(160deg, rgba(58,18,32,.97), rgba(42,12,23,.97));
  border:1px solid rgba(216,177,104,.3);
  border-radius:16px;
  padding: 12px 14px;
  box-shadow: var(--shadow-soft);
  display:none;
  max-height: 40vh;
  overflow-y:auto;
}
.tasks-widget.open .tasks-panel{ display:block; }
.task-row{
  display:flex; align-items:flex-start; gap:8px;
  padding:7px 0;
  border-bottom:1px solid rgba(255,255,255,.06);
  font-size:.82rem;
}
.task-row:last-child{ border-bottom:none; }
.task-check{
  width:16px; height:16px; border-radius:5px; flex:0 0 16px; margin-top:2px;
  border:1px solid rgba(216,177,104,.6);
  display:flex; align-items:center; justify-content:center; font-size:.65rem;
}
.task-row.done .task-check{ background: linear-gradient(135deg, var(--gold-bright), var(--gold)); color:var(--ink); }
.task-row.done .task-text{ text-decoration: line-through; opacity:.5; }
.task-row{ cursor:default; transition: opacity .2s; }

/* ---------- DAILY TASK CARD REVEAL ---------- */
.task-reveal-overlay{
  position:fixed; inset:0; z-index:70;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:28px;
  background: radial-gradient(ellipse at center, rgba(58,18,32,.94), rgba(15,4,9,.98));
  overflow:hidden;
}
.task-reveal-overlay.hidden{ display:none; }
.task-reveal-close{
  position:absolute; top:18px; right:18px; z-index:2;
  width:42px; height:42px; border-radius:50%;
  background: rgba(255,255,255,.08); border:1px solid rgba(216,177,104,.35);
  color: var(--cream); font-size:1.1rem; cursor:pointer;
}
.task-reveal-close:hover{ color: var(--gold-bright); transform: rotate(90deg); transition: transform .3s; }
.task-reveal-progress{
  position:absolute; top:26px; left:50%; transform:translateX(-50%);
  font-family: var(--font-display); color: var(--gold-bright);
  font-size:1.05rem; letter-spacing:.04em;
}
.task-reveal-hint2{
  color: rgba(248,236,224,.6); font-size:.9rem; text-align:center; padding:0 24px;
}

.task-cards{
  display:flex; gap:26px; justify-content:center; align-items:center; flex-wrap:wrap;
  perspective:1400px;
}
.task-card{
  width: clamp(120px, 27vw, 220px);
  height: clamp(174px, 39vw, 310px);
  cursor:pointer;
  transform-style: preserve-3d;
}
.task-card.disabled{ cursor:default; }
.task-card-inner{
  position:relative; width:100%; height:100%;
  transition: transform .6s cubic-bezier(.2,.8,.2,1), opacity .3s;
  transform-style: preserve-3d;
}
.task-card.flipped .task-card-inner{ transform: rotateY(180deg); }
.task-card.dimmed .task-card-inner{ opacity:.35; }
.task-card-face{
  position:absolute; inset:0;
  backface-visibility:hidden;
  border-radius: 18px;
  display:flex; align-items:center; justify-content:center;
  padding:14px;
  text-align:center;
}
.task-card-back{
  background: linear-gradient(160deg, rgba(58,18,32,.97), rgba(42,12,23,.97));
  border:1px solid rgba(216,177,104,.4);
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  box-shadow: var(--shadow-soft), inset 0 0 0 1px rgba(216,177,104,.08);
}
.task-card-front{
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: var(--ink);
  transform: rotateY(180deg);
  font-size: clamp(.85rem, 2vw, 1.1rem);
  font-weight:700;
  line-height:1.3;
  box-shadow: var(--shadow-soft);
}

/* влёт первой пачки по дуге из левого нижнего угла в центр */
@keyframes cardFlyInArc{
  0%   { transform: translate(-70vw, 55vh) rotate(-28deg) scale(.35); opacity:0; }
  45%  { transform: translate(-22vw, 8vh) rotate(-10deg) scale(.75); opacity:1; }
  100% { transform: translate(0,0) rotate(0deg) scale(1); opacity:1; }
}
.task-card.enter-arc{ animation: cardFlyInArc .75s cubic-bezier(.2,.8,.2,1) both; }

/* смена пачки: старые карты улетают влево, новые влетают справа */
@keyframes cardFlyOutLeft{
  0%   { transform: translate(0,0) rotate(0deg); opacity:1; }
  100% { transform: translate(-130vw, 6vh) rotate(-22deg); opacity:0; }
}
@keyframes cardFlyInRight{
  0%   { transform: translate(130vw, 6vh) rotate(22deg) scale(.6); opacity:0; }
  100% { transform: translate(0,0) rotate(0deg) scale(1); opacity:1; }
}
.task-card.exit-left{ animation: cardFlyOutLeft .5s cubic-bezier(.4,0,.6,1) both; }
.task-card.enter-right{ animation: cardFlyInRight .6s cubic-bezier(.2,.8,.2,1) both; }

/* confetti burst */
.confetti-piece{
  position:fixed; top:50%; left:50%;
  width:9px; height:9px; z-index:60; pointer-events:none;
  border-radius:2px;
  animation: burst 1.3s cubic-bezier(.16,.84,.3,1) forwards;
  will-change: transform, opacity;
}
@keyframes burst{
  to{ transform: translate3d(var(--dx), var(--dy), 0) rotate(var(--rot)); opacity:0; }
}

/* scrollbar tidy */
::-webkit-scrollbar{ width:6px; }
::-webkit-scrollbar-thumb{ background: rgba(216,177,104,.4); border-radius:4px; }

footer.credit{ text-align:center; font-size:.7rem; color: rgba(248,236,224,.3); padding: 10px 0 20px; }

/* ---------- RATING FLOATING WIDGET ---------- */
.rating-widget{
  position:fixed;
  right:14px; bottom:14px;
  z-index:40;
}
.rating-widget.hidden{ display:none; }
.rating-toggle{
  display:flex; align-items:center; gap:8px;
  background: linear-gradient(160deg, rgba(58,18,32,.95), rgba(42,12,23,.95));
  border:1px solid rgba(122,214,146,.55);
  color:#bdf3c6;
  padding:12px 18px;
  border-radius:999px;
  font-size:.9rem;
  font-weight:700;
  cursor:pointer;
  box-shadow: 0 0 16px 2px rgba(90,220,130,.5), var(--shadow-soft);
  animation: ratingGlowPulse 2.2s ease-in-out infinite;
  transition: transform .2s cubic-bezier(.34,1.3,.4,1);
}
.rating-toggle:active{ transform: scale(.94); }
@keyframes ratingGlowPulse{
  0%,100%{ box-shadow: 0 0 12px 2px rgba(90,220,130,.4), var(--shadow-soft); }
  50%{ box-shadow: 0 0 26px 7px rgba(90,220,130,.85), var(--shadow-soft); }
}

/* ---------- RATING MODAL ---------- */
.rating-cert-preview{ display:flex; flex-direction:column; align-items:center; gap:6px; margin-bottom:14px; }
.rating-cert-preview .icon{ font-size:2.6rem; }
.rating-cert-preview .name{ font-family: var(--font-display); font-size:1.2rem; color: var(--cream); }
.rating-question{ text-align:center; color: rgba(248,236,224,.8); font-size:.95rem; margin: 6px 0 4px; }

.rating-emoji{
  font-size:3rem; text-align:center; margin: 4px 0 14px;
  transition: transform .15s cubic-bezier(.34,1.3,.4,1);
}
.star-row{ display:flex; justify-content:center; gap:10px; font-size:2.5rem; margin-bottom:8px; }
.star-row .star{
  color: rgba(255,255,255,.18); cursor:pointer; line-height:1;
  transition: color .15s ease, transform .15s cubic-bezier(.34,1.3,.4,1);
}
.star-row .star:hover{ transform: scale(1.15); }
.star-row.locked .star{ cursor:default; }
.star-row.locked .star:hover{ transform:none; }
.star-row .star.filled{ color: var(--gold-bright); text-shadow: 0 0 14px rgba(243,217,154,.75); }
.rating-result{ text-align:center; margin-top:12px; font-size:.95rem; color: rgba(248,236,224,.85); }

/* effects applied to the modal card depending on the chosen score */
.rating-fx-gold{ animation: ratingGold 1.5s ease; }
@keyframes ratingGold{
  0%{ box-shadow: 0 -10px 40px rgba(0,0,0,.5); }
  30%{ box-shadow: 0 -10px 70px rgba(255,215,122,.95), 0 0 70px rgba(255,215,122,.6); }
  100%{ box-shadow: 0 -10px 40px rgba(0,0,0,.5); }
}
.rating-fx-gold-soft{ animation: ratingGoldSoft 1.2s ease; }
@keyframes ratingGoldSoft{
  0%{ box-shadow: 0 -10px 40px rgba(0,0,0,.5); }
  35%{ box-shadow: 0 -10px 50px rgba(255,215,122,.55); }
  100%{ box-shadow: 0 -10px 40px rgba(0,0,0,.5); }
}
.rating-fx-grey{ animation: ratingGrey 1s ease; }
@keyframes ratingGrey{
  0%{ filter:none; }
  40%{ filter: grayscale(.65) brightness(.9); }
  100%{ filter:none; }
}
.rating-fx-shake-mild{ animation: ratingShakeMild .5s ease; }
@keyframes ratingShakeMild{
  0%,100%{ transform: translateX(0); }
  20%{ transform: translateX(-6px); }
  40%{ transform: translateX(6px); }
  60%{ transform: translateX(-4px); }
  80%{ transform: translateX(4px); }
}
.rating-fx-shake-strong{
  animation: ratingShakeStrong .6s ease;
  box-shadow: 0 -10px 55px rgba(210,45,45,.6) !important;
}
@keyframes ratingShakeStrong{
  0%,100%{ transform: translateX(0) rotate(0); }
  15%{ transform: translateX(-11px) rotate(-1deg); }
  30%{ transform: translateX(11px) rotate(1deg); }
  45%{ transform: translateX(-9px) rotate(-1deg); }
  60%{ transform: translateX(9px) rotate(1deg); }
  75%{ transform: translateX(-5px); }
  90%{ transform: translateX(5px); }
}
