/* The three top-level screens (login, pending, app), the header, and the shell. */

/* --- Full-screen gates (login / access-pending) --- */
.gate { flex: 1; display: none; align-items: center; justify-content: center; padding: 24px; overflow-y: auto; }
.gate.show { display: flex; }

/* Login: words on the left, three of the characters on the right. */
.login {
  width: 100%; max-width: 1080px; margin: 0 auto; display: grid; align-items: center; gap: 56px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
}
.login-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 20px; max-width: 440px; }
.wordmark { font-family: var(--font-display); font-weight: var(--display-weight); font-size: 22px; letter-spacing: -.02em; }
.login-line {
  font-family: var(--font-display); font-weight: var(--display-weight); letter-spacing: -.025em;
  font-size: clamp(38px, 5.4vw, 60px); line-height: 1.04; text-wrap: balance;
}
.login-sub { color: var(--muted); font-size: 17px; max-width: 34ch; }
.login-art { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: start; }
.login-art img {
  width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--radius-lg);
  border: 1px solid var(--border); display: block; background: var(--panel);
}
.login-art img:nth-child(2) { margin-top: 44px; }
.login-art img:nth-child(3) { margin-top: 18px; }
@media (max-width: 820px) {
  .login { grid-template-columns: 1fr; gap: 32px; }
  .login-art { order: -1; max-width: 420px; }
}

/* Centered single card — the "waiting for access" screen. */
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 22px;
  padding: 36px; width: min(460px, 92vw); display: flex; flex-direction: column; gap: 16px;
}
.card h1 { font-size: 28px; }
.card p { color: var(--muted); }
.card b { color: var(--text); font-weight: 600; }
.btn-discord {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--discord); color: #fff; font-weight: 600; font-size: 15px;
  padding: 12px 20px; border-radius: 12px; text-decoration: none; cursor: pointer;
  transition: filter .15s;
}
.btn-discord:hover { filter: brightness(1.08); }
.idbox {
  display: flex; gap: 6px; align-items: center; justify-content: center;
  background: var(--panel2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px;
}
.idbox span { flex: 1; text-align: left; overflow-x: auto; }

/* --- App shell --- */
#app { flex: 1; display: none; flex-direction: column; min-height: 0; position: relative; }
#app.show { display: flex; }

header {
  display: flex; align-items: center; gap: 14px; padding: 0 var(--sp-5); height: var(--header-h); flex: none;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.brand {
  font-family: var(--font-display); font-weight: var(--display-weight); font-size: 24px; letter-spacing: -.02em;
  color: var(--text); text-decoration: none; cursor: pointer; background: none; border: none; padding: 0;
}
/* `button:hover:not(:disabled)` is more specific than a bare `.brand:hover`, so match it. */
.brand:hover:not(:disabled) { background: none; border-color: transparent; color: var(--text); }

.wallet-chip {
  display: inline-flex; align-items: baseline; gap: 6px; flex: none;
  background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 14px; font-weight: 600; font-size: 14px;
}
.wallet-chip:hover:not(:disabled) { background: var(--panel2); border-color: color-mix(in srgb, var(--text) 25%, var(--border)); }
.wallet-chip .unit { color: var(--muted); font-weight: 400; }
.tier-tag { font-size: 12px; font-weight: 500; color: var(--accent-text); }
.tier-tag.free { display: none; }

/* Account menu: avatar + name is the trigger; Profile, Admin and Sign out live
   in the dropdown (js/views/header.js toggles .open). */
.account-menu { position: relative; flex: none; }
.whoami {
  display: flex; align-items: center; gap: 10px; background: none; border: none; color: var(--text);
  font: inherit; font-weight: 500; cursor: pointer; padding: 4px 10px 4px 4px; border-radius: 999px;
}
.whoami:hover:not(:disabled) { background: var(--panel2); }
.whoami img { width: 32px; height: 32px; border-radius: 50%; background: var(--panel2); object-fit: cover; }
.whoami .hint { color: var(--text); font-size: 14px; }
.account-dropdown {
  display: none; position: absolute; top: calc(100% + 8px); right: 0; z-index: 30;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 6px; min-width: 190px; box-shadow: 0 16px 40px rgb(var(--veil) / .45);
}
.account-menu.open .account-dropdown { display: block; }
.account-dropdown button {
  display: block; width: 100%; text-align: left; background: none; border: none; border-radius: 9px;
  padding: 10px 12px; color: var(--text); font-weight: 500;
}
.account-dropdown button:hover:not(:disabled) { background: var(--panel2); }
.theme-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; font-weight: 500; font-size: 14px; }
.theme-dots { display: flex; gap: 8px; }
.account-dropdown .theme-dot {
  display: block; width: 26px; height: 26px; padding: 0; flex: none; border-radius: 50%;
  border: 2px solid var(--border); cursor: pointer;
  background: linear-gradient(135deg, var(--dot-bg) 50%, var(--dot-accent) 50%);
}
.account-dropdown .theme-dot:hover:not(:disabled) { border-color: var(--muted); background: linear-gradient(135deg, var(--dot-bg) 50%, var(--dot-accent) 50%); }
.account-dropdown .theme-dot.on { border-color: var(--text); }
.account-dropdown hr { border: none; border-top: 1px solid var(--border); margin: 6px 4px; }

/* Only ever shown when the chat engine can't be reached. */
.status-banner {
  flex: none; text-align: center; font-size: 14px; padding: 8px 16px;
  background: color-mix(in srgb, var(--warn) 16%, var(--bg)); color: var(--warn);
  border-bottom: 1px solid color-mix(in srgb, var(--warn) 30%, var(--border));
}
.status-banner[hidden] { display: none; }

/* --- Shell: one column. The character details open as a drawer over it. --- */
.app-shell { flex: 1; min-height: 0; display: flex; }
.stage { position: relative; min-width: 0; min-height: 0; flex: 1; display: flex; }
.stage-panel { flex: 1; min-width: 0; min-height: 0; display: none; flex-direction: column; }
.stage-panel.show { display: flex; }

@media (max-width: 560px) {
  header { padding: 0 var(--sp-3); gap: 8px; }
  .whoami .hint { display: none; }
}
