* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  background: #202124;
  color: #e8eaed;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Titlebar / Tab Strip (Window Controls Overlay) */
.titlebar {
  position: fixed;
  top: 0;
  left: env(titlebar-area-x, 0);
  width: env(titlebar-area-width, 100%);
  height: env(titlebar-area-height, 40px);
  background: #202124;
  display: flex;
  align-items: flex-end;
  padding: 6px 8px 0 8px;
  gap: 4px;
  -webkit-app-region: drag;
  z-index: 100;
}

.tab-strip {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  overflow-x: auto;
  max-width: calc(100% - 36px);
  scrollbar-width: none;
}
.tab-strip::-webkit-scrollbar { display: none; }

.tab {
  -webkit-app-region: no-drag;
  background: transparent;
  color: #9aa0a6;
  border-radius: 8px 8px 0 0;
  padding: 7px 10px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  min-width: 120px;
  max-width: 210px;
  user-select: none;
  transition: background 0.12s;
}
.tab:hover { background: #292a2d; color: #e8eaed; }
.tab.active {
  background: #35363a;
  color: #e8eaed;
  font-weight: 500;
}
.tab-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.tab-close {
  background: transparent;
  border: none;
  color: #9aa0a6;
  font-size: 11px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.tab-close:hover { background: #4a4d51; color: #fff; }

.new-tab-btn {
  -webkit-app-region: no-drag;
  background: transparent;
  border: none;
  color: #9aa0a6;
  font-size: 18px;
  width: 28px;
  height: 28px;
  margin-bottom: 3px;
  border-radius: 50%;
  cursor: pointer;
}
.new-tab-btn:hover { background: #292a2d; color: #e8eaed; }

/* Toolbar */
.toolbar {
  margin-top: env(titlebar-area-height, 40px);
  background: #35363a;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid #202124;
}
.icon-btn {
  background: transparent;
  border: none;
  color: #bdc1c6;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { background: #45474b; color: #fff; }

.omnibox {
  flex: 1;
  display: flex;
  align-items: center;
  background: #202124;
  border: 1px solid transparent;
  border-radius: 20px;
  padding: 4px 10px;
  gap: 8px;
  height: 34px;
}
.omnibox:focus-within {
  border-color: #8ab4f8;
  background: #171717;
}
.site-chip { font-size: 12px; color: #9aa0a6; }
.omnibox input {
  flex: 1;
  background: transparent;
  border: none;
  color: #e8eaed;
  font-size: 14px;
  outline: none;
}
.bookmark-btn {
  background: transparent;
  border: none;
  color: #9aa0a6;
  font-size: 15px;
  cursor: pointer;
}
.bookmark-btn:hover { color: #8ab4f8; }

.gememi-btn {
  background: linear-gradient(135deg, #4285f4, #9b72cb, #d96570);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gememi-btn:hover { filter: brightness(1.12); }

/* 3-Dot Menu */
.menu-wrap { position: relative; }
.dropdown {
  position: absolute;
  right: 0;
  top: 36px;
  width: 210px;
  background: #292a2d;
  border: 1px solid #3c4043;
  border-radius: 8px;
  padding: 6px 0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  z-index: 200;
}
.dropdown.hidden { display: none; }
.menu-item {
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
}
.menu-item:hover { background: #3c4043; }
.dropdown hr { border: none; border-top: 1px solid #3c4043; margin: 4px 0; }

/* Workspace & Search Results */
.workspace { display: flex; flex: 1; overflow: hidden; }
.viewport {
  flex: 1;
  overflow-y: auto;
  background: #202124;
  padding: 24px 32px;
}

.search-container { max-width: 720px; }
.ai-overview {
  background: linear-gradient(145deg, #252836, #202124);
  border: 1px solid #3c4043;
  border-left: 3px solid #8ab4f8;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 24px;
}
.ai-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #8ab4f8;
  margin-bottom: 10px;
}
.ai-text {
  font-size: 15px;
  line-height: 1.6;
  color: #e8eaed;
  white-space: pre-wrap;
}

.result-item { margin-bottom: 22px; }
.result-cite {
  font-size: 12px;
  color: #bdc1c6;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.result-title {
  font-size: 19px;
  color: #8ab4f8;
  text-decoration: none;
  cursor: pointer;
  display: inline-block;
  margin-bottom: 4px;
}
.result-title:hover { text-decoration: underline; }
.result-snippet {
  font-size: 14px;
  line-height: 1.5;
  color: #bdc1c6;
}

/* Error / Page View */
.error-page {
  max-width: 540px;
  margin: 60px auto;
  color: #9aa0a6;
}
.error-page h2 { color: #e8eaed; font-weight: 500; margin-bottom: 8px; }
.error-code { font-size: 12px; margin-top: 16px; color: #80868b; }

/* Settings Page (slop://settings) */
.settings-page { max-width: 680px; margin: 0 auto; }
.settings-page h1 { font-size: 22px; font-weight: 500; margin-bottom: 20px; }
.settings-card {
  background: #292a2d;
  border: 1px solid #3c4043;
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.settings-card h3 { margin: 0 0 4px 0; font-size: 15px; font-weight: 500; }
.settings-card p { margin: 0; font-size: 13px; color: #9aa0a6; }
.primary-btn {
  background: #8ab4f8;
  color: #202124;
  border: none;
  border-radius: 18px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.primary-btn:hover { background: #aecbfa; }

/* Gememi Side Panel */
.gememi-sidebar {
  width: 340px;
  max-width: 90vw;
  background: #292a2d;
  border-left: 1px solid #3c4043;
  display: flex;
  flex-direction: column;
}
.gememi-sidebar.hidden { display: none; }
.sidebar-header {
  padding: 10px 14px;
  border-bottom: 1px solid #3c4043;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 500;
}
.chat-log {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13.5px;
}
.msg {
  padding: 10px 13px;
  border-radius: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  max-width: 88%;
}
.msg.user { background: #8ab4f8; color: #202124; align-self: flex-end; }
.msg.bot { background: #35363a; color: #e8eaed; align-self: flex-start; }

.chat-input-box {
  padding: 10px;
  border-top: 1px solid #3c4043;
  display: flex;
  gap: 8px;
}
.chat-input-box input {
  flex: 1;
  background: #202124;
  border: 1px solid #3c4043;
  border-radius: 18px;
  padding: 8px 12px;
  color: #e8eaed;
  font-size: 13px;
  outline: none;
}
.chat-input-box button {
  background: #8ab4f8;
  color: #202124;
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  cursor: pointer;
}
