/* Tempo design system: dark canvas, one warm-neon gradient, generous type, springy motion. */
:root {
  --bg: #0b0b10;
  --bg-2: #101017;
  --bg-3: #16161f;
  --bg-4: #1d1d28;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-2: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.16);
  --text: #f4f4f8;
  --text-2: #a9a9bd;
  --text-3: #6e6e84;
  --accent: #8b6cff;
  --accent-2: #ff4fa3;
  --accent-3: #ff8a3d;
  --grad: linear-gradient(135deg, #8b6cff 0%, #ff4fa3 55%, #ff8a3d 100%);
  --grad-soft: linear-gradient(135deg, rgba(139, 108, 255, 0.25), rgba(255, 79, 163, 0.18) 55%, rgba(255, 138, 61, 0.2));
  --lime: #b6ff3b;
  --ok: #3ddc97;
  --warn: #ffc83d;
  --danger: #ff5c5c;
  --radius: 18px;
  --radius-s: 11px;
  --radius-xs: 7px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  --shadow-s: 0 8px 24px rgba(0, 0, 0, 0.35);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Sora', 'Inter', system-ui, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --topbar: 60px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(139, 108, 255, 0.16), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, rgba(255, 79, 163, 0.10), transparent 60%);
  z-index: 0;
}
.app { position: relative; z-index: 1; min-height: 100%; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
input, textarea { background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, textarea:focus { border-color: rgba(139, 108, 255, 0.6); box-shadow: 0 0 0 3px rgba(139, 108, 255, 0.18); }
textarea { resize: vertical; line-height: 1.5; }
::selection { background: rgba(139, 108, 255, 0.45); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.22); background-clip: padding-box; border: 3px solid transparent; }
h1, h2, h3, h4 { font-family: var(--display); margin: 0; letter-spacing: -0.02em; }
h1 { font-size: 40px; line-height: 1.05; font-weight: 800; }
h2 { font-size: 24px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.mono { font-variant-numeric: tabular-nums; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hidden { display: none !important; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar);
  display: flex; align-items: center; gap: 14px;
  padding: 0 18px;
  background: rgba(11, 11, 16, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 800; font-size: 18px; letter-spacing: -0.02em; }
.brand img { width: 28px; height: 28px; border-radius: 8px; }
.brand small { font-family: var(--font); font-weight: 500; color: var(--text-3); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; margin-left: 2px; }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a { padding: 7px 12px; border-radius: 999px; color: var(--text-2); font-weight: 500; transition: background .15s, color .15s; }
.nav a:hover { background: var(--panel-2); color: var(--text); }
.nav a.active { background: var(--panel-2); color: var(--text); }
.topbar .spacer { flex: 1; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,0.08); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 999px;
  background: var(--panel-2); color: var(--text); font-weight: 600; font-size: 13.5px;
  border: 1px solid var(--line); transition: transform .15s var(--spring), background .15s, border-color .15s, box-shadow .2s, opacity .15s;
  white-space: nowrap; user-select: none;
}
.btn:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--line-2); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 10px 30px rgba(255, 79, 163, 0.25), inset 0 1px 0 rgba(255,255,255,0.25); }
.btn.primary:hover { box-shadow: 0 14px 40px rgba(255, 79, 163, 0.38), inset 0 1px 0 rgba(255,255,255,0.3); }
.btn.lime { background: var(--lime); color: #0b0b10; border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.danger { color: var(--danger); }
.btn.sm { height: 30px; padding: 0 12px; font-size: 12.5px; }
.btn.lg { height: 48px; padding: 0 24px; font-size: 15px; }
.btn.icon { width: 38px; padding: 0; }
.btn.icon.sm { width: 30px; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.block { width: 100%; }

/* ---------- Chips / badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; background: var(--panel-2); color: var(--text-2); border: 1px solid var(--line); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.ok { color: var(--ok); border-color: rgba(61, 220, 151, 0.3); background: rgba(61, 220, 151, 0.08); }
.chip.warn { color: var(--warn); border-color: rgba(255, 200, 61, 0.3); background: rgba(255, 200, 61, 0.08); }
.chip.danger { color: var(--danger); border-color: rgba(255, 92, 92, 0.3); background: rgba(255, 92, 92, 0.08); }
.chip.accent { color: #d9ccff; border-color: rgba(139, 108, 255, 0.4); background: rgba(139, 108, 255, 0.14); }
.chip.pink { color: #ffb3d6; border-color: rgba(255, 79, 163, 0.4); background: rgba(255, 79, 163, 0.12); }
.chip.live .dot { animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(0.7); } }

/* ---------- Cards / panels ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.panel { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); }
.glass { background: rgba(20, 20, 28, 0.7); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid var(--line); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 11.5px; font-weight: 600; color: var(--text-3); letter-spacing: 0.06em; text-transform: uppercase; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.seg { display: inline-flex; background: var(--bg-3); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { height: 28px; padding: 0 12px; border-radius: 999px; color: var(--text-2); font-weight: 600; font-size: 12.5px; transition: background .15s, color .15s; }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 1px 0 rgba(255,255,255,0.08); }
.seg.grad button.active { background: var(--grad); color: #fff; }
.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 4px; background: var(--line-2); outline: none; padding: 0; border: 0; }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.5); cursor: pointer; }
.switch { position: relative; width: 40px; height: 22px; border-radius: 999px; background: var(--line-2); transition: background .15s; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s var(--spring); }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(18px); }
.color { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.15); padding: 0; background: none; overflow: hidden; }
.color input { width: 44px; height: 44px; margin: -8px; padding: 0; border: 0; background: none; cursor: pointer; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { pointer-events: auto; min-width: 240px; max-width: 420px; padding: 12px 14px; border-radius: 14px; background: rgba(22, 22, 31, 0.92); border: 1px solid var(--line-2); box-shadow: var(--shadow-s); display: flex; gap: 10px; align-items: flex-start; animation: toast-in .35s var(--spring); font-size: 13px; }
.toast.ok { border-color: rgba(61, 220, 151, 0.4); }
.toast.error { border-color: rgba(255, 92, 92, 0.5); }
.toast.warn { border-color: rgba(255, 200, 61, 0.45); }
.toast.warn .t-title { color: var(--warn); }
.toast .t-title { font-weight: 700; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(0.96); } to { opacity: 1; transform: none; } }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; z-index: 80; background: rgba(5, 5, 8, 0.6); backdrop-filter: blur(6px); display: grid; place-items: center; animation: fade .2s; }
.modal { width: min(560px, calc(100vw - 32px)); background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 22px; padding: 22px; box-shadow: var(--shadow); animation: toast-in .3s var(--spring); }
.modal h2 { margin-bottom: 6px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Progress ---------- */
.bar { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--grad); border-radius: 6px; transition: width .4s var(--ease); }
.bar.indeterminate > i { width: 40%; animation: slide 1.2s infinite ease-in-out; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.2); border-top-color: #fff; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.shimmer { position: relative; overflow: hidden; }
.shimmer::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,0.08) 50%, transparent 80%); animation: shimmer 1.4s infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ---------- Layout helpers ---------- */
.page { max-width: 1240px; margin: 0 auto; padding: 28px 22px 80px; }
.grid { display: grid; gap: 16px; }
.center { display: grid; place-items: center; }
.empty { text-align: center; padding: 60px 20px; color: var(--text-2); }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.kbd { font-family: var(--font); font-size: 11px; padding: 2px 6px; border-radius: 5px; background: var(--bg-4); border: 1px solid var(--line-2); color: var(--text-2); }
.fade-in { animation: fade .3s; }
.rise-in { animation: rise .5s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- Login ---------- */
.login { min-height: calc(100vh - var(--topbar)); display: grid; place-items: center; padding: 20px; }
.login .modal { width: min(420px, 100%); }

/* ---------- Home ---------- */
.hero { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 30px; align-items: center; padding: 40px 0 30px; min-height: 420px; }
.hero h1 { font-size: clamp(40px, 6vw, 68px); }
.hero p.lead { font-size: 17px; color: var(--text-2); max-width: 520px; margin: 18px 0 26px; }
.hero .cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 24px; margin-top: 30px; }
.hero-stats b { display: block; font-family: var(--display); font-size: 22px; }
.hero-stats span { font-size: 12px; color: var(--text-3); letter-spacing: 0.05em; text-transform: uppercase; }
.scene { position: relative; height: 460px; perspective: 1200px; display: grid; place-items: center; }
.phone { position: relative; width: 230px; height: 480px; border-radius: 36px; background: #0d0d14; border: 1px solid rgba(255,255,255,0.14); box-shadow: 0 40px 90px rgba(0,0,0,0.6), inset 0 0 0 6px #17171f, 0 0 0 1px rgba(255,255,255,0.05); transform-style: preserve-3d; transform: rotateY(-18deg) rotateX(6deg); transition: transform .25s var(--ease); overflow: hidden; }
.phone .screen { position: absolute; inset: 8px; border-radius: 30px; overflow: hidden; background: #000; }
.phone video, .phone img { width: 100%; height: 100%; object-fit: cover; display: block; }
.phone .notch { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); width: 70px; height: 20px; border-radius: 20px; background: #000; z-index: 2; }
.phone .cap { position: absolute; left: 14px; right: 14px; bottom: 26%; text-align: center; font-family: var(--display); font-weight: 800; font-size: 22px; line-height: 1.05; color: #fff; text-shadow: 0 3px 12px rgba(0,0,0,0.7); z-index: 2; }
.phone .cap mark { background: none; color: #ffe227; }
.scene .orb { position: absolute; border-radius: 50%; filter: blur(40px); opacity: 0.55; animation: float 9s ease-in-out infinite; }
.scene .orb.a { width: 260px; height: 260px; background: #8b6cff; top: 0; left: 6%; }
.scene .orb.b { width: 220px; height: 220px; background: #ff4fa3; bottom: 0; right: 4%; animation-delay: -4s; }
.scene .orb.c { width: 160px; height: 160px; background: #ff8a3d; top: 40%; right: 20%; animation-delay: -7s; }
@keyframes float { 0%, 100% { transform: translateY(0) translateX(0); } 50% { transform: translateY(-24px) translateX(12px); } }
.scene .tag { position: absolute; padding: 8px 12px; border-radius: 12px; font-size: 12px; font-weight: 600; background: rgba(20,20,28,0.85); border: 1px solid var(--line-2); box-shadow: var(--shadow-s); animation: float 7s ease-in-out infinite; }
.scene .tag.t1 { top: 12%; left: 10%; }
.scene .tag.t2 { bottom: 16%; left: 4%; animation-delay: -3s; }
.scene .tag.t3 { top: 30%; right: 6%; animation-delay: -5s; }
.scene .tag i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--lime); margin-right: 7px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 26px 0 14px; }
.projects { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.pcard { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--bg-3); border: 1px solid var(--line); transition: transform .2s var(--spring), border-color .2s, box-shadow .2s; cursor: pointer; }
.pcard:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: var(--shadow-s); }
.pcard .thumb { aspect-ratio: 4 / 3; background: var(--bg-4); display: grid; place-items: center; position: relative; overflow: hidden; }
.pcard .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pcard .thumb .ph { width: 44px; height: 78px; border-radius: 10px; border: 2px dashed var(--line-2); }
.pcard .thumb .chip { position: absolute; top: 10px; left: 10px; }
.pcard .body { padding: 12px 14px 14px; }
.pcard .title { font-weight: 700; font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.pcard .sub { color: var(--text-3); font-size: 12px; margin-top: 3px; display: flex; gap: 8px; }
.pcard.new { border-style: dashed; background: transparent; display: grid; place-items: center; min-height: 220px; color: var(--text-2); }
.pcard.new:hover { color: var(--text); border-color: var(--accent); }
.pcard.new .plus { font-size: 40px; font-family: var(--display); line-height: 1; }
.pcard .menu { position: absolute; top: 8px; right: 8px; opacity: 0; transition: opacity .15s; }
.pcard:hover .menu { opacity: 1; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search { min-width: 220px; height: 36px; border-radius: 999px; padding: 0 14px; }

/* ---------- Templates page ---------- */
.tgrid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.tcard { border-radius: var(--radius); overflow: hidden; background: var(--bg-3); border: 1px solid var(--line); cursor: pointer; transition: transform .2s var(--spring), border-color .2s; position: relative; }
.tcard:hover { transform: translateY(-3px); border-color: var(--line-2); }
.tcard.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 108, 255, 0.25); }
.tcard .tprev { aspect-ratio: 9 / 13; position: relative; overflow: hidden; background: #222 url('../img/scene.jpg') center/cover; }
.tcard .tprev .tx { position: absolute; left: 10%; right: 10%; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tcard .tbody { padding: 10px 12px 12px; }
.tcard .tbody b { display: block; font-size: 13.5px; }
.tcard .tbody span { font-size: 11.5px; color: var(--text-3); }
.tcard .accent { position: absolute; top: 10px; right: 10px; width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 0 3px rgba(0,0,0,0.4); }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .scene { height: 360px; }
  .phone { width: 180px; height: 380px; }
  .page { padding: 20px 16px 80px; }
  .nav { display: none; }
}
