:root {
  --bg: #121016;
  --bg2: #17141d;
  --panel: #1d1a24;
  --panel2: #262230;
  --text: #ece9f1;
  --muted: #a29cb0;
  --accent: #c07ac4;
  --accent2: #8a4f9e;
  --accent-soft: rgba(176, 106, 179, 0.14);
  --danger: #d64545;
  --ok: #35b06b;
  --border: #322d3d;
  --radius: 12px;
  --shadow: 0 2px 16px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: radial-gradient(1200px 500px at 50% -200px, #221c2e 0%, var(--bg) 60%) fixed var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  font-size: 15.5px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { max-width: 880px; width: 100%; margin: 0 auto; padding: 20px 16px 40px; flex: 1; }

h1 { font-size: 1.6rem; letter-spacing: -0.02em; margin: 14px 0 10px; }
h2 { font-size: 1.05rem; margin: 0 0 14px; letter-spacing: -0.01em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 12px 20px;
  background: rgba(23, 20, 29, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em;
  color: var(--text); text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}
.nav-links { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.nav-links > a { color: var(--muted); font-weight: 500; }
.nav-links > a:hover { color: var(--text); text-decoration: none; }
.nav-links > a.btn { color: #fff; }
.lang-switch { display: inline-flex; gap: 6px; align-items: center; margin-left: 4px;
  padding-left: 14px; border-left: 1px solid var(--border); font-size: 0.8rem; }
.lang-switch a { color: var(--muted); font-weight: 600; }
.lang-switch a.active { color: var(--accent); }
.lang-switch .sep { color: var(--border); }

/* ---------- footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 18px 20px 26px; text-align: center;
  color: var(--muted); font-size: 0.82rem;
}
.footer p { margin: 4px 0; }

/* ---------- cards & layout ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 16px 0;
  box-shadow: var(--shadow);
}
.card.narrow { max-width: 430px; margin: 48px auto; }
.intro { white-space: pre-wrap; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.center { text-align: center; }

/* ---------- forms ---------- */
label { display: block; margin: 14px 0; font-weight: 600; font-size: 0.92rem; }
input:not([type="radio"]), textarea, select {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
  background: var(--bg2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  font: inherit; font-weight: 400;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:not([type="radio"]):focus, textarea:focus {
  outline: none; border-color: var(--accent2);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; }
.mono { font-family: Consolas, "Cascadia Mono", monospace; font-size: 0.85rem; }
.receipt { white-space: pre; }
.prewrap { white-space: pre-wrap; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; padding: 9px 18px; border-radius: 8px;
  background: var(--panel2); color: var(--text); border: 1px solid var(--border);
  cursor: pointer; text-decoration: none; font: inherit; font-weight: 600; font-size: 0.92rem;
  transition: border-color 0.15s, background 0.15s, transform 0.06s;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent2), #6d3d85);
  border-color: transparent; color: #fff;
}
.btn.primary:hover { background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.btn.danger { background: var(--danger); border-color: transparent; color: #fff; }
.btn.small { padding: 4px 12px; font-size: 0.82rem; }
.btn.big { padding: 13px 30px; font-size: 1.05rem; border-radius: 10px; }
.btn.wide { width: 100%; margin-top: 8px; }
.link-btn {
  background: none; border: none; color: var(--muted); font-weight: 500;
  cursor: pointer; font: inherit; padding: 0;
}
.link-btn:hover { color: var(--text); }
.inline-form { display: inline; }

/* ---------- feedback ---------- */
.error { background: rgba(214, 69, 69, 0.12); border: 1px solid var(--danger); padding: 12px 16px; border-radius: 8px; }
.success { background: rgba(53, 176, 107, 0.1); border: 1px solid var(--ok); padding: 12px 16px; border-radius: 8px; }
.warn { background: rgba(200, 160, 30, 0.1); border: 1px solid #b7950b; padding: 12px 16px; border-radius: 8px; }
.muted { color: var(--muted); }
.small { font-size: 0.84rem; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
tbody tr, table tr { transition: background 0.1s; }
table tr:hover td { background: rgba(255, 255, 255, 0.02); }
tr.latest td { background: var(--accent-soft); }
tr.latest:hover td { background: var(--accent-soft); }
td.actions { white-space: nowrap; text-align: right; }
td.actions .btn { margin: 1px 0 1px 4px; }

/* ---------- landing ---------- */
.hero { max-width: 640px; margin: 10vh auto 6vh; text-align: center; }
.hero-title {
  font-size: clamp(2.2rem, 6vw, 3.4rem); line-height: 1.12;
  letter-spacing: -0.03em; margin: 0 0 18px;
  background: linear-gradient(120deg, var(--text) 40%, var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { color: var(--muted); font-size: 1.12rem; max-width: 480px; margin: 0 auto 30px; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.features {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px; max-width: 780px; margin: 0 auto 8vh;
}
.feature {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.feature h3 { margin: 0 0 8px; font-size: 1rem; color: var(--accent); }
.feature p { margin: 0; color: var(--muted); font-size: 0.9rem; }

.lang-banner {
  display: flex; gap: 10px; align-items: center; justify-content: center;
  flex-wrap: wrap; margin: 18px auto 0; padding: 10px 16px;
  max-width: 640px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 999px;
}
.anon-note { color: var(--muted); font-size: 0.88rem; margin-top: 22px; }

.intro-gate { max-width: 640px; margin: 24px auto; border-color: var(--accent2); }
.intro-gate .intro { font-size: 1.02rem; }
.gate-actions { text-align: center; margin-top: 18px; }

/* ---------- copy row / codes ---------- */
.copy-row { display: flex; gap: 8px; align-items: center; margin: 10px 0; flex-wrap: wrap; }
.copy-row input { flex: 1; margin-top: 0; min-width: 200px; }
.shortcode {
  background: var(--bg2); border: 1px solid var(--border);
  padding: 2px 10px; border-radius: 6px; font-size: 0.95rem; letter-spacing: 1.5px;
  font-family: Consolas, monospace;
}

/* ---------- fill page ---------- */
.legend {
  position: sticky; top: 58px; z-index: 10;
  display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center;
  padding: 12px 16px;
  background: rgba(29, 26, 36, 0.92); backdrop-filter: blur(8px);
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--muted); }
.legend-right { margin-left: auto; display: inline-flex; gap: 12px; }

.dot {
  display: inline-block; width: 19px; height: 19px; border-radius: 50%;
  background: var(--c, #888); border: 2px solid rgba(0, 0, 0, 0.5);
}
.legend .dot { width: 12px; height: 12px; }

.item-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.item-row:last-child { border-bottom: none; }
.item-name { flex: 1; min-width: 180px; }
.ratings { display: flex; gap: 8px; }

.dot-label { display: inline-flex; margin: 0; cursor: pointer; }
.dot-label input { position: absolute; opacity: 0; width: 0; height: 0; }
.dot-label .dot { transition: transform 0.12s, opacity 0.12s; opacity: 0.4; }
.dot-label:hover .dot { opacity: 1; transform: scale(1.18); }
.dot-label input:checked + .dot {
  opacity: 1; transform: scale(1.22);
  border-color: var(--text); box-shadow: 0 0 8px var(--c);
}
.dot-label input:focus-visible + .dot { outline: 2px solid var(--accent); outline-offset: 2px; }

.answer-badge {
  padding: 2px 13px; border-radius: 12px; font-size: 0.84rem; font-weight: 600;
  background: var(--panel2); border: 1px solid var(--border);
}
.answer-badge[data-value="Favorito"] { background: #23FD22; color: #000; border-color: transparent; }
.answer-badge[data-value="Gosto"]    { background: #B9F6CA; color: #000; border-color: transparent; }
.answer-badge[data-value="Ok"]       { background: #FDFD6B; color: #000; border-color: transparent; }
.answer-badge[data-value="Talvez"]   { background: #DB6C00; color: #000; border-color: transparent; }
.answer-badge[data-value="NÃO"]      { background: #920000; color: #fff; border-color: transparent; }

.safeword { font-size: 1.5rem; font-weight: 700; letter-spacing: 1px; color: var(--accent); }
.finish-box { text-align: center; }
.meta th { width: 170px; vertical-align: top; text-transform: none; font-size: 0.9rem; }

/* ---------- info tooltips ---------- */
.info {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; margin-left: 7px;
  border-radius: 50%; border: 1px solid var(--muted);
  color: var(--muted); font-size: 11px; font-style: italic; font-family: Georgia, serif;
  cursor: help; position: relative; vertical-align: middle; user-select: none;
  transition: border-color 0.15s, color 0.15s;
}
.info:hover, .info:focus { border-color: var(--accent); color: var(--accent); outline: none; }
.info .tip {
  display: none; position: absolute; z-index: 30;
  bottom: calc(100% + 9px); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: 270px;
  background: #0d0b11; color: var(--text); font-style: normal;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 0.8rem; font-weight: 400; line-height: 1.45; text-align: left;
  border: 1px solid var(--accent2); border-radius: 8px; padding: 9px 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
}
.info:hover .tip, .info:focus .tip, .info:focus-within .tip { display: block; }
h2 .info { margin-left: 9px; }

/* ---------- role selection ---------- */
.role-label { font-weight: 600; margin: 14px 0 8px; font-size: 0.92rem; }
.role-cards { display: grid; gap: 10px; }
.role-card {
  display: block; margin: 0; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg2); cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.role-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.role-card input { position: absolute; opacity: 0; width: 0; height: 0; }
.role-card .role-title { display: block; font-weight: 700; }
.role-card .role-desc { display: block; font-weight: 400; font-size: 0.85rem; color: var(--muted); margin-top: 3px; }
.role-card.disabled { opacity: 0.5; cursor: not-allowed; }
.badge {
  display: inline-block; padding: 1px 9px; border-radius: 10px;
  background: var(--accent2); color: #fff; font-size: 0.68rem; font-weight: 600;
  vertical-align: middle; text-transform: uppercase; letter-spacing: 0.6px;
}
.role-badge { background: var(--panel2); border: 1px solid var(--accent2); color: var(--accent); }

.check-row {
  display: flex; gap: 10px; align-items: flex-start;
  font-weight: 400; font-size: 0.88rem; color: var(--muted);
}
.check-row input { width: auto; margin: 3px 0 0; flex-shrink: 0; }

/* ---------- share card / optional tag ---------- */
.share-card { border-color: var(--accent2); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.share-card h2 { color: var(--accent); }
.optional-tag { color: var(--accent); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.5px; }
.field-help { display: block; font-weight: 400; margin-top: 4px; }

/* ---------- visual list editor ---------- */
.editor-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 20px; }
.editor-head h2 { margin: 0; }
.ed-cat { padding: 14px 16px; margin: 12px 0; background: var(--bg2); }
.ed-cat-head { display: flex; gap: 8px; align-items: center; }
.ed-cat-head .ed-cat-name { flex: 1; font-weight: 700; margin-top: 0; }
.ed-cat-desc { margin: 8px 0 4px; font-size: 0.86rem; }
.ed-items { margin: 6px 0 10px; }
.ed-item {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 5px 0; border-bottom: 1px solid var(--border);
}
.ed-item:last-child { border-bottom: none; }
.ed-item input { margin-top: 0; }
.ed-item-name { flex: 2; min-width: 160px; }
.ed-item-desc { flex: 3; min-width: 200px; font-size: 0.85rem; color: var(--muted); }
.ed-controls { display: inline-flex; gap: 4px; margin-left: auto; }
.icon-btn { padding: 3px 8px; font-size: 0.75rem; line-height: 1.2; }
.ed-fields-card { background: var(--bg2); }
.ed-field {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 5px 0; border-bottom: 1px solid var(--border);
}
.ed-field:last-child { border-bottom: none; }
.ed-field input:not([type="checkbox"]), .ed-field select { margin-top: 0; }
.ed-field-label { flex: 2; min-width: 160px; }
.ed-field-type { flex: 1; min-width: 130px; width: auto; }
.ed-field-reqwrap {
  display: inline-flex; align-items: center; gap: 6px; margin: 0;
  font-weight: 400; font-size: 0.86rem; color: var(--muted); white-space: nowrap;
}
.ed-field-reqwrap input { width: auto; margin: 0; }
#visual-editor > .btn { margin: 6px 0 14px; }

/* ---------- public repository ---------- */
.search-bar .copy-row input { min-width: 200px; }
.lang-filters { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.lang-check {
  display: inline-flex; align-items: center; gap: 6px; margin: 0;
  font-weight: 400; font-size: 0.9rem; color: var(--muted); cursor: pointer;
}
.lang-check input { width: auto; margin: 0; }
.pub-card h2 { margin-bottom: 2px; }
.pub-card h2 a { color: var(--text); }
.pub-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.lang-badge { background: var(--panel2); border: 1px solid var(--border); color: var(--muted); }
.tags { margin: 6px 0; }
.tag {
  display: inline-block; margin-right: 6px; padding: 1px 10px;
  background: var(--accent-soft); border-radius: 10px;
  color: var(--accent); font-size: 0.8rem; text-decoration: none;
}
.tag:hover { text-decoration: none; background: var(--accent2); color: #fff; }
.score-box, .vote-box { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.score { font-weight: 700; font-size: 1.1rem; min-width: 2ch; text-align: center; }
.score.pos { color: var(--ok); }
.score.neg { color: var(--danger); }
.vote-btn { padding: 4px 10px; filter: grayscale(1) opacity(0.7); }
.vote-btn:hover { filter: none; }
.vote-btn.vote-up:hover, .vote-btn.vote-up.voted { border-color: var(--ok); }
.vote-btn.vote-down:hover, .vote-btn.vote-down.voted { border-color: var(--danger); }
.vote-btn.voted { filter: none; }
.vote-btn.vote-up.voted { background: rgba(53, 176, 107, 0.18); }
.vote-btn.vote-down.voted { background: rgba(214, 69, 69, 0.18); }

.archived-box { margin-top: 16px; }
.archived-box summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.archived-box table { margin-top: 10px; }
.pub-cat { border-bottom: 1px solid var(--border); padding: 8px 0; }
.pub-cat:last-of-type { border-bottom: none; }
.pub-cat summary { cursor: pointer; }
.pub-items { margin: 8px 0; color: var(--muted); columns: 2 240px; column-gap: 30px; }
.pub-items li { margin: 3px 0; break-inside: avoid; }
.pub-fields-title { font-size: 0.95rem; margin: 16px 0 4px; }
.comment { border-top: 1px solid var(--border); padding: 12px 0 4px; margin-top: 12px; }
.comment-head { display: flex; align-items: center; gap: 10px; }
.comment-up { margin-left: auto; }
.comment p { margin: 6px 0 0; }
.section-actions { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  main { padding: 12px 12px 32px; }
  .topbar { padding: 10px 14px; }
  .nav-links { gap: 12px; font-size: 0.9rem; }
  .item-row { flex-direction: column; align-items: flex-start; gap: 5px; }
  .ratings { gap: 13px; }
  .dot { width: 25px; height: 25px; }
  .legend { top: 0; }
  td.actions { text-align: left; }
  .hero { margin-top: 6vh; }
}
