/* Neon palette and shared component measurements. */
:root {
  color-scheme: dark;
  --anox-bg: #0b0b14;
  --anox-surface: #151524;
  --anox-raised: #1e1e33;
  --anox-text: #f2f1ff;
  --anox-muted: #a8a6c3;
  --anox-line: #373754;
  --anox-control-line: #656382;
  --anox-live: #5ae2a9;
  --anox-danger: #ff8ba6;
  --anox-on-accent: #0b0b14;
  --anox-scrim: rgb(8 8 16 / 68%);
  --anox-shadow-color: #080810;
  --anox-media-surface: #05050d;
  --anox-warning: #ffbf65;
  --anox-info: #a6caff;
  --anox-print-background: #fff;
  --anox-print-text: #111;
  --anox-on-status: #0b0b14;
  --anox-font: "Inter", "Segoe UI", system-ui, sans-serif;
  --anox-type-small: .8125rem;
  --anox-space-1: .25rem;
  --anox-space-2: .5rem;
  --anox-space-3: .75rem;
  --anox-space-4: 1rem;
  --anox-space-5: 1.25rem;
  --anox-space-6: 1.5rem;
  --anox-radius-sm: .625rem;
  --anox-radius: 1.125rem;
  --anox-radius-lg: 1.75rem;
  --anox-round: 999px;
  --anox-touch: 2.75rem;
  --anox-rail: 12.75rem;
  --anox-divider: 1px solid var(--anox-line);
  --anox-shadow: 0 1rem 2rem -1rem var(--anox-scrim);
  --anox-content: 70rem;
  --anox-reading: 48rem;
}

:root:is([data-anox-tone="light"], :not([data-anox-tone])[data-theme="light"]) {
  color-scheme: light;
  --anox-bg: #f7f6fc;
  --anox-surface: #fff;
  --anox-raised: #eeedf7;
  --anox-text: #1d1a33;
  --anox-muted: #595671;
  --anox-line: #d6d2e5;
  --anox-control-line: #837f9c;
  --anox-live: #08734f;
  --anox-danger: #9d1e47;
  --anox-on-accent: #fff;
  --anox-scrim: rgb(26 21 47 / 48%);
  --anox-warning: #864600;
  --anox-info: #1d528a;
  --anox-on-status: #fff;
}

:root, [data-anox-area="random"], #shell-nav [data-area="random"] {
  --anox-accent: #22e3ff;
  --anox-accent-end: #9b85ff;
  --anox-light-accent: #04627a;
  --anox-light-accent-end: #5a35b0;
}

[data-anox-area="chats"], #shell-nav [data-area="chats"] {
  --anox-accent: #3ddc97;
  --anox-accent-end: #39bfff;
  --anox-light-accent: #076441;
  --anox-light-accent-end: #005c83;
}

[data-anox-area="rooms"], #shell-nav [data-area="rooms"] {
  --anox-accent: #ffb224;
  --anox-accent-end: #ff824f;
  --anox-light-accent: #805000;
  --anox-light-accent-end: #a03c20;
}

[data-anox-area="feed"], #shell-nav [data-area="feed"] {
  --anox-accent: #c09aff;
  --anox-accent-end: #ff80be;
  --anox-light-accent: #6040a7;
  --anox-light-accent-end: #9d225f;
}

[data-anox-area="flirt"], #shell-nav [data-area="flirt"] {
  --anox-accent: #ff7398;
  --anox-accent-end: #ff9a5a;
  --anox-light-accent: #a22b56;
  --anox-light-accent-end: #953a16;
}

[data-anox-area="profile"], #shell-nav [data-area="profile"] {
  --anox-accent: #9fb3ff;
  --anox-accent-end: #7ce0d0;
  --anox-light-accent: #4259a8;
  --anox-light-accent-end: #1a665b;
}

html:is([data-anox-tone="light"], :not([data-anox-tone])[data-theme="light"]),
html:is([data-anox-tone="light"], :not([data-anox-tone])[data-theme="light"])
  :is([data-anox-area], #shell-nav [data-area]) {
  --anox-accent: var(--anox-light-accent);
  --anox-accent-end: var(--anox-light-accent-end);
}

:is(:root, [data-anox-area], #shell-nav [data-area]) {
  --anox-gradient: linear-gradient(135deg, var(--anox-accent), var(--anox-accent-end));
  --anox-accent-surface: color-mix(in srgb, var(--anox-accent) 12%, var(--anox-surface));
  --anox-accent-line: color-mix(in srgb, var(--anox-accent) 75%, var(--anox-line));
  --anox-info-surface: color-mix(in srgb, var(--anox-info) 16%, var(--anox-surface));
}

* { box-sizing: border-box; }

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

body {
  display: grid;
  grid-template:
    "top top" auto
    "nav entry" auto
    "nav sub" auto
    "nav stage" minmax(0, 1fr) / var(--anox-rail) minmax(0, 1fr);
  overflow: hidden;
  background: var(--anox-bg);
  color: var(--anox-text);
  font: 1rem/1.45 var(--anox-font);
}

