:root {
  color-scheme: dark;
  --ink: #f7f8fb;
  --muted: #b7aaa2;
  --panel: rgba(16, 16, 19, 0.92);
  --line: rgba(255, 152, 0, 0.22);
  --ember: #ff5722;
  --flame: #ff9800;
  --gold: #ffc107;
  --warning: #ffc107;
  --danger: #ff6b7a;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 10% 10%, rgba(255, 87, 34, 0.16), transparent 32rem),
    radial-gradient(circle at 90% 90%, rgba(255, 152, 0, 0.14), transparent 34rem),
    #090706;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }

.shell {
  width: min(1080px, calc(100% - 32px));
  min-height: 640px;
  margin: clamp(24px, 6vh, 70px) auto;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, .92fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(12, 9, 8, 0.86);
  box-shadow: 0 34px 100px rgba(0, 0, 0, .48);
  backdrop-filter: blur(18px);
}

.brand-panel,
.access-panel { padding: clamp(32px, 6vw, 76px); }

.brand-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(28, 10, 4, .97), rgba(14, 10, 9, .88));
}

.brand-panel::after {
  content: "";
  position: absolute;
  inset: 24px;
  border: 1px solid rgba(255, 152, 0, .11);
  border-radius: 18px;
  pointer-events: none;
}

.mpp-logo-link {
  display: block;
  position: fixed;
  z-index: 101;
  top: 10px;
  left: 10px;
  width: 95px;
  line-height: 0;
  transition: transform .18s ease;
}

.mpp-logo-link:hover,
.mpp-logo-link:focus-visible {
  transform: translateY(-2px);
}

.mpp-logo-link img {
  display: block;
  width: 100%;
  height: auto;
}

.eyebrow,
.step {
  margin: 0 0 10px;
  color: var(--flame);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(64px, 10vw, 112px);
  line-height: .92;
  letter-spacing: -.07em;
  background: linear-gradient(120deg, #fff7e6 8%, var(--gold) 46%, var(--ember));
  -webkit-background-clip: text;
  color: transparent;
}

.brand-copy {
  max-width: 430px;
  margin: 28px 0;
  color: #c9d2df;
  font-size: clamp(18px, 2.3vw, 25px);
  line-height: 1.45;
}

.phoenix-hero {
  width: min(100%, 360px);
  aspect-ratio: 1;
  margin: -22px auto -12px;
  object-fit: cover;
  border-radius: 50%;
  filter: saturate(1.08) drop-shadow(0 0 24px rgba(255, 87, 34, .28));
  -webkit-mask-image: radial-gradient(circle, #000 48%, transparent 72%);
  mask-image: radial-gradient(circle, #000 48%, transparent 72%);
}

.security-note {
  max-width: 460px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.access-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--panel);
}

.shell.chat-mode {
  width: min(1280px, calc(100% - 32px));
  height: calc(100dvh - 32px);
  min-height: 0;
  margin: 16px auto;
  grid-template-columns: minmax(230px, .34fr) minmax(0, 1fr);
}

.shell.chat-mode .brand-panel { padding: 34px; }
.shell.chat-mode .brand-panel h1 { font-size: clamp(54px, 7vw, 82px); }
.shell.chat-mode .brand-copy { font-size: 17px; }
.shell.chat-mode .phoenix-hero { width: 220px; margin: -20px auto -8px; }
.shell.chat-mode .access-panel {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 28px;
  justify-content: stretch;
}
.shell.chat-mode #authorized-view {
  min-height: 0;
  flex: 1 1 auto;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  overflow: hidden;
}

[hidden] { display: none !important; }

h2 {
  margin: 0 0 10px;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.08;
  letter-spacing: -.035em;
}

.intro,
.view > p:not(.step) {
  color: var(--muted);
  line-height: 1.6;
}

form { display: grid; gap: 10px; margin-top: 28px; }

label {
  margin-top: 8px;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 700;
}

input {
  width: 100%;
  padding: 13px 14px;
  color: var(--ink);
  border: 1px solid #273449;
  border-radius: 12px;
  outline: none;
  background: #110d0b;
}

input:focus {
  border-color: var(--flame);
  box-shadow: 0 0 0 3px rgba(255, 152, 0, .11);
}

.password-field { position: relative; }
.password-field input { padding-right: 52px; }

.password-visibility {
  position: absolute;
  top: 50%;
  right: 9px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  transform: translateY(-50%);
  border: 0;
  border-radius: 9px;
  color: #9fb0c6;
  background: transparent;
}

.password-visibility:hover,
.password-visibility:focus-visible { color: var(--flame); background: rgba(255, 152, 0, .08); }
.password-visibility svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.password-visibility .eye-closed { display: none; }
.password-visibility[aria-pressed="true"] .eye-open { display: none; }
.password-visibility[aria-pressed="true"] .eye-closed { display: block; }

.primary,
.secondary {
  width: 100%;
  min-height: 46px;
  padding: 11px 16px;
  border-radius: 12px;
  font-weight: 800;
}

.primary {
  margin-top: 12px;
  border: 0;
  color: #1b0802;
  background: linear-gradient(110deg, var(--ember), var(--flame));
}

.secondary {
  border: 1px solid #2a3a52;
  color: var(--ink);
  background: #17100d;
}

button:disabled { opacity: .55; cursor: wait; }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0;
  color: #768397;
  font-size: 12px;
}

