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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #202124;
  color: #e8eaed;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Web banner at top */
#web-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: linear-gradient(90deg, #8ab4f8, #aecbfa);
  color: #202124;
  font-size: 13px;
  padding: 8px 16px;
  font-weight: 500;
}

#web-banner a {
  color: #202124;
  text-decoration: underline;
  font-weight: 700;
}

body.logged-out #nav-bar,
body.logged-out #ntp,
body.logged-out #web-banner { display: none; }

/* When loaded with ?guest (live preview on the landing page),
   trim the chrome so the embed reads cleanly inside the hero mock-up. */
body.embedded #web-banner { display: none; }
body.embedded #btn-clear { display: none; }
body.embedded .ntp-shortcuts { margin-top: 24px; }
body.embedded .ntp-logo { font-size: 48px; }
body.embedded .ntp-logo span { font-size: 22px; }
body.embedded #ntp { padding-top: 6vh; }

/* ===== Tab bar (visible whenever logged in) ===== */
#tab-bar { display: none; }

body.logged-in #tab-bar {
  display: flex;
  align-items: flex-end;
  background: #181a1f;
  height: 36px;
  padding: 0 8px;
  gap: 2px;
  overflow-x: auto;
  flex-shrink: 0;
}

body.logged-in #tabs-container {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  flex: 1;
  height: 100%;
}

.tab-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  background: #2f3138;
  border-radius: 8px 8px 0 0;
  font-size: 12px;
  color: #9aa0a6;
  cursor: pointer;
  min-width: 110px;
  max-width: 180px;
  margin-top: auto;
  transition: background 0.1s;
}

.tab-pill:hover { background: #3c4043; }

.tab-pill.active {
  background: #35363a;
  color: #e8eaed;
}

.tab-pill .tab-pill-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-pill .tab-pill-close {
  background: none;
  border: none;
  color: inherit;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
}

.tab-pill:hover .tab-pill-close,
.tab-pill.active .tab-pill-close { opacity: 1; }

.tab-pill .tab-pill-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

#new-tab-btn {
  background: none;
  border: none;
  color: #9aa0a6;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  margin-bottom: 2px;
}

#new-tab-btn:hover { background: rgba(255,255,255,0.08); color: #e8eaed; }

/* ===== Site iframe container ===== */
#site-container {
  position: relative;
  flex: 1;
  min-height: 0;
  display: none;
  background: #202124;
}

body.logged-in.viewing-site #site-container { display: flex; }
body.logged-in.viewing-site #ntp { display: none; }

#site-container iframe {
  width: 100%;
  height: 100%;
  flex: 1;
  border: none;
  background: white;
  display: none;
}

#site-container iframe.active { display: block; }

/* "Site blocked" overlay */
.site-blocked-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #292a2d, #1a1a1c);
  color: #e8eaed;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  text-align: center;
  z-index: 10;
}

.site-blocked-overlay h3 {
  font-size: 20px;
  margin-bottom: 12px;
  color: #f28b82;
}

.site-blocked-overlay p {
  font-size: 14px;
  color: #9aa0a6;
  max-width: 420px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.site-blocked-overlay code {
  background: #202124;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: #fbbc04;
}

.site-blocked-overlay .actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.site-blocked-overlay button,
.site-blocked-overlay a {
  background: #8ab4f8;
  color: #202124;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.site-blocked-overlay a.secondary {
  background: #3c4043;
  color: #e8eaed;
}

.site-blocked-overlay a:hover { background: #aecbfa; }
.site-blocked-overlay a.secondary:hover { background: #5f6368; }

/* ===== Login screen ===== */
#login-screen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, #202124, #292a2d);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}

body.logged-in #login-screen { display: none; }

#login-box {
  width: 400px;
  background: #292a2d;
  border: 1px solid #3c4043;
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

.login-logo {
  text-align: center;
  font-size: 42px;
  font-weight: 300;
  color: #8ab4f8;
  letter-spacing: -1px;
}

.login-logo span {
  display: block;
  margin-top: -4px;
  font-size: 16px;
  color: #9aa0a6;
  letter-spacing: 3px;
  text-transform: uppercase;
  font-weight: 300;
}

.login-tabs {
  display: flex;
  margin: 28px 0 20px;
  gap: 8px;
  border-bottom: 1px solid #3c4043;
}

.login-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 10px 0;
  color: #9aa0a6;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.login-tab.active {
  color: #8ab4f8;
  border-bottom-color: #8ab4f8;
}

#login-form { display: flex; flex-direction: column; gap: 12px; }

#login-form input {
  background: #202124;
  border: 1px solid #5f6368;
  border-radius: 6px;
  color: #e8eaed;
  padding: 12px 14px;
  font-size: 14px;
  outline: none;
}

#login-form input:focus { border-color: #8ab4f8; }

#login-submit {
  background: #8ab4f8;
  color: #202124;
  border: none;
  padding: 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
}

#login-submit:hover { background: #aecbfa; }

.login-error {
  background: rgba(242, 139, 130, 0.15);
  color: #f28b82;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  border: 1px solid rgba(242, 139, 130, 0.3);
}
.login-error.hidden { display: none; }

.login-hint {
  font-size: 12px;
  color: #9aa0a6;
  margin-top: 20px;
  text-align: center;
}

/* ===== Nav bar ===== */
#nav-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: #35363a;
  border-bottom: 1px solid #2f3138;
  flex-shrink: 0;
}

#address-bar {
  flex: 1;
  height: 36px;
  border: none;
  border-radius: 18px;
  background: #202124;
  color: #e8eaed;
  padding: 0 18px;
  font-size: 14px;
  outline: none;
}