body[data-anox-area="flirt"] {
  background: radial-gradient(ellipse at top, var(--anox-accent-surface), var(--anox-bg) 65%);
}

button, summary { font: inherit; cursor: pointer; }
:where(a, button, summary, input):focus-visible {
  outline: 2px solid var(--anox-accent);
  outline-offset: 2px;
}
[hidden] { display: none !important; }

#shell-header, #shell-header-actions {
  display: flex;
  align-items: center;
  gap: var(--anox-space-2);
  min-width: 0;
}

#shell-header {
  grid-area: top;
  justify-content: space-between;
  padding: var(--anox-space-2) var(--anox-space-4);
  padding-top: calc(var(--anox-space-2) + env(safe-area-inset-top));
  border-bottom: var(--anox-divider);
  position: relative;
  z-index: 5;
}

#shell-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--anox-space-2);
  min-height: var(--anox-touch);
  color: var(--anox-text);
  font-size: 1.375rem;
  font-weight: 800;
  text-decoration: none;
}

#shell-brand span {
  width: 2rem;
  aspect-ratio: 1;
  border-radius: var(--anox-radius-sm);
  background: var(--anox-gradient);
  box-shadow: 0 0 1.25rem -.4rem var(--anox-accent);
}

#shell-profile, #shell-activity-menu { position: relative; }

#shell-profile summary {
  display: grid;
  place-items: center;
  width: var(--anox-touch);
  height: var(--anox-touch);
  border: 1px solid var(--anox-control-line);
  border-radius: var(--anox-round);
  background: var(--anox-surface);
  color: var(--anox-text);
  list-style: none;
}

#shell-profile summary::-webkit-details-marker { display: none; }

#shell-profile :is(img, #shell-profile-initial) {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--anox-round);
  background: var(--anox-gradient);
  color: var(--anox-on-accent);
  font-weight: 750;
  object-fit: cover;
}

#shell-profile-actions, #shell-activity-list {
  position: absolute;
  inset: calc(100% + var(--anox-space-2)) 0 auto auto;
  width: min(15rem, calc(100vw - 2rem));
  margin: 0;
  padding: var(--anox-space-2);
  border: 1px solid var(--anox-control-line);
  border-radius: var(--anox-radius);
  background: var(--anox-surface);
  box-shadow: var(--anox-shadow);
}

#shell-profile-actions button, #shell-activity-list button {
  width: 100%;
  min-height: var(--anox-touch);
  padding: var(--anox-space-2) var(--anox-space-3);
  border: 0;
  border-radius: var(--anox-radius-sm);
  background: transparent;
  color: inherit;
  text-align: start;
}

#shell-profile-actions button:hover, #shell-activity-list button:hover { background: var(--anox-raised); }
#shell-profile-actions [data-profile-action="logout"] { color: var(--anox-danger); }

#shell-profile-status {
  margin: var(--anox-space-2) var(--anox-space-3);
  color: var(--anox-muted);
  font-size: var(--anox-type-small);
}

#shell-profile-status:empty { margin: 0; }

#shell-activity-list {
  max-height: min(60vh, 24rem);
  overflow: auto;
  padding-inline-start: var(--anox-space-5);
  font-size: var(--anox-type-small);
}

#shell-entry {
  grid-area: entry;
  padding: var(--anox-space-3) var(--anox-space-4);
  border-bottom: var(--anox-divider);
  background: var(--anox-surface);
}

#shell-entry p { margin: 0 0 var(--anox-space-2); font-size: .9rem; }
#shell-entry > div { display: flex; flex-wrap: wrap; gap: var(--anox-space-2); }
#shell-entry button { flex: 1; }

#shell-nav {
  grid-area: nav;
  display: flex;
  flex-direction: column;
  gap: var(--anox-space-2);
  overflow: auto;
  padding: var(--anox-space-3);
  border-right: var(--anox-divider);
  background: var(--anox-bg);
}

#shell-nav button {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--anox-space-2);
  min-height: var(--anox-touch);
  padding: var(--anox-space-2) var(--anox-space-3);
  border: 1px solid transparent;
  border-radius: var(--anox-radius-sm);
  background: transparent;
  color: var(--anox-muted);
  font-size: .875rem;
  font-weight: 650;
  text-align: start;
}

#shell-nav button:hover { background: var(--anox-surface); color: var(--anox-text); }

#shell-nav button.is-active {
  border-color: var(--anox-accent-line);
  background: var(--anox-accent-surface);
  color: var(--anox-text);
}

.shell-icon { flex: none; width: 1.25rem; height: 1.25rem; }
.is-active .shell-icon { color: var(--anox-accent); }
.shell-label, .shell-label-desktop { min-width: 0; }
#shell-nav button:has(.shell-label-desktop) .shell-label { display: none; }

.shell-live {
  margin-inline-start: auto;
  color: var(--anox-live);
  font-size: .6875rem;
  line-height: 1;
}

.shell-live:empty { display: none; }

