/* ==========================================================================
   Wavey chps — style.css
   ========================================================================== */

:root {
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --display: 'Sora', 'Inter', system-ui, sans-serif;
  --blur: 22px;
  --r: 14px;

  /* violet (default) */
  --bg0: #0b0613;
  --bg1: #1a0d33;
  --accent: #a78bfa;
  --accent2: #ec4899;
  --accent-rgb: 167, 139, 250;
  --orb1: #7c3aed;
  --orb2: #db2777;
  --orb3: #2563eb;

  --text: #f4f0ff;
  --muted: #a99fc4;
  --faint: #6f6690;
  --glass: rgba(255, 255, 255, 0.06);
  --glass-2: rgba(255, 255, 255, 0.11);
  --line: rgba(255, 255, 255, 0.12);
  --shadow: 0 18px 50px -18px rgba(0, 0, 0, 0.7);
}

[data-theme='ocean'] {
  --bg0: #050d1a; --bg1: #0a1f3d; --accent: #38bdf8; --accent2: #6366f1; --accent-rgb: 56, 189, 248;
  --orb1: #0284c7; --orb2: #4f46e5; --orb3: #0891b2; --muted: #9db4cf; --faint: #5f7491;
}
[data-theme='sunset'] {
  --bg0: #140a08; --bg1: #331410; --accent: #fb923c; --accent2: #f43f5e; --accent-rgb: 251, 146, 60;
  --orb1: #ea580c; --orb2: #e11d48; --orb3: #f59e0b; --muted: #c9aa9b; --faint: #8b6c5f;
}
[data-theme='emerald'] {
  --bg0: #04120e; --bg1: #0a2b22; --accent: #34d399; --accent2: #22d3ee; --accent-rgb: 52, 211, 153;
  --orb1: #059669; --orb2: #0891b2; --orb3: #65a30d; --muted: #9bbfb3; --faint: #5c8478;
}
[data-theme='rose'] {
  --bg0: #13060f; --bg1: #331033; --accent: #f472b6; --accent2: #c084fc; --accent-rgb: 244, 114, 182;
  --orb1: #be185d; --orb2: #9333ea; --orb3: #e11d48; --muted: #c7a3bd; --faint: #8a6482;
}
[data-theme='graphite'] {
  --bg0: #0a0a0c; --bg1: #1a1b20; --accent: #e5e7eb; --accent2: #94a3b8; --accent-rgb: 229, 231, 235;
  --orb1: #475569; --orb2: #64748b; --orb3: #334155; --muted: #a3a8b3; --faint: #666b77;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg0);
  color-scheme: dark;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
::selection { background: rgba(var(--accent-rgb), 0.35); }
[hidden] { display: none !important; }

.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
kbd {
  font: 600 11px/1 var(--font); padding: 3px 6px; border-radius: 6px;
  background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); color: var(--muted);
}