#address-bar:focus {
  background: #292b2e;
  box-shadow: 0 0 0 2px rgba(138,180,248,0.4);
}

#nav-bar button {
  background: transparent;
  border: none;
  color: #9aa0a6;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#nav-bar button:hover {
  background: rgba(255,255,255,0.08);
  color: #e8eaed;
}

#btn-music.music-active { color: #8ab4f8; }

/* ===== New Tab Page ===== */
#ntp {
  position: relative;
  flex: 1;
  min-height: 0;
  background: var(--ntp-bg, #202124);
  background-size: cover;
  background-position: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 12vh;
  overflow: auto;
}

#ntp.has-image-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

#ntp > * { position: relative; z-index: 1; }

.ntp-logo {
  font-size: 64px;
  font-weight: 300;
  color: #8ab4f8;
  letter-spacing: -2px;
}

.ntp-logo span {
  display: block;
  text-align: center;
  margin-top: -8px;
  font-size: 28px;
  font-weight: 200;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: #9aa0a6;
}

.ntp-search {
  margin-top: 32px;
  width: 560px;
  max-width: 90%;
  height: 46px;
  border-radius: 23px;
  background: #303134;
  border: 1px solid #5f6368;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}

.ntp-search:hover, .ntp-search:focus-within {
  background: #3c3e42;
}

.ntp-search-icon { color: #9aa0a6; }

.ntp-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #e8eaed;
  font-size: 16px;
}

.ntp-search input::placeholder { color: #9aa0a6; }

.ntp-shortcuts {
  display: grid;
  grid-template-columns: repeat(4, 112px);
  gap: 12px;
  margin-top: 40px;
}

@media (max-width: 600px) {
  .ntp-shortcuts { grid-template-columns: repeat(2, 112px); }
}

.ntp-shortcut {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 8px;
  border-radius: 12px;
  cursor: pointer;
}

.ntp-shortcut:hover { background: rgba(255,255,255,0.06); }

.ntp-shortcut-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #303134;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8ab4f8;
  font-size: 18px;
  font-weight: 700;
}

.ntp-shortcut-label {
  font-size: 12px;
  color: #e8eaed;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Hidden music player ===== */
#bg-music-player {
  position: fixed;
  top: -10000px;
  left: -10000px;
  width: 320px;
  height: 240px;
  pointer-events: none;
  z-index: -1;
}

#bg-music-player iframe {
  width: 320px;
  height: 240px;
  border: none;
}

/* ===== Settings ===== */
#settings-panel {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

#settings-panel.hidden { display: none; }

#settings-content {
  width: 520px;
  max-width: 90%;
  max-height: 86vh;
  background: #292a2d;
  border: 1px solid #3c4043;
  border-radius: 12px;
  padding: 24px 32px;
  position: relative;
  overflow-y: auto;
}

#settings-content h2 { font-size: 18px; margin-bottom: 20px; }

#settings-close {
  position: absolute;
  top: 16px; right: 16px;
  background: none; border: none;
  color: #9aa0a6;
  width: 28px; height: 28px;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
}

#settings-close:hover { background: rgba(255,255,255,0.08); color: #e8eaed; }

.settings-section { margin-bottom: 24px; }

.settings-section h3 {
  font-size: 13px;
  color: #8ab4f8;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.settings-section button {
  background: #8ab4f8;
  color: #202124;
  border: none;
  padding: 8px 18px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
  margin-right: 8px;
}

.settings-section button:hover { background: #aecbfa; }

.hint {
  font-size: 12px;
  color: #9aa0a6;
  margin-bottom: 12px;
}

.settings-text-input {
  width: 100%;
  background: #202124;
  border: 1px solid #5f6368;
  border-radius: 4px;
  color: #e8eaed;
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  margin-bottom: 8px;
}

.settings-text-input:focus { border-color: #8ab4f8; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin: 8px 0;
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: #8ab4f8;
}

.select-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.select-row select {
  background: #202124;
  border: 1px solid #5f6368;
  border-radius: 4px;
  color: #e8eaed;
  padding: 6px 10px;
  font-size: 13px;
  outline: none;
}

.music-status {
  font-size: 12px;
  background: #202124;
  border: 1px solid #3c4043;
  border-radius: 6px;
  padding: 8px 12px;
  margin: 8px 0;
  color: #9aa0a6;
}
.music-status.playing {
  color: #81c995;
  border-color: rgba(129,201,149,0.3);
}

.play-btn { background: #81c995 !important; }
.play-btn:hover { background: #a8dab5 !important; }

#logout-btn { background: #3c4043 !important; color: #e8eaed !important; }
#logout-btn:hover { background: #5f6368 !important; }

#account-info {
  background: #202124;
  border: 1px solid #3c4043;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 12px;
  font-size: 14px;
}

/* Shortcut editor rows */
.shortcut-row {
  display: grid;
  grid-template-columns: 1fr 1.5fr 28px;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #3c4043;
}

.shortcut-row input {
  width: 100%;
  background: #202124;
  border: 1px solid #5f6368;
  border-radius: 4px;
  color: #e8eaed;
  padding: 6px 10px;
  font-size: 12px;
  outline: none;
}

.shortcut-remove {
  background: none !important;
  color: #9aa0a6 !important;
  font-size: 18px !important;
  width: 28px;
  height: 28px;
  border-radius: 50% !important;
  padding: 0 !important;
  margin: 0 !important;
}

.shortcut-remove:hover {
  background: rgba(242, 139, 130, 0.15) !important;
  color: #f28b82 !important;
}

/* Toast */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #303134;
  color: #81c995;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 200;
  transition: opacity 0.3s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
#toast.hidden { opacity: 0; pointer-events: none; }