.shell-badge {
  min-width: 1.25rem;
  padding: .125rem var(--anox-space-1);
  border-radius: var(--anox-round);
  background: var(--anox-accent);
  color: var(--anox-on-accent);
  font-size: .6875rem;
  font-weight: 750;
  text-align: center;
}

#shell-subnav {
  grid-area: sub;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--anox-space-2);
  padding: var(--anox-space-2) var(--anox-space-4);
  border-bottom: var(--anox-divider);
  background: var(--anox-bg);
}

#shell-subnav button, #shell-back, #shell-install, #shell-activity-menu summary, #shell-entry button, #shell-sign-in {
  min-height: var(--anox-touch);
  padding: var(--anox-space-2) var(--anox-space-3);
  border: 1px solid var(--anox-control-line);
  border-radius: var(--anox-round);
  background: var(--anox-surface);
  color: var(--anox-text);
  font-size: var(--anox-type-small);
  font-weight: 650;
}

#shell-activity-menu summary { display: flex; align-items: center; gap: var(--anox-space-1); list-style: none; }
#shell-activity-menu summary::-webkit-details-marker { display: none; }

#shell-sign-in, #shell-entry-account {
  border-color: transparent;
  background: var(--anox-gradient);
  color: var(--anox-on-accent);
}

#shell-subnav button.is-active {
  border-color: var(--anox-accent-line);
  background: var(--anox-accent-surface);
  color: var(--anox-accent);
}

#shell-subnav button.is-live::before { content: "● "; color: var(--anox-live); }

#shell-back {
  grid-area: stage;
  position: relative;
  align-self: start;
  justify-self: start;
  margin: var(--anox-space-2);
  z-index: 3;
}

#shell-stage { grid-area: stage; position: relative; min-height: 0; }

/* Hidden frames stay rendered so audio, video and sockets keep running. */
#shell-stage iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--anox-bg);
  visibility: hidden;
  pointer-events: none;
}

#shell-stage iframe.is-active { visibility: visible; pointer-events: auto; z-index: 1; }

:is(.anox-entry-dialog, #shell-replace-dialog) {
  width: min(calc(100% - 2rem), 29rem);
  max-height: calc(100% - 2rem);
  padding: var(--anox-space-5);
  border: 1px solid var(--anox-control-line);
  border-radius: var(--anox-radius);
  background: var(--anox-surface);
  color: var(--anox-text);
  line-height: 1.5;
}

:is(.anox-entry-dialog, #shell-replace-dialog)::backdrop { background: var(--anox-scrim); }
:is(.anox-entry-dialog, #shell-replace-dialog) h2 { margin-top: 0; color: inherit; }
.anox-entry-dialog nav { display: flex; flex-wrap: wrap; gap: var(--anox-space-2) var(--anox-space-4); }
.anox-entry-dialog a { color: var(--anox-accent); text-decoration: underline; }
.anox-entry-dialog label { display: block; margin: var(--anox-space-3) 0 var(--anox-space-4); color: inherit; }

:is(.anox-entry-dialog, #shell-replace-dialog) button {
  min-height: var(--anox-touch);
  padding: var(--anox-space-3) var(--anox-space-4);
  border: 0;
  border-radius: var(--anox-radius-sm);
  background: var(--anox-gradient);
  color: var(--anox-on-accent);
  font-weight: 700;
}

.anox-entry-dialog button { width: 100%; white-space: normal; }
#shell-replace-keep { margin: 0 var(--anox-space-2) var(--anox-space-2) 0; }

@media (max-width: 760px) {
  body { grid-template: "top" auto "entry" auto "sub" auto "stage" minmax(0, 1fr) "nav" auto / minmax(0, 1fr); }
  #shell-header { padding-inline: var(--anox-space-3); }

  #shell-nav {
    flex-direction: row;
    gap: var(--anox-space-1);
    padding: var(--anox-space-1);
    padding-bottom: calc(var(--anox-space-1) + env(safe-area-inset-bottom));
    border-right: 0;
    border-top: var(--anox-divider);
  }

  #shell-nav button {
    flex: 1 1 0;
    flex-direction: column;
    gap: var(--anox-space-1);
    min-width: 0;
    min-height: 3.25rem;
    padding: var(--anox-space-1);
    font-size: .6875rem;
    text-align: center;
  }

  #shell-nav button.is-live .shell-icon { color: var(--anox-live); }
  #shell-nav button:has(.shell-label-desktop) .shell-label { display: inline; }
  .shell-label-desktop { display: none; }
  .shell-live { margin: 0; }
  .shell-badge { position: absolute; inset: 0 0 auto auto; }
  #shell-activity-list { inset-inline-end: calc(-1 * var(--anox-touch)); }
  #shell-install { max-width: 6rem; line-height: 1.15; }
}

@media (max-width: 370px) {
  #shell-header { padding-inline: var(--anox-space-2); }
  #shell-brand { font-size: 1.125rem; }
  #shell-brand span { width: 1.5rem; }
  #shell-header-actions { gap: var(--anox-space-1); }
  #shell-header-actions > button, #shell-activity-menu summary { padding-inline: var(--anox-space-2); }
  #shell-nav button { font-size: .625rem; }
}
