/* ── Reset & base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --purple:  #9333ea;
  --pink:    #d946ef;
  --gold:    #f59e0b;
  --bg:      #fff;
  --text:    #1f2937;
  --muted:   #6b7280;
  --border:  #e5e7eb;
  --radius:  16px;
  --shadow:  0 8px 40px rgba(0,0,0,.13);
}

html { font-size: 16px; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
}

/* ── No-JS banner ─────────────────────────────────────────────────── */
.noscript-msg {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 9999;
  background: #fef3c7;
  color: #92400e;
  border-bottom: 2px solid #f59e0b;
  text-align: center;
  padding: .65rem 1rem;
  font-size: .9rem;
  font-weight: 600;
}

/* ── Pixel canvas background ──────────────────────────────────────── */
canvas#bg {
  position: fixed;
  inset: 0;
  display: block;
  image-rendering: pixelated;
  z-index: 0;
}

/* ── Layout ───────────────────────────────────────────────────────── */
main {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 580px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

.results-main { max-width: 660px; }

/* ── Hero view ────────────────────────────────────────────────────── */
body.hero-view {
  overflow: hidden; /* no scroll on landing */
}

#heroView {
  position: relative;
  z-index: 1;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: clamp(2rem, 8vh, 4rem) 1.5rem clamp(2rem, 6vh, 3.5rem);
}

.hero-brand {
  text-align: center;
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 20px;
  padding: 1.1rem 2.25rem;
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
}

.hero-brand h1 {
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.15;
  margin-bottom: .2rem;
}

.hero-brand p {
  font-size: .85rem;
  color: var(--muted);
  font-weight: 500;
}

.hero-lang-bar {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  justify-content: center;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.hero-lang-bar .lang-btn {
  font-size: .95rem;
  padding: .6rem 1.4rem;
  font-weight: 800;
  background: rgba(255, 214, 0, 0.78);
  color: #5c3d00;
  border: 4px solid #5c3d00;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.hero-lang-bar .lang-btn:hover {
  background: rgba(255, 214, 0, 0.95);
  border-color: #5c3d00;
}

/* ── Form view header ─────────────────────────────────────────────── */
body.form-view {
  overflow-y: auto;
}

.form-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 1rem .5rem;
  max-width: 580px;
  margin: 0 auto;
}

.back-link {
  font-size: .85rem;
  font-weight: 600;
  color: var(--purple);
  text-decoration: none;
  padding: .35rem .7rem;
  border-radius: 8px;
  background: rgba(255,255,255,.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.6);
}

/* ── Language bar (form view) ─────────────────────────────────────── */
.lang-bar {
  display: flex;
  gap: .4rem;
  justify-content: center;
}

.lang-btn {
  display: inline-block;
  padding: .35rem .85rem;
  border-radius: 50px;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-decoration: none;
  color: var(--purple);
  border: 1.5px solid var(--purple);
  background: rgba(255,255,255,.7);
  transition: background .15s, color .15s;
}

.lang-btn.active,
.lang-btn:hover {
  background: var(--purple);
  color: #fff;
}

/* ── Card ─────────────────────────────────────────────────────────── */
.card {
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,.7);
  box-shadow: var(--shadow);
  padding: 2rem 1.75rem;
}

@media (max-width: 480px) {
  .card { padding: 1.5rem 1.25rem; }
}

/* ── Hero ─────────────────────────────────────────────────────────── */
.hero { text-align: center; margin-bottom: 2rem; }

.hero h1 {
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.15;
  margin-bottom: .5rem;
}

.hero p {
  color: var(--muted);
  font-size: 1rem;
}

.hero.small { margin-bottom: 1.5rem; }
.hero.small h1 { font-size: clamp(1.3rem, 4vw, 1.7rem); }

/* ── Section title ────────────────────────────────────────────────── */
.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--purple);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin: 1.75rem 0 1rem;
}

/* ── Member rows ──────────────────────────────────────────────────── */
.member-row {
  background: rgba(147,51,234,.04);
  border: 1.5px solid rgba(147,51,234,.12);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: .85rem;
}

.member-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .75rem;
}

.member-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.member-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .6rem;
}

@media (max-width: 400px) {
  .member-fields { grid-template-columns: 1fr; }
}

