/* Give the slogan clearer gaps between words in Modern and Web 1.0. */
html[data-style="modern"] .masthead .edition,
html[data-style="modern"] .intro h1,
html[data-style="web1"] .masthead .edition,
html[data-style="web1"] .intro h1 { word-spacing: .15em; }

/* Keep the brand and navigation on one line when the header slogan no longer fits. */
@media (max-width: 1100px) {
  html[data-style] .masthead {
    flex-wrap: nowrap;
  }

  html[data-style] .masthead .edition { display: none; }
  html[data-style] .masthead .brand { flex: 0 1 auto; min-width: 0; }
  html[data-style] .masthead #rating-open,
  html[data-style] .masthead #account-open,
  html[data-style] .masthead .style-picker,
  html[data-style] .masthead .language-picker { flex-shrink: 0; }
}

/* Increase the mark and wordmark together by about 15%. */
html[data-style="modern"] .masthead .brand,
html[data-style="terminal"] .masthead .brand { font-size: 1.84rem; }
html[data-style="modern"] .masthead .brand .spark { width: 37px; height: 37px; }
html[data-style="terminal"] .masthead .brand .spark { width: 39px; height: 39px; }
html[data-style="pixel"] .masthead .brand {
  font-size: clamp(21.85px, calc(1.232vw + 12.98px), 28.75px);
  gap: 14px;
}
html[data-style="pixel"] .masthead .brand .spark {
  flex-basis: clamp(37px, calc(1.607vw + 25.43px), 46px);
  width: clamp(37px, calc(1.607vw + 25.43px), 46px);
  height: clamp(37px, calc(1.607vw + 25.43px), 46px);
}

/* Give Terminal's header controls 15% more presence. */
html[data-style="terminal"] .masthead #rating-open,
html[data-style="terminal"] .masthead #account-open { font-size: 1.012rem; padding: 11px 14px; }
html[data-style="terminal"] .masthead #style-toggle { font-size: .9775rem; padding: 10px 12px; }
html[data-style="terminal"] .masthead #language-toggle { font-size: .828rem; padding: 8px 5px; }

@media (min-width: 376px) {
  html[data-style="terminal"] .masthead #style-toggle,
  html[data-style="terminal"] .masthead #language-toggle { height: 45px; min-height: 45px; }
}

@media (min-width: 721px) and (max-width: 760px) {
  html[data-style="pixel"] .masthead { gap: 10px; }
}

@media (max-width: 720px) {
  html[data-style="terminal"] .masthead .brand { font-size: 1.84rem; }
  html[data-style="terminal"] .masthead .brand .spark { width: 39px; height: 39px; }
  html[data-style="terminal"] .masthead #rating-open,
  html[data-style="terminal"] .masthead #account-open,
  html[data-style="terminal"] .masthead #style-toggle,
  html[data-style="terminal"] .masthead #language-toggle { font-size: .805rem; }
  html[data-style="terminal"] .masthead #rating-open,
  html[data-style="terminal"] .masthead #account-open,
  html[data-style="terminal"] .masthead #style-toggle { padding: 5px 3px; }
  html[data-style="terminal"] .masthead #language-toggle { padding: 5px 2px; }
  html[data-style="pixel"] .masthead { gap: 8px; }
  html[data-style="pixel"] .masthead .brand {
    flex: 0 0 auto;
    font-size: clamp(9.5px, calc(2.9625vw + .52px), 21.85px);
    gap: clamp(4px, calc(2.5vw - 4px), 14px);
  }
  html[data-style="pixel"] .masthead .brand .spark {
    flex-basis: clamp(21px, calc(3.75vw + 10px), 37px);
    width: clamp(21px, calc(3.75vw + 10px), 37px);
    height: clamp(21px, calc(3.75vw + 10px), 37px);
  }
  html[data-style="pixel"] .masthead #rating-open,
  html[data-style="pixel"] .masthead #account-open,
  html[data-style="pixel"] .masthead #style-toggle,
  html[data-style="pixel"] .masthead #language-toggle { font-size: 9.5px; }
  html[data-style="web1"] .masthead .brand { flex: 0 0 auto; font-size: 2rem; gap: 7px; }
  html[data-style="web1"] .masthead .brand .spark { width: 52px; height: 52px; }
}

