:root {
  --bg: #111311;
  --raise: #1b1e1b;
  --line: #2c302c;
  --text: #ecebe4;
  --muted: #8b8f86;
  --lime: #e4ff57;
  --coral: #ff7a59;
  --def: #e4ff57;
  --ind: #ff7a59;
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--display);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- top bar ---------- */
.top {
  flex: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px 6px;
}
.wordmark { font: 700 18px var(--mono); letter-spacing: -0.04em; }
.wordmark i { display: inline-block; width: 7px; height: 7px; margin-left: 3px; border-radius: 50%; background: var(--lime); }
.top nav { display: flex; gap: 2px; }
.icon { width: 38px; height: 38px; border: none; border-radius: 12px; background: none; color: var(--muted); display: grid; place-items: center; }
.icon:hover { color: var(--text); background: var(--raise); }

.loading { font: 14px var(--mono); color: var(--muted); text-align: center; margin-top: 35vh; padding: 0 20px; }
.loading .center { justify-content: center; }
.loading a { color: var(--lime); }

/* Botón con pinta de enlace (cuenta, denunciar, borrar…). */
.link { background: none; border: none; padding: 0; min-height: 38px; color: var(--muted); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--text); }
.link.danger { color: var(--coral); }

/* ---------- game ---------- */
.game {
  flex: 1; min-height: 0;
  width: 100%; max-width: 540px; margin: 0 auto;
  padding: 6px 18px calc(14px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column;
}
.game { overflow-y: auto; }

.meta { display: flex; justify-content: space-between; align-items: center; font: 500 12px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.level { display: inline-flex; align-items: center; gap: 6px; }
.level i { width: 14px; height: 5px; border-radius: 3px; background: var(--line); }
.level i.on { background: var(--lime); }
.archived { color: var(--coral); }
.day-nav { display: inline-flex; align-items: center; gap: 4px; margin-left: -8px; }
.step { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); }
.step svg { width: 16px; height: 16px; }
.step[href]:hover { color: var(--text); background: var(--raise); }
.step[aria-disabled] { opacity: .25; }

.clue {
  font: 700 clamp(28px, 8.4vw, 42px)/1.08 var(--display);
  letter-spacing: -0.025em;
  margin: 18px 0 22px;
  text-wrap: pretty;
}
.clue .enum { color: var(--muted); font-weight: 500; }
.clue mark { color: inherit; background: none; transition: color .3s, box-shadow .3s; }
.clue mark.on { padding: 0 .08em; border-radius: 4px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.clue mark.def.on { color: var(--bg); background: var(--def); }
.clue mark.ind.on { color: var(--ind); background: color-mix(in srgb, var(--ind) 22%, transparent); }

/* Answer: one real input under mono underline slots. */
.answer { position: relative; display: block; cursor: text; }
.answer input { position: absolute; inset: 0; width: 100%; opacity: 0; font-size: 16px; border: 0; }
.slots { display: flex; flex-wrap: wrap; gap: 14px; }
.slots .word { display: flex; gap: 6px; }
.slot {
  width: clamp(26px, 7.4vw, 34px); height: 44px;
  display: grid; place-items: end center; padding-bottom: 4px;
  font: 700 clamp(22px, 6.6vw, 28px)/1 var(--mono);
  border-bottom: 3px solid var(--line);
  transition: border-color .15s, color .3s;
}
.slot.filled { border-color: var(--muted); }
.slot.next { border-color: var(--text); animation: blink 1s steps(2) infinite; }
.answer:not(.focus) .slot.next { animation: none; }
.slot.given { color: var(--lime); }
.answer.won .slot { color: var(--lime); border-color: var(--lime); }
.answer.lost .slot { color: var(--coral); border-color: var(--coral); }
.answer.shake { animation: shake .4s; }
@keyframes blink { 50% { border-color: var(--line); } }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }

.status { min-height: 20px; margin: 10px 0 0; font: 500 13px var(--mono); color: var(--muted); }
.status .miss { color: var(--coral); text-decoration: line-through; margin-right: 8px; }

/* ---------- bottom controls ---------- */
.play, .result { margin-top: auto; padding-top: 14px; }
.chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.chip {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 9px 10px; border: 1px solid var(--muted); border-radius: 12px; background: none;
  transition: border-color .15s, opacity .2s;
}
.chip b { font-weight: 500; font-size: 13px; }
.chip small { font: 500 11px var(--mono); color: var(--coral); }
.chip:hover:not(:disabled) { border-color: var(--text); }
.chip:disabled { opacity: .35; cursor: default; }
.chip.used { border-color: var(--line); }
.chip.used small { color: var(--muted); }
.chip.used b::after { content: " ✓"; color: var(--lime); }
.hint-text { min-height: 20px; margin: 10px 0; font-size: 14px; color: var(--text); }
.hint-text.idle { color: var(--muted); }

.go {
  width: 100%; height: 56px; border: none; border-radius: 16px;
  background: var(--lime); color: var(--bg);
  font: 700 18px var(--display); letter-spacing: -0.01em;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.go:active { transform: scale(.985); }
.go span { font: 500 12px var(--mono); opacity: .65; }
.go.small { width: auto; height: 46px; padding: 0 22px; font-size: 16px; }

.verdict { display: flex; justify-content: space-between; align-items: baseline; }
.verdict strong { font: 700 26px var(--display); letter-spacing: -0.02em; }
.verdict span { font: 700 14px var(--mono); color: var(--lime); }
.explanation { margin: 8px 0 14px; padding: 12px 14px; border-left: 3px solid var(--lime); background: var(--raise); border-radius: 0 12px 12px 0; font-size: 15px; }
.result-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.next { font: 500 12px var(--mono); color: var(--muted); }
.next b { color: var(--text); }
.report { font-size: 13px; }

/* ---------- reacciones (pistas de la comunidad) ---------- */
.reactions { margin-bottom: 12px; }
.reaction-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.reaction {
  min-height: 40px; padding: 6px 8px; border: 1px dashed var(--line); border-radius: 12px; background: none;
  font-size: 13px; line-height: 1.2; transition: border-color .15s, color .15s;
}
.reaction small { font: 500 11px var(--mono); color: var(--muted); }
.reaction:hover { border-color: var(--muted); border-style: solid; }
.reaction[aria-pressed="true"] { border-style: solid; border-color: var(--lime); color: var(--lime); }
.reaction[aria-pressed="true"] small { color: var(--lime); }


/* ---------- sheets (slide up from the bottom on phones) ---------- */
.sheet {
  width: min(520px, 100vw); max-width: 100vw; max-height: 88dvh;
  margin: auto auto 0; padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
  border: 1px solid var(--line); border-bottom: none; border-radius: 22px 22px 0 0;
  background: var(--raise); color: var(--text);
  animation: up .25s ease-out;
}
@media (min-width: 640px) { .sheet { margin: auto; border-radius: 22px; border-bottom: 1px solid var(--line); } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet::backdrop { background: rgba(0, 0, 0, .6); }
.sheet h2 { font: 700 26px var(--display); letter-spacing: -0.02em; margin: 0 0 14px; }
.sheet h3 { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 0 8px; }
.close { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border: none; border-radius: 50%; background: var(--line); font-size: 20px; line-height: 1; }
.close:focus:not(:focus-visible) { outline: none; }

.account-text { color: var(--muted); line-height: 1.5; margin: 0 0 18px; }
.account-text b { color: var(--text); }
.account-error { color: var(--coral); font-size: 14px; margin: 10px 0 0; }
.account-error:empty { display: none; }
.icon.signed { color: var(--lime); }
.account-links { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 18px; }
.account-links .danger { color: var(--coral); }
.account-links a { color: var(--muted); font-size: 14px; }

/* ---------- static pages (privacidad) ---------- */
body.doc { height: auto; overflow: auto; }
.wordmark { color: inherit; text-decoration: none; }
.doc-body { width: min(640px, 100%); margin: 0 auto; padding: 24px 20px 64px; line-height: 1.6; }
.doc-body h1 { font: 700 36px var(--display); letter-spacing: -0.02em; margin: 12px 0 4px; }
.doc-body h2 { font: 700 20px var(--display); margin: 32px 0 8px; }
.doc-body a { color: var(--lime); }
.doc-body .muted { color: var(--muted); font: 500 12px var(--mono); }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stat-row div { background: var(--bg); border-radius: 12px; padding: 10px 6px; text-align: center; }
.stat-row strong { display: block; font: 700 26px var(--mono); }
.stat-row span { font-size: 12px; color: var(--muted); }
.dist { display: grid; gap: 5px; }
.bar { display: grid; grid-template-columns: 16px 1fr; gap: 8px; align-items: center; font: 500 12px var(--mono); }
.bar div { background: var(--line); text-align: right; padding: 3px 8px; border-radius: 6px; min-width: 26px; }
.bar.now div { background: var(--lime); color: var(--bg); }

.archive-list { list-style: none; padding: 0; margin: 0; max-height: 60dvh; overflow: auto; }
.archive-list a { display: flex; justify-content: space-between; align-items: center; padding: 12px 2px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.archive-list a:hover { color: var(--lime); }
.archive-list .st { font: 500 12px var(--mono); color: var(--muted); }
.archive-list .st.won { color: var(--lime); }

/* ---------- hoja «Comunidad» ---------- */
a.go { text-decoration: none; }
.go.create { height: 48px; font-size: 16px; }
.tabs { display: flex; gap: 4px; margin: 16px 0 4px; padding: 4px; background: var(--bg); border-radius: 12px; }
.tabs button { flex: 1; min-height: 38px; border: none; border-radius: 9px; background: none; color: var(--muted); font-size: 14px; }
.tabs button[aria-selected="true"] { background: var(--line); color: var(--text); }
.feed-list { list-style: none; padding: 0; margin: 0; max-height: 46dvh; overflow: auto; }
.feed-list li { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.feed-list a { flex: 1; min-width: 0; display: grid; gap: 4px; padding: 12px 2px; color: inherit; text-decoration: none; }
.feed-list a:hover .feed-clue { color: var(--lime); }
.feed-clue { font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.feed-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font: 500 12px var(--mono); color: var(--muted); }
.feed-meta .level { gap: 3px; }
.feed-meta .level i { width: 10px; height: 4px; }
.feed-meta .st.won { color: var(--lime); }
.feed-meta .tag { color: var(--coral); }
.feed-note { color: var(--muted); font-size: 14px; margin: 12px 0 0; }
.feed-note:empty { display: none; }

/* ---------- /crear ---------- */
.back { color: var(--muted); font-size: 14px; text-decoration: none; min-height: 38px; display: inline-flex; align-items: center; }
.back:hover { color: var(--text); }
.create h2 { margin-top: 8px; }
.lead { color: var(--muted); margin: 8px 0 0; }
.create h3 { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 28px 0 8px; }
.clue-form { margin-top: 20px; }
.field { display: grid; gap: 6px; margin: 0 0 18px; padding: 0; border: none; min-width: 0; }
.field label, .field legend { font-weight: 600; padding: 0; margin-bottom: 0; }
.field legend { margin-bottom: 6px; }
.field small { color: var(--muted); font-size: 13px; line-height: 1.4; }
.field input:not([type="radio"]), .field textarea, .field select {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--raise); color: var(--text);
  font: 16px/1.4 var(--display);
}
.field textarea { resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--lime); }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); opacity: .6; }
#f-answer { font-family: var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.enum-hint { font: 500 13px var(--mono); color: var(--lime); margin-left: 6px; }
.req { font: 500 12px var(--mono); color: var(--muted); font-weight: 400; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; background: var(--raise); border-radius: 12px; }
.segmented label { position: relative; font-weight: 500; }
.segmented input { position: absolute; opacity: 0; inset: 0; }
.segmented span { display: grid; place-items: center; min-height: 38px; border-radius: 9px; color: var(--muted); cursor: pointer; }
.segmented input:checked + span { background: var(--line); color: var(--lime); }
.segmented input:focus-visible + span { outline: 2px solid var(--lime); }
.preview { padding: 14px 16px 2px; border: 1px solid var(--line); border-radius: 16px; }
.preview .clue { font-size: clamp(24px, 6.4vw, 32px); margin: 12px 0 14px; overflow-wrap: anywhere; }
.preview .clue.empty { color: var(--muted); font-weight: 500; }
.problems { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 6px; font-size: 14px; }
.problems li { color: var(--coral); padding-left: 16px; position: relative; }
.problems li::before { content: "·"; position: absolute; left: 4px; font-weight: 700; }
.problems li.warn { color: var(--muted); }
.go:disabled { opacity: .4; cursor: default; transform: none; }
.go.ghost { background: none; color: var(--text); border: 1px solid var(--line); }
.share-link { font: 500 15px var(--mono); overflow-wrap: anywhere; padding: 12px 14px; background: var(--raise); border-radius: 12px; }
.done-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.tips { margin-top: 40px; padding-top: 8px; border-top: 1px solid var(--line); }
.tips ul { padding-left: 20px; }
.tips li { margin-bottom: 8px; }
.tips .muted a { color: var(--muted); }

.toast {
  position: fixed; left: 50%; top: 64px; transform: translate(-50%, -8px);
  background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: 10px;
  font: 500 13px var(--mono); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 640px) and (min-height: 700px) {
  .game { flex: 0 0 560px; margin: auto; padding-bottom: 24px; }
  .clue { margin-top: 28px; }
}
@media (max-height: 600px) {
  .clue { margin: 10px 0 14px; font-size: clamp(24px, 7vw, 34px); }
  .go { height: 50px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
