:root {
  --pink: #ff8fab;
  --pink-deep: #f56d9b;
  --purple: #b08cff;
  --bg: #fdf3f7;
  --card: #ffffff;
  --text: #3d2c3f;
  --text-2: #9b8a97;
  --line: #f3e3ea;
}

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

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
}

.hidden { display: none !important; }

button { font-family: inherit; cursor: pointer; border: none; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #ffd6e3 0%, #ffeef4 40%, #e8ddff 100%);
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 360px;
  background: rgba(255,255,255,.92);
  border-radius: 24px;
  padding: 36px 28px;
  box-shadow: 0 12px 40px rgba(245,109,155,.18);
  text-align: center;
  backdrop-filter: blur(8px);
}
.login-heart { font-size: 52px; animation: float 2.6s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.login-title { font-size: 22px; margin: 10px 0 6px; }
.login-sub { color: var(--text-2); font-size: 13px; margin-bottom: 26px; }

input, textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color .15s;
}
input:focus, textarea:focus { border-color: var(--pink); }
.login-card input { margin-bottom: 12px; }
textarea { resize: none; }

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--pink) 0%, var(--pink-deep) 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  border-radius: 14px;
  padding: 13px;
  box-shadow: 0 6px 16px rgba(245,109,155,.35);
}
.btn-primary:active { transform: scale(.97); }
.btn-ghost {
  background: #f6eef2;
  color: var(--text-2);
  font-size: 15px;
  border-radius: 14px;
  padding: 12px;
}

