.gs-anchor { position: relative; flex-shrink: 0; }
.gs-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text2);
  background: var(--bg2);
  font: inherit;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}
.gs-toggle:hover, .gs-toggle[aria-expanded="true"] { color: var(--accent2); border-color: var(--accent2); }
.gs-toggle:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }
.gs-shell {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  box-sizing: border-box;
  width: min(440px, calc(100vw - 32px));
  margin: 0;
  padding: 8px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0,0,0,.36);
  z-index: 130;
  color: var(--text);
  font-family: inherit;
}
.gs-shell[hidden] { display: none; }
.gs-control {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 6px 4px 9px;
}
.gs-control:focus-within { border-color: var(--accent2); }
.gs-label { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
#global-search-input {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 7px 10px;
}
#global-search-input::placeholder { color: var(--text2); }
#global-search-input:focus-visible,
.gs-button:focus-visible,
.gs-option:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }
.gs-button {
  background: var(--accent2);
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 7px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.gs-button:hover { filter: brightness(1.12); }
.gs-shortcut { color: var(--text2); font-size: 11px; white-space: nowrap; }
.gs-results {
  position: relative;
  margin-top: 6px;
  max-height: min(56vh, 420px);
  overflow-y: auto;
  border: 0;
  border-radius: 8px;
  background: var(--bg2);
  padding: 6px;
}
.gs-results[hidden] { display: none; }
.gs-group { color: var(--text2); font-size: 11px; font-weight: 700; padding: 8px 10px 4px; }
.gs-option {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 9px 10px;
}
.gs-option:hover, .gs-option.gs-active { background: var(--bg3); }
.gs-name { font-weight: 700; }
.gs-path { margin-left: auto; color: var(--text2); font-size: 11px; text-align: right; }
.gs-status { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
/* Keep the header a single row: the existing nav remains keyboard-scrollable. */
header nav { min-width: 0; overflow-x: auto; scrollbar-width: none; }
header nav button { flex-shrink: 0; white-space: nowrap; }
@media (min-width: 769px) and (max-width: 1400px) {
  header { gap: 10px; padding-left: 12px; padding-right: 12px; }
  header nav button { padding: 5px 8px; }
  .header-right { gap: 6px; }
}
@media (max-width: 600px) {
  /* The old compact search row occupied 49px; use 16px mobile top spacing. */
  main { padding-top: 16px; }
  .gs-toggle { width: 30px; padding: 5px; justify-content: center; }
  .gs-toggle-label { display: none; }
  .gs-shell { position:fixed; top:54px; left:0; right:0; width:auto; border-radius:0 0 8px 8px; }
  .header-right { gap: 4px; min-width: 0; }
  .header-right .lang-switcher { margin-left: 0; }
  .header-right #auth-badge-name { display: none; }
  .header-right .auth-user-badge { padding: 3px; gap: 3px; }
  .gs-control { flex-wrap: wrap; gap: 7px; }
  .gs-label { display:none; }
  .gs-shortcut { display: none; }
  .gs-option { flex-wrap: wrap; }
  .gs-path { width: 100%; margin-left: 0; text-align: left; }
}