.divider::before,
.divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.text-button {
  display: block;
  margin: 18px auto 0;
  padding: 4px;
  border: 0;
  color: var(--flame);
  background: transparent;
}

.status {
  min-height: 22px;
  margin: 22px 0 0;
  color: var(--warning);
  font-size: 13px;
  line-height: 1.45;
}

.shell.chat-mode .status { margin: 8px 0 0; }

.step.success { color: var(--flame); }
.step.warning { color: var(--warning); }

.milestone-card {
  margin: 30px 0;
  padding: 20px;
  border: 1px solid rgba(255, 152, 0, .25);
  border-radius: 16px;
  background: rgba(255, 152, 0, .06);
}

.milestone-card span { display: block; margin-bottom: 8px; color: var(--flame); font-size: 12px; text-transform: uppercase; letter-spacing: .15em; }
.milestone-card strong { display: block; font-size: 18px; }
.milestone-card p { margin: 8px 0 0; color: var(--muted); line-height: 1.55; }

.chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 0 20px 12px;
  border-bottom: 1px solid var(--line);
}

.chat-header h2 { margin: 0; font-size: clamp(28px, 3.5vw, 38px); }
.chat-identity { display: flex; align-items: center; gap: 14px; }
.chat-phoenix { width: 64px; height: 64px; flex: 0 0 auto; object-fit: cover; border-radius: 50%; box-shadow: 0 0 22px rgba(255, 87, 34, .28); }
.member-line { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.member-line strong { color: #d8e1ed; }
.chat-actions { display: flex; gap: 8px; }

.compact-button {
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid #2a3a52;
  border-radius: 10px;
  color: #dfe7f2;
  background: #17100d;
  white-space: nowrap;
}

.compact-button:hover,
.compact-button:focus-visible { border-color: #49627f; background: #101d30; }

.chat-messages {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px 6px 20px;
  scrollbar-color: #33445d transparent;
}

.chat-empty {
  min-height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 34px;
  text-align: center;
}

.chat-empty > img {
  width: 118px;
  height: 118px;
  object-fit: cover;
  margin-bottom: 18px;
  border: 1px solid rgba(255, 152, 0, .32);
  border-radius: 50%;
  box-shadow: 0 12px 40px rgba(255, 87, 34, .2);
}

.chat-empty h3 { margin: 0; font-size: 24px; }
.chat-empty p { max-width: 440px; margin: 10px 0 0; color: var(--muted); line-height: 1.55; }

.message {
  width: min(86%, 760px);
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: #e9eef5;
  line-height: 1.62;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message.user {
  margin-left: auto;
  border-color: rgba(255, 152, 0, .32);
  border-bottom-right-radius: 5px;
  background: rgba(255, 87, 34, .13);
}

.message.assistant {
  margin-right: auto;
  border-bottom-left-radius: 5px;
  background: rgba(27, 18, 14, .9);
}

.message.assistant.pending::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--flame);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse { 50% { opacity: .25; transform: scale(.72); } }

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: end;
  gap: 10px;
  margin: 0;
  padding: 8px;
  border: 1px solid #2a3a52;
  border-radius: 17px;
  background: #110d0b;
  box-shadow: 0 16px 36px rgba(0, 0, 0, .2);
}

.chat-form:focus-within { border-color: var(--flame); box-shadow: 0 0 0 3px rgba(255, 152, 0, .09); }

.chat-form textarea {
  max-height: 150px;
  resize: none;
  padding: 10px 11px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  line-height: 1.45;
}

.send-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 12px;
  color: #1d0802;
  background: linear-gradient(135deg, var(--ember), var(--flame));
}

.send-button svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chat-note { margin: 9px 0 0; color: #758399; font-size: 11px; text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.spinner {
  width: 38px;
  height: 38px;
  margin-bottom: 24px;
  border: 3px solid rgba(255, 152, 0, .16);
  border-top-color: var(--flame);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 790px) {
  .shell { grid-template-columns: 1fr; margin: 16px auto; }
  .brand-panel { min-height: 460px; border-right: 0; border-bottom: 1px solid var(--line); }
  .mpp-logo-link { position: static; width: 90px; margin: 10px 0 0 10px; transform: none; }
  .mpp-logo-link:hover,
  .mpp-logo-link:focus-visible { transform: translateY(-2px); }
  .access-panel { min-height: 520px; }
  .shell.chat-mode { height: calc(100dvh - 32px); min-height: 0; grid-template-columns: 1fr; }
  .shell.chat-mode .brand-panel { display: none; }
  .shell.chat-mode .access-panel { height: 100%; min-height: 0; }
  .shell.chat-mode #authorized-view { min-height: 0; }
}

@media (max-width: 470px) {
  .shell { width: 100%; min-height: 100vh; margin: 0; border: 0; border-radius: 0; }
  .brand-panel, .access-panel { padding: 36px 24px; }
  .brand-panel { padding-inline: 36px; }
  .shell.chat-mode { width: 100%; height: 100dvh; min-height: 0; margin: 0; }
  .shell.chat-mode .access-panel { height: 100%; min-height: 0; padding: 20px 14px; }
  .shell.chat-mode #authorized-view { min-height: 0; }
  .chat-header { align-items: flex-start; }
  .chat-header h2 { font-size: 25px; }
  .chat-actions { flex-direction: column; }
  .compact-button { min-height: 34px; padding: 6px 10px; }
  .message { width: 92%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