/* TOP takes less room, so keep the desktop-sized controls until they need to contract. */
@media (min-width: 376px) and (max-width: 720px) {
  html[data-style="terminal"] .masthead #rating-open,
  html[data-style="terminal"] .masthead #account-open { font-size: 1.012rem; padding: 11px 14px; }
  html[data-style="terminal"] .masthead #style-toggle { font-size: .9775rem; padding: 10px 12px; }
  html[data-style="terminal"] .masthead #language-toggle { font-size: .828rem; padding: 8px 5px; }
}

@media (min-width: 521px) and (max-width: 720px) {
  html[data-style="pixel"] .masthead #rating-open,
  html[data-style="pixel"] .masthead #account-open,
  html[data-style="pixel"] .masthead #style-toggle { font-size: 10.56px; }
  html[data-style="pixel"] .masthead #language-toggle { font-size: 10.2px; }
}

@media (min-width: 521px) and (max-width: 650px) {
  html[data-style="web1"] .masthead { min-height: 86px; }
  html[data-style="web1"] .masthead #rating-open { width: 64px; }
  html[data-style="web1"] .masthead #account-open { width: 85px; }
  html[data-style="web1"] .masthead .style-picker { width: 80px; }
  html[data-style="web1"] .masthead .language-picker { width: 62px; }
  html[data-style="web1"] .masthead #rating-open,
  html[data-style="web1"] .masthead #account-open,
  html[data-style="web1"] .masthead #style-toggle,
  html[data-style="web1"] .masthead #language-toggle { height: 67px; min-height: 67px; }
  html[data-style="web1"] .masthead #language-toggle { font-size: .85rem; }
  html[data-style="web1"] .masthead #rating-open::before,
  html[data-style="web1"] .masthead #style-toggle::before,
  html[data-style="web1"] .masthead #language-toggle::before { height: 30px; font-size: 1.65rem !important; line-height: 30px; }
  html[data-style="web1"] .masthead #account-open::before { width: 28px; height: 30px; }
}

@media (max-width: 600px) {
  html[data-style="modern"] .masthead #rating-open,
  html[data-style="modern"] .masthead #account-open,
  html[data-style="modern"] .masthead #style-toggle,
  html[data-style="modern"] .masthead #language-toggle { font-size: .8rem; }
}

@media (min-width: 401px) and (max-width: 600px) {
  html[data-style="modern"] .masthead #rating-open,
  html[data-style="modern"] .masthead #account-open { font-size: .88rem; padding: 10px 12px; }
  html[data-style="modern"] .masthead #style-toggle { font-size: .85rem; padding: 9px 10px; }
  html[data-style="modern"] .masthead #language-toggle { font-size: .85rem; }
  html[data-style="modern"] .masthead .language-picker { flex-basis: 58px; }
}

@media (min-width: 521px) and (max-width: 600px) {
  html[data-style="web1"] .masthead #rating-open,
  html[data-style="web1"] .masthead #account-open { font-size: .88rem; }
}

@media (max-width: 520px) {
  html[data-style="pixel"] .masthead { gap: 6px; padding-inline: 4px; }
  html[data-style="pixel"] .masthead #rating-open,
  html[data-style="pixel"] .masthead #account-open,
  html[data-style="pixel"] .masthead #style-toggle,
  html[data-style="pixel"] .masthead #language-toggle {
    font-size: clamp(8px, calc(3.2vw - 2.24px), 10.56px);
  }
  html[data-style="pixel"] .masthead #rating-open,
  html[data-style="pixel"] .masthead #account-open,
  html[data-style="pixel"] .masthead #style-toggle { padding-inline: 1px; }
  html[data-style="pixel"] .masthead .language-picker { flex-basis: clamp(32px, 10vw, 42px); }
  html[data-style="pixel"] .masthead #language-toggle { padding-inline: 1px; }
}

@media (max-width: 320px) {
  html[data-style="pixel"] .masthead { gap: 1px; }
}

@media (max-width: 500px) {
  html[data-style="modern"] .shell { padding-inline: 12px; }
  html[data-style="modern"] .masthead { gap: 2px; }
  html[data-style="modern"] .masthead .brand { flex: 0 0 auto; }
}

@media (max-width: 470px) {
  html[data-style="modern"] .masthead .brand { font-size: clamp(.7rem, calc(20vw - 64.6px), 1.84rem); }
  html[data-style="modern"] .masthead .brand .spark { width: clamp(16px, calc(14vw - 28.8px), 37px); height: clamp(16px, calc(14vw - 28.8px), 37px); }
}

