:root{
  --z-bg-page:#e3e5e8;
  --z-bg-chrome:#ffffff;
  --z-tabs-bg:linear-gradient(#f3f4f6,#dfe1e5);
  --z-tabs-border:#ccd0d5;
  --z-pill-bg:#ffffff;
  --z-pill-shadow:0 -2px 4px rgba(0,0,0,.12);
  --z-tab-hover:rgba(255,255,255,.7);
  --z-tab-active:#1a73e8;
  --z-tab-divider:#d0d0d0;
  --z-toolbar-bg:#f9fafb;
  --z-toolbar-border:#e0e0e0;
  --z-icon:#5f6368;
  --z-icon-hover:#1a73e8;
  --z-address-bg:#f1f3f4;
  --z-address-text:#111827;
  --z-text-primary:#111827;
  --z-menu-btn-hover:#e8eaed;
  --z-menu-bg:#ffffff;
  --z-menu-item-hover:#f1f3f4;
  --z-content-bg:#fafafa;
}

html,body{
  margin:0;
  height:100%;
  background:var(--z-bg-page);
  font-family:Segoe UI,system-ui,sans-serif;
  overflow:hidden;
}

.chrome{
  display:flex;
  flex-direction:column;
  height:100vh;
  background:var(--z-bg-chrome);
}

.tabs{
  display:flex;
  align-items:flex-end;
  height:44px;
  background:var(--z-tabs-bg);
  border-bottom:1px solid var(--z-tabs-border);
  padding-left:8px;
  position:relative;
  overflow:hidden;
}

.tabs-container{
  display:flex;
  align-items:center; 
  gap:0;
  flex:1;
  overflow:hidden;
  position:relative;
}

.active-pill{
  position:absolute;
  bottom:0;
  left:0;
  height:35px;
  background:var(--z-pill-bg);
  border-radius:8px 8px 0 0;
  box-shadow:none;
  border:1px solid color-mix(in srgb, var(--z-tabs-border) 82%, transparent);
  border-bottom:none;
  box-sizing:border-box;
  transform:translateX(0);
  transition:transform .22s cubic-bezier(.2,.8,.2,1), width .22s cubic-bezier(.2,.8,.2,1);
  pointer-events:none;
  will-change:transform,width;
  z-index:0;
}

.tab{
  display:flex;
  align-items:center;
  gap:8px;
  height:35px;
  padding:0 12px;
  border-radius:8px 8px 0 0;
  background:transparent;
  font-size:13px;
  cursor:pointer;
  min-width:50px;
  max-width:240px;
  position:relative;
  transition: background-color .16s ease,
              color .16s ease,
              transform .24s cubic-bezier(.22,.78,.18,1),
              opacity .18s ease,
              padding .24s cubic-bezier(.22,.78,.18,1),
              margin .24s cubic-bezier(.22,.78,.18,1),
              filter .2s ease;
  border-right:1px solid var(--z-tab-divider);
  color:var(--z-text-primary);
  will-change:transform,width;
  z-index:2;
}

.tab.shift-flavor{
  animation:tabShiftFlavor .28s cubic-bezier(.2,.75,.2,1);
}

.tab:last-child{
  border-right:none;
}

.tab:hover{
  background:var(--z-tab-hover);
  filter:brightness(1.02);
}

.tab.active{
  color:var(--z-tab-active);
  background:transparent;
}

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

.tab-favicon{
  display:flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
}

.close-btn{
  width:20px;
  height:20px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:50%;
  opacity:0;
  transition:.2s;
}

.tab:hover .close-btn{
  opacity:1;
}

.close-btn:hover{
  background:rgba(0,0,0,.1);
}

.tab.closing{
  opacity:0;
  transform:scale(0.85);
  width:0 !important;
  padding:0;
  margin:0;
  overflow:hidden;
}

.tab-closing-ghost{
  position:absolute;
  top:0;
  margin:0 !important;
  pointer-events:none;
  z-index:1;
  transform-origin:center center;
  opacity:.94;
  filter:saturate(1.03);
  box-shadow:0 10px 24px rgba(0,0,0,.12);
  transition:transform .24s cubic-bezier(.2,.8,.2,1), opacity .24s ease, filter .24s ease;
}

.tab-closing-ghost.closing{
  opacity:0;
  filter:blur(.5px) saturate(.92);
  transform:translateY(-3px) scale(.94) rotate(-1.25deg);
}

.add-tab{
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  font-size:20px;
  color:var(--z-icon);
  width:36px;
  height:35px;
  flex-shrink:0;
}

.add-tab:hover{
  color:var(--z-icon-hover);
}

.toolbar{
  display:flex;
  align-items:center;
  gap:14px;
  height:48px;
  padding:0 14px;
  background:var(--z-toolbar-bg);
  border-bottom:1px solid var(--z-toolbar-border);
}

.tool{
  font-size:18px;
  cursor:pointer;
  color:var(--z-icon);
}

.tool:hover{
  color:var(--z-icon-hover);
}

.address-bar{
  flex:1;
  display:flex;
  align-items:center;
  background:var(--z-address-bg);
  border-radius:16px;
  padding:0 10px;
  height:32px;
  gap:8px;
  position:relative;
}

.address-bar > i{
  color:var(--z-icon);
}

.address-input{
  flex:1;
  border:none;
  background:transparent;
  outline:none;
  color:var(--z-address-text);
}

.address-suggestions{
  position:absolute;
  top:calc(100% + 8px);
  left:0;
  right:0;
  display:flex;
  flex-direction:column;
  padding:6px;
  border:1px solid var(--z-toolbar-border);
  border-radius:16px;
  background:color-mix(in srgb, var(--z-menu-bg) 98%, transparent);
  box-shadow:0 14px 34px rgba(0,0,0,.16);
  z-index:1200;
}

.address-suggestions[hidden]{
  display:none !important;
}

.address-suggestion{
  display:flex;
  align-items:center;
  gap:10px;
  min-height:38px;
  padding:0 12px;
  border-radius:12px;
  color:var(--z-text-primary);
  cursor:pointer;
  user-select:none;
}

.address-suggestion i{
  color:var(--z-icon);
  font-size:15px;
}

.address-suggestion span{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:13px;
}

.address-suggestion.active,
.address-suggestion:hover{
  background:var(--z-menu-item-hover);
}

.menu-wrapper{
  position:relative;
}

.ai-tab-btn{
  width:32px;
  height:32px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:10px;
  cursor:pointer;
  font-size:18px;
  color:var(--z-icon);
  transition:.2s ease;
}

.ai-tab-btn[hidden]{
  display:none !important;
}

.ai-tab-btn:hover{
  background:var(--z-menu-btn-hover);
  color:var(--z-icon-hover);
}

.ai-tab-btn.active{
  background:color-mix(in srgb, var(--z-tab-active) 14%, transparent);
  color:var(--z-tab-active);
}

.menu-btn{
  width:32px;
  height:32px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:6px;
  cursor:pointer;
  font-size:20px;
  color:var(--z-icon);
}

.menu-btn:hover{
  background:var(--z-menu-btn-hover);
  color:var(--z-icon-hover);
}

.dropdown-menu{
  position:absolute;
  top:40px;
  right:0;
  background:var(--z-menu-bg);
  border-radius:8px;
  box-shadow:0 4px 12px rgba(0,0,0,.15);
  min-width:200px;
  padding:6px 0;
  opacity:0;
  visibility:hidden;
  transform:translateY(-5px);
  transition: opacity .25s ease, transform .25s ease, visibility .25s;
  z-index:999;
}

.dropdown-menu.open{
  opacity:1;
  visibility:visible;
  transform:translateY(0);
}

.menu-item{
  display:flex;
  align-items:center;
  gap:10px;
  padding:8px 14px;
  font-size:13px;
  cursor:pointer;
  color:var(--z-text-primary);
}

.menu-item i{
  font-size:16px;
  color:var(--z-icon);
}

.menu-item:hover{
  background:var(--z-menu-item-hover);
}

.menu-item:hover i{
  color:var(--z-icon-hover);
}

.content-area{
  flex:1;
  position:relative;
  background:var(--z-content-bg);
  overflow:hidden;
}

.content{
  position:absolute;
  inset:0;
  background:var(--z-content-bg);
  transition:right .25s ease;
}

.content-area.ai-open .content{
  right:360px;
}

.ai-sidepanel{
  position:absolute;
  top:0;
  right:0;
  bottom:0;
  width:360px;
  display:flex;
  flex-direction:column;
  background:var(--z-menu-bg);
  border-left:1px solid var(--z-toolbar-border);
  box-shadow:-10px 0 30px rgba(0,0,0,.12);
  transform:translateX(100%);
  opacity:0;
  pointer-events:none;
  transition:transform .25s ease, opacity .25s ease;
  overflow:hidden;
}

.content-area.ai-open .ai-sidepanel{
  transform:translateX(0);
  opacity:1;
  pointer-events:auto;
}

.ai-sidepanel-header{
  height:52px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 14px 0 16px;
  border-bottom:1px solid var(--z-toolbar-border);
  background:color-mix(in srgb, var(--z-toolbar-bg) 96%, transparent);
}

.ai-sidepanel-title{
  display:flex;
  align-items:center;
  gap:10px;
  color:var(--z-text-primary);
  font-size:14px;
  font-weight:700;
}

.ai-sidepanel-title i{
  color:var(--z-tab-active);
  font-size:16px;
}

.ai-sidepanel-close{
  width:30px;
  height:30px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:none;
  border-radius:9px;
  background:transparent;
  color:var(--z-icon);
  cursor:pointer;
  transition:.2s ease;
}

.ai-sidepanel-close:hover{
  background:var(--z-menu-btn-hover);
  color:var(--z-icon-hover);
}

.ai-sidepanel-frame{
  flex:1;
  width:100%;
  border:none;
  background:transparent;
}

.ai-nudge{
  position:absolute;
  right:18px;
  bottom:18px;
  width:min(320px, calc(100% - 36px));
  display:flex;
  flex-direction:column;
  gap:14px;
  padding:16px;
  border:1px solid var(--z-toolbar-border);
  border-radius:16px;
  background:color-mix(in srgb, var(--z-menu-bg) 96%, transparent);
  box-shadow:0 16px 40px rgba(0,0,0,.16);
  z-index:6;
  animation:aiNudgeIn .2s ease;
}

.ai-nudge[hidden]{
  display:none !important;
}

.ai-nudge-copy{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.ai-nudge-copy strong{
  font-size:14px;
  color:var(--z-text-primary);
}

.ai-nudge-copy span{
  font-size:12px;
  line-height:1.45;
  color:var(--z-icon);
}

.ai-nudge-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
}

.ai-nudge-btn{
  min-width:68px;
  height:34px;
  border-radius:10px;
  border:1px solid var(--z-toolbar-border);
  background:var(--z-menu-bg);
  color:var(--z-text-primary);
  cursor:pointer;
  font:inherit;
  font-weight:600;
}

.ai-nudge-yes{
  border-color:transparent;
  background:var(--z-tab-active);
  color:#fff;
}

.ai-nudge-no{
  background:var(--z-address-bg);
}

.nsfw-guard{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
  background:color-mix(in srgb, var(--z-bg-chrome) 52%, rgba(0,0,0,.62));
  backdrop-filter:blur(12px);
  z-index:7;
}

.nsfw-guard[hidden]{
  display:none !important;
}

.nsfw-guard-card{
  width:min(460px, 100%);
  display:flex;
  flex-direction:column;
  gap:14px;
  padding:20px;
  border:1px solid var(--z-toolbar-border);
  border-radius:20px;
  background:var(--z-menu-bg);
  color:var(--z-text-primary);
  box-shadow:0 18px 50px rgba(0,0,0,.22);
}

.nsfw-guard-head{
  display:flex;
  align-items:center;
  gap:10px;
  font-size:15px;
}

.nsfw-guard-head i{
  color:var(--z-tab-active);
  font-size:18px;
}

.nsfw-guard-copy{
  font-size:13px;
  line-height:1.55;
  color:var(--z-icon);
}

.nsfw-guard-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
}

.nsfw-guard-btn{
  min-width:104px;
  height:36px;
  border:none;
  border-radius:12px;
  cursor:pointer;
  font:inherit;
  font-weight:600;
}

.nsfw-guard-yes{
  background:var(--z-tab-active);
  color:#fff;
}

.nsfw-guard-no{
  background:var(--z-address-bg);
  color:var(--z-text-primary);
}

.tab-frame{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  border:none;
  display:none;
}

.tab-frame.active{
  display:block;
}

@media (max-width: 900px){
  .content-area.ai-open .content{
    right:0;
  }

  .ai-sidepanel{
    width:min(100%, 380px);
  }
}

@keyframes aiNudgeIn{
  from{
    opacity:0;
    transform:translateY(10px);
  }
  to{
    opacity:1;
    transform:translateY(0);
  }
}

@keyframes tabShiftFlavor{
  0%{
    filter:brightness(1);
  }
  45%{
    filter:brightness(1.04);
  }
  100%{
    filter:brightness(1);
  }
}