/* ---------- Backdrop ---------- */
.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: radial-gradient(120% 90% at 50% -10%, var(--bg1), var(--bg0) 62%); }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.5; will-change: transform; }
.o1 { width: 46vmax; height: 46vmax; left: -14vmax; top: -16vmax; background: var(--orb1); animation: drift1 28s ease-in-out infinite alternate; }
.o2 { width: 40vmax; height: 40vmax; right: -12vmax; top: 10vh; background: var(--orb2); opacity: 0.38; animation: drift2 32s ease-in-out infinite alternate; }
.o3 { width: 36vmax; height: 36vmax; left: 25vw; bottom: -20vmax; background: var(--orb3); opacity: 0.35; animation: drift3 36s ease-in-out infinite alternate; }
.bg .grid {
  position: absolute; inset: 0; opacity: 0.22;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 52px 52px;
  -webkit-mask-image: radial-gradient(70% 60% at 50% 25%, #000, transparent);
  mask-image: radial-gradient(70% 60% at 50% 25%, #000, transparent);
}
.bg .grain {
  position: absolute; inset: 0; opacity: 0.05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}
@keyframes drift1 { to { transform: translate(18vmax, 12vmax) scale(1.18); } }
@keyframes drift2 { to { transform: translate(-16vmax, 14vmax) scale(0.9); } }
@keyframes drift3 { to { transform: translate(-14vmax, -10vmax) scale(1.2); } }
.no-motion .orb { animation: none; }
@media (prefers-reduced-motion: reduce) { .orb { animation: none; } * { scroll-behavior: auto !important; } }

/* ---------- App shell ---------- */
.app { position: relative; z-index: 1; height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding: 10px; gap: 8px; }
.glass, .chrome, .menu, .panel, .toast {
  background: var(--glass);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(150%);
  backdrop-filter: blur(var(--blur)) saturate(150%);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass, .chrome, .menu, .panel, .toast { background: rgba(26, 18, 44, 0.94); }
}
.chrome { position: relative; border-radius: 18px; box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.08); z-index: 5; }

/* ---------- Tabs ---------- */
.tabbar { display: flex; align-items: center; gap: 6px; padding: 8px 8px 0; }
.brand { display: flex; align-items: center; gap: 9px; padding: 0 12px 0 6px; font-family: var(--display); font-weight: 700; letter-spacing: 0.2px; height: 36px; border-radius: 10px; }
.brand:hover { background: rgba(255, 255, 255, 0.05); }
.brand-mark { width: 22px; height: 22px; border-radius: 7px; background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 0 20px rgba(var(--accent-rgb), 0.6); position: relative; overflow: hidden; }
.brand-mark::after { content: ''; position: absolute; left: -2px; right: -2px; top: 9px; height: 8px; border-radius: 50%; border-top: 2.5px solid rgba(255, 255, 255, 0.92); }

.tabs { display: flex; gap: 4px; flex: 1; min-width: 0; overflow: hidden; }
.tab {
  position: relative; display: flex; align-items: center; gap: 8px; min-width: 38px; flex: 0 1 220px; height: 36px; padding: 0 6px 0 11px;
  border-radius: 12px 12px 0 0; color: var(--muted); cursor: pointer; user-select: none; -webkit-user-select: none;
  transition: background 0.2s, color 0.2s, opacity 0.2s;
}
.tab:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.tab.active { background: rgba(255, 255, 255, 0.11); color: var(--text); }
.tab.active::after {
  content: ''; position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2)); box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.9);
}
.tab.dragging { opacity: 0.4; }
.tab.over { box-shadow: inset 2px 0 0 var(--accent); }
.tab .fav { width: 16px; height: 16px; flex: none; display: grid; place-items: center; border-radius: 5px; overflow: hidden; font-size: 10px; font-weight: 700; color: #fff; }
.tab .fav img { width: 16px; height: 16px; object-fit: contain; border-radius: 4px; }
.tab .ttl { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 500; font-size: 13px; }
.tab .x { width: 22px; height: 22px; flex: none; display: grid; place-items: center; border-radius: 7px; opacity: 0; color: var(--muted); transition: opacity 0.15s, background 0.15s; }
.tab:hover .x, .tab.active .x { opacity: 1; }
.tab .x:hover { background: rgba(255, 255, 255, 0.14); color: var(--text); }
.tab .x .i { width: 14px; height: 14px; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.2); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 8px; padding: 8px; background: rgba(255, 255, 255, 0.05); border-top: 1px solid var(--line); border-radius: 0 0 18px 18px; }
.nav, .tools { display: flex; align-items: center; gap: 2px; }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: var(--muted); transition: background 0.15s, color 0.15s, transform 0.1s; flex: none; }
.icon-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); color: var(--text); }
.icon-btn:active:not(:disabled) { transform: scale(0.93); }
.icon-btn:disabled { opacity: 0.3; cursor: default; }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn.on { color: #fbbf24; }
.icon-btn.on .i { fill: currentColor; }

.omni { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 6px 0 12px; border-radius: 999px; background: rgba(0, 0, 0, 0.28); border: 1px solid var(--line); transition: border-color 0.2s, box-shadow 0.2s, background 0.2s; }
.omni:focus-within { border-color: rgba(var(--accent-rgb), 0.7); box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.16); background: rgba(0, 0, 0, 0.4); }
.omni-ico { color: var(--faint); display: grid; place-items: center; }
.omni-ico.secure { color: #4ade80; }
.omni input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: 0; font-size: 14px; }
.omni input::placeholder { color: var(--faint); }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px 0 9px; margin-right: 4px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--text); background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.28), rgba(var(--accent-rgb), 0.1)); border: 1px solid rgba(var(--accent-rgb), 0.4); white-space: nowrap; max-width: 190px; transition: transform 0.1s, filter 0.2s; }
.pill:hover { filter: brightness(1.2); }
.pill:active { transform: scale(0.96); }
.pill .i { width: 14px; height: 14px; color: var(--accent); }
.pill span { overflow: hidden; text-overflow: ellipsis; }

