@import url("https://fonts.googleapis.com/css2?family=Chivo+Mono:wght@500&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap");

:root {
  --page-a: #dde7f5;
  --page-b: #c4d4eb;
  --window: #edf3fb;
  --window-top: #bfd2ef;
  --window-edge: #7f9abf;
  --window-line: #c8d7ea;
  --tab: #d5e1f3;
  --tab-active: #ffffff;
  --toolbar: #e4ecf7;
  --toolbar-edge: #becde0;
  --address: #ffffff;
  --address-edge: #b3c2d6;
  --button: #edf3fa;
  --button-edge: #aebfd5;
  --text: #202631;
  --muted: #67768a;
  --blue: #4f87db;
  --blue-deep: #3769b6;
  --blue-faint: #edf4ff;
  --gold: #b98314;
  --gold-soft: #fff1c2;
  --shadow: 0 18px 34px rgba(67, 89, 122, 0.26);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100vh;
  overflow: hidden;
  font-family: "IBM Plex Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.78), transparent 28%),
    linear-gradient(180deg, var(--page-a), var(--page-b));
}

.desktop {
  height: 100vh;
  min-height: 100vh;
  padding: 6px;
}

.browser-window {
  display: flex;
  flex-direction: column;
  width: min(1490px, 100%);
  height: calc(100vh - 12px);
  min-height: 0;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--window-edge);
  border-radius: 8px 8px 0 0;
  background: var(--window);
  box-shadow: var(--shadow);
}

.titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 7px 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0)),
    linear-gradient(180deg, #dae9fd, var(--window-top) 52%, #acc3e5 100%);
  border-bottom: 1px solid var(--window-line);
}

.brand-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(223, 235, 252, 0.92));
  border: 1px solid rgba(114, 140, 180, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 1px 0 rgba(255, 255, 255, 0.5);
}

