:root { --newcode-header-height: 60px; }
.newcode-home-brand { display: flex; align-items: center; justify-content: center; gap: 16px; }
.newcode-home-brand img { width: 56px; height: 56px; }
.newcode-home-brand h1 { margin: 0; color: var(--md-sys-color-on-surface); font-size: 42px; line-height: 1.2; font-weight: 700; }
.auth-help-links,
nav[aria-label="Legal"],
[aria-label="Social links"] { display: none !important; }
[data-newcode-auth-root] { display: flex; flex-direction: column; }
[data-newcode-auth-root] > :first-child { flex-shrink: 0; }
main[data-newcode-auth] { display: flex; flex: 1; justify-content: center; align-items: center; height: auto; min-height: 0; overflow-y: auto; padding: 24px 20px; }
main[data-newcode-auth] > section { display: flex; flex-direction: column; width: min(100%, 440px); min-height: 0; padding: 0; }
main[data-newcode-auth] > section > header { justify-content: flex-end; }
main[data-newcode-auth] > section > div { overflow: visible; padding: 28px 0 0; }
#root {
  top: calc(env(safe-area-inset-top) + var(--viewport-offset-top, 0px) + var(--newcode-header-height));
}
#newcode-header {
  position: fixed;
  inset: env(safe-area-inset-top) env(safe-area-inset-right) auto env(safe-area-inset-left);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 20px;
  height: var(--newcode-header-height);
  padding: 0 18px;
  border-bottom: 1px solid #282828;
  background: #000;
  color: #f6f6f6;
  font: 14px/1.4 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
  isolation: isolate;
  -webkit-app-region: drag;
}
#newcode-header[data-native-mac="true"] { padding-left: 84px; }
#newcode-header button,
#newcode-garland-settings button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #383838;
  border-radius: 10px;
  color: #f6f6f6;
  background: #151515;
  cursor: pointer;
  transition: background 140ms ease, transform 140ms ease;
  font: inherit;
  -webkit-app-region: no-drag;
}
#newcode-header button:hover,
#newcode-garland-settings button:hover { background: #282828; }
#newcode-header button:active,
#newcode-garland-settings button:active { transform: scale(.96); }
#newcode-header button:focus-visible,
#newcode-garland-settings :focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
#newcode-header .nc-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  border: 0;
  padding: 0;
  background: none;
  border-radius: 4px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.6px;
}
#newcode-header .nc-brand img { width: 33px; height: 33px; }
#newcode-header .nc-brand:hover { background: none; }
#newcode-header .nc-garland {
  position: relative;
  flex: 1;
  height: 56px;
  min-width: 80px;
  overflow: hidden;
  contain: layout paint;
}
#newcode-header .nc-wire {
  position: absolute;
  inset: 1px 0 0;
  width: 100%;
  height: 35px;
  fill: none;
  stroke: #747474;
  stroke-width: 1.2;
}
#newcode-header .nc-bulb {
  position: absolute;
  left: var(--nc-x);
  top: var(--nc-y);
  width: 9px;
  height: 22px;
  margin-left: -4px;
  transform: rotate(var(--nc-tilt));
}
#newcode-header .nc-bulb::before {
  position: absolute;
  content: "";
  width: 5px;
  height: 5px;
  top: -3px;
  left: 2px;
  border-radius: 1px 1px 0 0;
  background: #636363;
}
#newcode-header .nc-light {
  position: absolute;
  inset: 1px 0 0;
  border: 1px solid #ffffff80;
  border-radius: 5px 5px 7px 7px;
  background: var(--nc-color);
  box-shadow: 0 0 7px 1px var(--nc-color);
  animation: nc-shimmer 3.8s ease-in-out infinite;
  animation-delay: var(--nc-delay);
}
#newcode-header .nc-light-alt {
  background: var(--nc-color-alt);
  box-shadow: 0 0 7px 1px var(--nc-color-alt);
  animation-name: nc-crossfade;
}
#newcode-header[data-enabled="false"] .nc-light {
  animation: none;
  background: #777;
  box-shadow: none;
  border-color: #ffffff30;
  opacity: .3;
}
#newcode-header[data-enabled="false"] .nc-light-alt { opacity: 0; }
#newcode-header[data-motion="still"] .nc-light { animation: none; opacity: .95; }
#newcode-header[data-motion="still"] .nc-light-alt { opacity: 0; }
#newcode-header[data-paused="true"] .nc-light { animation-play-state: paused; }
#newcode-header .nc-controls { display: flex; gap: 6px; }
#newcode-header .nc-controls button { width: 32px; height: 32px; }
#newcode-header .nc-controls svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.5; }
#newcode-header #nc-power[aria-pressed="true"] { border-color: #777; background: #2a2a2a; }
#newcode-garland-settings {
  position: fixed;
  z-index: 10001;
  inset: calc(env(safe-area-inset-top) + 65px) 16px auto auto;
  margin: 0;
  width: min(320px, calc(100vw - 32px));
  max-height: calc(100dvh - 90px);
  overflow: auto;
  border: 1px solid #414141;
  border-radius: 16px;
  padding: 18px;
  background: #151515;
  color: #f6f6f6;
  box-shadow: 0 16px 45px #0009;
  color-scheme: dark;
  font: 14px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-app-region: no-drag;
}
#newcode-garland-settings[hidden] { display: none; }
#newcode-garland-settings .nc-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
#newcode-garland-settings h2 { margin: 0; color: inherit; font-size: 17px; font-weight: 600; }
#newcode-garland-settings .nc-close { width: 28px; height: 28px; font-size: 20px; }
#newcode-garland-settings label { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 14px; }
#newcode-garland-settings select { width: 142px; min-height: 34px; padding: 4px 8px; border: 1px solid #555; border-radius: 8px; background: #222; color: #fff; font: inherit; }
#newcode-garland-settings fieldset { border: 0; margin: 16px 0 0; padding: 0; }
#newcode-garland-settings legend { margin-bottom: 9px; }
#newcode-garland-settings .nc-colors { display: flex; gap: 12px; }
#newcode-garland-settings .nc-colors label { margin: 0; }
#newcode-garland-settings input[type="color"] { width: 52px; height: 36px; padding: 3px; background: #222; border: 1px solid #666; border-radius: 9px; cursor: pointer; }
@keyframes nc-shimmer { 0%, 100% { opacity: .95; } 50% { opacity: .42; } }
@keyframes nc-crossfade { 0%, 100% { opacity: 0; } 50% { opacity: .95; } }
@media (prefers-reduced-motion: reduce) {
  #newcode-header .nc-light { animation: none; }
  #newcode-header .nc-light-alt { opacity: 0; }
  #newcode-header button,
  #newcode-garland-settings button { transition: none; }
}
@media (max-width: 600px) {
  #newcode-header { gap: 10px; padding-inline: 12px; }
  #newcode-header .nc-brand { gap: 7px; font-size: 16px; }
  #newcode-header .nc-brand img { width: 28px; height: 28px; }
  #newcode-header .nc-bulb:nth-of-type(even) { display: none; }
}

