:root {
  --bg: #0b1210;
  --bg2: #101a17;
  --card: #121c19;
  --card2: #16241f;
  --line: rgba(255,255,255,.07);
  --line2: rgba(120,200,160,.22);
  --text: #f2f6f4;
  --muted: #8a9a94;
  --green: #22c55e;
  --green-d: #1a7a45;
  --blue: #3b82f6;
  --blue-bg: rgba(59,130,246,.14);
  --red: #ef4444;
  --yellow: #eab308;
  --r: 20px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  background:
    radial-gradient(900px 400px at 50% -100px, rgba(34,197,94,.14), transparent 70%),
    var(--bg);
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
.hidden { display: none !important; }

#app { max-width: 520px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 12px) 16px calc(130px + env(safe-area-inset-bottom)); }

.top { display: flex; justify-content: space-between; align-items: center; padding: 8px 2px 14px; }
.top h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -.5px; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.top-badge {
  background: var(--blue-bg); color: #8db8ff; font-size: 13px; font-weight: 600;
  padding: 8px 12px; border-radius: 12px; border: 1px solid rgba(59,130,246,.25);
}

.view { display: none; animation: fade .3s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.section-title { margin: 22px 4px 10px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }

/* chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 14px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 9px 14px; border-radius: 14px; font-size: 14px; font-weight: 600;
  background: var(--card); border: 1px solid var(--line); color: var(--muted); transition: .2s;
}
.chip.on { background: var(--blue-bg); border-color: rgba(59,130,246,.5); color: #a8c8ff; }
.chip .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; }

/* wheel */
.wheel-card {
  background: linear-gradient(160deg, #15251f, #0e1714);
  border: 1px solid var(--line2); border-radius: 28px; padding: 18px;
  box-shadow: 0 20px 50px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.05);
}
.wheel-wrap { position: relative; width: 100%; max-width: 380px; margin: 0 auto; aspect-ratio: 1; }
#wheel { width: 100%; height: 100%; display: block; filter: drop-shadow(0 8px 24px rgba(0,0,0,.5)); }
.pointer {
  position: absolute; left: 50%; top: -6px; transform: translateX(-50%); z-index: 3;
  width: 0; height: 0; border-left: 14px solid transparent; border-right: 14px solid transparent;
  border-top: 28px solid #fff; filter: drop-shadow(0 3px 4px rgba(0,0,0,.6));
}
.hub {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); z-index: 2;
  width: 26%; aspect-ratio: 1; border-radius: 50%;
  font-weight: 800; font-size: clamp(11px, 3.2vw, 14px); letter-spacing: .04em;
  background: radial-gradient(circle at 35% 30%, #3ee07a, #16a34a 70%);
  box-shadow: 0 0 0 5px #0b1210, 0 0 0 7px rgba(255,255,255,.18), 0 10px 24px rgba(34,197,94,.45);
  color: #04200f; transition: transform .15s;
}
.hub:active { transform: translate(-50%,-50%) scale(.93); }
.hub:disabled { filter: grayscale(.7) brightness(.7); }

/* result */
.result {
  margin-top: 16px; padding: 18px; border-radius: var(--r);
  background: linear-gradient(160deg, var(--card2), var(--card));
  border: 1px solid var(--line2);
  animation: pop .45s cubic-bezier(.2,1.4,.4,1);
}
@keyframes pop { from { opacity: 0; transform: scale(.92) translateY(10px); } to { opacity: 1; transform: none; } }
.res-head { display: flex; gap: 12px; align-items: center; }
.res-prov { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.res-name { margin: 2px 0 0; font-size: 24px; font-weight: 800; letter-spacing: -.4px; line-height: 1.15; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0; }
.stat { background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 14px; padding: 10px 8px; text-align: center; }
.stat b { display: block; font-size: 17px; }
.stat small { color: var(--muted); font-size: 11px; }
.verdict { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 16px; border: 1px solid; }
.verdict img { width: 76px; height: 76px; border-radius: 16px; object-fit: cover; object-position: top; flex: none; border: 2px solid rgba(255,255,255,.15); }
.verdict h3 { margin: 0 0 4px; font-size: 20px; font-weight: 800; }
.verdict p { margin: 0; font-size: 14px; line-height: 1.4; color: #dbe5e0; }
.tips { margin: 14px 0 0; display: grid; gap: 6px; }
.tip { font-size: 14px; color: #c5d3cd; padding: 9px 12px; border-radius: 12px; background: rgba(255,255,255,.04); }
.row-btns { display: flex; gap: 8px; margin-top: 14px; }

.btn { padding: 13px 16px; border-radius: 14px; font-weight: 700; font-size: 15px; transition: .15s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--blue); color: #fff; flex: 1; }
.btn.ghost { background: rgba(255,255,255,.07); color: var(--text); }
.btn.green { background: var(--green); color: #04200f; flex: 1; }

/* history */
.history { display: grid; gap: 8px; }
.h-item { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; text-align: left; width: 100%; }
.h-item .e { font-size: 24px; }
.h-item b { display: block; font-size: 15px; }
.h-item small { color: var(--muted); }
.h-empty { color: var(--muted); font-size: 14px; padding: 12px 4px; }

/* seg */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--card); border-radius: 16px; border: 1px solid var(--line); margin-bottom: 16px; }
.seg button { padding: 11px; border-radius: 12px; font-weight: 700; color: var(--muted); transition: .2s; }
.seg button.on { background: var(--blue-bg); color: #a8c8ff; box-shadow: inset 0 0 0 1px rgba(59,130,246,.4); }

/* tarot */
.tarot-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; perspective: 1000px; }
.slot-label { text-align: center; font-size: 12px; color: var(--muted); margin-bottom: 8px; font-weight: 600; letter-spacing: .04em; }
.tcard { position: relative; aspect-ratio: 3/4.6; transform-style: preserve-3d; transition: transform .7s cubic-bezier(.3,1.2,.4,1); cursor: pointer; width: 100%; }
.tcard.flipped { transform: rotateY(180deg); }
.tcard.rev.flipped { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; border-radius: 16px; backface-visibility: hidden; overflow: hidden; }
.back {
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.05) 0 6px, transparent 6px 12px),
    linear-gradient(160deg, #1e3a2e, #0f1f19);
  border: 1px solid var(--line2); display: grid; place-items: center; font-size: 38px;
  box-shadow: inset 0 0 0 5px #0f1f19, inset 0 0 0 6px rgba(120,200,160,.3);
}
.front {
  transform: rotateY(180deg);
  background: linear-gradient(170deg, #1d2f27, #101a17);
  border: 1px solid rgba(250,204,21,.4);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 8px 6px;
  text-align: center;
}
.front .num { font-size: 11px; color: #facc15; font-weight: 700; letter-spacing: .12em; }
.front .art { flex: 1; width: 100%; display: grid; place-items: center; font-size: 44px; overflow: hidden; border-radius: 10px; margin: 4px 0; }
.front .art img { width: 100%; height: 100%; object-fit: cover; object-position: top; border-radius: 10px; }
.front .nm { font-size: 12px; font-weight: 800; line-height: 1.1; }
.front .sb { font-size: 10px; color: var(--muted); line-height: 1.15; margin-top: 2px; }
.rev-mark .art, .rev-mark .nm { }
.rev-badge { font-size: 10px; color: var(--red); font-weight: 800; }

.t-read { margin-top: 16px; display: grid; gap: 10px; }
.t-item { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; animation: pop .4s ease; }
.t-item .pos { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.t-item h4 { margin: 4px 0 6px; font-size: 16px; }
.t-item p { margin: 0; font-size: 14px; line-height: 1.45; color: #cfdbd5; }
.final { margin-top: 12px; padding: 18px; border-radius: 20px; text-align: center; background: linear-gradient(160deg, rgba(34,197,94,.18), rgba(59,130,246,.12)); border: 1px solid var(--line2); animation: pop .5s ease; }
.final .big { font-size: 40px; }
.final h3 { margin: 4px 0 6px; font-size: 22px; }
.final p { margin: 0; color: #cfdbd5; font-size: 14px; line-height: 1.45; }

/* horoscope */
.sign-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px; scrollbar-width: none; }
.sign-row::-webkit-scrollbar { display: none; }
.sign { flex: none; width: 74px; padding: 10px 4px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); text-align: center; }
.sign.on { background: var(--blue-bg); border-color: rgba(59,130,246,.5); }
.sign i { display: block; font-style: normal; font-size: 26px; }
.sign span { font-size: 12px; font-weight: 600; color: var(--muted); }
.sign.on span { color: #a8c8ff; }
.horo-card { background: linear-gradient(160deg, var(--card2), var(--card)); border: 1px solid var(--line2); border-radius: 22px; padding: 18px; animation: pop .4s ease; }
.horo-top { display: flex; align-items: center; gap: 14px; }
.horo-top .big { font-size: 48px; line-height: 1; }
.horo-top h2 { margin: 0; font-size: 24px; }
.horo-top small { color: var(--muted); }
.luck { margin: 16px 0 6px; display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); font-weight: 600; }
.bar { height: 10px; border-radius: 6px; background: rgba(255,255,255,.08); overflow: hidden; }
.bar > div { height: 100%; border-radius: 6px; background: linear-gradient(90deg, #ef4444, #eab308, #22c55e); background-size: 300px 100%; transition: width .8s cubic-bezier(.2,1,.3,1); }
.horo-card p { font-size: 14px; line-height: 1.5; color: #d3dfd9; margin: 14px 0 0; }
.horo-card p b { color: #fff; }
.lucky { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.lucky div { background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 14px; padding: 10px 6px; text-align: center; }
.lucky b { display: block; font-size: 14px; margin-top: 3px; }
.lucky small { color: var(--muted); font-size: 11px; }
.h-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; margin-bottom: 8px; }
.h-row.on { border-color: rgba(59,130,246,.5); }
.h-row .e { font-size: 26px; }
.h-row .mid { flex: 1; min-width: 0; }
.h-row b { display: block; font-size: 15px; }
.h-row small { color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-row .pc { font-weight: 800; font-size: 15px; }

/* oracle */
.oracle-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.o-card { position: relative; border-radius: 20px; overflow: hidden; border: 1px solid var(--line); aspect-ratio: 4/5; text-align: left; background: var(--card); }
.o-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.o-card::after { content: ''; position: absolute; inset: 0; background: linear-gradient(transparent 45%, rgba(5,10,8,.92)); }
.o-card .cap { position: absolute; left: 12px; right: 12px; bottom: 10px; z-index: 1; }
.o-card .cap b { display: block; font-size: 15px; }
.o-card .cap small { color: #aebfb8; font-size: 11px; line-height: 1.2; display: block; margin-top: 2px; }
.o-card.on { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue), 0 10px 30px rgba(59,130,246,.3); }
.ask { display: flex; gap: 8px; margin: 14px 0; }
.ask input { flex: 1; min-width: 0; padding: 13px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-size: 15px; outline: none; }
.ask input:focus { border-color: rgba(59,130,246,.6); }
.ask .btn { flex: none; }
.answer { background: linear-gradient(160deg, var(--card2), var(--card)); border: 1px solid var(--line2); border-radius: 22px; overflow: hidden; animation: pop .45s cubic-bezier(.2,1.4,.4,1); }
.answer .ph { width: 100%; max-height: 300px; aspect-ratio: 4/3; object-fit: cover; object-position: top; display: block; }
.answer .body { padding: 16px; }
.answer .q { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.tag { display: inline-block; padding: 5px 11px; border-radius: 10px; font-size: 12px; font-weight: 800; letter-spacing: .06em; margin-bottom: 8px; }
.tag.yes { background: rgba(34,197,94,.16); color: #4ade80; }
.tag.no { background: rgba(239,68,68,.16); color: #f87171; }
.tag.maybe { background: rgba(234,179,8,.16); color: #facc15; }
.answer p { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.35; }

/* tab bar */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 20;
  width: min(calc(100% - 32px), 488px); display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 8px; border-radius: 28px;
  background: rgba(14,22,19,.82); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line2); box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0; border-radius: 20px; color: var(--muted); transition: .2s; }
.tabbar i { font-style: normal; font-size: 22px; filter: grayscale(1) opacity(.7); transition: .2s; }
.tabbar span { font-size: 11px; font-weight: 600; }
.tabbar button.on { color: #a8c8ff; background: var(--blue-bg); }
.tabbar button.on i { filter: none; }

.foot { color: #5d6c66; font-size: 11px; line-height: 1.4; text-align: center; margin: 26px 10px 0; }

.toast { position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; background: #e8f5ee; color: #04200f; font-weight: 700; font-size: 14px; padding: 10px 16px; border-radius: 14px; pointer-events: none; transition: .3s; z-index: 50; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.confetti { position: fixed; top: -30px; z-index: 40; pointer-events: none; font-size: 26px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); opacity: .9; } }
