:root {
  color-scheme: dark;
  --bg: #0f1016;
  --bg-deep: #090a0f;
  --sidebar: #1e1f26;
  --panel: #2b2d35;
  --panel-soft: #32343d;
  --panel-hover: #3a3d48;
  --input: #1b1c22;
  --text: #f4f5fb;
  --muted: #a9adba;
  --subtle: #7b8191;
  --line: rgba(255, 255, 255, .08);
  --accent: #5865f2;
  --accent-2: #7c86ff;
  --green: #3ba55d;
  --danger: #ed4245;
  --shadow: 0 24px 80px rgba(0, 0, 0, .38);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { background: var(--bg-deep); }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 8%, rgba(88, 101, 242, .22), transparent 28%),
    radial-gradient(circle at 90% 0%, rgba(59, 165, 93, .11), transparent 26%),
    linear-gradient(135deg, #11131b 0%, #0b0c12 56%, #090a0f 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, transparent, rgba(88, 101, 242, .08), transparent),
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, .05), transparent 38%);
  opacity: .9;
}

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

.app-shell {
  width: min(1240px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 42px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 900;
  letter-spacing: -.02em;
  text-transform: lowercase;
}

.mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-weight: 950;
  box-shadow: 0 12px 34px rgba(88, 101, 242, .35);
}

