:root {
  --peach: #dcaa89;
  --teal: #30525c;
  --copper: #c35627;
  --terra: #d6794d;
  --aqua: #4c848d;
  --stone: #bfb9b5;
  --bg: #efe6de;
  --surface: #fffaf6;
  --ink: #30525c;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Outfit, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #2a474f;
  -webkit-font-smoothing: antialiased;
}

.phone {
  min-height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
@media (min-width: 480px) {
  body {
    display: grid;
    place-items: center;
    padding: 32px 16px;
  }
  .phone {
    width: 390px;
    min-height: 780px;
    height: min(844px, calc(100dvh - 64px));
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
    border: 1px solid color-mix(in srgb, var(--teal) 40%, black);
  }
}

.topbar {
  background: var(--teal);
  color: #fffaf6;
  padding: 18px 18px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: none;
}
.brand {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--peach);
}
.brand-sub {
  margin: 4px 0 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: #fffaf6;
}
.btn-cta {
  appearance: none;
  border: 0;
  background: var(--copper);
  color: #fffaf6;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  cursor: pointer;
  flex: none;
}
.btn-cta:active { transform: scale(0.98); }

.screen {
  flex: 1;
  overflow: auto;
  padding: 18px 16px 40px;
}

.who {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--aqua);
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--stone) 80%, var(--peach));
  border-radius: 10px;
  padding: 8px 12px;
}
.who button {
  border: 0;
  background: none;
  color: var(--copper);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.block { margin-bottom: 28px; }
.block.tight { margin: 22px 0 0; }
.sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.sec-head h2,
.sheet h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--aqua);
}
.sec-note { font-size: 12px; color: var(--stone); }

.list { display: flex; flex-direction: column; gap: 12px; }
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 1px 0 rgba(48, 82, 92, 0.06), 0 10px 24px rgba(48, 82, 92, 0.06);
}
.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.card h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.votes {
  font-size: 11px;
  font-weight: 600;
  color: var(--teal);
  background: color-mix(in srgb, var(--peach) 55%, white);
  border-radius: 999px;
  padding: 5px 9px;
  white-space: nowrap;
}
.meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--aqua);
}
.preview {
  margin: 12px 0 14px;
  font-size: 14px;
  line-height: 1.5;
  color: color-mix(in srgb, var(--teal) 82%, black);
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.btn {
  appearance: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn:disabled,
input:disabled,
textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-solid { background: var(--copper); color: #fffaf6; }
.btn-line {
  background: color-mix(in srgb, var(--aqua) 10%, var(--surface));
  color: var(--teal);
  border-color: color-mix(in srgb, var(--aqua) 28%, var(--stone));
}
.btn-danger {
  background: color-mix(in srgb, var(--copper) 10%, var(--surface));
  color: var(--copper);
  border-color: color-mix(in srgb, var(--terra) 50%, var(--stone));
}
.btn-row,
.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}
.btn-row .btn,
.card-actions .btn { width: 100%; }

.empty {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px 16px;
  font-size: 14px;
  color: var(--aqua);
  text-align: center;
}

.rank-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 6px 16px 10px;
  box-shadow: 0 1px 0 rgba(48, 82, 92, 0.06), 0 10px 24px rgba(48, 82, 92, 0.06);
}
.rank-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 0 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--stone) 55%, white);
}
.rank-item:last-child { border-bottom: 0; }
.rank-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
}
.bar-wrap {
  height: 4px;
  margin: 0 0 0 38px;
  background: color-mix(in srgb, var(--stone) 45%, white);
  border-radius: 99px;
}
.num {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--teal) 12%, var(--surface));
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
}
.rank-item.is-first .num {
  background: var(--copper);
  color: #fffaf6;
}
.rank .name { font-size: 15px; font-weight: 600; }
.rank-meta { font-size: 12px; color: var(--aqua); margin-top: 2px; line-height: 1.3; }
.bar { height: 100%; border-radius: 99px; background: var(--aqua); }
.right {
  font-size: 14px;
  font-weight: 700;
  color: var(--terra);
  font-variant-numeric: tabular-nums;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(42, 71, 79, 0.55);
  padding: 0;
}
.modal.open { display: flex; }
.sheet {
  width: min(390px, 100%);
  max-height: 92dvh;
  overflow: auto;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  padding: 10px 18px 28px;
}
.grab {
  width: 40px;
  height: 4px;
  border-radius: 99px;
  background: var(--stone);
  margin: 4px auto 10px;
}
.sheet-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.sheet-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--aqua);
}
.close {
  border: 0;
  background: none;
  color: var(--copper);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.sheet h2:not(.sec-head h2) {
  font-size: 22px;
  letter-spacing: -0.03em;
  text-transform: none;
  color: var(--teal);
  margin: 0 0 8px;
}
.sheet p.hint { margin: 0 0 14px; color: var(--aqua); font-size: 14px; }
.lbl {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin: 0 0 6px;
}
input, textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid color-mix(in srgb, var(--stone) 70%, var(--aqua));
  color: var(--ink);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  font-size: 16px;
  margin-bottom: 12px;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--aqua);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--aqua) 22%, transparent);
}
textarea { min-height: 140px; resize: vertical; line-height: 1.5; }
.err { color: var(--copper); font-size: 13px; min-height: 18px; margin: 0 0 8px; }
.q {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 8px 0 18px;
}
.card-actions.tres {
  grid-template-columns: 1fr 1fr;
}
.com-block {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid color-mix(in srgb, var(--stone) 55%, white);
}
.com-item {
  padding: 12px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--stone) 45%, white);
}
.com-item:last-of-type { border-bottom: 0; }
.com-who {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--aqua);
  margin-bottom: 4px;
}
.com-texto {
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.45;
  color: var(--teal);
}
.com-del {
  border: 0;
  background: none;
  color: var(--copper);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
#com-texto { min-height: 88px; }

.modal#modal-flujo { z-index: 40; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%) translateY(80px);
  background: var(--teal);
  color: #fffaf6;
  padding: 11px 16px;
  border-radius: 12px;
  z-index: 50;
  opacity: 0;
  font-size: 13px;
  font-weight: 500;
  transition: .2s ease;
  max-width: 90%;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