/* Full-width instruments + email on their own rows */
.member-fields input:nth-child(3),
.member-fields input:nth-child(4) {
  grid-column: 1 / -1;
}

/* ── Inputs ───────────────────────────────────────────────────────── */
input[type="text"],
input[type="email"],
textarea {
  width: 100%;
  padding: .65rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: .95rem;
  color: var(--text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
}

input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(147,51,234,.12);
}

textarea {
  resize: vertical;
  min-height: 90px;
}

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn-primary {
  display: block;
  width: 100%;
  padding: .9rem 1.5rem;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: #fff;
  border: none;
  border-radius: 50px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: opacity .15s, transform .1s;
  margin-top: 1.5rem;
}

.btn-primary:active { transform: scale(.98); opacity: .9; }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .7rem 1.25rem;
  background: rgba(147,51,234,.08);
  color: var(--purple);
  border: 1.5px solid rgba(147,51,234,.25);
  border-radius: 50px;
  font-family: inherit;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
}

.btn-secondary:hover { background: rgba(147,51,234,.14); }

.btn-add {
  width: 100%;
  padding: .7rem 1rem;
  background: transparent;
  color: var(--purple);
  border: 1.5px dashed rgba(147,51,234,.4);
  border-radius: 12px;
  font-family: inherit;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  margin-bottom: 1rem;
}

.btn-add:hover { background: rgba(147,51,234,.05); border-color: var(--purple); }

.member-header-left {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.you-label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--purple);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.btn-remove {
  background: none;
  border: none;
  color: var(--muted);
  font-size: .8rem;
  cursor: pointer;
  padding: .2rem .5rem;
  border-radius: 6px;
  transition: color .15s, background .15s;
}

.btn-remove:hover { color: #ef4444; background: rgba(239,68,68,.06); }

/* ── Disclaimer ───────────────────────────────────────────────────── */
.disclaimer a {
  color: var(--purple);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.disclaimer {
  font-size: .78rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
  margin-top: 1.25rem;
}

/* ── Error ────────────────────────────────────────────────────────── */
.form-error {
  color: #ef4444;
  font-size: .875rem;
  font-weight: 500;
  text-align: center;
  padding: .6rem .8rem;
  background: rgba(239,68,68,.07);
  border-radius: 8px;
  margin-top: .75rem;
}

/* ── Success card ─────────────────────────────────────────────────── */
.success-card {
  text-align: center;
  margin-top: 1rem;
}

.success-icon { font-size: 3rem; margin-bottom: .75rem; }
.success-card h2 { font-size: 1.4rem; font-weight: 700; color: var(--purple); margin-bottom: .5rem; }
.success-card p  { color: var(--muted); }

/* ── Evaluate page ────────────────────────────────────────────────── */
.eval-block {
  background: rgba(147,51,234,.04);
  border: 1.5px solid rgba(147,51,234,.12);
  border-radius: 12px;
  padding: 1.25rem 1rem;
  margin-bottom: 1.1rem;
}

.eval-member-name {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: .2rem;
}

.eval-instruments {
  display: block;
  font-size: .8rem;
  color: var(--muted);
  font-weight: 400;
  margin-bottom: 1rem;
}

.slider-group { display: flex; flex-direction: column; gap: .9rem; }

.slider-wrap { display: flex; flex-direction: column; gap: .3rem; }

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
}

/* ── Range slider ─────────────────────────────────────────────────── */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
  border: none;
  padding: 0;
  background: linear-gradient(to right, var(--purple) 0%, var(--purple) 50%, var(--border) 50%, var(--border) 100%);
}

input[type="range"][data-color="pink"] {
  background: linear-gradient(to right, var(--pink) 0%, var(--pink) 50%, var(--border) 50%, var(--border) 100%);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--purple);
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(147,51,234,.35);
  cursor: pointer;
  transition: transform .1s;
}

input[type="range"][data-color="pink"]::-webkit-slider-thumb {
  background: var(--pink);
  box-shadow: 0 2px 8px rgba(217,70,239,.35);
}

input[type="range"]::-webkit-slider-thumb:active { transform: scale(1.15); }

input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--purple);
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(147,51,234,.35);
  cursor: pointer;
}

input[type="range"][data-color="pink"]::-moz-range-thumb {
  background: var(--pink);
}

/* ── Challenges block ─────────────────────────────────────────────── */
.challenges-block { margin-top: 1.5rem; }