.center-card, .panel, .ios-card, .modal-card, .question, .skill-card, .user-card, .conversation-list, .thread {
  border: 1px solid var(--line);
  background: rgba(43, 45, 53, .82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.center-card {
  max-width: 430px;
  margin: 18vh auto 0;
  padding: 34px;
  border-radius: 28px;
  text-align: center;
}
.center-card .mark { margin: 0 auto 16px; }
.center-card h1 { margin: 0 0 8px; font-size: 40px; letter-spacing: -.06em; text-transform: lowercase; }
.center-card p { margin: 0; color: var(--muted); }

.hero {
  min-height: 28vh;
  display: grid;
  place-items: end center;
  padding: 54px 0 24px;
  text-align: center;
}
.hero h1 {
  max-width: 780px;
  margin: 22px auto 12px;
  font-size: clamp(42px, 7vw, 80px);
  line-height: .92;
  letter-spacing: -.075em;
  text-transform: lowercase;
}
.hero p {
  max-width: 620px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

.panel {
  max-width: 720px;
  margin: 0 auto;
  padding: 26px;
  border-radius: 24px;
}
.wide { max-width: 100%; }
.stack { display: grid; gap: 16px; }

input, textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--input);
  color: var(--text);
  padding: 0 15px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea { min-height: 110px; padding-top: 13px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #777d8d; }
input:focus, textarea:focus {
  border-color: rgba(88, 101, 242, .75);
  box-shadow: 0 0 0 4px rgba(88, 101, 242, .18);
  background: #181920;
}

.primary, .ghost, .tabs button, .nav button, .chip, .option-grid button, .scale button, .rank-item button, .send button {
  border: 0;
  border-radius: 14px;
  min-height: 42px;
  padding: 0 15px;
  color: var(--text);
  background: var(--panel-soft);
  font-weight: 800;
  text-transform: lowercase;
  transition: transform .12s, background .12s, color .12s, box-shadow .12s;
}
.primary {
  background: var(--accent);
  box-shadow: 0 12px 28px rgba(88, 101, 242, .24);
}
.primary:hover { background: #6673ff; transform: translateY(-1px); }
.ghost:hover, .tabs button:hover, .nav button:hover, .chip:hover, .option-grid button:hover, .scale button:hover, .rank-item button:hover, .send button:hover {
  background: var(--panel-hover);
}
.active, .tabs button.active, .nav button.active, .chip.active, .scale button.active, .option-grid button.active {
  background: var(--accent) !important;
  color: white !important;
}
.tabs, .nav { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.tabs { margin-bottom: 18px; }
.tabs.small button { flex: 1 1 0; min-width: 0; }
.muted { color: var(--muted); line-height: 1.5; }
label { color: var(--text); font-weight: 900; text-transform: lowercase; letter-spacing: -.01em; }

.auth-context, .step-meta, .section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.auth-context { margin-bottom: 16px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.onboarding-step { gap: 18px; }
.step-meta { color: var(--muted); font-size: 13px; font-weight: 850; text-transform: lowercase; }
.progress {
  height: 8px;
  border-radius: 999px;
  background: #191a22;
  overflow: hidden;
}
.progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .22s ease; }
.sloan-result {
  border: 1px solid rgba(245, 196, 65, .65);
  border-radius: 18px;
  padding: 16px;
  text-align: center;
  background: rgba(255, 255, 255, .045);
  animation: sloan-pop .42s cubic-bezier(.2, .9, .2, 1.15);
}
.sloan-result span, .sloan-result small { display: block; color: var(--muted); font-size: 12px; font-weight: 900; text-transform: lowercase; }
.sloan-result strong { display: block; min-height: 43px; margin: 4px 0; color: var(--accent); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 34px; letter-spacing: .12em; }
.quiz-result strong { letter-spacing: -.04em; font-size: 48px; }
.sloan-result p { margin: 6px auto; max-width: 520px; color: var(--text); line-height: 1.45; }
@keyframes sloan-pop { from { opacity: 0; transform: scale(.88) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.form-actions .primary, .form-actions .ghost { flex: 1; }

.chip-grid { display: flex; flex-wrap: wrap; gap: 9px; }
.chip { min-height: 38px; border-radius: 999px; font-size: 14px; }
.rank-list { display: grid; gap: 8px; }
.rank-list.empty, .empty {
  border: 1px dashed var(--line);
  border-radius: 16px;
  padding: 22px;
  color: var(--muted);
  background: rgba(255, 255, 255, .03);
  text-align: center;
}
.rank-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .04);
  text-transform: lowercase;
}
.rank-item > span {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent);
  font-weight: 900;
}
.rank-item { overflow-wrap: anywhere; }
.rank-item div { display: flex; gap: 6px; flex-wrap: nowrap; }
.rank-item button { min-height: 32px; padding: 0 10px; }
.question { border-radius: 18px; padding: 18px; }
.question h3, .question p { margin: 0 0 12px; line-height: 1.45; }
.scale { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.scale button { border-radius: 12px; }
.scale-labels { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; margin-top: -4px; text-transform: lowercase; }
.option-grid { display: grid; gap: 8px; }
.option-grid button { min-height: 46px; height: auto; padding: 12px 15px; text-align: left; line-height: 1.35; overflow-wrap: anywhere; }

.topbar {
  position: sticky;
  top: 14px;
  z-index: 5;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(30, 31, 38, .86);
  box-shadow: 0 16px 50px rgba(0, 0, 0, .28);
  backdrop-filter: blur(18px);
}
.topbar .brand { padding: 0 8px; }
.topbar .mark { width: 38px; height: 38px; border-radius: 13px; }
.topbar .nav { justify-content: flex-end; }
.nav button {
  min-height: 38px;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
}
.nav button.active { background: var(--panel-hover) !important; color: var(--text) !important; }

.screen {
  min-height: 70vh;
  border-radius: 26px;
  padding: 22px;
  background: rgba(30, 31, 38, .72);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.section-head { margin-bottom: 16px; flex-wrap: wrap; align-items: flex-start; }
.section-head h2 { margin: 0; font-size: clamp(28px, 4vw, 48px); line-height: .95; letter-spacing: -.06em; text-transform: lowercase; }
.section-head h2, .section-head p { min-width: 0; }
.section-head .ghost { flex: 0 0 auto; }
.grid.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }

.user-card, .skill-card {
  width: 100%;
  min-height: 230px;
  border-radius: 20px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  color: var(--text);
  text-align: left;
  transition: transform .14s, background .14s, border-color .14s;
}
.user-card:hover, .skill-card:hover { transform: translateY(-3px); background: var(--panel-soft); border-color: rgba(88, 101, 242, .38); }
.user-card h3, .skill-card h3 { margin: 12px 0 4px; max-width: 100%; font-size: 21px; letter-spacing: -.035em; text-transform: lowercase; overflow-wrap: anywhere; }
.user-card p, .skill-card p { margin: 0 0 14px; max-width: 100%; color: var(--muted); line-height: 1.35; overflow-wrap: anywhere; }
.user-card b, .skill-card b {
  display: inline-flex;
  margin-top: auto;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(88, 101, 242, .16);
  color: #cfd3ff;
  font-size: 13px;
}
.avatar, .ios-avatar {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #5865f2, #3ba55d);
  color: white;
  font-weight: 950;
  text-transform: uppercase;
}
.avatar.large { width: 76px; height: 76px; border-radius: 24px; font-size: 26px; margin: 0 auto; }
.skill-card img { width: 58px; height: 58px; border-radius: 18px; object-fit: cover; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.chips span {
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  color: var(--muted);
  font-size: 12px;
  text-transform: lowercase;
  overflow-wrap: anywhere;
}

.messages-layout {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 14px;
  height: clamp(460px, calc(100vh - 148px), 680px);
  min-height: 0;
}
.conversation-list, .thread { border-radius: 20px; box-shadow: none; overflow: hidden; }
.convo {
  position: relative;
  width: 100%;
  min-height: 64px;
  border: 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 3px;
  padding: 13px 16px;
  color: var(--text);
  background: transparent;
  text-align: left;
}
.convo:hover { background: rgba(255, 255, 255, .05); }
.convo b { text-transform: lowercase; }
.convo span { min-width: 0; max-width: calc(100% - 34px); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo em {
  position: absolute;
  right: 12px;
  top: 14px;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--danger);
  color: white;
  font-style: normal;
  font-size: 12px;
}
.thread { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; padding: 16px; min-height: 0; }
.thread h3 { margin: 0 0 12px; text-transform: lowercase; }
.message-list { display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow: auto; padding: 6px 2px 16px; }
.message-list::before { content: ''; margin-top: auto; }
.bubble {
  max-width: min(74%, 560px);
  align-self: flex-start;
  padding: 10px 12px;
  border-radius: 16px 16px 16px 5px;
  background: #3a3d48;
  color: var(--text);
  line-height: 1.42;
  overflow-wrap: anywhere;
}
.bubble.me { align-self: flex-end; border-radius: 16px 16px 5px 16px; background: var(--accent); }
.bubble.pending { opacity: 0.72; }
.bubble.failed { background: #7a3440; opacity: 1; }
.send { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.send input { border-radius: 16px; }
.send button { background: var(--accent); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, .62);
}
.modal-card {
  position: relative;
  width: min(430px, 100%);
  border-radius: 24px;
  padding: 26px;
  text-align: center;
}
.modal-card h2, .modal-card p { overflow-wrap: anywhere; }
.close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, .08);
  color: var(--text);
  font-size: 22px;
}

.quiz {
  width: min(860px, calc(100% - 28px));
  margin: 0 auto;
  padding: 30px 0 60px;
}
.quiz > h1 { margin: 22px 0 8px; font-size: clamp(38px, 6vw, 68px); line-height: .92; letter-spacing: -.075em; text-transform: lowercase; }
.quiz > p { color: var(--muted); line-height: 1.55; }

/* Profile kept close to the iOS structure, recolored to match the Discord-like web app. */
.screen:has(.ios-profile) { display: block; }
.ios-profile {
  width: min(760px, 100%);
  max-width: 100%;
  margin: 0 auto;
  padding: 4px 0 18px;
  display: grid;
  gap: 14px;
  color: var(--text);
}
.ios-profile h1 {
  margin: 0 0 6px;
  font-size: clamp(34px, 5vw, 54px);
  line-height: .9;
  letter-spacing: -.065em;
  text-transform: lowercase;
}
.ios-card {
  border-radius: 20px;
  padding: 16px;
  box-shadow: none;
  display: grid;
  gap: 14px;
}
.ios-card h3 { margin: 0; font-size: 17px; text-transform: lowercase; letter-spacing: -.02em; }
.ios-subtitle { margin: -6px 0 0; color: var(--muted); line-height: 1.35; }
.ios-profile-header, .completion-card, .settings-row, .profile-link-row, .result-row, .profile-editor-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ios-profile-header > div { min-width: 0; }
.ios-profile-header h2 { margin: 0; font-size: 22px; letter-spacing: -.03em; overflow-wrap: anywhere; }
.ring {
  --size: 64px;
  width: var(--size);
  height: var(--size);
  flex: 0 0 var(--size);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), #1a1b22 0);
  position: relative;
}
.ring:after { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--panel); }
.ring span { position: relative; z-index: 1; font-weight: 900; }
.completion-card { align-items: flex-start; }
.completion-card > div:last-child { min-width: 0; }
.completion-row { color: var(--muted); font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.completion-row.done { color: #c8ffd9; }
.result-row, .profile-editor-row, .profile-link-row, .settings-row {
  width: 100%;
  border: 0;
  border-radius: 15px;
  padding: 12px;
  background: rgba(255, 255, 255, .045);
  color: var(--text);
  text-align: left;
}
.result-row:hover, .profile-editor-row:hover, .profile-link-row:hover { background: rgba(255, 255, 255, .075); }
.result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "meta action" "value action" "desc action";
  align-items: center;
  column-gap: 14px;
  row-gap: 4px;
}
.result-row small, .profile-editor-row small, .profile-link-row small, .settings-row small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; line-height: 1.35; overflow-wrap: anywhere; }
.result-row small { grid-area: meta; }
.result-row strong, .result-row em { grid-area: value; min-width: 0; }
.result-row > span:last-child { grid-area: action; white-space: nowrap; color: var(--muted); }
.result-row strong { display: block; font-size: 20px; line-height: 1.15; overflow-wrap: anywhere; }
.result-row p { grid-area: desc; margin: 0; color: var(--muted); line-height: 1.35; overflow-wrap: anywhere; }
.profile-editor-list { display: grid; gap: 8px; }
.profile-editor-row .check, .link-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: #1b1c22;
  color: var(--muted);
}
.profile-editor-row .check.done { background: rgba(59, 165, 93, .18); color: #8df3ab; }
.profile-editor-row span:nth-child(2), .profile-link-row span:nth-child(2), .settings-row span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.profile-editor-row i, .profile-link-row i { color: var(--muted); font-style: normal; }
.settings-row input {
  appearance: none;
  width: 48px;
  height: 28px;
  min-height: 28px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  background: #1b1c22;
  position: relative;
  flex: 0 0 48px;
}
.settings-row input:before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #d7d9e4;
  transition: transform .16s, background .16s;
}
.settings-row input:checked { background: var(--accent); }
.settings-row input:checked:before { transform: translateX(20px); background: white; }
.score-bars { display: grid; gap: 10px; }
.score-bars label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; }
.score-bars span { display: block; height: 8px; border-radius: 999px; overflow: hidden; background: #1a1b22; }
.score-bars i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--green)); }
.ios-signout {
  border: 0;
  border-radius: 16px;
  min-height: 48px;
  background: rgba(237, 66, 69, .14);
  color: #ffb8ba;
  font-weight: 900;
  text-transform: lowercase;
}
.ios-signout:hover { background: rgba(237, 66, 69, .22); }
button:disabled { cursor: not-allowed; opacity: .55; transform: none !important; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 20;
  transform: translateX(-50%);
  max-width: min(520px, calc(100% - 28px));
  padding: 12px 16px;
  border-radius: 999px;
  background: #11131b;
  border: 1px solid var(--line);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .35);
  color: var(--text);
  text-align: center;
}