@media (max-width: 480px) {
  html[data-style="terminal"] .masthead { gap: 2px; padding-inline: 6px; }
  html[data-style="terminal"] .masthead .brand { flex: 0 0 auto; }
}

@media (max-width: 460px) {
  html[data-style="terminal"] .masthead .brand { font-size: clamp(.7rem, calc(26vw - 85.75px), 1.84rem); }
  html[data-style="terminal"] .masthead .brand .spark {
    width: clamp(16px, calc(28.75vw - 93.25px), 39px);
    height: clamp(16px, calc(28.75vw - 93.25px), 39px);
  }
}

@media (max-width: 420px) {
  html[data-style="terminal"] .masthead { gap: 2px; padding-inline: 5px; }
}

@media (min-width: 376px) and (max-width: 390px) {
  html[data-style="terminal"] .masthead { gap: 1px; }
  html[data-style="terminal"] .masthead #rating-open,
  html[data-style="terminal"] .masthead #account-open { padding-inline: 12px; }
  html[data-style="terminal"] .masthead #style-toggle { padding-inline: 10px; }
}

@media (max-width: 360px) {
  html[data-style="terminal"] .masthead #rating-open,
  html[data-style="terminal"] .masthead #account-open,
  html[data-style="terminal"] .masthead #style-toggle,
  html[data-style="terminal"] .masthead #language-toggle { font-size: .713rem; }
  html[data-style="terminal"] .masthead #rating-open,
  html[data-style="terminal"] .masthead #account-open,
  html[data-style="terminal"] .masthead #style-toggle { padding-inline: 2px; }
  html[data-style="terminal"] .masthead #language-toggle { padding-inline: 1px; }
}

@media (min-width: 651px) and (max-width: 720px) {
  html[data-style="web1"] .masthead { gap: 8px; }
  html[data-style="web1"] .masthead #rating-open { width: 64px; }
  html[data-style="web1"] .masthead #account-open { width: 96px; }
  html[data-style="web1"] .masthead .style-picker { width: 80px; }
  html[data-style="web1"] .masthead .language-picker { width: 62px; }
}

@media (min-width: 601px) and (max-width: 650px) {
  html[data-style="web1"] .masthead #account-open { width: 88px; }
}

@media (min-width: 551px) and (max-width: 650px) {
  html[data-style="web1"] .masthead { gap: 6px; }
}

@media (min-width: 551px) and (max-width: 560px) {
  html[data-style="web1"] .masthead { gap: 5px; }
}

@media (min-width: 521px) and (max-width: 550px) {
  html[data-style="web1"] .shell { padding-inline: 4px; }
  html[data-style="web1"] .masthead { gap: 4px; padding-inline: 3px; }
  html[data-style="web1"] .masthead #rating-open { width: 56px; }
}

@media (min-width: 521px) and (max-width: 530px) {
  html[data-style="web1"] .masthead #rating-open { width: 48px; }
}

@media (max-width: 460px) {
  html[data-style="web1"] .shell { padding-inline: 6px; }
  html[data-style="web1"] .masthead { gap: 6px; padding-inline: 6px; }
  html[data-style="web1"] .masthead .brand { font-size: clamp(.93rem, calc(12vw - 23.2px), 2rem); gap: clamp(1px, calc(4.286vw - 12.72px), 7px); }
  html[data-style="web1"] .masthead .brand .spark { width: clamp(20px, calc(22.86vw - 53.14px), 52px); height: clamp(20px, calc(22.86vw - 53.14px), 52px); }
}

@media (max-width: 520px) {
  html[data-style="web1"] .masthead { gap: 6px; }
}

@media (max-width: 400px) {
  html[data-style="web1"] .shell,
  html[data-style="web1"] .masthead { padding-inline: 4px; }
}

@media (min-width: 361px) and (max-width: 375px) {
  html[data-style="modern"] .shell { padding-inline: 16px; }
  html[data-style="web1"] .shell { padding-inline: 4px; }
  html[data-style="web1"] .masthead { padding-inline: 4px; }
}

/* Keep the narrow header controls distinct without wrapping the navigation. */
@media (max-width: 720px) {
  html[data-style="terminal"] .masthead { gap: 8px; }
  html[data-style="web1"] .masthead { gap: 10px; }
}

@media (max-width: 480px) {
  html[data-style="terminal"] .masthead { gap: 6px; }
}

