/* Majloket con Josi
   Layout: una columna angosta pensada para el celu; el caso es una "hoja" con margen
   tipo página de estudio, opciones rotuladas א ב ג ד, ranking como tabla sobria. */
:root {
  --bg: #f3f4f9;
  --surface: #ffffff;
  --ink: #151a33;
  --muted: #5c6283;
  --line: #d9dcea;
  --tekhelet: #2a47ad;
  --tekhelet-soft: #e4e9fb;
  --gold: #a87a1e;
  --ok: #1f7a4d;
  --ok-soft: #e1f3e9;
  --bad: #b23a2a;
  --display: "Frank Ruhl Libre", "Iowan Old Style", Georgia, serif;
  --body: "Assistant", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1124; --surface: #161b35; --ink: #eceffa; --muted: #a2a8c8; --line: #2b3157;
    --tekhelet: #8fa6ff; --tekhelet-soft: #232c5c; --gold: #e2b65a; --ok: #5fd39a; --ok-soft: #173a2b; --bad: #ff8a78;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1124; --surface: #161b35; --ink: #eceffa; --muted: #a2a8c8; --line: #2b3157;
  --tekhelet: #8fa6ff; --tekhelet-soft: #232c5c; --gold: #e2b65a; --ok: #5fd39a; --ok-soft: #173a2b; --bad: #ff8a78;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 17px; line-height: 1.5; }
.wrap {
  max-width: 620px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: max(18px, env(safe-area-inset-top, 0px)) 40px;
  display: flex; flex-direction: column; gap: 22px;
}
.wrap.wide { max-width: 1080px; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.15; margin: 0; text-wrap: balance; }
p { margin: 0; }
.label { font-size: .74rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }

/* Masthead */
.mast { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-bottom: 2px solid var(--ink); padding-bottom: 10px; }
.mast h1 { font-size: clamp(1.7rem, 7vw, 2.3rem); letter-spacing: -.01em; }
.mast h1 em { font-style: normal; color: var(--tekhelet); }
.mast .who { font-size: .95rem; color: var(--muted); }
.mast .who button { all: unset; cursor: pointer; color: var(--tekhelet); font-weight: 700; }

/* Cards */
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px 20px; display: grid; gap: 16px; }
.sheet .meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sheet h2 { font-size: clamp(1.45rem, 6vw, 1.9rem); }
.case-text { white-space: pre-wrap; border-left: 3px solid var(--gold); padding-left: 14px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--tekhelet-soft); color: var(--tekhelet); }
.pill.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: blink 1.4s infinite; }
.pill.gold { background: transparent; border: 1px solid var(--gold); color: var(--gold); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.draft { background: transparent; border: 1px solid var(--line); color: var(--muted); }
@keyframes blink { 50% { opacity: .25; } }

/* Options */
.opts { display: grid; gap: 10px; }
.opt { all: unset; box-sizing: border-box; cursor: pointer; display: grid; grid-template-columns: 2.2rem 1fr; gap: 12px; align-items: start; padding: 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); position: relative; overflow: hidden; }
.opt:hover { border-color: var(--tekhelet); }
.opt:focus-visible { outline: 3px solid var(--tekhelet); outline-offset: 2px; }
.opt .heb { font-family: var(--display); font-size: 1.6rem; line-height: 1; color: var(--tekhelet); text-align: center; padding-top: 2px; }
.opt .txt { position: relative; z-index: 1; min-width: 0; }
.opt .bar { position: absolute; inset: 0 auto 0 0; background: var(--tekhelet-soft); z-index: 0; transition: width .5s ease; }
.opt .heb { position: relative; z-index: 1; }
.opt .num { display: block; font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 4px; }
.opt.mine { border-color: var(--tekhelet); box-shadow: inset 0 0 0 1px var(--tekhelet); }
.opt.right { border-color: var(--ok); box-shadow: inset 0 0 0 1px var(--ok); }
.opt.right .bar { background: var(--ok-soft); }
.opt.right .heb { color: var(--ok); }
.opt[aria-disabled="true"] { cursor: default; }
.opt[aria-disabled="true"]:hover { border-color: var(--line); }
.opt.mine[aria-disabled="true"]:hover { border-color: var(--tekhelet); }
.opt.right[aria-disabled="true"]:hover { border-color: var(--ok); }
.tags { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.tag { font-size: .75rem; font-weight: 700; color: var(--tekhelet); letter-spacing: .04em; text-transform: uppercase; }
.opt.right .tag { color: var(--ok); }

.verdict { padding: 14px 16px; border-radius: 12px; background: var(--tekhelet-soft); display: grid; gap: 6px; }
.verdict.ok { background: var(--ok-soft); }
.verdict strong { font-family: var(--display); font-size: 1.25rem; }
.psak { white-space: pre-wrap; }

/* Forms & buttons */
.btn { font: inherit; font-weight: 700; cursor: pointer; border: 0; border-radius: 10px; padding: 12px 18px; background: var(--tekhelet); color: var(--surface); }
.btn:hover { filter: brightness(1.08); }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.gold { background: var(--gold); color: var(--surface); }
.btn.danger { background: transparent; color: var(--bad); border: 1px solid var(--line); }
.btn.sm { padding: 7px 12px; font-size: .9rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 700; font-size: .92rem; }
input, textarea, select { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; width: 100%; }
textarea { min-height: 120px; resize: vertical; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }
.msg { color: var(--bad); font-weight: 600; font-size: .95rem; }
.empty { text-align: center; padding: 34px 18px; display: grid; gap: 8px; justify-items: center; }
.empty .glyph { font-family: var(--display); font-size: 3rem; color: var(--tekhelet); line-height: 1; }

/* Ranking */
.rank { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.rank th { text-align: left; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.rank td { padding: 9px 8px; border-bottom: 1px solid var(--line); }
.rank td.n, .rank th.n { text-align: right; }
.rank tr.me td { background: var(--tekhelet-soft); }
.rank .pos { font-family: var(--display); font-weight: 700; width: 2.2rem; color: var(--muted); }
.rank tr:first-child .pos { color: var(--gold); }
.rank .pts { font-weight: 800; }
.table-wrap { overflow-x: auto; }
.foot { text-align: center; color: var(--muted); font-size: .85rem; }

@media (prefers-reduced-motion: reduce) { .pill.live::before { animation: none; } .opt .bar { transition: none; } }
