:root {
  --bg: var(--tg-theme-bg-color, #0d0f14);
  --bg2: #12151d;
  --card: var(--tg-theme-secondary-bg-color, #191d27);
  --text: var(--tg-theme-text-color, #eef1f6);
  --muted: var(--tg-theme-hint-color, #8b93a1);
  --accent: #6c5cff;
  --accent2: #00d4ff;
  --accent-text: #ffffff;
  --danger: #ff5a6a;
  --ok: #2fd27a;
  --warn: #ffb03a;
  --radius: 18px;
  --tabbar-h: 76px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(900px 500px at 50% -10%, #1c2340 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  min-height: 100vh;
}
#app { max-width: 560px; margin: 0 auto; }
.content { padding: 18px 16px calc(var(--tabbar-h) + 20px); }

.center { display: flex; align-items: center; justify-content: center; min-height: 70vh; text-align: center; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

h1 { font-size: 24px; margin: 2px 0 2px; letter-spacing: -.3px; }
h2 { font-size: 17px; margin: 22px 0 12px; }
.sub { color: var(--muted); font-size: 14px; margin: 0 0 18px; }

.card {
  background: var(--card);
  border: 1px solid #ffffff0d;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
}

.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

button {
  font: inherit; border: none; border-radius: 14px;
  padding: 13px 16px; background: var(--accent); color: var(--accent-text);
  font-weight: 650; cursor: pointer; transition: transform .06s ease, opacity .2s, filter .2s;
}
button:active { transform: scale(.97); }
button:disabled { opacity: .4; cursor: default; }
button.secondary { background: #ffffff12; color: var(--text); }
button.danger { background: transparent; color: var(--danger); padding: 8px 10px; }
button.ghost { background: transparent; color: var(--accent2); padding: 8px; font-weight: 600; }
.full { width: 100%; }

input, textarea, select {
  font: inherit; width: 100%; background: var(--bg2); color: var(--text);
  border: 1px solid #ffffff16; border-radius: 12px; padding: 13px 14px; margin-bottom: 10px;
}
textarea { resize: vertical; min-height: 64px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }

.pill { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: #ffffff12; color: var(--muted); }
.pill.warn { color: var(--warn); background: #ffb03a1a; }
.weight-1 { color: var(--ok); } .weight-3 { color: var(--warn); }

/* ---- Статы ---- */
.stat-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 6px; }
.stat { background: var(--card); border: 1px solid #ffffff0d; border-radius: var(--radius); padding: 14px 8px; text-align: center; }
.stat .n { font-size: 22px; font-weight: 750; background: linear-gradient(120deg,#fff,#b9c2ff); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat .l { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ---- Колесо ---- */
.wheel-hero { text-align: center; padding: 6px 0 2px; }
.wheel-stage {
  position: relative; width: min(88vw, 360px); aspect-ratio: 1; margin: 10px auto 6px;
}
.wheel-stage::before {
  content: ""; position: absolute; inset: -14%;
  background: radial-gradient(circle at 50% 45%, #6c5cff55, transparent 62%);
  filter: blur(14px); z-index: 0; pointer-events: none;
}
#wheel { position: relative; width: 100%; height: 100%; display: block; z-index: 1;
  filter: drop-shadow(0 18px 30px rgba(0,0,0,.45)); }
.wheel-pointer {
  position: absolute; top: -6px; left: 50%; transform: translateX(-50%); z-index: 3;
  width: 0; height: 0; border-left: 15px solid transparent; border-right: 15px solid transparent;
  border-top: 26px solid #fff;
  filter: drop-shadow(0 3px 5px rgba(0,0,0,.5));
}
.wheel-hub {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); z-index: 3;
  width: 62px; height: 62px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #2a3150, #12151d);
  border: 2px solid #ffffff22; box-shadow: 0 6px 16px rgba(0,0,0,.5), inset 0 1px 2px #ffffff2a;
  display: flex; align-items: center; justify-content: center; font-size: 24px;
}

/* большая кнопка спина */
.spin-btn {
  position: relative; width: 100%; margin: 14px 0 4px; padding: 17px;
  font-size: 17px; font-weight: 750; letter-spacing: .3px;
  background: linear-gradient(120deg, var(--accent), var(--accent2));
  box-shadow: 0 10px 26px -8px #6c5cffcc;
}
.spin-btn:not(:disabled) { animation: breathe 2.6s ease-in-out infinite; }
@keyframes breathe { 0%,100% { box-shadow: 0 10px 26px -8px #6c5cffcc; } 50% { box-shadow: 0 12px 34px -6px #00d4ffcc; } }

.wheel-locked {
  background: var(--card); border: 1px solid #ffffff0d; border-radius: var(--radius);
  padding: 22px; text-align: center;
}

/* ---- Активная задача ---- */
.active-hero {
  position: relative; overflow: hidden; color: #fff; border-radius: 22px; padding: 24px; margin-bottom: 14px;
  background: linear-gradient(135deg, #6c5cff, #b14bff 55%, #00d4ff);
}
.active-hero::after { content:""; position:absolute; right:-30px; top:-30px; width:150px; height:150px;
  background: radial-gradient(circle, #ffffff40, transparent 70%); }
.active-hero .label { opacity: .9; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.active-hero .title { font-size: 26px; font-weight: 800; margin: 8px 0; line-height: 1.15; }
.active-hero .meta { opacity: .92; font-size: 14px; }

.log-item { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid #ffffff0f; font-size: 14px; }
.log-item:last-child { border: none; }
.dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.dot.yes { background: var(--ok); } .dot.no { background: var(--danger); } .dot.none { background: var(--muted); }

.banner { background: #ffb03a1a; color: var(--warn); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; font-size: 14px; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty .big { font-size: 44px; margin-bottom: 10px; }

/* ---- Нижняя навигация ---- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: var(--tabbar-h); max-width: 560px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(3,1fr);
  background: #10131bd9; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid #ffffff12;
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: none; color: var(--muted); font-size: 11px; font-weight: 600; border-radius: 0;
  position: relative; padding: 8px 0;
}
.tab .ic { font-size: 22px; line-height: 1; filter: grayscale(.4) opacity(.75); transition: .15s; }
.tab.active { color: var(--text); }
.tab.active .ic { filter: none; transform: translateY(-1px); }
.tab.active::before { content:""; position:absolute; top:0; width:34px; height:3px; border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.tab .badge {
  position: absolute; top: 6px; left: 50%; margin-left: 6px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.tab .badge.alert { background: var(--danger); }

/* ---- Модалка / нижний лист ---- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.62); display: flex; align-items: flex-end; justify-content: center; z-index: 60; }
.sheet { background: var(--card); width: 100%; max-width: 560px; border-radius: 22px 22px 0 0; padding: 22px 18px calc(28px + env(safe-area-inset-bottom)); animation: up .22s ease; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---- Карточка результата спина ---- */
.result { text-align: center; padding: 26px 18px calc(26px + env(safe-area-inset-bottom)); }
.result .kicker { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 1px; }
.result .big { font-size: 28px; font-weight: 800; margin: 10px 0 4px; animation: pop .35s cubic-bezier(.2,1.4,.4,1); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.result .emoji { font-size: 52px; animation: pop .4s cubic-bezier(.2,1.4,.4,1); }
