:root {
  --royal: #4169e1;
  --royal-bright: #5b8cff;
  --royal-soft: #a8c0ff;
  --royal-vivid: #6d9bff;
  --navy-0: #04060f;
  --navy-1: #0a1024;
  --navy-2: #101a3a;
  --glass: rgba(10, 16, 38, 0.68);
  --glass-border: rgba(91, 140, 255, 0.22);
  --glass-hover: rgba(91, 140, 255, 0.08);
  --text: #e8eeff;
  --text-dim: #8b9dc7;
  --danger: #ff5c7a;
  --ok: #38e1a0;
  --radius: 20px;
  --glow: 0 0 28px rgba(65, 105, 225, 0.5);
  --glow-strong: 0 0 48px rgba(65, 105, 225, 0.7);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  color: var(--text);
  background: radial-gradient(1400px 800px at 15% -15%, #14225c 0%, transparent 50%),
              radial-gradient(1200px 700px at 85% 115%, #0d1b52 0%, transparent 45%),
              radial-gradient(800px 500px at 50% 50%, #0a1440 0%, transparent 60%),
              linear-gradient(180deg, var(--navy-0) 0%, var(--navy-1) 50%, #050a18 100%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#stars { position: fixed; inset: 0; z-index: 0; pointer-events: none; }

.blob {
  position: fixed; border-radius: 50%; filter: blur(100px); opacity: 0.45; z-index: 0; pointer-events: none;
  animation: drift 24s ease-in-out infinite alternate;
}
.blob-1 { width: 480px; height: 480px; left: -140px; top: 8%; background: radial-gradient(circle, #1d3fae 0%, #0d1f6e 100%); }
.blob-2 { width: 420px; height: 420px; right: -120px; bottom: 3%; background: radial-gradient(circle, #2747c8 0%, #142380 100%); animation-delay: -9s; }
.blob-3 { width: 300px; height: 300px; left: 40%; top: 50%; background: radial-gradient(circle, #3355d8 0%, #1a2d90 100%); animation-delay: -15s; opacity: 0.25; }

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(70px, -60px) scale(1.18); }
}

main, .page { position: relative; z-index: 1; }

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: 0 8px 48px rgba(2, 6, 20, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 0.3s, box-shadow 0.3s;
}

/* ---------- Wave Logo SVG ---------- */
.wave-logo-svg {
  width: 72px;
  height: 42px;
  display: block;
  filter: drop-shadow(0 0 12px rgba(91, 140, 255, 0.5));
}

.wave-logo-mini {
  width: 26px;
  height: 16px;
  display: block;
  color: #fff;
}

/* ---------- Buttons / inputs ---------- */
button {
  font-family: inherit; cursor: pointer; border: none; border-radius: 14px;
  font-weight: 600; letter-spacing: 0.02em; transition: all 0.2s ease;
}
.btn-primary {
  background: linear-gradient(135deg, #2f56d0 0%, var(--royal-bright) 50%, #4d7bff 100%);
  color: #fff; padding: 14px 28px; font-size: 15px;
  box-shadow: 0 4px 24px rgba(65, 105, 225, 0.5);
  position: relative;
  overflow: hidden;
}
.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.2s;
}
.btn-primary:hover:not(:disabled)::before { opacity: 1; }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--glow-strong); }
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost {
  background: rgba(91, 140, 255, 0.08); color: var(--royal-soft);
  border: 1px solid var(--glass-border); padding: 10px 18px; font-size: 13px;
}
.btn-ghost:hover { background: rgba(91, 140, 255, 0.18); border-color: rgba(91, 140, 255, 0.4); }
.btn-danger {
  background: rgba(255, 92, 122, 0.1); color: var(--danger);
  border: 1px solid rgba(255, 92, 122, 0.3); padding: 10px 18px; font-size: 13px;
}
.btn-danger:hover { background: rgba(255, 92, 122, 0.22); border-color: rgba(255, 92, 122, 0.5); }
.btn-sm { padding: 7px 14px; font-size: 12.5px; border-radius: 10px; }

input {
  width: 100%; background: rgba(4, 9, 26, 0.75); border: 1px solid rgba(91, 140, 255, 0.25);
  border-radius: 14px; color: var(--text); padding: 14px 16px; font-size: 14.5px;
  font-family: inherit; outline: none; transition: border 0.25s, box-shadow 0.25s, background 0.25s;
}
input:focus { border-color: var(--royal-bright); box-shadow: 0 0 0 4px rgba(91, 140, 255, 0.15); background: rgba(8, 14, 36, 0.9); }
input::placeholder { color: #4d6090; }

label { display: block; font-size: 12px; color: var(--text-dim); margin: 0 0 7px 3px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 500; }

.field { margin-bottom: 20px; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px; position: sticky; top: 0; z-index: 50;
  background: rgba(5, 9, 24, 0.82); backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid rgba(91, 140, 255, 0.12);
}
.brand { display: flex; align-items: center; gap: 12px; font-size: 19px; font-weight: 700; letter-spacing: 0.02em; }
.logo {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, #2f56d0, #5b8cff);
  box-shadow: var(--glow); animation: pulse 3.5s ease-in-out infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 38px rgba(65, 105, 225, 0.85); } }
.brand span { background: linear-gradient(135deg, #8db4ff, #dbe6ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.top-right { display: flex; align-items: center; gap: 12px; }
.user-chip {
  font-size: 13px; color: var(--royal-soft); background: rgba(91, 140, 255, 0.08);
  border: 1px solid var(--glass-border); padding: 7px 16px; border-radius: 999px;
  font-weight: 500;
}

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 420px; padding: 48px 42px;
  animation: fadeUp 0.7s ease;
  text-align: center;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
.login-card h1 {
  font-size: 28px; margin: 20px 0 6px; font-weight: 800;
  background: linear-gradient(135deg, #c8d8ff, #fff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.login-card .sub { color: var(--text-dim); font-size: 14px; margin-bottom: 32px; font-weight: 400; }
.login-logo {
  margin: 0 auto;
  width: 90px; height: 90px; border-radius: 22px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #2f56d0, #5b8cff);
  box-shadow: var(--glow);
  animation: logoPulse 4s ease-in-out infinite;
}
@keyframes logoPulse {
  0%, 100% { box-shadow: 0 0 28px rgba(65, 105, 225, 0.5); }
  50% { box-shadow: 0 0 52px rgba(91, 140, 255, 0.75); }
}
.login-card form { text-align: left; }
.error-box {
  display: none; margin: 0 0 18px; padding: 12px 16px; border-radius: 12px; font-size: 13.5px;
  background: rgba(255, 92, 122, 0.08); border: 1px solid rgba(255, 92, 122, 0.35); color: #ff9db2;
  text-align: left;
}
.error-box.show { display: block; animation: shake 0.4s ease; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.login-footer { text-align: center; margin-top: 26px; font-size: 12.5px; color: var(--text-dim); }
.login-footer a { color: var(--royal-soft); text-decoration: none; transition: color 0.2s; }
.login-footer a:hover { color: #fff; }

/* ---------- Panel ---------- */
.wrap { max-width: 1200px; margin: 0 auto; padding: 28px 28px 130px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 14px; }
.page-head h2 { font-size: 25px; font-weight: 800; }
.page-head .muted { color: var(--text-dim); font-size: 13.5px; margin-top: 5px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat {
  padding: 20px 22px; animation: fadeUp 0.5s ease both;
  position: relative; overflow: hidden;
}
.stat::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--royal-bright), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}
.stat:hover::before { opacity: 1; }
.stat .num { font-size: 28px; font-weight: 800; margin-top: 8px; }
.stat .lbl { font-size: 11.5px; color: var(--text-dim); letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; }
.stat .num.hi { color: var(--royal-soft); text-shadow: 0 0 20px rgba(91, 140, 255, 0.6); }

.table-card { overflow: hidden; animation: fadeUp 0.6s ease 0.08s both; }
.table-card .head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid rgba(91, 140, 255, 0.12); }
.table-card .head h3 { font-size: 16px; font-weight: 700; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th { text-align: left; color: var(--text-dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; padding: 13px 22px; border-bottom: 1px solid rgba(91, 140, 255, 0.12); font-weight: 600; }
tbody td { padding: 14px 22px; border-bottom: 1px solid rgba(91, 140, 255, 0.06); }
tbody tr { transition: background 0.2s; }
tbody tr:hover { background: rgba(91, 140, 255, 0.05); }
tbody tr:last-child td { border-bottom: none; }
.tag { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em; }
.tag.ok { color: var(--ok); background: rgba(56, 225, 160, 0.1); border: 1px solid rgba(56, 225, 160, 0.3); }
.tag.err { color: var(--danger); background: rgba(255, 92, 122, 0.1); border: 1px solid rgba(255, 92, 122, 0.3); }
.empty { padding: 52px 20px; text-align: center; color: var(--text-dim); font-size: 14px; }
.rows { max-height: 560px; overflow-y: auto; }

/* ---------- Modal ---------- */
.modal-bg {
  position: fixed; inset: 0; z-index: 100; display: none; place-items: center; padding: 24px;
  background: rgba(3, 6, 16, 0.8); backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.modal-bg.show { display: grid; animation: fadeUp 0.25s ease; }
.modal { width: 100%; max-width: 860px; max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; }
.modal .m-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid rgba(91, 140, 255, 0.12); }
.modal .m-head h3 { font-size: 17px; font-weight: 700; }
.modal .m-body { padding: 22px 24px; overflow-y: auto; }
.close-x { background: none; color: var(--text-dim); font-size: 22px; line-height: 1; }
.close-x:hover { color: #fff; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 18px; }
.kv div { background: rgba(4, 9, 26, 0.65); border: 1px solid rgba(91, 140, 255, 0.14); border-radius: 12px; padding: 11px 14px; }
.kv b { display: block; font-size: 11.5px; color: var(--text-dim); font-weight: 600; margin-bottom: 3px; text-transform: uppercase; letter-spacing: 0.04em; }
.kv span { font-size: 13.5px; }
.log-view {
  background: #03060f; border: 1px solid rgba(91, 140, 255, 0.18); border-radius: 14px;
  padding: 18px; font-family: 'Cascadia Code', Consolas, monospace; font-size: 12.5px; line-height: 1.6;
  color: #b9c9f5; max-height: 320px; overflow: auto; white-space: pre-wrap; word-break: break-word;
}
.section-title { font-size: 12.5px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; margin: 20px 0 10px; font-weight: 600; }
.file-list { display: flex; flex-wrap: wrap; gap: 8px; }
.file-pill {
  font-size: 12px; background: rgba(91, 140, 255, 0.06); border: 1px solid rgba(91, 140, 255, 0.18);
  padding: 6px 12px; border-radius: 999px; color: var(--royal-soft); max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.m-actions { display: flex; gap: 10px; padding: 18px 24px; border-top: 1px solid rgba(91, 140, 255, 0.12); flex-wrap: wrap; }
.screenshot { max-width: 100%; border-radius: 14px; border: 1px solid var(--glass-border); margin-top: 6px; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; z-index: 60;
  display: flex; gap: 6px; padding: 8px 10px; border-radius: 22px;
  background: rgba(6, 10, 28, 0.9); backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid rgba(91, 140, 255, 0.2); box-shadow: 0 12px 48px rgba(0, 0, 0, 0.55);
}
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 11px 22px; border-radius: 16px;
  color: var(--text-dim); font-size: 14px; font-weight: 600; text-decoration: none;
  transition: all 0.22s ease;
}
.nav-item .ico { font-size: 17px; }
.nav-item:hover { color: var(--royal-soft); background: rgba(91, 140, 255, 0.08); }
.nav-item.active {
  color: #fff; background: linear-gradient(135deg, #2f56d0, #4d7bff);
  box-shadow: 0 4px 20px rgba(65, 105, 225, 0.55);
}

/* ---------- Cards (builder / settings / remote) ---------- */
.card { padding: 28px 30px; margin-bottom: 22px; animation: fadeUp 0.5s ease both; }
.card h3 { font-size: 17px; margin-bottom: 8px; font-weight: 700; }
.card .hint { color: var(--text-dim); font-size: 13px; line-height: 1.65; margin-bottom: 22px; }
.drop-zone {
  border: 2px dashed rgba(91, 140, 255, 0.35); border-radius: 18px; padding: 48px 24px; text-align: center;
  color: var(--text-dim); font-size: 14px; transition: all 0.25s; cursor: pointer;
}
.drop-zone:hover, .drop-zone.over {
  border-color: var(--royal-bright); background: rgba(91, 140, 255, 0.06);
  color: var(--royal-soft); box-shadow: var(--glow);
}
.build-info { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 20px; }
.bi { flex: 1; min-width: 150px; background: rgba(4, 9, 26, 0.65); border: 1px solid rgba(91, 140, 255, 0.14); border-radius: 14px; padding: 13px 16px; }
.bi b { display: block; font-size: 11px; color: var(--text-dim); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.bi span { font-size: 13.5px; word-break: break-all; }
.soon-card { text-align: center; padding: 80px 32px; }
.soon-badge {
  display: inline-block; margin-bottom: 20px; padding: 8px 20px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  color: var(--royal-soft); background: rgba(91, 140, 255, 0.08); border: 1px solid rgba(91, 140, 255, 0.35);
  letter-spacing: 0.12em;
  animation: badgePulse 2.4s ease-in-out infinite;
}
@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 0 rgba(91, 140, 255, 0); }
  50% { box-shadow: 0 0 20px rgba(91, 140, 255, 0.3); }
}
.soon-card h2 { font-size: 28px; margin-bottom: 12px; font-weight: 800; }
.soon-card p { color: var(--text-dim); max-width: 440px; margin: 0 auto; line-height: 1.65; }
.divider { height: 1px; background: rgba(91, 140, 255, 0.12); margin: 24px 0; }
.form-row { display: grid; grid-template-columns: 1fr; gap: 0; }
.danger-zone { border-color: rgba(255, 92, 122, 0.3); }
.danger-zone h3 { color: var(--danger); }
.note { font-size: 12.5px; color: var(--text-dim); margin-top: 12px; }
.note.ok { color: var(--ok); }

/* ---------- Terms ---------- */
.terms-wrap { max-width: 820px; margin: 0 auto; padding: 44px 28px 80px; }
.terms-wrap h1 { font-size: 28px; margin-bottom: 6px; }
.terms-wrap .updated { color: var(--text-dim); font-size: 12.5px; margin-bottom: 28px; }
.terms-wrap h2 { font-size: 17px; margin: 28px 0 10px; color: var(--royal-soft); }
.terms-wrap p, .terms-wrap li { color: #c2cdf2; font-size: 14px; line-height: 1.75; }
.terms-wrap ul { padding-left: 22px; margin: 8px 0; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(91, 140, 255, 0.25); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(91, 140, 255, 0.4); }

/* ---------- Selection ---------- */
::selection { background: rgba(91, 140, 255, 0.3); color: #fff; }

@media (max-width: 720px) {
  .bottom-nav { bottom: 10px; width: calc(100% - 24px); justify-content: space-around; }
  .nav-item { padding: 11px 14px; font-size: 12.5px; }
  .wrap { padding: 18px 16px 130px; }
  .login-card { padding: 36px 28px; }
}