@media (max-width: 460px) {
  html[data-style="terminal"] .masthead .brand { font-size: clamp(.7rem, calc(25vw - 85px), 1.84rem); }
  html[data-style="terminal"] .masthead .brand .spark {
    width: clamp(16px, calc(25vw - 82px), 39px);
    height: clamp(16px, calc(25vw - 82px), 39px);
  }
}

@media (min-width: 376px) and (max-width: 390px) {
  html[data-style="terminal"] .masthead { gap: 5px; }
}

/* Compact Millennium's header while keeping its full-width frame and gradient. */
html[data-style="web1"] .masthead {
  min-height: 81px;
  padding-block: 10px;
  border-width: 3px;
  box-shadow: inset 0 1px #fff, inset 0 -2px #345aa5, 3px 3px 0 #7687bd;
}
@media (min-width: 721px) {
  html[data-style="web1"] .masthead {
    padding-inline: max(clamp(9px, 1.4vw, 21px), calc(50% - 603px));
  }
}
html[data-style="web1"] .masthead::before { left: 7px; top: 5px; font-size: 17px; }
html[data-style="web1"] .masthead .brand {
  gap: 5px;
  font-size: clamp(1.4rem, 2.94vw, 3.255rem);
}
html[data-style="web1"] .masthead .brand .spark {
  width: clamp(36px, 4.62vw, 66px);
  height: clamp(36px, 4.62vw, 66px);
}
html[data-style="web1"] .masthead .edition { font-size: .8rem; }
html[data-style="web1"] .masthead .quiet { font-size: .85rem; }
html[data-style="web1"] .masthead #rating-open,
html[data-style="web1"] .masthead #account-open,
html[data-style="web1"] .masthead #style-toggle,
html[data-style="web1"] .masthead #language-toggle {
  height: 47px;
  min-height: 47px;
  padding-block: 5px;
}
html[data-style="web1"] .masthead #rating-open::before,
html[data-style="web1"] .masthead #style-toggle::before,
html[data-style="web1"] .masthead #language-toggle::before {
  height: 21px;
  font-size: 1.15rem;
  line-height: 21px;
}
html[data-style="web1"] .masthead #account-open::before { width: 20px; height: 21px; }
html[data-style="web1"] .masthead #language-toggle::after { bottom: 3px; }

@media (max-width: 720px) {
  html[data-style="web1"] .masthead .brand { gap: 5px; font-size: 1.5rem; }
  html[data-style="web1"] .masthead .brand .spark { width: 39px; height: 39px; }
  html[data-style="web1"] .masthead #rating-open,
  html[data-style="web1"] .masthead #account-open,
  html[data-style="web1"] .masthead #style-toggle,
  html[data-style="web1"] .masthead #language-toggle {
    font-size: clamp(.75rem, 2vw, .85rem);
  }
}
@media (max-width: 650px) {
  html[data-style="web1"] body { min-width: 0; }
  html[data-style="web1"] .masthead { min-height: 46px; padding-block: 5px; }
  html[data-style="web1"] .masthead .style-options { min-width: 144px; padding: 2px; }
  html[data-style="web1"] .masthead .language-options { min-width: 76px; }
  html[data-style="web1"] .masthead .style-options button {
    padding: 7px 9px;
    font-size: .84rem;
  }
  html[data-style="web1"] .masthead #rating-open,
  html[data-style="web1"] .masthead #account-open,
  html[data-style="web1"] .masthead #style-toggle,
  html[data-style="web1"] .masthead #language-toggle {
    height: 38px;
    min-height: 38px;
    padding-block: 3px;
  }
  html[data-style="web1"] .masthead #rating-open::before,
  html[data-style="web1"] .masthead #style-toggle::before,
  html[data-style="web1"] .masthead #language-toggle::before {
    height: 14px;
    font-size: .875rem !important;
    line-height: 14px;
  }
  html[data-style="web1"] .masthead #account-open::before { width: 12px; height: 14px; }
  html[data-style="web1"] .masthead #language-toggle::after { bottom: 1px; }
}
@media (max-width: 460px) {
  html[data-style="web1"] .masthead .brand {
    gap: clamp(.7px, calc(3vw - 8.9px), 5px);
    font-size: clamp(.74rem, calc(9.3vw - 18px), 1.5rem);
  }
  html[data-style="web1"] .masthead .brand .spark {
    width: clamp(16px, calc(17.5vw - 40px), 39px);
    height: clamp(16px, calc(17.5vw - 40px), 39px);
  }
}
