/* ═══════════════════════════════════════════════════════════════════════════
   CUBIX — Dark grey & white, minimal, clean
   ═══════════════════════════════════════════════════════════════════════════ */

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

:root {
  --bg:        #111111;
  --surface:   #1a1a1a;
  --surface2:  #222222;
  --border:    #2a2a2a;
  --border-hi: #3a3a3a;
  --text:      #ffffff;
  --text-2:    #999999;
  --text-3:    #555555;
  --font:      'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius:    8px;
  --chrome-h:  96px; /* topbar + tabbar total */
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ─── Chrome (top area) ──────────────────────────────────────────────────── */
.chrome {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  user-select: none;
}

/* ─── Top bar ────────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  height: 52px;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 1px;
  cursor: pointer;
  flex-shrink: 0;
  margin-right: 4px;
}

.logo-l {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
  display: inline-block;
  animation:
    logo-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) both,
    logo-shimmer 4s ease-in-out calc(var(--d) * 0.4s + 0.8s) infinite;
  animation-delay: calc(var(--d) * 0.06s);
}

@keyframes logo-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes logo-shimmer {
  0%, 80%, 100% { color: var(--text); }
  40%           { color: #888; }
}

/* Nav buttons */
.nav-btn {
  background: none;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.nav-btn:hover:not(:disabled) { background: var(--surface2); color: var(--text); }
.nav-btn:disabled { opacity: 0.25; cursor: default; }

/* URL bar form */
.urlbar-form {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.urlbar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 12px;
  height: 34px;
  transition: border-color 0.15s;
  min-width: 0;
}
.urlbar:focus-within {
  border-color: var(--border-hi);
}

.urlbar-icon {
  color: var(--text-3);
  display: flex;
  flex-shrink: 0;
}

.url-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 400;
  caret-color: #fff;
  min-width: 0;
}
.url-input::placeholder { color: var(--text-3); }
.url-input::selection   { background: rgba(255,255,255,0.15); }

/* Go button */
.go-btn {
  background: #ffffff;
  color: #000000;
  border: none;
  border-radius: var(--radius);
  padding: 0 18px;
  height: 34px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
.go-btn:hover  { background: #e8e8e8; }
.go-btn:active { transform: scale(0.97); }

/* ─── Tab bar ────────────────────────────────────────────────────────────── */
.tabbar {
  display: flex;
  align-items: center;
  border-top: 1px solid var(--border);
  height: 36px;
  padding: 0 6px;
  gap: 4px;
  overflow: hidden;
}

.tabs-scroll {
  display: flex;
  align-items: center;
  gap: 3px;
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1;
  scrollbar-width: none;
}
.tabs-scroll::-webkit-scrollbar { display: none; }

/* Single tab */
.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px 0 12px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  max-width: 180px;
  min-width: 80px;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
  animation: tab-in 0.2s ease both;
}
.tab:hover                 { background: var(--surface2); border-color: var(--border); }
.tab.active                { background: var(--bg); border-color: var(--border); }

@keyframes tab-in {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

.tab-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.tab.active .tab-title { color: var(--text); }

.tab-loading {
  width: 10px; height: 10px;
  border: 1.5px solid var(--border-hi);
  border-top-color: var(--text-2);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

.tab-close {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
  opacity: 0;
}
.tab:hover .tab-close,
.tab.active .tab-close { opacity: 1; }
.tab-close:hover { background: var(--surface2); color: var(--text); }

/* New tab button */
.new-tab-btn {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}
.new-tab-btn:hover { background: var(--surface2); color: var(--text); }

/* ─── Content area ───────────────────────────────────────────────────────── */
.content {
  position: fixed;
  top: var(--chrome-h);
  left: 0; right: 0; bottom: 0;
  background: var(--bg);
  overflow: hidden;
}

/* ─── Loading bar ────────────────────────────────────────────────────────── */
.load-bar {
  position: absolute;
  top: 0; left: 0;
  height: 2px;
  width: 0%;
  background: #ffffff;
  z-index: 10;
  transition: width 0.4s ease, opacity 0.3s;
  opacity: 0;
  border-radius: 0 2px 2px 0;
}
.load-bar.running {
  opacity: 1;
  animation: load-progress 1.8s ease forwards;
}
.load-bar.done {
  width: 100% !important;
  opacity: 0;
  transition: width 0.15s ease, opacity 0.4s 0.15s;
}

@keyframes load-progress {
  0%   { width: 0%; }
  40%  { width: 65%; }
  80%  { width: 88%; }
  100% { width: 93%; }
}

/* ─── Proxy iframe ───────────────────────────────────────────────────────── */
.frame {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

/* ─── New-tab splash ─────────────────────────────────────────────────────── */
.splash {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
}

.splash-logo {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-bottom: 4px;
}

.sl {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -3px;
  color: var(--text);
  display: inline-block;
  animation:
    sl-in 0.7s cubic-bezier(0.16, 1, 0.3, 1) calc(var(--d) * 0.08s) both,
    logo-shimmer 5s ease-in-out calc(var(--d) * 0.6s + 1.2s) infinite;
}

@keyframes sl-in {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.splash-sub {
  font-size: 13px;
  color: var(--text-3);
  font-weight: 400;
  letter-spacing: 0.3px;
  animation: fade-in 0.6s ease 0.5s both;
  margin-bottom: 32px;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Quick-site grid */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 420px;
  animation: fade-in 0.6s ease 0.7s both;
}

.quick-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.12s;
}
.quick-tile:hover {
  background: var(--surface2);
  border-color: var(--border-hi);
  color: var(--text);
  transform: translateY(-2px);
}
.quick-tile:active { transform: translateY(0); }

.qt-char {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  width: 36px;
  height: 36px;
  background: var(--surface2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 520px) {
  .logo { display: none; }
  .nav-btn { display: none; }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
}