.err {
  color: #e0506e;
  font-size: 13px;
  text-align: center;
  margin: 8px 0;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 10px;
  background: linear-gradient(135deg, #ffd6e3, #eadfff);
}
.topbar-title { font-size: 17px; font-weight: 700; }
.topbar-menu { font-size: 24px; padding: 0 8px; color: var(--text); line-height: 1; }

.menu-pop {
  position: fixed; top: 54px; right: 14px; z-index: 30;
  background: #fff; border-radius: 14px;
  box-shadow: 0 8px 28px rgba(0,0,0,.14);
  overflow: hidden;
  animation: pop .18s ease;
}
@keyframes pop { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.menu-item { padding: 13px 20px; font-size: 15px; }
.menu-item:active { background: #faf0f5; }

/* ---------- 页面主体 ---------- */
main { padding: 4px 16px 84px; }
.page { animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- chips ---------- */
.chips {
  display: flex; gap: 8px;
  overflow-x: auto; padding: 10px 2px 12px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 999px;
  background: #fff;
  border: 1.5px solid var(--line);
  font-size: 14px;
  color: var(--text-2);
}
.chip.active { background: var(--text); color: #fff; border-color: var(--text); }

/* ---------- 待办卡片 ---------- */
.todos { display: flex; flex-direction: column; gap: 10px; }
.todo-card {
  background: var(--card);
  border-radius: 16px;
  padding: 13px 15px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 3px 10px rgba(245,109,155,.08);
}
.todo-check {
  width: 26px; height: 26px; flex-shrink: 0;
  border: 2px solid #e8d5de; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: transparent; font-size: 15px;
  transition: all .2s;
}
.todo-check.done { background: linear-gradient(135deg, var(--pink), var(--pink-deep)); border-color: transparent; color: #fff; }
.todo-body { flex: 1; min-width: 0; }
.todo-title { font-size: 15px; word-break: break-all; }
.todo-title.done-text { text-decoration: line-through; color: var(--text-2); }
.todo-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.todo-cat { font-size: 11px; padding: 2px 9px; border-radius: 999px; color: #fff; }
.todo-note { font-size: 12px; color: var(--text-2); word-break: break-all; }
.todo-del { color: #d8c6cf; font-size: 18px; padding: 4px; }
.empty { text-align: center; color: var(--text-2); padding: 60px 0 20px; font-size: 14px; }
.empty .empty-ico { font-size: 42px; display: block; margin-bottom: 10px; }

/* ---------- FAB ---------- */
.fab {
  position: fixed; right: 22px; bottom: 86px; z-index: 15;
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--pink), var(--pink-deep));
  color: #fff; font-size: 30px;
  box-shadow: 0 8px 20px rgba(245,109,155,.4);
}
.fab:active { transform: scale(.92); }

/* ---------- 底部 tab ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; text-align: center;
  padding: 10px 0 12px;
  font-size: 12px; color: var(--text-2);
}
.tab.active { color: var(--pink-deep); font-weight: 600; }
.tab-ico { display: block; font-size: 20px; margin-bottom: 2px; }
.tab-badge {
  display: inline-block;
  background: var(--pink-deep); color: #fff;
  font-size: 10px; line-height: 1;
  padding: 3px 6px; border-radius: 999px;
  margin-left: 3px; vertical-align: 2px;
}

/* ---------- 转盘 ---------- */
.wheel-stage {
  position: relative;
  margin: 6px auto 0;
  padding: 30px 12px 14px;
  background-image:
    radial-gradient(130% 100% at 50% -10%, rgba(255,120,150,.22), transparent 55%),
    radial-gradient(120% 140% at 50% 118%, rgba(255,170,60,.16), transparent 55%),
    linear-gradient(168deg, #55182a 0%, #360c1a 48%, #471228 100%);
  border-radius: 26px;
  border: 1.5px solid rgba(240,190,100,.5);
  box-shadow:
    0 18px 48px rgba(20,4,10,.6),
    inset 0 0 0 1px rgba(255,215,140,.14),
    inset 0 0 70px rgba(0,0,0,.4);
  overflow: hidden;
}

/* 天鹅绒幕布 */
.curtain-top {
  position: absolute; top: 0; left: 0; right: 0;
  height: 34px;
  background:
    repeating-linear-gradient(90deg,
      #4a0e1e 0 14px, #5c1226 14px 28px, #450c1b 28px 42px, #6a152c 42px 56px);
  box-shadow: 0 4px 10px rgba(0,0,0,.5);
  z-index: 4;
}
.curtain-top::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -9px;
  height: 18px;
  background-image: radial-gradient(circle at 15px 0, #55101f 13px, transparent 14px);
  background-size: 30px 18px;
  background-repeat: repeat-x;
}
.curtain-l, .curtain-r {
  position: absolute; top: 0; bottom: 0;
  width: 16px;
  background: repeating-linear-gradient(180deg,
    #4a0e1e 0 16px, #60122a 16px 32px);
  z-index: 4;
}
.curtain-l {
  left: 0;
  border-radius: 0 0 14px 0;
  box-shadow: 3px 0 8px rgba(0,0,0,.45);
  clip-path: polygon(0 0, 100% 6%, 100% 94%, 0 100%);
}
.curtain-r {
  right: 0;
  border-radius: 0 0 0 14px;
  box-shadow: -3px 0 8px rgba(0,0,0,.45);
  clip-path: polygon(0 6%, 100% 0, 100% 100%, 0 94%);
}

/* 金色聚光灯 */
.spotlight {
  position: absolute; top: 0;
  width: 120px; height: 230px;
  background: linear-gradient(180deg, rgba(255,214,140,.5), rgba(255,214,140,.08));
  clip-path: polygon(42% 0, 58% 0, 100% 100%, 0 100%);
  filter: blur(10px);
  pointer-events: none;
  mix-blend-mode: screen;
  animation: sway 5.5s ease-in-out infinite alternate;
}
.sl-a { left: 14%; }
.sl-b { right: 14%; animation-delay: -2.6s; }
@keyframes sway {
  from { transform: rotate(-3deg); opacity: .7; }
  to { transform: rotate(3deg); opacity: 1; }
}

/* bokeh 光斑 */
.bokeh { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.bk {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255,236,190,.95), rgba(255,190,110,.25) 60%, transparent 75%);
  animation: bokehUp 6s linear infinite;
}
.bk1 { width: 10px; height: 10px; left: 12%; bottom: -20px; animation-duration: 7.2s; }
.bk2 { width: 6px; height: 6px; left: 28%; bottom: -20px; animation-duration: 5.6s; animation-delay: -2s; }
.bk3 { width: 14px; height: 14px; left: 46%; bottom: -24px; animation-duration: 8.4s; animation-delay: -4s; }
.bk4 { width: 8px; height: 8px; left: 63%; bottom: -18px; animation-duration: 6.4s; animation-delay: -1s; }
.bk5 { width: 12px; height: 12px; left: 78%; bottom: -22px; animation-duration: 7.8s; animation-delay: -3s; }
.bk6 { width: 7px; height: 7px; left: 90%; bottom: -16px; animation-duration: 5.2s; animation-delay: -2.5s; }
@keyframes bokehUp {
  from { transform: translateY(0); opacity: 0; }
  12% { opacity: .9; }
  85% { opacity: .5; }
  to { transform: translateY(-560px); opacity: 0; }
}

/* 彩带雨 */
.streamers { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 3; }
.st {
  position: absolute; top: -30px;
  width: 5px; height: 26px;
  border-radius: 3px;
  opacity: .75;
  animation: streamerFall linear infinite;
}
.st1 { left: 8%; background: linear-gradient(#ffd166, #c8890e); animation-duration: 5.8s; }
.st2 { left: 20%; background: linear-gradient(#ff8fab, #c2275c); animation-duration: 7.2s; animation-delay: -2s; }
.st3 { left: 33%; background: linear-gradient(#7ae0a3, #1e9e5a); animation-duration: 6.4s; animation-delay: -3.5s; }
.st4 { left: 45%; background: linear-gradient(#ffe9b0, #c8924a); animation-duration: 8s; animation-delay: -1s; }
.st5 { left: 58%; background: linear-gradient(#7aa2ff, #2a4d9e); animation-duration: 5.4s; animation-delay: -4s; }
.st6 { left: 71%; background: linear-gradient(#ffb35c, #d46a0c); animation-duration: 7.6s; animation-delay: -2.8s; }
.st7 { left: 83%; background: linear-gradient(#ff7bd5, #b0158c); animation-duration: 6.8s; animation-delay: -5s; }
.st8 { left: 93%; background: linear-gradient(#b08cff, #5c2fc2); animation-duration: 7s; animation-delay: -1.5s; }
@keyframes streamerFall {
  0% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(25%) rotate(140deg); }
  50% { transform: translateY(55%) rotate(20deg); }
  75% { transform: translateY(80%) rotate(200deg); }
  100% { transform: translateY(110%) rotate(360deg); }
}

.stage-title {
  position: relative;
  text-align: center;
  font-size: 14px;
  letter-spacing: 5px;
  margin-bottom: 6px;
  color: #ffd98a;
  text-shadow: 0 0 16px rgba(255,190,90,.75), 0 1px 2px rgba(60,10,20,.8);
}
.stage-title::before, .stage-title::after {
  content: "◆";
  font-size: 9px;
  margin: 0 12px;
  vertical-align: 2px;
  color: rgba(255,214,140,.8);
}
.wheel-wrap {
  position: relative;
  width: 300px; height: 300px;
  margin: 4px auto 6px;
}
.wheel-spin-layer {
  position: absolute; inset: 0;
  border-radius: 50%;
  will-change: transform;
}
#wheelCanvas, #ledCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* 皇冠红宝石指针 */
.wheel-pointer-crown {
  position: absolute; top: -34px; left: 50%;
  transform: translateX(-50%);
  z-index: 7;
  text-align: center;
  pointer-events: none;
  filter: drop-shadow(0 0 10px rgba(255,200,90,.85)) drop-shadow(0 2px 4px rgba(0,0,0,.55));
}
.crown-ico { font-size: 34px; display: block; line-height: 1; }
.crown-ruby {
  display: block; width: 12px; height: 12px;
  margin: 1px auto 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff9a9a, #e0243f 55%, #8f0f22);
  box-shadow: 0 0 10px rgba(255,60,80,.9);
}
.crown-arrow {
  display: block;
  font-size: 16px; line-height: 1;
  margin-top: -2px;
  color: #ffd98a;
  text-shadow: 0 0 8px rgba(255,200,90,.9);
}

.wheel-wrap.shake { animation: shake .5s ease; }
@keyframes shake {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-7px, 3px); }
  40% { transform: translate(6px, -4px); }
  60% { transform: translate(-5px, -3px); }
  80% { transform: translate(4px, 2px); }
  100% { transform: translate(0, 0); }
}

/* 底部宝藏堆 */
.treasure {
  position: relative;
  text-align: center;
  font-size: 22px;
  letter-spacing: 8px;
  padding: 6px 0 2px;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,.5));
  text-shadow: 0 0 10px rgba(255,200,90,.5);
}

.chamber-list {
  position: relative;
  width: 300px; margin: 4px auto 0;
  background: rgba(20,4,12,.38);
  border: 1px solid rgba(255,214,140,.22);
  border-radius: 16px;
  backdrop-filter: blur(6px);
  overflow: hidden;
}
.chamber-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid rgba(255,214,140,.09);
  transition: background .2s;
}
.chamber-row:last-child { border-bottom: none; }
.chamber-num {
  width: 24px; height: 24px; flex-shrink: 0;
  background: linear-gradient(135deg, #f6dda8, #b0813e 60%, #8a5c22);
  color: #33130a;
  border-radius: 50%;
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 1px 2px rgba(255,255,255,.6), 0 1px 4px rgba(0,0,0,.4);
}
.chamber-name { flex: 1; font-size: 14px; color: #f5e4d0; word-break: break-all; }
.chamber-row.hit { background: linear-gradient(135deg, rgba(255,95,109,.85), rgba(170,12,38,.88)); }
.chamber-row.hit .chamber-num { background: #fff3e0; color: #b00f2e; }
.chamber-row.hit .chamber-name { color: #fff; font-weight: 700; }

.wheel-center {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 72px; height: 72px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #6e1f33, #3f0d1d 62%, #2a0713);
  border: 2px solid rgba(255,214,140,.85);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; color: #ffd98a;
  letter-spacing: 2px;
  box-shadow:
    0 0 22px rgba(255,190,90,.55),
    0 0 50px rgba(255,120,150,.28),
    inset 0 0 14px rgba(255,190,90,.22),
    inset 0 2px 6px rgba(255,255,255,.18);
  z-index: 6;
  cursor: pointer;
  user-select: none;
}
.wheel-center::before {
  content: "";
  position: absolute; inset: -7px;
  border-radius: 50%;
  border: 1px dashed rgba(255,214,140,.4);
  animation: dashSpin 14s linear infinite;
}
@keyframes dashSpin { to { transform: rotate(360deg); } }
.wheel-center.spinning { animation: btnPulse .9s ease-in-out infinite; }
.wheel-center.fire {
  animation: btnFire .5s ease;
  background: radial-gradient(circle at 35% 30%, #ff9a3c, #c2460f 62%, #7a2503);
  color: #fff3d6;
  box-shadow: 0 0 40px rgba(255,170,70,.95), 0 0 90px rgba(255,140,50,.5);
}
@keyframes btnPulse {
  0%, 100% { box-shadow: 0 0 22px rgba(255,190,90,.55), 0 0 50px rgba(255,120,150,.28); }
  50% { box-shadow: 0 0 36px rgba(255,200,100,.95), 0 0 80px rgba(255,140,160,.55); }
}
@keyframes btnFire {
  0% { transform: translate(-50%, -50%) scale(1); }
  30% { transform: translate(-50%, -50%) scale(1.18); }
  100% { transform: translate(-50%, -50%) scale(1); }
}
.wheel-center:active { transform: translate(-50%, -50%) scale(.93); }
.wheel-center.spinning { pointer-events: none; opacity: .9; }
.wheel-hint { text-align: center; color: var(--text-2); font-size: 13px; padding: 10px 0 20px; }

/* 特效层 */
#fxCanvas {
  position: fixed; inset: 0;
  z-index: 120;
  pointer-events: none;
}
.wheel-stage.flash::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 42%, rgba(255,235,190,.85), rgba(255,180,120,.25) 60%, transparent 80%);
  animation: stageFlash .55s ease forwards;
  pointer-events: none;
}
@keyframes stageFlash {
  0% { opacity: 0; }
  12% { opacity: 1; }
  100% { opacity: 0; }
}

/* ---------- 完成页 ---------- */
.done-list { display: flex; flex-direction: column; gap: 10px; padding-top: 8px; }
.done-card {
  background: #fff; border-radius: 16px; padding: 13px 15px;
  box-shadow: 0 3px 10px rgba(0,0,0,.05);
}
.done-top { display: flex; align-items: center; gap: 10px; }
.done-ico { font-size: 20px; }
.done-title { flex: 1; font-size: 15px; text-decoration: line-through; color: var(--text-2); word-break: break-all; }
.done-time { font-size: 11px; color: #cbb8c4; margin-top: 6px; padding-left: 30px; }
.done-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.done-actions button { background: #faf0f5; color: var(--text-2); font-size: 12px; padding: 6px 12px; border-radius: 999px; }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(60,35,55,.45);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadein .2s ease;
}
.modal-card {
  width: 100%; max-width: 480px;
  background: #fff;
  border-radius: 24px 24px 0 0;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  animation: slideup .25s ease;
  max-height: 86vh; overflow-y: auto;
}
@keyframes slideup { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-card h3 { font-size: 17px; margin-bottom: 14px; text-align: center; }
.modal-card input, .modal-card textarea { margin-bottom: 12px; }
.modal-label { font-size: 13px; color: var(--text-2); margin: 4px 0 6px; }
.modal-card .chips { padding: 4px 0 12px; }
.modal-btns { display: flex; gap: 12px; margin-top: 14px; }
.modal-btns .btn-primary, .modal-btns .btn-ghost { width: auto; flex: 1; }

.seg { display: flex; background: #f6eef2; border-radius: 12px; padding: 4px; margin-bottom: 12px; }
.seg-item { flex: 1; text-align: center; padding: 8px; border-radius: 9px; font-size: 14px; color: var(--text-2); }
.seg-item.active { background: #fff; color: var(--pink-deep); font-weight: 600; box-shadow: 0 2px 6px rgba(0,0,0,.08); }

/* 分类管理 */
.cat-manage { margin-bottom: 12px; }
.cat-row { display: flex; align-items: center; gap: 8px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.cat-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.cat-name { flex: 1; font-size: 15px; }
.cat-act { font-size: 12px; color: var(--text-2); padding: 5px 8px; }
.cat-act.del { color: #e0506e; }
.cat-add-row { display: flex; gap: 10px; }
.cat-add-row input { flex: 1; margin-bottom: 0; }

/* 结果弹窗 */
.result-card { text-align: center; }
.result-fire { font-size: 46px; margin: 4px 0 8px; animation: float 1.8s ease-in-out infinite; }
.result-title { font-size: 19px; margin-bottom: 12px !important; }
.result-item {
  background: linear-gradient(135deg, #fff3f7, #f5efff);
  border-radius: 16px;
  padding: 18px 14px;
  margin-bottom: 4px;
}
.result-item .r-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; word-break: break-all; }
.result-item .r-meta { font-size: 13px; color: var(--text-2); }

/* 响应式：桌面居中 */
@media (min-width: 600px) {
  #app, .login-wrap { max-width: 560px; margin: 0 auto; }
  .tabbar { max-width: 560px; left: 50%; transform: translateX(-50%); }
  .fab { right: calc(50% - 258px); }
  .modal { align-items: center; }
  .modal-card { border-radius: 24px; }
}