@media (min-width: 900px) {
  .app-shell:has(.topbar) {
    width: min(1280px, calc(100% - 32px));
    display: grid;
    grid-template-columns: 214px 1fr;
    gap: 16px;
    align-items: start;
  }
  .app-shell:has(.topbar) .topbar {
    position: sticky;
    top: 16px;
    min-height: calc(100vh - 32px);
    grid-template-columns: 1fr;
    align-content: start;
    padding: 14px;
    border-radius: 26px;
    margin: 0;
  }
  .topbar .brand { justify-content: flex-start; padding: 2px; }
  .topbar .nav { display: grid; justify-content: stretch; gap: 8px; margin-top: 18px; }
  .topbar .nav button { justify-content: flex-start; text-align: left; padding: 0 14px; }
  .screen { min-height: calc(100vh - 44px); }
}

@media (max-width: 760px) {
  .app-shell { width: min(100% - 18px, 1240px); padding-top: 10px; }
  .hero { min-height: auto; padding: 34px 0 18px; }
  .panel, .screen { padding: 16px; border-radius: 20px; }
  .hero h1, .quiz > h1 { line-height: 1; }
  .topbar { grid-template-columns: 1fr; }
  .topbar .nav { justify-content: stretch; }
  .nav button { flex: 1; }
  .messages-layout { grid-template-columns: 1fr; min-height: 0; height: auto; }
  .conversation-list { max-height: 250px; overflow: auto; }
  .thread { min-height: 440px; }
  .grid.cards { grid-template-columns: 1fr; }
  .section-head { display: grid; grid-template-columns: 1fr; }
  .section-head .ghost { width: 100%; }
  .form-actions, .send { grid-template-columns: 1fr; flex-direction: column; }
  .scale { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .scale button { padding: 0 6px; }
  .rank-item { grid-template-columns: 30px minmax(0, 1fr); }
  .rank-item div { grid-column: 2; justify-content: flex-start; }
  .completion-card, .ios-profile-header, .settings-row, .profile-link-row, .profile-editor-row { align-items: flex-start; }
  .result-row { grid-template-columns: 1fr; grid-template-areas: "meta" "value" "desc" "action"; }
  .result-row p { margin-top: 0; }
  .result-row > span:last-child { justify-self: start; margin-top: 4px; }
}