.brand-icon svg {
  display: block;
  width: 19px;
  height: 19px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-label {
  color: #1d2633;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.05;
}

.brand-tagline {
  color: #68788d;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.window-meta {
  align-self: center;
}

.meta-chip {
  display: inline-block;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: "Chivo Mono", monospace;
  font-size: 0.67rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.toolbar {
  display: grid;
  grid-template-columns: auto minmax(320px, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 10px 8px;
  background: linear-gradient(180deg, #f7fafd 0%, var(--toolbar) 60%, #dbe5f2 100%);
  border-bottom: 1px solid var(--toolbar-edge);
}

.nav-group,
.action-group {
  display: flex;
  gap: 6px;
  align-items: center;
}

.btn {
  border: 1px solid var(--button-edge);
  background: linear-gradient(180deg, #ffffff 0%, var(--button) 100%);
  color: var(--text);
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.81rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.94);
  transition: background 140ms ease, transform 140ms ease, border-color 140ms ease;
}

.btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #ffffff 0%, #edf4ff 100%);
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

.icon-btn {
  width: 34px;
  height: 31px;
  border-radius: 6px;
  font-size: 0.98rem;
}

.address-wrap {
  position: relative;
  min-width: 0;
}

.address-shell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 0 6px 0 10px;
  border: 1px solid var(--address-edge);
  border-radius: 17px;
  background: var(--address);
  box-shadow:
    inset 0 1px 2px rgba(44, 60, 88, 0.12),
    0 1px 0 rgba(255, 255, 255, 0.9);
}

.address-mark {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(180deg, #86bcff, var(--blue));
}

#address-bar {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: #2f3845;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.84rem;
  line-height: 1;
  outline: none;
}

#address-bar::selection {
  background: #c8dcff;
}

.address-dropdown {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  right: 0;
  z-index: 3;
  overflow: hidden;
  border: 1px solid var(--toolbar-edge);
  border-radius: 0 0 12px 12px;
  background: linear-gradient(180deg, #fefefe 0%, #eef4fc 100%);
  box-shadow: 0 12px 28px rgba(58, 79, 110, 0.22);
}

.address-dropdown[hidden] {
  display: none;
}

.address-dropdown-meta {
  display: flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-bottom: 1px solid #d7e1ef;
  background: linear-gradient(180deg, #fdfefe 0%, #eef4fb 100%);
}

.address-meta {
  margin: 0;
  color: var(--muted);
  font-family: "Chivo Mono", monospace;
  font-size: 0.67rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.address-results {
  max-height: 308px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #ffffff;
}

.address-spacer {
  width: 100%;
  pointer-events: none;
}

.address-option,
.address-results-empty {
  width: 100%;
  height: 42px;
}

.address-option {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  padding: 6px 12px;
  border: 0;
  border-top: 1px solid #edf2f8;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.address-option:hover,
.address-option.is-active {
  background: linear-gradient(180deg, #ffffff 0%, #e7f0ff 100%);
}

.address-option.is-current {
  background: linear-gradient(180deg, #fcfdff 0%, #deebff 100%);
}

.address-option-title {
  color: #2d3847;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.address-option.is-current .address-option-title {
  color: #224f7c;
}

.address-option-meta {
  color: #7a8798;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.address-option mark {
  padding: 0 2px;
  border-radius: 2px;
  background: var(--gold-soft);
  color: inherit;
}

.address-results-empty {
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: #7a8798;
  font-size: 0.78rem;
}

.address-star {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #8b97a6;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.address-star::before {
  content: "\2606";
  display: block;
  font-size: 0.92rem;
  line-height: 22px;
  text-align: center;
}

.address-star:hover:not(:disabled) {
  background: var(--blue-faint);
  color: #57759f;
  transform: translateY(-1px);
}

.address-star:disabled {
  opacity: 0.45;
  cursor: wait;
}

.address-star.is-active {
  background: var(--gold-soft);
  color: var(--gold);
}

.address-star.is-active::before {
  content: "\2605";
}

.action-group {
  justify-content: flex-end;
  position: relative;
}

.next-btn,
.open-btn,
.share-btn {
  min-height: 31px;
  padding: 0 14px;
  border-radius: 6px;
}

.share-btn {
  flex: 0 0 34px;
  min-width: 34px;
  padding: 0;
  font-size: 0.94rem;
  line-height: 1;
}

.next-btn {
  min-width: 90px;
  border-color: #356ab9;
  background: linear-gradient(180deg, #71a9ff 0%, var(--blue) 58%, var(--blue-deep) 100%);
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.next-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #7cb3ff 0%, #5f94e6 58%, #4477c2 100%);
}

.open-btn {
  min-width: 72px;
}

.share-card {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 2;
  display: grid;
  gap: 8px;
  width: 250px;
  padding: 10px;
  border: 1px solid var(--toolbar-edge);
  border-radius: 7px;
  background: linear-gradient(180deg, #fefefe 0%, #edf3fb 100%);
  box-shadow: 0 10px 26px rgba(58, 79, 110, 0.18);
}

.share-card[hidden] {
  display: none;
}

.share-title {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
}

.share-link {
  width: 100%;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--address-edge);
  border-radius: 5px;
  background: #ffffff;
  color: #364250;
  font-family: "Chivo Mono", monospace;
  font-size: 0.68rem;
  outline: none;
}

.share-actions {
  display: flex;
  gap: 6px;
}

.share-copy-btn,
.share-native-btn {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 5px;
  font-size: 0.76rem;
}

.highlights-strip {
  min-height: 32px;
  padding: 5px 10px 6px;
  background: linear-gradient(180deg, #f4f8fd, #e9f0f9);
  border-bottom: 1px solid #d3ddeb;
}

.bookmark-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
  min-width: 0;
}

.highlight-list {
  display: flex;
  gap: 2px;
  align-items: center;
  min-height: 24px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  padding: 1px 2px;
}

.highlight-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 24px;
  max-width: 188px;
  padding: 0 10px 0 7px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #435062;
  font-size: 0.75rem;
  font-weight: 400;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.highlight-pill:hover {
  border-color: #c7d5e7;
  background: linear-gradient(180deg, #ffffff 0%, #ebf2fc 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.highlight-pill::before {
  content: "";
  width: 13px;
  height: 15px;
  border-radius: 2px;
  background:
    linear-gradient(135deg, transparent 0 58%, #d6e3fa 59% 100%) top right / 5px 5px no-repeat,
    linear-gradient(180deg, #5d92ff 0 3px, #ffffff 3px 100%);
  border: 1px solid #7e9bc6;
  flex: 0 0 auto;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    0 1px 0 rgba(255, 255, 255, 0.55);
}

.highlight-pill.is-current {
  border-color: #a3bde5;
  background: linear-gradient(180deg, #ffffff 0%, #deebff 100%);
  color: #25476f;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.highlight-empty {
  margin: 0;
  padding-left: 3px;
  color: #7f8a99;
  font-size: 0.74rem;
}

.highlight-measure {
  position: absolute;
  left: -9999px;
  top: -9999px;
  visibility: hidden;
  max-width: none;
  pointer-events: none;
}

.bookmark-overflow {
  position: relative;
  flex: 0 0 auto;
}

.bookmark-overflow-btn {
  width: 26px;
  height: 24px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #5f6f86;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
}

.bookmark-overflow-btn:hover,
.bookmark-overflow-btn[aria-expanded="true"] {
  border-color: #c7d5e7;
  background: linear-gradient(180deg, #ffffff 0%, #ebf2fc 100%);
  color: #30517d;
}

.bookmark-overflow-btn[hidden],
.bookmark-overflow-menu[hidden] {
  display: none;
}

.bookmark-overflow-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 5px);
  z-index: 4;
  width: min(280px, 72vw);
  max-height: 320px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--toolbar-edge);
  border-radius: 7px;
  background: linear-gradient(180deg, #fefefe 0%, #eef4fc 100%);
  box-shadow: 0 10px 26px rgba(58, 79, 110, 0.18);
}

.bookmark-overflow-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: #394656;
  font-size: 0.76rem;
  text-align: left;
  cursor: pointer;
}

.bookmark-overflow-item::before {
  content: "";
  width: 13px;
  height: 15px;
  border-radius: 2px;
  background:
    linear-gradient(135deg, transparent 0 58%, #d6e3fa 59% 100%) top right / 5px 5px no-repeat,
    linear-gradient(180deg, #5d92ff 0 3px, #ffffff 3px 100%);
  border: 1px solid #7e9bc6;
  flex: 0 0 auto;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    0 1px 0 rgba(255, 255, 255, 0.55);
}

.bookmark-overflow-item:hover,
.bookmark-overflow-item.is-current {
  border-color: #c7d5e7;
  background: linear-gradient(180deg, #ffffff 0%, #ebf2fc 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.bookmark-overflow-item.is-current {
  color: #25476f;
}

.viewer-shell {
  flex: 1;
  min-height: 0;
  padding: 0;
  background: #ffffff;
}

#site-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

@media (max-width: 980px) {
  .toolbar {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .action-group {
    grid-column: 1 / -1;
    justify-self: end;
  }
}

@media (max-width: 720px) {
  .desktop {
    padding: 0;
  }

  body {
    background: linear-gradient(180deg, #dbe6f5 0%, #c5d6ec 18%, #eef3fa 18%, #eef3fa 100%);
  }

  .browser-window {
    width: 100%;
    height: 100vh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: #eef3fa;
  }

  .titlebar {
    order: 1;
    min-height: 36px;
    padding: 6px 10px;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0)),
      linear-gradient(180deg, #d8e5f6 0%, #c3d4eb 100%);
  }

  .brand-bar {
    min-width: 0;
    gap: 8px;
  }

  .brand-icon {
    width: 24px;
    height: 24px;
    border-radius: 7px;
  }

  .brand-icon svg {
    width: 16px;
    height: 16px;
  }

  .brand-label {
    font-size: 0.87rem;
  }

  .brand-tagline {
    display: none;
  }

  .window-meta {
    flex: 0 0 auto;
  }

  .meta-chip {
    font-size: 0.61rem;
  }

  .toolbar {
    order: 4;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, #f8fbff 0%, #e8eef7 100%);
    border-top: 1px solid #c8d7ea;
    border-bottom: 0;
    box-shadow: 0 -10px 24px rgba(67, 89, 122, 0.16);
  }

  .address-wrap {
    grid-column: 1 / -1;
  }

  .nav-group,
  .action-group {
    width: auto;
  }

  .nav-group {
    gap: 8px;
  }

  .action-group {
    justify-self: end;
    gap: 8px;
  }

  .address-shell {
    min-height: 40px;
    padding: 0 7px 0 11px;
    border-radius: 20px;
  }

  #address-bar {
    font-size: 0.9rem;
  }

  .icon-btn {
    width: 40px;
    height: 38px;
    border-radius: 11px;
  }

  .address-dropdown {
    left: 0;
    right: 0;
    top: auto;
    bottom: calc(100% + 8px);
    border-radius: 14px;
    box-shadow: 0 -6px 26px rgba(58, 79, 110, 0.18);
  }

  .share-card {
    left: auto;
    right: 0;
    top: auto;
    bottom: calc(100% + 8px);
    width: min(280px, calc(100vw - 20px));
  }

  .share-btn {
    flex: 0 0 40px;
    min-width: 40px;
    min-height: 38px;
    border-radius: 11px;
    font-size: 1rem;
  }

  .next-btn,
  .open-btn {
    min-height: 38px;
    border-radius: 11px;
  }

  .next-btn {
    min-width: 96px;
  }

  .open-btn {
    min-width: 74px;
  }

  .viewer-shell {
    order: 2;
  }

  .highlights-strip {
    order: 3;
    min-height: 34px;
    padding: 4px 10px 6px;
    background: linear-gradient(180deg, #f5f9ff 0%, #ebf1fa 100%);
    border-top: 1px solid #d4dfef;
    border-bottom: 0;
  }

  .highlights-strip[data-empty="true"] {
    display: none;
  }

  .highlight-pill {
    max-width: 136px;
    font-size: 0.73rem;
  }

  .bookmark-overflow-menu {
    top: auto;
    right: 0;
    bottom: calc(100% + 8px);
    width: min(260px, calc(100vw - 20px));
    max-height: min(46vh, 320px);
  }
}