.loadbar { position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px; overflow: hidden; border-radius: 2px; opacity: 0; transition: opacity 0.25s; pointer-events: none; }
.loadbar i { display: block; height: 100%; width: 40%; border-radius: 2px; background: linear-gradient(90deg, transparent, var(--accent), var(--accent2), transparent); }
.loadbar.on { opacity: 1; }
.loadbar.on i { animation: load 1.2s cubic-bezier(0.4, 0, 0.2, 1) infinite; }
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

/* ---------- Suggestions ---------- */
.suggest { position: absolute; top: calc(100% + 8px); left: 0; right: 0; list-style: none; padding: 6px; border-radius: 16px; background: rgba(20, 13, 36, 0.92); border: 1px solid var(--line); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); box-shadow: var(--shadow); z-index: 20; display: none; }
.suggest.open { display: block; animation: pop 0.14s ease-out; }
.suggest li { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; }
.suggest li .i { color: var(--faint); }
.suggest li.sel, .suggest li:hover { background: rgba(var(--accent-rgb), 0.16); }
.suggest li b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest li small { margin-left: auto; color: var(--faint); font-size: 12px; white-space: nowrap; max-width: 45%; overflow: hidden; text-overflow: ellipsis; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(0.99); } }

/* ---------- Viewport ---------- */
.viewport { position: relative; flex: 1; min-height: 0; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.2); box-shadow: var(--shadow); }
.frames, .frame { position: absolute; inset: 0; width: 100%; height: 100%; }
.frames { pointer-events: none; }
.frame { display: none; border: 0; background: #fff; color-scheme: light; pointer-events: auto; }
.frame.active { display: block; }

/* ---------- Home ---------- */
.home { position: absolute; inset: 0; display: none; overflow-y: auto; padding: 5vh 20px 40px; }
.home.show { display: block; }
.home-inner { max-width: 880px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; text-align: center; animation: rise 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.eyebrow { margin-top: 3vh; font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.hero { margin-top: 6px; font-family: var(--display); font-weight: 700; font-size: clamp(44px, 9vw, 88px); line-height: 1.02; letter-spacing: -0.03em; }
.hero-wave { background: linear-gradient(110deg, var(--accent), var(--accent2) 55%, var(--accent)); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; animation: shimmer 7s linear infinite; }
.no-motion .hero-wave { animation: none; }
@keyframes shimmer { to { background-position: -200% 0; } }
.sub { margin-top: 10px; color: var(--muted); font-size: 15px; min-height: 22px; }

.hsearch { margin-top: 28px; width: min(680px, 100%); display: flex; align-items: center; gap: 10px; height: 58px; padding: 0 8px 0 20px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); -webkit-backdrop-filter: blur(var(--blur)) saturate(150%); backdrop-filter: blur(var(--blur)) saturate(150%); box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.1); transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s; }
.hsearch:focus-within { border-color: rgba(var(--accent-rgb), 0.75); box-shadow: 0 0 0 5px rgba(var(--accent-rgb), 0.16), 0 20px 60px -20px rgba(var(--accent-rgb), 0.6); transform: translateY(-1px); }
.hsearch > .i { color: var(--muted); width: 20px; height: 20px; }
.hsearch input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: 0; font-size: 16px; }
.hsearch input::placeholder { color: var(--faint); }
.chip { height: 34px; padding: 0 13px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--muted); background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line); white-space: nowrap; transition: background 0.15s, color 0.15s; }
.chip:hover { background: rgba(255, 255, 255, 0.14); color: var(--text); }
.go { height: 42px; padding: 0 22px; border-radius: 999px; font-weight: 600; color: #120a24; background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 8px 24px -8px rgba(var(--accent-rgb), 0.9); transition: transform 0.12s, filter 0.2s; }
.go:hover { filter: brightness(1.1); }
.go:active { transform: scale(0.96); }

.section-head { width: 100%; margin-top: 46px; display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.section-head h2 { font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.link { color: var(--accent); font-weight: 600; font-size: 13px; padding: 2px 4px; border-radius: 6px; }
.link:hover { text-decoration: underline; }

.tiles { width: 100%; margin-top: 14px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 10px 14px; border-radius: 18px; background: var(--glass); border: 1px solid var(--line); -webkit-backdrop-filter: blur(var(--blur)); backdrop-filter: blur(var(--blur)); transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.2s, border-color 0.2s, box-shadow 0.2s; min-width: 0; }
.tile:hover { transform: translateY(-4px); background: var(--glass-2); border-color: rgba(var(--accent-rgb), 0.5); box-shadow: 0 18px 40px -18px rgba(var(--accent-rgb), 0.7); }
.tile:active { transform: translateY(-1px) scale(0.98); }
.tile .av { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; font-weight: 700; font-size: 20px; color: #fff; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 8px 18px -8px rgba(0, 0, 0, 0.6); }
.tile .nm { max-width: 100%; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .mt { max-width: 100%; margin-top: -6px; font-size: 11px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .rm { position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; display: none; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, 0.45); color: var(--text); }
.tile .rm .i { width: 12px; height: 12px; }
.tile .rm:hover { background: #e11d48; }
.tiles.edit .rm { display: grid; }
.tiles.edit .tile { animation: wiggle 0.5s ease-in-out infinite alternate; }
.no-motion .tiles.edit .tile { animation: none; }
@keyframes wiggle { from { transform: rotate(-0.8deg); } to { transform: rotate(0.8deg); } }
.empty { grid-column: 1 / -1; padding: 24px; color: var(--faint); }

.tips { margin-top: 38px; display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: center; color: var(--faint); font-size: 12px; }
.tips kbd { margin: 0 2px; }

/* ---------- Error view ---------- */
.errorview { position: absolute; inset: 0; display: none; place-items: center; padding: 20px; background: radial-gradient(60% 60% at 50% 40%, rgba(var(--accent-rgb), 0.1), transparent), rgba(8, 5, 16, 0.7); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.errorview.show { display: grid; }
.errorview .card { width: min(560px, 100%); padding: 30px; border-radius: 24px; text-align: center; background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line); box-shadow: var(--shadow); animation: rise 0.4s ease-out both; }
.err-ico { width: 54px; height: 54px; margin: 0 auto 14px; border-radius: 16px; display: grid; place-items: center; color: #fbbf24; background: rgba(251, 191, 36, 0.12); border: 1px solid rgba(251, 191, 36, 0.3); }
.err-ico .i { width: 26px; height: 26px; }
.errorview h2 { font-family: var(--display); font-size: 22px; }
.err-url { margin-top: 8px; color: var(--accent); font-size: 13px; word-break: break-all; }
.err-msg { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.3); color: var(--muted); font-size: 12.5px; text-align: left; word-break: break-word; max-height: 130px; overflow: auto; }
.errorview .row { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.hint { margin-top: 16px; font-size: 12.5px; color: var(--faint); }

.btn { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 16px; border-radius: 12px; font-weight: 600; font-size: 13px; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); transition: background 0.15s, transform 0.1s; }
.btn:hover { background: rgba(255, 255, 255, 0.15); }
.btn:active { transform: scale(0.97); }
.btn.primary { color: #120a24; border-color: transparent; background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: #fda4af; border-color: rgba(244, 63, 94, 0.35); background: rgba(244, 63, 94, 0.1); }
.btn.danger:hover { background: rgba(244, 63, 94, 0.2); }
.btn.sm { height: 30px; padding: 0 12px; font-size: 12px; border-radius: 10px; }
.btn .i { width: 15px; height: 15px; }

/* ---------- Menu ---------- */
.menu { position: fixed; top: 108px; right: 18px; z-index: 40; width: 260px; padding: 6px; border-radius: 16px; background: rgba(20, 13, 36, 0.9); box-shadow: var(--shadow); opacity: 0; visibility: hidden; transform: translateY(-6px) scale(0.97); transform-origin: top right; transition: opacity 0.16s, transform 0.16s, visibility 0s 0.16s; }
.menu.open { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.menu button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; text-align: left; font-weight: 500; }
.menu button:hover { background: rgba(var(--accent-rgb), 0.16); }
.menu button .i { color: var(--muted); }
.menu button kbd { margin-left: auto; }
.menu hr { border: 0; height: 1px; background: var(--line); margin: 6px 4px; }

/* ---------- Side panel ---------- */
.scrim { position: fixed; inset: 0; z-index: 44; background: rgba(5, 2, 12, 0.5); opacity: 0; visibility: hidden; transition: opacity 0.25s, visibility 0s 0.25s; }
.scrim.show { opacity: 1; visibility: visible; transition-delay: 0s; }
.panel { position: fixed; top: 10px; right: 10px; bottom: 10px; z-index: 50; width: min(420px, calc(100vw - 20px)); display: flex; flex-direction: column; border-radius: 22px; background: rgba(18, 11, 33, 0.88); -webkit-backdrop-filter: blur(30px) saturate(160%); backdrop-filter: blur(30px) saturate(160%); box-shadow: var(--shadow); transform: translateX(110%); visibility: hidden; transition: transform 0.38s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s 0.38s; }
.panel.open { transform: none; visibility: visible; transition-delay: 0s; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 12px 22px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-family: var(--display); font-size: 18px; }
.panel-body { flex: 1; overflow-y: auto; padding: 8px 14px 26px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.2) transparent; }

.group { margin-top: 18px; }
.group > h3 { margin: 0 8px 8px; font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.field { padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); margin-bottom: 8px; }
.field .lbl { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; }
.field small { display: block; margin-top: 3px; color: var(--muted); font-weight: 400; font-size: 12px; line-height: 1.4; }
.field input[type='text'], .field select, .field textarea { width: 100%; margin-top: 10px; padding: 9px 12px; border-radius: 10px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); outline: 0; }
.field input[type='text']:focus, .field select:focus, .field textarea:focus { border-color: rgba(var(--accent-rgb), 0.7); }
.field textarea { min-height: 78px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.field select option { background: #1a0f2e; color: #fff; }
.field .two { display: grid; grid-template-columns: 70px 1fr; gap: 8px; }
.field input[type='range'] { width: 100%; margin-top: 10px; accent-color: var(--accent); }
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.swatch { width: 40px; height: 40px; border-radius: 13px; padding: 3px; border: 2px solid transparent; transition: transform 0.15s, border-color 0.15s; }
.swatch span { display: block; width: 100%; height: 100%; border-radius: 9px; background: linear-gradient(135deg, var(--a), var(--b)); }
.swatch:hover { transform: scale(1.08); }
.swatch.on { border-color: #fff; }

.seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 4px; margin-top: 10px; padding: 4px; border-radius: 12px; background: rgba(0, 0, 0, 0.3); }
.seg button { padding: 8px 4px; border-radius: 9px; font-weight: 600; font-size: 12.5px; color: var(--muted); transition: background 0.15s, color 0.15s; }
.seg button.on { color: #120a24; background: linear-gradient(135deg, var(--accent), var(--accent2)); }

.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 1; margin: 0; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.16); transition: background 0.2s; }
.switch i::after { content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4); }
.switch input:checked + i { background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }

.relay { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.22); margin-top: 8px; }
.relay .nfo { flex: 1; min-width: 0; }
.relay b { font-weight: 600; }
.relay small { display: block; color: var(--faint); margin: 0; }
.rstat { font-size: 11.5px; font-weight: 600; white-space: nowrap; color: var(--faint); }
.rstat.ok { color: #4ade80; }
.rstat.bad { color: #fb7185; }

.list { display: flex; flex-direction: column; gap: 2px; }
.item { display: flex; align-items: center; gap: 12px; padding: 10px 10px; border-radius: 12px; cursor: pointer; transition: background 0.15s; }
.item:hover { background: rgba(255, 255, 255, 0.07); }
.item .av { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; flex: none; }
.item .tx { flex: 1; min-width: 0; }
.item .tx b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .tx small { display: block; color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .del { opacity: 0; color: var(--muted); }
.item:hover .del { opacity: 1; }
.day { margin: 16px 10px 6px; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.search-in { width: 100%; margin: 12px 0 4px; padding: 10px 14px; border-radius: 12px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); outline: 0; }
.search-in:focus { border-color: rgba(var(--accent-rgb), 0.7); }
.panel-empty { padding: 44px 20px; text-align: center; color: var(--faint); }

.prose { padding: 4px 8px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.prose h4 { margin: 18px 0 6px; color: var(--text); font-size: 14px; }
.prose p { margin-bottom: 8px; }
.prose ul { padding-left: 18px; margin-bottom: 8px; }
.prose code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; padding: 1px 5px; border-radius: 5px; background: rgba(255, 255, 255, 0.08); color: var(--text); }
.prose pre { margin: 8px 0; padding: 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.4); border: 1px solid var(--line); overflow: auto; max-height: 260px; font-size: 11.5px; line-height: 1.5; color: #d9d2ee; }
.prose .warn { padding: 10px 12px; border-radius: 12px; background: rgba(251, 191, 36, 0.08); border: 1px solid rgba(251, 191, 36, 0.25); color: #fcd34d; }
.kbds { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: center; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: min(92vw, 460px); }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 14px; background: rgba(22, 14, 40, 0.92); box-shadow: var(--shadow); font-weight: 500; opacity: 0; transform: translateY(10px) scale(0.98); transition: opacity 0.25s, transform 0.25s; max-width: 100%; }
.toast.in { opacity: 1; transform: none; }
.toast .i { color: #4ade80; }
.toast.warn .i { color: #fbbf24; }

.noscript { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg0); z-index: 999; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .pill span { display: none; }
  .pill { padding: 0 9px; }
}
@media (max-width: 720px) {
  .app { padding: 6px; gap: 6px; }
  .hide-sm { display: none; }
  .brand-name { display: none; }
  .brand { padding: 0 6px; }
  .tab { flex-basis: 150px; }
  .toolbar { padding: 6px; gap: 4px; }
  .icon-btn { width: 32px; height: 32px; }
  .hsearch { height: 54px; padding-left: 16px; }
  .hsearch .chip { display: none; }
  .menu { top: 96px; right: 10px; }
  .home { padding-top: 3vh; }
}
@media (max-width: 420px) {
  .tab { flex-basis: 110px; }
  .tab .x { opacity: 1; }
  .nav .icon-btn:nth-child(2) { display: none; }
}


/* ==========================================================================
   v1.1 — logo, section row, pages, tools, apps, gear + settings frame
   ========================================================================== */

/* ---------- Logo ---------- */
.brand-logo { width: 26px; height: 26px; object-fit: contain; filter: drop-shadow(0 0 10px rgba(var(--accent-rgb), 0.65)); }
.hero-logo { width: 84px; height: 84px; margin-top: 2vh; object-fit: contain; filter: drop-shadow(0 0 26px rgba(var(--accent-rgb), 0.75)); animation: float 6s ease-in-out infinite; }
.hero-logo:not([src]) { display: none; }
.hero-logo + .eyebrow { margin-top: 12px; }
@keyframes float { 50% { transform: translateY(-6px) rotate(-3deg); } }
.no-motion .hero-logo { animation: none; }
.tab .fav.logo { background: none; }

/* ---------- Section row under the address bar ---------- */
.toolbar { border-radius: 0; }
.pagenav { display: flex; gap: 4px; padding: 6px 8px 8px; border-top: 1px solid var(--line); border-radius: 0 0 18px 18px; overflow-x: auto; scrollbar-width: none; }
.pagenav::-webkit-scrollbar { display: none; }
.pn { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 15px; border-radius: 999px; font-weight: 600; font-size: 13px; color: var(--muted); white-space: nowrap; transition: background 0.15s, color 0.15s, transform 0.1s; }
.pn .i { width: 16px; height: 16px; }
.pn:hover { background: rgba(255, 255, 255, 0.09); color: var(--text); }
.pn:active { transform: scale(0.96); }
.pn[aria-current='page'] { color: #120a24; background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 6px 18px -8px rgba(var(--accent-rgb), 0.9); }
.loadbar { bottom: 46px; }

/* ---------- Pages ---------- */
.page { position: absolute; inset: 0; display: none; overflow-y: auto; padding: 26px clamp(16px, 4vw, 44px) 44px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.2) transparent; }
.viewport[data-page='games'] #page-games { display: flex; }
.viewport[data-page='tools'] #page-tools,
.viewport[data-page='apps'] #page-apps,
.viewport[data-page='partners'] #page-partners { display: block; }
.viewport:not([data-page='browser']) :is(.home, .frames, .errorview, .hostbar) { display: none !important; }
.wrap, .ph { max-width: 1100px; margin-left: auto; margin-right: auto; }
.ph { margin-bottom: 20px; }
.ph h1 { font-family: var(--display); font-size: clamp(28px, 5vw, 40px); letter-spacing: -0.02em; }
.ph p { margin-top: 6px; color: var(--muted); }
.blank { max-width: 1100px; margin: 0 auto; color: var(--faint); }
.sec { margin: 28px 0 12px; font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.note { margin: 0 0 6px; padding: 10px 14px; border-radius: 12px; background: rgba(var(--accent-rgb), 0.08); border: 1px solid rgba(var(--accent-rgb), 0.25); color: var(--muted); font-size: 12.5px; }
.grow { flex: 1; }

/* ---------- Games ---------- */
#page-games { padding: 0; overflow: hidden; flex-direction: column; }
.gbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 8px 12px; flex: none; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); }
.gbar b { font-family: var(--display); }
.gwrap { position: relative; flex: 1; min-height: 0; background: #0b0613; }
.gframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #0b0613; }
.gload { position: absolute; inset: 0; z-index: 1; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 20px; text-align: center; color: var(--muted); background: #0b0613; }

/* ---------- Tool cards + tool UI ---------- */
.tcard { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border-radius: 16px; text-align: left; background: var(--glass); border: 1px solid var(--line); transition: transform 0.2s, background 0.2s, border-color 0.2s; }
.tcard:hover { transform: translateY(-3px); background: var(--glass-2); border-color: rgba(var(--accent-rgb), 0.5); }
.tcard .em { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-size: 21px; flex: none; background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.3), rgba(var(--accent-rgb), 0.08)); border: 1px solid var(--line); }
.tcard b { display: block; font-weight: 600; }
.tcard small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.tool-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.tool-head h2 { font-family: var(--display); font-size: 22px; }
.tbody { max-width: 760px; display: flex; flex-direction: column; gap: 14px; }
.tbody textarea, .tbody input[type='text'], .tbody input[type='number'], .tbody input[type='datetime-local'], .tbody select { width: 100%; padding: 10px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); outline: 0; }
.tbody textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.5; }
.tbody textarea:focus, .tbody input:focus, .tbody select:focus { border-color: rgba(var(--accent-rgb), 0.7); }
.tbody select option { background: #1a0f2e; color: #fff; }
.tbody label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.tbody input[type='range'] { accent-color: var(--accent); width: 100%; }
.tbody input[type='color'] { width: 100%; height: 42px; padding: 3px; border-radius: 12px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); }
.trow { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-items: end; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.checks label { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-weight: 500; font-size: 13px; }
.drop { display: grid; place-items: center; gap: 4px; padding: 30px 16px; text-align: center; border-radius: 18px; cursor: pointer; border: 2px dashed rgba(var(--accent-rgb), 0.45); background: rgba(var(--accent-rgb), 0.06); color: var(--muted); font-weight: 400; font-size: 13px; transition: background 0.15s, border-color 0.15s; }
.drop strong { color: var(--text); font-size: 15px; }
.drop:hover, .drop.over { background: rgba(var(--accent-rgb), 0.14); border-color: var(--accent); }
.tlist { display: flex; flex-direction: column; gap: 8px; }
.trow2 { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); }
.trow2 img { width: 48px; height: 48px; object-fit: cover; border-radius: 10px; background: rgba(0, 0, 0, 0.3); flex: none; }
.trow2 .tx { flex: 1; min-width: 0; }
.trow2 b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow2 small { color: var(--muted); font-size: 12px; }
.tout { padding: 16px; border-radius: 14px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); font: 600 20px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; min-height: 58px; }
.meter { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #f43f5e, #fbbf24, #4ade80); transition: width 0.2s; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.stats > div, .stats > button { padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); text-align: left; }
.stats b { display: block; font-size: 20px; font-family: var(--display); word-break: break-all; }
.stats span { color: var(--muted); font-size: 12px; }
.stats > button:hover { border-color: rgba(var(--accent-rgb), 0.6); }
.tmsg { font-size: 13px; color: var(--muted); min-height: 18px; }
.tmsg.ok { color: #4ade80; }
.tmsg.bad { color: #fb7185; }
.bigclock { font: 700 clamp(36px, 8vw, 64px)/1 var(--display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.swatch-big { height: 74px; border-radius: 16px; border: 1px solid var(--line); }
.tsplit { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.tpanel { padding: 16px; border-radius: 16px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.tpanel h3 { font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.laps { max-height: 140px; overflow: auto; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }

/* ---------- Apps ---------- */
.apps-top { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.apps-top .search-in { margin: 0; flex: 1; min-width: 200px; }
.addapp { display: grid; grid-template-columns: 1fr 1.6fr auto; gap: 8px; margin: 10px 0 4px; }
.addapp input { padding: 9px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); outline: 0; min-width: 0; }
.addapp input:focus { border-color: rgba(var(--accent-rgb), 0.7); }
.acard { display: flex; align-items: center; gap: 4px; border-radius: 16px; background: var(--glass); border: 1px solid var(--line); transition: transform 0.2s, background 0.2s, border-color 0.2s; min-width: 0; }
.acard:hover { transform: translateY(-3px); background: var(--glass-2); border-color: rgba(var(--accent-rgb), 0.5); }
.acard .main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 12px; text-align: left; }
.acard .av { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; flex: none; font-weight: 700; font-size: 18px; color: #fff; text-shadow: 0 1px 5px rgba(0, 0, 0, 0.35); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3); }
.acard .tx { min-width: 0; }
.acard b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acard small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acard { position: relative; }
.acard .side { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); display: flex; opacity: 0; border-radius: 10px; background: rgba(18, 11, 33, 0.92); transition: opacity 0.15s; }
.acard:hover .side, .acard:focus-within .side { opacity: 1; }
@media (hover: none) { .acard .side { opacity: 1; } }

/* ---------- Hosted-proxy hint ---------- */
.hostbar { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 4; display: none; align-items: center; gap: 10px; max-width: calc(100% - 24px); padding: 8px 8px 8px 14px; border-radius: 999px; font-size: 12.5px; background: rgba(20, 13, 36, 0.92); border: 1px solid rgba(var(--accent-rgb), 0.5); box-shadow: var(--shadow); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.hostbar.show { display: flex; }
.hostbar b { color: var(--accent); font-weight: 600; word-break: break-all; }

/* ---------- Footer gear + settings frame ---------- */
.foot { display: flex; align-items: center; justify-content: space-between; flex: none; height: 24px; padding: 0 4px; color: var(--faint); font-size: 11px; }
.gear { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 8px; color: var(--faint); transition: color 0.2s, background 0.2s, transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
.gear .i { width: 15px; height: 15px; }
.gear:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.gear.on { color: var(--accent); transform: rotate(90deg); }
.sframe { position: fixed; left: 12px; bottom: 44px; z-index: 60; width: min(440px, calc(100vw - 24px)); max-height: min(660px, calc(100dvh - 120px)); display: flex; flex-direction: column; border-radius: 20px; background: rgba(18, 11, 33, 0.92); border: 1px solid var(--line); -webkit-backdrop-filter: blur(30px) saturate(160%); backdrop-filter: blur(30px) saturate(160%); box-shadow: var(--shadow); opacity: 0; visibility: hidden; transform: translateY(14px) scale(0.97); transform-origin: bottom left; transition: opacity 0.2s, transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s 0.28s; }
.sframe.open { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.sframe-head { padding: 14px 20px 10px; border-bottom: 1px solid var(--line); }
.sframe-head h2 { font-family: var(--display); font-size: 17px; }

@media (max-width: 720px) {
  .pn { padding: 0 12px; }
  .addapp { grid-template-columns: 1fr; }
  .sframe { left: 6px; bottom: 40px; width: calc(100vw - 12px); }
}
