/* ============================================================
   styles.css — Conduta.
   Identidade visual: dark mode roxo, lima e lilás.
   Organizado por seções para facilitar manutenção.
   ============================================================ */

/* ── VARIÁVEIS DE DESIGN ──────────────────────────────────── */
:root {
  --bg:        #3c183d;
  --bg2:       #4a2050;
  --bg3:       #562560;
  --lilac:     #d2cbfe;
  --lime:      #cefc8a;
  --forest:    #022e21;
  --white:     #ffffff;
  --muted:     rgba(210, 203, 254, 0.5);
  --border:    rgba(210, 203, 254, 0.2);
  --error:     #ff6b6b;
  --error-bg:  rgba(255, 107, 107, 0.12);
  --radius:    10px;
  --radius-sm: 6px;
}

/* ── RESET ────────────────────────────────────────────────── */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--white);
  font-family: 'DM Sans', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ── HEADER ───────────────────────────────────────────────── */
header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 20px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 30px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-btns { display: flex; gap: 6px; }

.hbtn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--lilac);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
}
.hbtn:hover { background: var(--bg3); border-color: var(--lilac); }

/* ── BARRA DE DATA ────────────────────────────────────────── */
.datebar {
  max-width: 640px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.datebar span { color: var(--lilac); }

/* ── MAIN ─────────────────────────────────────────────────── */
main {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 20px 80px;
  flex: 1;
  width: 100%;
}

/* ── DOTS DE TENTATIVA ────────────────────────────────────── */
.dots {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 24px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg2);
  border: 1.5px solid var(--border);
  transition: all 0.25s ease;
}
.dot.correct { background: var(--lime);  border-color: var(--lime); }
.dot.wrong   { background: var(--error); border-color: var(--error); }
.dot.current { border-color: var(--lilac); box-shadow: 0 0 0 3px rgba(210, 203, 254, 0.15); }

/* ── CARD DO CASO ─────────────────────────────────────────── */
.case-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 16px;
}

.case-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.case-tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--lime);
}

.clue-counter {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.case-text {
  font-size: 15px;
  font-weight: 300;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.9);
}

/* ── CAIXAS DE PISTA ──────────────────────────────────────── */
.clue-box {
  margin-top: 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-left: 3px solid var(--lilac);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  animation: clueIn 0.35s ease;
}

.clue-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--lilac);
  margin-bottom: 6px;
  opacity: 0.8;
}

.clue-text {
  font-size: 14px;
  font-weight: 300;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.85);
}

/* ── PALPITES ─────────────────────────────────────────────── */
.guesses {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.guess-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg2);
  border: 1px solid var(--border);
  animation: clueIn 0.25s ease;
}
.guess-row.wrong { background: var(--error-bg); border-color: rgba(255, 107, 107, 0.3); }

.guess-icon { font-size: 14px; flex-shrink: 0; }
.guess-text { font-size: 14px; font-weight: 500; flex: 1; }
.guess-row.wrong .guess-text { color: var(--error); }
.guess-hint { font-size: 11px; color: var(--muted); font-style: italic; }

/* ── INPUT DE DIAGNÓSTICO ─────────────────────────────────── */
.input-wrap {
  position: relative;
  margin-bottom: 10px;
}

.diagnosis-input {
  width: 100%;
  padding: 14px 52px 14px 16px;
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 400;
  outline: none;
  transition: border-color 0.2s;
}
.diagnosis-input::placeholder { color: var(--muted); }
.diagnosis-input:focus        { border-color: var(--lilac); }
.diagnosis-input.shake        { animation: shake 0.35s ease; }

.submit-btn {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 50px;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--lime);
  border: none;
  cursor: pointer;
  color: var(--forest);
  font-size: 18px;
  font-weight: 700;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.submit-btn:hover    { background: #d8ff96; }
.submit-btn:disabled { background: var(--bg3); color: var(--muted); cursor: not-allowed; }

/* ── AUTOCOMPLETE ─────────────────────────────────────────── */
.autocomplete {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg3);
  border: 1px solid var(--lilac);
  border-radius: var(--radius-sm);
  z-index: 50;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  display: none;
}

.ac-item {
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.ac-item:last-child        { border-bottom: none; }
.ac-item:hover, .ac-item.sel { background: var(--bg2); color: var(--lime); }

/* ── CARD DE RESULTADO ────────────────────────────────────── */
.result-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  margin-top: 20px;
  display: none;
  animation: resultIn 0.45s ease;
}
.result-card.show { display: block; }

.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 18px;
}
.result-badge.win  { background: var(--lime); color: var(--forest); }
.result-badge.lose { background: var(--error-bg); color: var(--error); border: 1px solid rgba(255, 107, 107, 0.3); }

.result-diagnosis {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 6px;
  color: var(--white);
}

.result-meta {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 22px;
}

.result-divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

.result-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--lime);
  margin-bottom: 10px;
}

.result-body {
  font-size: 14px;
  font-weight: 300;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 16px;
}

.result-refs {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.7;
}