/* New Code account surfaces share the same palette as the conversation. */
.settings_overlay { background: var(--md-sys-color-surface-container-lowest); padding-block-start: var(--newcode-header-height); box-sizing: border-box; height: 100dvh; }
.settings_sidebar { border-inline-end: 1px solid var(--md-sys-color-outline-variant); }
.settings_sidebar .content { padding: 24px 12px 12px; }
.settings_sidebar .button { border-radius: 12px; min-height: 42px; }
.settings_sidebar .button[aria-selected="true"] { background: var(--md-sys-color-secondary-container); }
.settings_cont { padding-block: 24px; }
.newcode-account-summary { border: 1px solid var(--md-sys-color-outline-variant); border-radius: 18px; }
.newcode-account-summary > div:first-child > div { color: var(--md-sys-color-on-surface); min-width: 0; }
.newcode-account-summary > div:first-child > div > span:last-child { color: var(--md-sys-color-on-surface-variant); }
.settings_sidebar .button.account { color: var(--md-sys-color-on-primary-container); }

/* A profile reads top to bottom instead of squeezing text into square tiles. */
.newcode-profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  width: 100%;
  max-width: 620px;
  min-width: 0;
}
.newcode-profile-grid > * {
  grid-column: 1 / -1;
  min-width: 0;
  width: 100%;
  aspect-ratio: auto;
  height: auto;
  overflow: visible;
  border-radius: 14px;
}
.newcode-profile-grid > div:not(.newcode-profile-banner):not(.newcode-profile-actions) { padding: 14px; border: 1px solid var(--md-sys-color-outline-variant); }
.newcode-profile-grid .title { font-size: 14px; line-height: 1.45; font-weight: 600; overflow-wrap: anywhere; }
.newcode-profile-grid > div:not(.newcode-profile-banner):not(.newcode-profile-actions) > span:first-of-type { font-size: 14px; line-height: 1.45; font-weight: 600; overflow-wrap: anywhere; }
.newcode-profile-grid .label { font-size: 12px; line-height: 1.5; color: var(--md-sys-color-on-surface-variant); }
.newcode-profile-grid .newcode-profile-banner {
  min-height: 148px;
  padding: 18px;
  background-color: #111;
  border: 1px solid #333;
  border-radius: 16px;
}
.newcode-profile-banner > div { min-width: 0; }
.newcode-profile-banner > div > div { min-width: 0; gap: 6px; }
.newcode-profile-banner > div > div > span { font-size: 20px; line-height: 1.3; }
.newcode-profile-actions { display: flex; justify-content: flex-start; align-items: center; gap: 8px; padding: 2px 0 4px; }
.newcode-profile-actions > button { min-height: 38px; }
.newcode-profile-actions > button:first-child { flex: 1; }
.newcode-profile-actions > button:not(:first-child) { flex: 0 0 auto; }

