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

:root {
  --bg: #1a1a1f; --surface: #26262e; --surface-2: #2e2e38;
  --border: #3a3a48; --text: #e8e8f0; --text-muted: #8888a0;
  --accent: #6c8ef5; --accent-hover: #7f9ef7; --danger: #e05c5c;
  --toolbar-h: 52px; --tab-h: 36px; --bookmarks-h: 34px;
  --radius: 6px; --transition: 0.15s ease;
}

html, body { height: 100%; width: 100%; overflow: hidden;
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px; }

.app { display: flex; flex-direction: column; height: 100vh; width: 100vw; }

.tab-bar { height: var(--tab-h); background: var(--bg); display: flex;
  align-items: flex-end; padding: 0 8px; gap: 2px;
  border-bottom: 1px solid var(--border); flex-shrink: 0; }

.tab { display: flex; align-items: center; gap: 6px; height: 28px;
  padding: 0 14px 0 10px; border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface-2); cursor: pointer;
  min-width: 140px; max-width: 260px; transition: background var(--transition); }
.tab.active { background: var(--surface); }
.tab-favicon { width: 14px; height: 14px; object-fit: contain; flex-shrink: 0; }
.tab-title { font-size: 12px; color: var(--text-muted); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; flex: 1; }
.tab.active .tab-title { color: var(--text); }

.toolbar { height: var(--toolbar-h); background: var(--surface); display: flex;
  align-items: center; gap: 6px; padding: 0 10px;
  border-bottom: 1px solid var(--border); flex-shrink: 0; }
.nav-buttons { display: flex; gap: 2px; }
.nav-btn { width: 32px; height: 32px; border: none; background: transparent;
  color: var(--text-muted); border-radius: var(--radius); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition), color var(--transition); flex-shrink: 0; }
.nav-btn svg { width: 16px; height: 16px; }
.nav-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.nav-btn:disabled { opacity: 0.35; cursor: default; }
.nav-btn:active:not(:disabled) { background: var(--border); }
.star-btn.starred svg { color: #f5c842; }

.address-bar-wrapper { flex: 1; display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0 10px; height: 34px;
  transition: border-color var(--transition); }
.address-bar-wrapper:focus-within { border-color: var(--accent); }
.address-favicon { width: 14px; height: 14px; object-fit: contain; flex-shrink: 0; }
.loading-spinner { width: 14px; height: 14px; border: 2px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%; flex-shrink: 0; display: none; }
.loading-spinner.active { display: block; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.address-bar { flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-size: 13px; font-family: inherit; min-width: 0; }
.address-bar::placeholder { color: var(--text-muted); }

.go-btn { height: 34px; padding: 0 16px; background: var(--accent); color: #fff;
  border: none; border-radius: var(--radius); cursor: pointer; font-size: 13px;
  font-weight: 500; font-family: inherit; flex-shrink: 0;
  transition: background var(--transition); }
.go-btn:hover { background: var(--accent-hover); }
.go-btn:active { opacity: 0.85; }

.bookmarks-bar { height: var(--bookmarks-h); background: var(--surface);
  display: flex; align-items: center; gap: 2px; padding: 0 8px;
  border-bottom: 1px solid var(--border); overflow-x: auto;
  flex-shrink: 0; scrollbar-width: none; }
.bookmarks-bar::-webkit-scrollbar { display: none; }
.bookmark-item { display: flex; align-items: center;
  border-radius: calc(var(--radius) - 2px); transition: background var(--transition); }
.bookmark-item:hover { background: var(--surface-2); }
.bookmark-btn { display: flex; align-items: center; gap: 5px; height: 24px;
  padding: 0 10px; border: none; background: transparent; color: var(--text-muted);
  border-radius: calc(var(--radius) - 2px); cursor: pointer; font-size: 12px;
  font-family: inherit; white-space: nowrap;
  transition: background var(--transition), color var(--transition); flex-shrink: 0; }
.bookmark-btn:hover { background: var(--surface-2); color: var(--text); }
.bookmark-favicon { width: 12px; height: 12px; object-fit: contain; }
.bookmark-remove { width: 14px; height: 14px; margin-left: 4px;
  color: var(--text-muted); opacity: 0; background: none; border: none;
  cursor: pointer; padding: 0; display: flex; align-items: center;
  justify-content: center; border-radius: 50%;
  transition: opacity var(--transition), background var(--transition); }
.bookmark-item:hover .bookmark-remove { opacity: 1; }
.bookmark-remove:hover { background: var(--border); color: var(--danger); }

.content-area { flex: 1; position: relative; overflow: hidden; background: var(--bg); }
.viewer-frame { position: absolute; inset: 0; width: 100%; height: 100%;
  border: none; background: #fff; }

.start-screen { position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; background: var(--bg); }
.start-inner { text-align: center; max-width: 480px; padding: 24px; }
.start-logo { width: 56px; height: 56px; margin: 0 auto 20px; color: var(--accent); }
.start-logo svg { width: 100%; height: 100%; }
.start-title { font-size: 28px; font-weight: 600; color: var(--text);
  margin-bottom: 8px; letter-spacing: -0.5px; }
.start-subtitle { font-size: 14px; color: var(--text-muted); margin-bottom: 32px; }
.quick-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.quick-link-btn { display: flex; align-items: center; gap: 7px; padding: 8px 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-muted); font-size: 13px;
  font-family: inherit; cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition); }
.quick-link-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--accent); }
.quick-link-favicon { width: 16px; height: 16px; object-fit: contain; }

.error-screen { position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; background: var(--bg); }
.error-inner { text-align: center; max-width: 420px; padding: 24px; }
.error-icon { width: 48px; height: 48px; margin: 0 auto 16px; color: var(--danger); }
.error-icon svg { width: 100%; height: 100%; }
.error-title { font-size: 20px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.error-message { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; line-height: 1.5; }
.retry-btn { padding: 0 24px; }