@font-face { font-family: 'Cairo'; font-weight: 200 1000; font-display: swap; src: url('/static/fonts/cairo-arabic.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFC, U+200C-200E; }
@font-face { font-family: 'Cairo'; font-weight: 200 1000; font-display: swap; src: url('/static/fonts/cairo-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2000-206F; }
:root {
  --bg: #0b0a14;
  --card: #15132a;
  --card2: #1d1a38;
  --accent: #7c3aed;
  --accent2: #ec4899;
  --glow: #a78bfa;
  --text: #f1eefc;
  --muted: #9b95b8;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Cairo', system-ui, sans-serif;
  overscroll-behavior-y: none;
}
body { padding-bottom: calc(76px + var(--safe-bottom)); min-height: 100vh; }
#app { max-width: 520px; margin: 0 auto; padding: 16px 16px 8px; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* Tabbar */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex; justify-content: space-around;
  background: rgba(21, 19, 42, 0.92); backdrop-filter: blur(16px);
  border-top: 1px solid rgba(167,139,250,0.15);
  padding: 8px 0 calc(8px + var(--safe-bottom));
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 600; padding: 4px 14px; border-radius: 12px; transition: all .2s; }
.tab i { font-size: 20px; }
.tab.active { color: #fff; }
.tab.active i { color: var(--glow); filter: drop-shadow(0 0 8px var(--glow)); }

/* Cards */
.card {
  background: var(--card); border-radius: 20px; padding: 16px;
  border: 1px solid rgba(167,139,250,0.1);
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}
.card-glow {
  background: linear-gradient(135deg, rgba(124,58,237,0.35), rgba(236,72,153,0.25));
  border: 1px solid rgba(167,139,250,0.35);
}
.act-card { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; transition: transform .15s; }
.act-card:active { transform: scale(.97); }
.act-emoji { font-size: 38px; width: 60px; height: 60px; display: grid; place-items: center; border-radius: 16px; background: var(--card2); flex-shrink: 0; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--card2); color: var(--muted); }
.chip.hot { background: rgba(236,72,153,0.2); color: #f9a8d4; }
.chip.chem { background: rgba(124,58,237,0.2); color: #c4b5fd; }

/* Intensity bar */
.bar { height: 6px; border-radius: 3px; background: var(--card2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--accent2)); box-shadow: 0 0 10px var(--accent2); }

/* Buttons */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 15px; border-radius: 16px; font-weight: 700; font-size: 16px; transition: transform .12s, filter .12s; }
.btn:active { transform: scale(.97); filter: brightness(1.1); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; box-shadow: 0 8px 24px rgba(124,58,237,0.4); }
.btn-ghost { background: var(--card2); color: var(--text); }
.btn-sm { padding: 10px 14px; font-size: 14px; width: auto; border-radius: 12px; }

/* Selector pills */
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { padding: 9px 14px; border-radius: 999px; background: var(--card2); color: var(--muted); font-weight: 600; font-size: 13px; border: 1.5px solid transparent; transition: all .15s; }
.pill.on { background: rgba(124,58,237,0.25); color: #fff; border-color: var(--glow); }

/* Sheet (details) */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 90; animation: fade .2s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 100; max-width: 520px; margin: 0 auto; max-height: 92vh; overflow-y: auto; background: var(--card); border-radius: 28px 28px 0 0; padding: 12px 20px calc(24px + var(--safe-bottom)); animation: up .3s cubic-bezier(.2,.8,.2,1); }
.sheet::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--muted); margin: 0 auto 14px; opacity: .5; }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* Guided session (fullscreen) */
.session { position: fixed; inset: 0; z-index: 200; background: radial-gradient(circle at 50% 30%, #2a1f5e 0%, var(--bg) 70%); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; }
.orb { width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #c4b5fd, var(--accent) 45%, var(--accent2) 100%); box-shadow: 0 0 60px rgba(167,139,250,0.6), 0 0 120px rgba(236,72,153,0.4); display: grid; place-items: center; transition: transform var(--dur, 3s) ease-in-out, box-shadow var(--dur, 3s) ease-in-out; }
.orb.in { transform: scale(1.35); box-shadow: 0 0 100px rgba(167,139,250,0.9), 0 0 200px rgba(236,72,153,0.6); }
.orb.out { transform: scale(0.75); }
.orb.hold { transform: scale(1.2); }
.orb.rest { transform: scale(0.85); background: radial-gradient(circle at 35% 35%, #93c5fd, #2563eb 45%, #0ea5e9 100%); box-shadow: 0 0 60px rgba(59,130,246,0.5); }
.orb .big { font-size: 56px; font-weight: 900; color: #fff; text-shadow: 0 2px 20px rgba(0,0,0,0.4); }
.phase { font-size: 30px; font-weight: 900; margin-top: 32px; min-height: 40px; }
.sub { color: var(--muted); font-size: 15px; margin-top: 8px; }
.ring { position: absolute; inset: 0; margin: auto; width: 280px; height: 280px; border-radius: 50%; border: 2px dashed rgba(167,139,250,0.25); animation: spin 30s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.top-close { position: absolute; top: calc(16px + env(safe-area-inset-top, 0px)); left: 16px; width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,0.08); display: grid; place-items: center; font-size: 18px; }

/* Rating */
.stars { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.star { width: 38px; height: 38px; border-radius: 12px; background: var(--card2); font-weight: 700; font-size: 15px; display: grid; place-items: center; transition: all .12s; }
.star.on { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; transform: scale(1.08); }

/* Utils */
.fade-in { animation: fadeUp .4s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.pulse { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .6; } }
.grad-text { background: linear-gradient(135deg, #c4b5fd, #f9a8d4); -webkit-background-clip: text; background-clip: text; color: transparent; }
.muted { color: var(--muted); }
.warn { background: rgba(251,191,36,0.12); border: 1px solid rgba(251,191,36,0.3); color: #fde68a; border-radius: 14px; padding: 10px 12px; font-size: 13px; }
::-webkit-scrollbar { display: none; }

/* Offline / sync badges */
.netbar { position: fixed; top: 0; left: 0; right: 0; z-index: 400; text-align: center; font-size: 12px; font-weight: 700; padding: 6px 12px calc(6px); background: #b45309; color: #fff; transform: translateY(-100%); transition: transform .3s; padding-top: calc(6px + env(safe-area-inset-top, 0px)); }
.netbar.show { transform: none; }
.install-card { display: flex; gap: 12px; align-items: center; background: linear-gradient(135deg, rgba(124,58,237,.3), rgba(59,130,246,.2)); }
.orb.in.hold { transform: scale(1.5); box-shadow: 0 0 140px rgba(251,191,36,0.9), 0 0 260px rgba(236,72,153,0.7); }
.orb.out.rest { transform: scale(0.6); }