/* Wider labels prevent translated friends filters from spilling into the list. */
.newcode-friends { min-height: 0; height: 100%; }
.newcode-friends main { min-height: 0; flex: 1; }
.newcode-friends main > div { height: 100%; overflow: hidden; padding-inline: 0 !important; display: flex; flex-direction: column; }
.newcode-friends mdui-navigation-rail { width: 148px; }
.newcode-friends mdui-navigation-rail-item { width: 140px; font-size: 13px; }
.newcode-friends mdui-navigation-rail-item::part(label) { white-space: normal; overflow-wrap: normal; font-size: 13px; line-height: 1.35; }
.newcode-friends .FriendsList { margin-inline-start: 0; width: 100%; min-height: 0; flex: 1; }
.newcode-friends-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 12px 16px; border-bottom: 1px solid var(--md-sys-color-outline-variant); }
.newcode-friends-filters button { min-height: 36px; border-radius: 10px; padding-inline: 14px; font-size: 13px; white-space: nowrap; }
.newcode-friends-filters button[aria-pressed="true"] { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.newcode-friends-filters button:last-child { margin-inline-start: auto; }

.newcode-status-picker { display: flex; flex-direction: column; gap: 12px; }
.newcode-status-label { font-size: 13px; color: var(--md-sys-color-on-surface-variant); }
.newcode-status-icons { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
.newcode-status-icon { min-width: 0; min-height: 36px; border: 1px solid var(--md-sys-color-outline-variant); border-radius: 10px; font-size: 20px; background: var(--md-sys-color-surface-container); cursor: pointer; }
.newcode-status-icon[aria-pressed="true"] { border-color: var(--md-sys-color-on-surface); background: var(--md-sys-color-surface-container-highest); }
.newcode-status-icon:focus-visible, .newcode-status-clear:focus-visible { outline: 2px solid var(--md-sys-color-on-surface); outline-offset: 2px; }
.newcode-status-icon:active { transform: scale(.94); }
.newcode-status-clear { align-self: flex-start; cursor: pointer; color: var(--md-sys-color-on-surface); font-size: 13px; padding: 6px 0; }
.newcode-status-preview { padding: 12px; border-radius: 10px; background: var(--md-sys-color-surface-container); font-size: 14px; overflow-wrap: anywhere; }
.newcode-status-help { font-size: 12px; color: var(--md-sys-color-on-surface-variant); }
@media (max-width: 600px) {
  .settings_cont { padding-block: 20px; }
  .newcode-profile-grid { padding: 8px; }
  .newcode-friends mdui-navigation-rail { width: 110px; }
  .newcode-friends mdui-navigation-rail-item { width: 106px; }
}