/* ── COMPARTILHAR ─────────────────────────────────────────── */
.share-area {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.share-preview {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.8;
  white-space: pre-wrap;
  margin-bottom: 12px;
  letter-spacing: 0.01em;
}

.share-btns { display: flex; gap: 8px; }

.share-btn {
  flex: 1;
  padding: 12px 10px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: opacity 0.15s;
}
.share-btn:hover     { opacity: 0.85; }
.share-btn.whatsapp  { background: #25D366; color: white; }
.share-btn.telegram  { background: #0088cc; color: white; }
.share-btn.copy      { background: var(--lime); color: var(--forest); }

/* ── MODAIS ───────────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 10, 31, 0.8);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.overlay.open { display: flex; }

.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  max-width: 420px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  animation: resultIn 0.25s ease;
  position: relative;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 22px;
  letter-spacing: -0.02em;
  padding-right: 32px;
}

.modal-close {
  position: absolute;
  top: 22px;
  right: 20px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: var(--white); }

/* ── ESTATÍSTICAS ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}

.stat-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 8px;
  text-align: center;
}

.stat-val {
  display: block;
  font-size: 26px;
  font-weight: 700;
  color: var(--lime);
  letter-spacing: -0.02em;
}

.stat-lbl {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 4px;
}

.dist-title {
  margin-bottom: 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--lime);
}

.dist-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 12px;
}

.dist-num      { color: var(--muted); width: 14px; text-align: right; font-weight: 600; }
.dist-bar-wrap { flex: 1; background: var(--bg); border-radius: 3px; height: 22px; overflow: hidden; }
.dist-bar      { height: 100%; background: var(--bg3); border-radius: 3px; transition: width 0.6s ease; min-width: 22px; display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; }
.dist-bar.active { background: var(--lime); }
.dist-bar span { font-size: 11px; font-weight: 600; color: var(--forest); }

/* ── COMO JOGAR ───────────────────────────────────────────── */
.how-step {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 300;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.8);
}
.how-step:last-child { border-bottom: none; }
.how-num { color: var(--lime); font-weight: 700; font-size: 15px; flex-shrink: 0; margin-top: 1px; }

.how-note {
  margin-top: 20px;
  padding: 14px 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}

/* ── TOAST ────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: var(--white);
  color: var(--bg);
  padding: 10px 22px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  z-index: 300;
  transition: transform 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ── DISCLAIMER ───────────────────────────────────────────── */
.disclaimer {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(210, 203, 254, 0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 20px;
}

/* ── TABS ─────────────────────────────────────────────────── */
.tab-nav {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.tab-btn {
  flex: 1;
  padding: 13px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  text-transform: uppercase;
}
.tab-btn:hover  { color: var(--lilac); }
.tab-btn.active { color: var(--lime); border-bottom-color: var(--lime); }

/* ── ARQUIVO (VIEW DE LISTA) ──────────────────────────────── */
#archive-view {
  display: none;
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}
#archive-view.show { display: block; }
#game-view.hidden  { display: none; }

.archive-header {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 20px 4px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.archive-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--lime);
  margin-bottom: 16px;
}

.archive-list { display: flex; flex-direction: column; gap: 10px; }

.archive-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-decoration: none;
}
.archive-item:hover { border-color: var(--lilac); background: var(--bg3); }

.archive-num {
  font-size: 18px;
  font-weight: 700;
  color: var(--lime);
  min-width: 44px;
  letter-spacing: -0.02em;
}

.archive-info   { flex: 1; }
.archive-date   { font-size: 12px; color: var(--muted); margin-bottom: 3px; font-weight: 500; }
.archive-diag   { font-size: 14px; font-weight: 600; color: rgba(255, 255, 255, 0.85); }
.archive-cat    { font-size: 11px; color: var(--lilac); opacity: 0.7; margin-top: 2px; }

.archive-status { font-size: 18px; flex-shrink: 0; }

.archive-diff {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.archive-diff.easy   { background: rgba(206, 252, 138, 0.12); color: var(--lime); }
.archive-diff.medium { background: rgba(210, 203, 254, 0.12); color: var(--lilac); }
.archive-diff.hard   { background: rgba(255, 107, 107, 0.12); color: var(--error); }

/* ── MODAL DE CASO DO ARQUIVO ─────────────────────────────── */
.archive-modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  z-index: 150;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: none;
  animation: slideUp 0.3s ease;
}
.archive-modal.open { display: block; }

.archive-modal-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 20px 80px;
}

.archive-modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.back-btn {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--lilac);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.back-btn:hover { background: var(--bg3); }

.archive-modal-title { font-size: 15px; font-weight: 600; color: var(--white); }
.archive-modal-sub   { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ── FOOTER ───────────────────────────────────────────────── */
.page-disclaimer {
  text-align: center;
  padding: 16px 20px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
  border-top: 1px solid var(--border);
  max-width: 640px;
  margin: 0 auto;
}

footer {
  text-align: center;
  padding: 28px 20px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.9;
  border-top: 1px solid var(--border);
}

/* ── SCROLLBAR ────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 4px; }

/* ── ANIMAÇÕES ────────────────────────────────────────────── */
@keyframes clueIn {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes resultIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ── RESPONSIVO ───────────────────────────────────────────── */
@media (max-width: 480px) {
  .header-inner { padding: 0 16px; }
  main          { padding: 20px 16px 60px; }
  .result-diagnosis { font-size: 24px; }
  .stats-grid   { grid-template-columns: repeat(2, 1fr); }
  .share-btns   { flex-direction: column; }
  .modal        { padding: 22px 18px; }
}