.field-label {
  display: block;
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .5rem;
}

/* ── Already done ─────────────────────────────────────────────────── */
.already-done { text-align: center; padding: 1rem 0; }
.big-emoji { font-size: 3rem; margin-bottom: .75rem; }
.already-done h2 { font-size: 1.2rem; font-weight: 700; color: var(--purple); }

/* ── Waiting page ─────────────────────────────────────────────────── */
.waiting-card { text-align: center; }
.waiting-icon { font-size: 3rem; margin-bottom: .75rem; }
.waiting-card h1 { font-size: 1.5rem; font-weight: 800; color: var(--purple); margin-bottom: .6rem; }
.waiting-card p { color: var(--muted); line-height: 1.6; }

.progress-wrap { margin: 1.75rem 0 1rem; }

.progress-bar {
  height: 10px;
  background: var(--border);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: .6rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--pink));
  border-radius: 5px;
  transition: width .6s ease;
}

.progress-label { font-size: .88rem; color: var(--muted); font-weight: 500; }

.auto-refresh { font-size: .78rem; color: rgba(107,114,128,.6); margin-top: 1rem; }

/* ── Promo box ────────────────────────────────────────────────────── */
.promo-box {
  background: rgba(253, 224, 71, 0.55);
  border: 1.5px solid rgba(202, 138, 4, 0.35);
  border-radius: 12px;
  padding: .9rem 1.1rem;
  font-size: .85rem;
  line-height: 1.55;
  color: #713f12;
  margin-bottom: 1.5rem;
}

.promo-box a {
  color: #92400e;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Results page ─────────────────────────────────────────────────── */
.results-card { padding: 2rem 1.75rem; }

/* Personality Matrix */
.matrix-wrap {
  position: relative;
  margin: .5rem 0 2rem;
  padding: 24px 36px;
}

.matrix-axis-label {
  position: absolute;
  font-size: .72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.matrix-axis-top    { top: 4px; left: 50%; transform: translateX(-50%); }
.matrix-axis-bottom { bottom: 4px; left: 50%; transform: translateX(-50%); }
.matrix-axis-left   { left: 2px; top: 50%; transform: translateY(-50%) rotate(-90deg); transform-origin: center; }
.matrix-axis-right  { right: 2px; top: 50%; transform: translateY(-50%) rotate(90deg); transform-origin: center; }

.matrix {
  position: relative;
  width: 100%;
  padding-top: 100%; /* square */
  border: 2px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255,255,255,.5);
}

/* Quadrant backgrounds */
.quadrant {
  position: absolute;
  width: 50%; height: 50%;
}
.q-tl { top: 0; left: 0;  background: rgba(147,51,234,.05); }
.q-tr { top: 0; right: 0; background: rgba(217,70,239,.05); }
.q-bl { bottom: 0; left: 0;  background: rgba(245,158,11,.05); }
.q-br { bottom: 0; right: 0; background: rgba(217,70,239,.08); }

/* Crosshair lines */
.matrix::before,
.matrix::after {
  content: '';
  position: absolute;
  background: var(--border);
}
.matrix::before { left: 50%; top: 0; width: 1px; height: 100%; }
.matrix::after  { top: 50%; left: 0; height: 1px; width: 100%; }

/* Member dots */
.matrix-dot {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 2;
  cursor: default;
}

.dot-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2.5px solid #fff;
  box-shadow: 0 2px 10px rgba(147,51,234,.3);
  flex-shrink: 0;
}

.dot-name {
  margin-top: 3px;
  font-size: .68rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  background: rgba(255,255,255,.85);
  padding: 1px 5px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 380px) {
  .dot-avatar { width: 28px; height: 28px; font-size: .65rem; }
  .dot-name   { font-size: .6rem; max-width: 52px; }
}

/* Diagnosis text */
.diagnosis-text {
  font-size: .95rem;
  line-height: 1.75;
  color: var(--text);
  background: rgba(147,51,234,.04);
  border-left: 3px solid var(--purple);
  padding: 1rem 1.25rem;
  border-radius: 0 10px 10px 0;
  margin-bottom: 1.5rem;
}

/* Share */
.share-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

#copiedMsg {
  font-size: .85rem;
  color: #22c55e;
  font-weight: 600;
}
