/* ============================================================
   Twilight — shared design system (homepage + messenger)
   Stability-first: no animation dependencies, pure CSS layout,
   mobile-first with PC enhancements.
   ============================================================ */

:root {
  --bg: #0b0e17;
  --bg-2: #111527;
  --panel: #161b2e;
  --panel-2: #1d2340;
  --line: #2a3152;
  --text: #e8eaf6;
  --muted: #9aa3c7;
  --accent: #7c6cff;
  --accent-2: #4ecdc4;
  --danger: #ff6b81;
  --ok: #55d68a;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0, 0, 0, .45);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
}

body { min-height: 100vh; }

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

button { font-family: inherit; }

/* ---------- generic helpers ---------- */
.hidden { display: none !important; }

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--panel);
}

.site-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  max-width: 1100px;
  margin: 0 auto;
}

.btn {
  display: inline-block;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 12px 22px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
  text-align: center;
}
.btn:hover { background: #262e55; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: wait; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #5a4bd6);
  border-color: transparent;
}
.btn-primary:hover { background: linear-gradient(135deg, #8f81ff, #6a5be6); }

.btn-danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}

.input-group { margin-bottom: 16px; }
.input-group label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: .3px;
}

.input {
  width: 100%;
  padding: 13px 14px;
  font-size: 16px; /* >=16px prevents iOS zoom-on-focus */
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  outline: none;
}
.input:focus { border-color: var(--accent); }
.input::placeholder { color: #5b6386; }

.notice {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.45;
  margin: 14px 0;
  border: 1px solid var(--line);
  background: var(--bg-2);
  word-break: break-word;
}
.notice.error   { border-color: var(--danger); color: #ffd7dd; background: rgba(255,107,129,.08); }
.notice.success { border-color: var(--ok);     color: #d6ffe6; background: rgba(85,214,138,.08); }
.notice.info    { color: var(--muted); }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ============================================================
   AUTH SCREEN (sign in / sign up)
   ============================================================ */
.auth-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(1200px 500px at 50% -200px, rgba(124,108,255,.18), transparent 60%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.auth-brand img {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  object-fit: cover;
  border: 1px solid var(--line);
}
.auth-brand h1 { margin: 0; font-size: 26px; letter-spacing: .5px; }
.auth-brand p  { margin: 0; color: var(--muted); font-size: 13.5px; }

.auth-tabs {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 20px;
}
.auth-tab {
  flex: 1;
  padding: 11px 0;
  text-align: center;
  background: var(--bg-2);
  color: var(--muted);
  border: 0;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.auth-tab.active { background: var(--accent); color: #fff; }

.auth-form { display: none; }
.auth-form.active { display: block; }

.auth-hint {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.4;
}

.auth-footer {
  margin-top: 18px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: tw-spin .8s linear infinite;
  vertical-align: -3px;
  margin-right: 8px;
}
@keyframes tw-spin { to { transform: rotate(360deg); } }

/* TU reveal card after signup */
.tu-reveal {
  text-align: center;
  padding: 18px;
  border: 1px dashed var(--accent-2);
  border-radius: var(--radius);
  background: rgba(78,205,196,.06);
  margin: 16px 0;
}
.tu-reveal .tu-number {
  font-size: 26px;
  letter-spacing: 2px;
  font-weight: 700;
  color: var(--accent-2);
  user-select: all;
  -webkit-user-select: all;
  margin: 8px 0;
}

/* ============================================================
   MESSENGER APP SHELL
   ============================================================ */
.app-shell {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* Left rail: conversation list */
.rail {
  width: 340px;
  min-width: 280px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

.rail-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}
.rail-header .brand-logo { width: 34px; height: 34px; border-radius: 8px; }
.rail-title { font-weight: 700; font-size: 17px; flex: 1; }

.icon-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  width: 36px;
  height: 36px;
  border-radius: 9px;
  font-size: 17px;
  cursor: pointer;
  line-height: 1;
}
.icon-btn:hover { color: var(--text); background: var(--panel-2); }

.rail-search { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.rail-search .input { padding: 10px 12px; font-size: 15px; }

.conv-list { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }

.conv-item {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(42,49,82,.5);
  cursor: pointer;
  align-items: center;
}
.conv-item:hover { background: var(--panel-2); }
.conv-item.active { background: var(--panel-2); box-shadow: inset 3px 0 0 var(--accent); }

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  flex: 0 0 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 17px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.conv-meta { flex: 1; min-width: 0; }
.conv-name {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-preview {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.conv-time { font-size: 11px; color: var(--muted); align-self: flex-start; white-space: nowrap; }

.rail-empty {
  padding: 30px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

/* Main chat area */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(900px 400px at 80% -150px, rgba(124,108,255,.10), transparent 60%),
    var(--bg);
  min-width: 0;
}

.chat-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-header .who { flex: 1; min-width: 0; }
.chat-header .who .name { font-weight: 700; font-size: 16px; }
.chat-header .who .sub  { font-size: 12px; color: var(--muted); }

.back-btn { display: none; }

.chat-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.day-divider {
  align-self: center;
  font-size: 11.5px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 3px 12px;
  border-radius: 999px;
  margin: 10px 0 4px;
}

.msg {
  max-width: min(75%, 560px);
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.45;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  position: relative;
}
.msg.in  { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg.out { align-self: flex-end;   background: linear-gradient(135deg, #5a4bd6, #7c6cff); color: #fff; border-bottom-right-radius: 6px; }

.msg .time {
  display: block;
  font-size: 10.5px;
  opacity: .65;
  margin-top: 3px;
  text-align: right;
}

.msg.pending { opacity: .6; }
.msg.failed  { border: 1px solid var(--danger); }

.chat-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  gap: 12px;
  text-align: center;
  padding: 30px;
}
.chat-placeholder img { width: 140px; border-radius: 20px; opacity: .8; border: 1px solid var(--line); }

/* composer */
.composer {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: var(--panel);
  align-items: flex-end;
}
.composer textarea {
  flex: 1;
  resize: none;
  max-height: 120px;
  min-height: 44px;
  padding: 12px 14px;
  font-size: 16px;
  line-height: 1.4;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  outline: none;
  font-family: inherit;
}
.composer textarea:focus { border-color: var(--accent); }
.send-btn {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  border: 0;
  background: linear-gradient(135deg, var(--accent), #5a4bd6);
  color: #fff;
  font-size: 19px;
  cursor: pointer;
  flex: 0 0 46px;
}
.send-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- message requests: chat card + contacts-tab cards ---------- */
.req-card {
  margin: 10px 0 14px; padding: 12px 14px;
  border: 1px solid var(--line, #2c2e3a); border-radius: 12px;
  background: var(--panel-2, rgba(255, 255, 255, .04));
}
.contact-req { margin: 10px 12px; }

/* ---------- contacts rail (password-encrypted, device-local) ---------- */
.contacts-lock { padding: 22px 16px; text-align: center; }
.contacts-lock-ic { font-size: 30px; margin-bottom: 8px; opacity: .85; }
.contacts-lock-text {
  font-size: 13px; color: var(--muted, #9aa0b4); margin-bottom: 14px; line-height: 1.45;
}
.contacts-lock form { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.contacts-list { height: auto; flex: 1; }
.msg-item { cursor: pointer; }
.msg-item:hover { background: rgba(255,255,255,.04); }
.req-title { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.req-hint { font-size: 12.5px; color: var(--muted, #9aa0b4); margin-bottom: 10px; }
.req-actions { display: flex; gap: 8px; }
.req-actions .btn { padding: 5px 14px; font-size: 12.5px; }

.menu { position: relative; }
.req-badge {
  display: none; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  margin-left: 3px; background: var(--accent, #d35d8f); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 1; vertical-align: middle;
}
.req-badge.show { display: inline-flex; }
.req-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 60;
  width: 320px; max-width: calc(100vw - 24px);
  background: var(--panel, #1b1c24); border: 1px solid var(--line, #2c2e3a);
  border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
  overflow: hidden;
}
.req-menu-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-bottom: 1px solid var(--line, #2c2e3a);
  font-size: 13px; font-weight: 700; letter-spacing: .02em;
}
.req-menu-close {
  border: 0; background: transparent; color: var(--muted, #9aa0b4);
  font-size: 16px; cursor: pointer; padding: 2px 6px; border-radius: 6px; line-height: 1;
}
.req-menu-close:hover { color: inherit; background: rgba(255, 255, 255, .06); }
.req-menu-list { max-height: 320px; overflow-y: auto; }
.req-empty { padding: 18px 14px; font-size: 13px; color: var(--muted, #9aa0b4); text-align: center; }
.req-item {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--line, #2c2e3a);
}
.req-item:last-child { border-bottom: 0; }
.req-item-from { font-size: 13px; font-weight: 700; }
.req-item-time { font-size: 11px; color: var(--muted, #9aa0b4); }
.req-item-preview {
  grid-column: 1 / -1; font-size: 12.5px; color: var(--muted, #9aa0b4);
  white-space: pre-wrap; word-break: break-word; max-height: 3.6em; overflow: hidden;
}
.req-item-actions { grid-column: 1 / -1; display: flex; gap: 8px; margin-top: 4px; }
.req-item-actions .btn { padding: 4px 12px; font-size: 12px; }

/* note shown on request cards (Contacts tab + chat card) */
.req-note {
  font-size: 12.5px; color: var(--text, #e8e9f3); margin-bottom: 10px;
  padding: 6px 10px; border-radius: 8px; background: rgba(255, 255, 255, .05);
  white-space: pre-wrap; word-break: break-word;
}
/* editable note on an unsent draft card */
.req-note-edit {
  width: 100%; box-sizing: border-box; margin-bottom: 10px;
  font-size: 12.5px; resize: vertical; min-height: 44px;
}

/* ---------- inline quick-send rows in the Messages dropdown ---------- */
.msg-item-send {
  grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; margin-top: 6px;
}
.msg-inline-input {
  flex: 1 1 auto; min-width: 0; padding: 7px 10px; font-size: 13px;
  border-radius: 9px; border: 1px solid var(--line, #2c2e3a);
  background: var(--panel-2, rgba(255, 255, 255, .04)); color: var(--text, #e8e9f3);
}
.msg-inline-input:focus { outline: none; border-color: var(--accent, #d35d8f); }
.msg-inline-send {
  flex: 0 0 auto; width: 32px; height: 32px; font-size: 13px; border-radius: 9px;
}

/* ---------- pretty typing indicator (tw.html #typingRow) ---------- */
.typing-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 14px 8px;
}
.typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-radius: 14px 14px 14px 4px;
  background: var(--bg-2, #141a2b);
  border: 1px solid var(--line, rgba(255,255,255,.08));
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.typing-bubble .tdot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent, #7c6cf0);
  opacity: .35;
  animation: tw-typing 1.2s infinite ease-in-out;
}
.typing-bubble .tdot:nth-child(2) { animation-delay: .18s; }
.typing-bubble .tdot:nth-child(3) { animation-delay: .36s; }
@keyframes tw-typing {
  0%, 60%, 100% { transform: translateY(0);    opacity: .35; }
  30%           { transform: translateY(-4px); opacity: 1;   }
}
@media (prefers-reduced-motion: reduce) {
  .typing-bubble .tdot { animation: none; opacity: .8; }
}
.typing-word {
  font-size: 12px;
  color: var(--muted, #9aa3b8);
  font-style: italic;
}

/* send button icon + padlock */
.send-btn svg { display: block; margin: 0 auto; }
.send-btn .ic-plane { fill: currentColor; }
.send-btn .ic-lock rect  { fill: currentColor; }
.send-btn .ic-lock path  { fill: none; stroke: currentColor; }

/* status bar (connection) */
.status-bar {
  padding: 6px 14px;
  font-size: 12px;
  text-align: center;
  color: #ffe9b3;
  background: rgba(255, 196, 61, .12);
  border-bottom: 1px solid rgba(255, 196, 61, .3);
}
.status-bar.ok { display: none; }

/* ============================================================
   MODALS (new chat, settings)
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 14, .7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 100;
}
.modal {
  width: 100%;
  max-width: 430px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  max-height: 85dvh;
  overflow-y: auto;
}
.modal h2 { margin: 0 0 6px; font-size: 19px; }
.modal .modal-sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }

.kv { font-size: 14px; color: var(--muted); margin: 6px 0; }
.kv b { color: var(--text); user-select: all; }

/* ============================================================
   SETTINGS TAB — card-based layout (tw.html railSettings).
   Previously .settings-pane/.set-* had NO styles at all, which
   is why the panel looked broken. Full design system below,
   dark + antarctic themes both work through CSS variables only.
   ============================================================ */
.settings-pane {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.set-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
}
.set-card-head {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 8px;
}
.set-card .kv { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 8px 0; }
.set-card .kv span { flex: 0 0 auto; }
.set-card .kv b { text-align: right; word-break: break-word; }
.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  font-size: 14px;
  color: var(--text);
}
.set-row + .set-row { border-top: 1px dashed var(--line); }
.set-badge-anchor { min-width: 18px; height: 18px; font-size: 11px; }
.set-select {
  width: auto;
  min-width: 130px;
  padding: 7px 10px;
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  font-size: 13.5px;
  cursor: pointer;
}
.set-select:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.model-bullets {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
  white-space: pre-line;   /* the i18n bullet string contains \n separators */
}
.set-btn { width: 100%; margin-top: 8px; }
.set-card-danger { border-color: rgba(255, 107, 129, .45); }
.set-card-danger .set-card-head { color: var(--danger); }
.set-card-danger .auth-hint { margin-top: 6px; }

/* ============================================================
   MOBILE (<= 760px): single-pane navigation
   ============================================================ */
@media (max-width: 760px) {
  .app-shell { flex-direction: column; }

  .rail {
    width: 100%;
    min-width: 0;
    border-right: 0;
    flex: 1;
  }

  /* On mobile the chat pane is an overlay until a chat is opened */
  .chat-area {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 20;
  }

  .app-shell.chat-open .rail { display: none; }
  .app-shell.chat-open .chat-area { display: flex; }

  .back-btn { display: inline-flex; align-items: center; justify-content: center; }

  .msg { max-width: 85%; }

  .auth-card { padding: 22px 18px; }
  .auth-brand h1 { font-size: 22px; }
}

/* Very small screens */
@media (max-width: 360px) {
  .rail { min-width: 0; }
  .conv-time { display: none; }
}

/* Desktop niceties */
@media (min-width: 1200px) {
  .msg { max-width: min(60%, 640px); }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 1.6s; }
  * { transition: none !important; }
}

/* ============================================================
   LOGIN PAGE REVAMP (v20261103c)
   ============================================================ */
.login-body { position: relative; }

.bg-orbs { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.bg-orbs i {
  position: absolute; border-radius: 50%; filter: blur(90px); opacity: .35;
}
.bg-orbs i:nth-child(1) { width: 480px; height: 480px; background: #7c6cff; top: -180px; left: -120px; }
.bg-orbs i:nth-child(2) { width: 420px; height: 420px; background: #4ecdc4; bottom: -160px; right: -100px; opacity: .22; }
.bg-orbs i:nth-child(3) { width: 300px; height: 300px; background: #ff6b81; top: 40%; right: 12%; opacity: .12; }
@media (prefers-reduced-motion: no-preference) {
  .bg-orbs i:nth-child(1) { animation: orb-drift-a 22s ease-in-out infinite alternate; }
  .bg-orbs i:nth-child(2) { animation: orb-drift-b 26s ease-in-out infinite alternate; }
}
@keyframes orb-drift-a { to { transform: translate(60px, 40px); } }
@keyframes orb-drift-b { to { transform: translate(-50px, -30px); } }
@media (prefers-reduced-motion: reduce) { .bg-orbs i { animation: none !important; } }

.auth-screen { position: relative; z-index: 1; }

.lang-float {
  position: absolute; top: 16px; right: 16px; display: flex; gap: 6px;
  background: rgba(22, 27, 46, .8); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px; backdrop-filter: blur(6px);
}
.lang-chip {
  border: 0; background: transparent; color: var(--muted);
  font-size: 12.5px; font-weight: 700; letter-spacing: .5px;
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
}
.lang-chip:hover { color: var(--text); }
.lang-chip.active { background: var(--accent); color: #fff; }

.auth-card {
  max-width: 460px;
  background: rgba(22, 27, 46, .88);
  backdrop-filter: blur(10px);
  border-radius: 18px;
}

.btn-lg { width: 100%; padding: 14px 22px; font-size: 16px; border-radius: 12px; margin-top: 4px; }

.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 46px; }
.pw-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.pw-eye:hover { color: var(--text); background: var(--panel-2); }
.pw-eye.on { color: var(--accent-2); }

.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.link-btn {
  background: transparent; border: 0; color: var(--accent-2);
  font-size: 12.5px; cursor: pointer; padding: 2px 4px;
}
.link-btn:hover { text-decoration: underline; }

.level-pick { display: flex; flex-direction: column; gap: 8px; }
.level-opt {
  display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 10px;
  width: 100%; text-align: left; cursor: pointer;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; color: var(--text);
  transition: border-color .15s ease, background .15s ease;
}
.level-opt:hover { border-color: var(--accent); }
.level-opt.active { border-color: var(--accent); background: rgba(124,108,255,.12); box-shadow: inset 3px 0 0 var(--accent); }
.lo-name { font-size: 14px; font-weight: 600; line-height: 1.3; }
.lo-desc { font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.lo-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.lo-dot-ok   { background: var(--ok);     box-shadow: 0 0 8px rgba(85,214,138,.6); }
.lo-dot-warn { background: #ffc43d;       box-shadow: 0 0 8px rgba(255,196,61,.6); }
.lo-dot-max  { background: var(--danger); box-shadow: 0 0 8px rgba(255,107,129,.6); }

.auth-home { margin-top: 10px; text-align: center; font-size: 13px; }

@media (max-width: 760px) {
  .lang-float { top: 10px; right: 10px; }
  .auth-card { padding: 24px 18px; }
  .level-opt { grid-template-columns: 12px 1fr; }
  .lo-desc { display: none; }
}

/* ============================================================
   BUILD BADGE — "2026H2 Antarctica" chip (injected by app-core.js)
   ========================================================== */
.build-badge {
  position: fixed; right: 12px; bottom: 10px; z-index: 9999;
  font-size: 10.5px; font-weight: 700; letter-spacing: .4px;
  color: var(--muted); background: rgba(22, 27, 46, .72);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 10px; pointer-events: none; user-select: none;
  backdrop-filter: blur(6px); opacity: .85;
}

/* ============================================================
   THEME FAB — floating ☀/☾ switch (bright mode = "antarctic")
   ========================================================== */
.theme-fab {
  position: fixed; left: 14px; bottom: 12px; z-index: 9999;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--panel-2);
  color: var(--text); font-size: 17px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow); transition: transform .12s ease, background .15s ease;
}
.theme-fab:hover { transform: translateY(-2px); background: var(--panel); }
.theme-fab:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ============================================================
   BRIGHT MODE — "antarctic"
   Optional ice-white palette. Activated via <html data-theme="antarctic">
   (persisted in tw.theme.v1 / ?theme=antarctic). Everything below is a
   pure variable + override swap: no layout changes, so both palettes
   stay pixel-aligned.
   ========================================================== */
[data-theme="antarctic"] {
  --bg: #eef4fa;            /* pale glacier sky        */
  --bg-2: #e2ecf6;         /* frost shade             */
  --panel: #ffffff;        /* snow white              */
  --panel-2: #f2f7fc;      /* powdered sugar          */
  --line: #c9d8ea;         /* thin ice line           */
  --text: #16283c;         /* deep seal blue-black    */
  --muted: #5c7188;        /* slate mist              */
  --accent: #2b7de0;       /* aurora blue             */
  --accent-2: #0aa79a;     /* glacial teal            */
  --danger: #e0556d;
  --ok: #2fb477;
  --shadow: 0 8px 30px rgba(22, 40, 60, .14);
}

/* glass surfaces go opaque-snow */
[data-theme="antarctic"] .auth-card { background: rgba(255, 255, 255, .92); }
[data-theme="antarctic"] .lang-float { background: rgba(255, 255, 255, .85); }
[data-theme="antarctic"] .msg-menu,
[data-theme="antarctic"] .dropdown,
[data-theme="antarctic"] .modal-card { background: var(--panel); }

/* white text on accent buttons stays white in both palettes */
[data-theme="antarctic"] .btn-primary { color: #fff; }
[data-theme="antarctic"] .lang-chip.active,
[data-theme="antarctic"] .auth-tab.active { color: #fff; }

/* ambient orbs soften into pale ice discs instead of glowing voids */
[data-theme="antarctic"] .bg-orbs i { opacity: .35; filter: saturate(.5); }

/* inputs & panels get crisp borders rather than glow */
[data-theme="antarctic"] .input,
[data-theme="antarctic"] .level-opt { box-shadow: none; }
[data-theme="antarctic"] .level-opt.active { background: rgba(43, 125, 224, .10); }

/* the build badge reads better as white glass in bright mode */
[data-theme="antarctic"] .build-badge { background: rgba(255, 255, 255, .8); }

/* boot-splash build line ("Build 2026H2 Antarctica") */
.boot-build { font-size: 11.5px; letter-spacing: .4px; color: var(--muted); margin-top: 6px; opacity: .8; }
