.chrome-page {
  --glass: rgb(55 57 62 / .8);
  --rim: rgb(255 255 255 / .15);
  --accent: #70b8ff;
  --gutter: clamp(12px, 4.1vw, 18px);
  --ease-out: cubic-bezier(.2, .75, .25, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --header-height: 97px;
  --footer-height: 83px;
  color-scheme: dark;
  scroll-padding: calc(var(--header-height) + var(--safe-top)) 0 calc(var(--footer-height) + var(--safe-bottom));
}

.chrome-page body {
  background: #050505;
  color: #fafafa;
  font: 16px/1.3 -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}

.chrome-page *, .chrome-page *::before {
  box-sizing: border-box;
}

.chrome-page [hidden] {
  display: none !important;
}

.chrome-page :is(a, button):focus-visible {
  outline-color: var(--accent);
  outline-offset: 2px;
}

.icon-definitions {
  position: absolute;
  width: 0;
  height: 0;
}

.switcher-icon {
  width: 24px;
  height: 24px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.switcher-header, .switcher-footer {
  position: fixed;
  z-index: 2;
  inset-inline: 0;
  width: min(100%, 470px);
  margin-inline: auto;
}

.switcher-header {
  top: 0;
  padding: var(--safe-top) 8px 10px;
  background: linear-gradient(#050505 16%, rgb(5 5 5 / .63) 66%, transparent);
}

.switcher-nav a {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 2px;
  padding-inline: 6px 10px;
  color: #bedcff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.switcher-nav .switcher-icon {
  width: 14px;
  height: 14px;
}

.switcher-toolbar {
  position: relative;
}

.switcher-controls, .switcher-search {
  display: grid;
  height: 48px;
  gap: 8px;
  align-items: center;
}

.switcher-controls {
  grid-template-columns: 44px minmax(0, 1fr) 44px;
}

.glass {
  border: 1px solid var(--rim);
  background: var(--glass);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .08), 0 4px 12px rgb(0 0 0 / .2);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.switcher-header button, .switcher-footer button, .tab-close {
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.control-round {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  padding: 0;
}

.more-button .switcher-icon {
  fill: currentColor;
  stroke: none;
}

.switcher-modes {
  --segment: 1;
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  justify-self: center;
  width: min(100%, 212px);
  height: 46px;
  border-radius: 24px;
  padding: 2px;
}

.switcher-modes[data-mode="incognito"] { --segment: 0; }
.switcher-modes[data-mode="groups"] { --segment: 2; }

.switcher-modes::before {
  position: absolute;
  z-index: -1;
  inset: 2px auto 2px 2px;
  width: calc((100% - 4px) / 3);
  border-radius: 23px;
  background: #fafbfc;
  content: "";
  transform: translateX(calc(var(--segment) * 100%));
  transition: transform 210ms var(--ease-out);
}

.switcher-modes button {
  display: grid;
  min-width: 0;
  height: 100%;
  place-items: center;
  border: 0;
  border-radius: 23px;
  padding: 0;
  background: none;
  transition: color 150ms ease-out;
}

.switcher-modes button[aria-pressed="true"] {
  color: #111214;
}

.tab-count {
  display: grid;
  min-width: 27px;
  height: 27px;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 8px;
  padding-inline: 3px;
  font-size: 14px;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.switcher-search {
  grid-template-columns: minmax(0, 1fr) auto;
  animation: chrome-reveal 170ms var(--ease-out) both;
}

.switcher-search[data-search="web"] {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.search-field {
  display: flex;
  height: 44px;
  align-items: center;
  gap: 7px;
  border-radius: 24px;
  padding-inline: 12px;
}

.search-field .switcher-icon {
  width: 18px;
  height: 18px;
  color: #c8c9ce;
}

.search-field input {
  width: 100%;
  min-width: 0;
  height: 100%;
  border: 0;
  padding: 0;
  background: none;
  color: inherit;
  font: inherit;
  outline: none;
}

.search-field input::placeholder {
  color: #b9bbc2;
}

.search-field:focus-within {
  border-color: var(--accent);
}

.search-cancel, .search-submit {
  min-height: 44px;
  border-radius: 24px;
  padding-inline: 12px;
}

.switcher-header .search-cancel {
  border: 0;
  background: none;
  color: #bedcff;
}

.switcher-search:not([data-search="web"]) .search-submit {
  display: none;
}

.switcher-actions {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  min-width: 196px;
  border-radius: 16px;
  padding: 4px;
  animation: chrome-reveal 150ms var(--ease-out) both;
  transform-origin: right top;
}

.switcher-actions button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 8px 12px;
  background: none;
  text-align: left;
  font-size: 14px;
}

.switcher-actions button:hover:not(:disabled) {
  background: rgb(255 255 255 / .1);
}

.switcher-actions button:disabled {
  opacity: .45;
  cursor: default;
}

.switcher-content {
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(var(--header-height) + var(--safe-top)) var(--gutter)
    calc(var(--footer-height) + var(--safe-bottom));
}

.tab-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gutter);
}

.tab-card {
  position: relative;
  min-width: 0;
  aspect-ratio: 3 / 4;
  border-radius: clamp(14px, 5vw, 23px);
  background: #f8f9fb;
  color: #15171a;
}

.tab-card.is-current {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.tab-link {
  display: grid;
  grid-template-rows: 36px minmax(0, 1fr);
  height: 100%;
  padding: 0 4px 4px;
  border-radius: inherit;
  color: inherit;
  text-decoration: none;
}

.tab-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  padding-inline: 7px 34px;
}

.tab-favicon {
  width: 15px;
  height: 15px;
  flex: none;
  opacity: .65;
}

.tab-title {
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-preview {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  border-radius: clamp(11px, 4vw, 19px);
  background: #202124;
}

.tab-preview-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.tab-preview-status {
  align-self: center;
  padding: 10px;
  color: #cfced1;
  font-size: 12px;
  text-align: center;
}

.tab-close {
  position: absolute;
  inset: 0 2px auto auto;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: none;
  color: #565e67;
}

.tab-close .switcher-icon {
  width: 17px;
  height: 17px;
}

.tabs-empty {
  margin: 20vh 0 0;
  color: #b4b7c0;
  font-size: 15px;
  text-align: center;
}

.switcher-footer {
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  padding: 12px var(--gutter) calc(var(--safe-bottom) + 16px);
  background: linear-gradient(transparent, rgb(5 5 5 / .9) 50%, #050505);
  pointer-events: none;
}

.switcher-footer > * {
  pointer-events: auto;
}

.switcher-footer .new-tab {
  grid-column: 2;
  justify-self: center;
  border: 1px solid rgb(255 255 255 / .23);
  background: var(--accent);
  color: #091624;
}

.switcher-done {
  grid-column: 3;
  justify-self: end;
  display: grid;
  min-height: 44px;
  place-items: center;
  border-radius: 24px;
  padding-inline: 15px;
  color: inherit;
  font-weight: 600;
  text-decoration: none;
}

.control-round, .switcher-done, .tab-close {
  transition: transform 140ms var(--ease-out);
}

:is(.control-round, .switcher-done, .tab-close):active {
  transform: scale(.94);
}

@keyframes chrome-reveal {
  from { opacity: 0; transform: scale(.98); }
}

@media (prefers-reduced-motion: reduce) {
  .chrome-page *, .chrome-page *::before {
    animation-duration: 0s !important;
    transition-duration: 0s !important;
  }
}

@media (max-height: 550px) {
  .chrome-page {
    --footer-height: 67px;
  }

  .switcher-footer {
    padding-block: 8px calc(var(--safe-bottom) + 9px);
  }
}
