/* Layout: mesa de estudio. Barra superior con pestañas; cada vista es una rejilla de 2 columnas (tablero/matriz + panel) que se apila en móvil.
   Tokens: replica/design/tokens.json (comprobados con tests/contrast.js). */
:root {
  --bg: #f3f5f2;
  --surface: #ffffff;
  --surface-2: #e9ede8;
  --border: #d3dad3;
  --border-input: #7b877f;
  --text: #16201a;
  --text-muted: #505c55;
  --accent: #1d6a4c;
  --on-accent: #ffffff;
  --danger: #b3261e;
  --success: #1d7a47;
  --warning: #8a5a00;
  --danger-soft: #fbe9e7;
  --success-soft: #e3f3ea;
  --warning-soft: #fbf0db;
  --accent-soft: #e1efe8;
  --act-fold: #5d7290;
  --act-pass: #3b9467;
  --act-agg-1: #b97f12;
  --act-agg-2: #cf5f24;
  --act-agg-3: #c2412f;
  --act-agg-4: #8f2440;
  --suit-s: #16201a;
  --suit-h: #c62a2a;
  --suit-d: #1f5fbf;
  --suit-c: #1f7d3a;
  --card-bg: #ffffff;
  --card-back: #1d6a4c;
  --cell-empty: #e4e9e3;
  --chart-line: #187a52;
  --f-display: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --f-sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --shadow: 0 1px 2px rgba(16, 32, 24, 0.06), 0 2px 8px rgba(16, 32, 24, 0.06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0e1411;
    --surface: #161e1a;
    --surface-2: #1f2a24;
    --border: #2c3a32;
    --border-input: #7f8f86;
    --text: #e5ebe7;
    --text-muted: #a2b0a8;
    --accent: #5cc79a;
    --on-accent: #08140e;
    --danger: #ff8a80;
    --success: #6fd59c;
    --warning: #f0b45a;
    --danger-soft: #3a1c1a;
    --success-soft: #15301f;
    --warning-soft: #33270f;
    --accent-soft: #173326;
    --act-fold: #7d93b3;
    --act-pass: #4fae7f;
    --act-agg-1: #e8b04c;
    --act-agg-2: #e3813f;
    --act-agg-3: #d65845;
    --act-agg-4: #b33a5c;
    --card-bg: #f4f6f3;
    --card-back: #2f8a63;
    --cell-empty: #1c2620;
    --chart-line: #34a272;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #0e1411;
  --surface: #161e1a;
  --surface-2: #1f2a24;
  --border: #2c3a32;
  --border-input: #7f8f86;
  --text: #e5ebe7;
  --text-muted: #a2b0a8;
  --accent: #5cc79a;
  --on-accent: #08140e;
  --danger: #ff8a80;
  --success: #6fd59c;
  --warning: #f0b45a;
  --danger-soft: #3a1c1a;
  --success-soft: #15301f;
  --warning-soft: #33270f;
  --accent-soft: #173326;
  --act-fold: #7d93b3;
  --act-pass: #4fae7f;
  --act-agg-1: #e8b04c;
  --act-agg-2: #e3813f;
  --act-agg-3: #d65845;
  --act-agg-4: #b33a5c;
  --card-bg: #f4f6f3;
  --card-back: #2f8a63;
  --cell-empty: #1c2620;
  --chart-line: #34a272;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
html,
body {
  min-height: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--f-sans);
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
h1,
h2,
h3 {
  font-family: var(--f-display);
  margin: 0;
  line-height: 1.15;
  text-wrap: balance;
}
h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
h2 {
  font-size: 20px;
  font-weight: 600;
}
h3 {
  font-size: 16px;
  font-weight: 600;
}
p {
  margin: 0;
}
.num,
.mono {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
}
.muted {
  color: var(--text-muted);
}
.small {
  font-size: 13px;
}
a {
  color: var(--accent);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* barra superior */
.top {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 5;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding-block: 10px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
body::before {
  content: '';
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 10;
  background: var(--surface);
}
.top-in {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px 20px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 19px;
  text-decoration: none;
  color: var(--text);
}
.brand svg {
  width: 26px;
  height: 26px;
  flex: none;
}
.tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.tab {
  border: 0;
  background: none;
  padding: 7px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 500;
  text-decoration: none;
}
.tab:hover {
  background: var(--surface-2);
  color: var(--text);
}
.tab[aria-current='page'] {
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 600;
}
.top .spacer {
  flex: 1;
}

main {
  max-width: 1280px;
  margin: 0 auto;
  padding-block: 20px 64px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px 16px;
  justify-content: space-between;
}
.head .lede {
  max-width: 62ch;
  color: var(--text-muted);
  margin-top: 4px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
}
[hidden] {
  display: none !important;
}
.cols > *,
.stack > * {
  min-width: 0;
}
@media (max-width: 900px) {
  .cols {
    grid-template-columns: minmax(0, 1fr);
  }
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-input);
  background: var(--surface);
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
}
.btn:hover {
  background: var(--surface-2);
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.btn.primary:hover {
  filter: brightness(1.08);
}
.btn.ghost {
  border-color: transparent;
  background: none;
}
.btn.ghost:hover {
  background: var(--surface-2);
}
.btn.danger {
  color: var(--danger);
  border-color: var(--danger);
}
.btn.sm {
  min-height: 32px;
  padding: 0 10px;
  font-size: 14px;
  border-radius: var(--r-sm);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.kbd {
  font: 500 11px/1 var(--f-mono);
  border: 1px solid currentColor;
  border-radius: 4px;
  padding: 2px 4px;
  opacity: 0.7;
}
.seg {
  display: inline-flex;
  border: 1px solid var(--border-input);
  border-radius: var(--r-md);
  overflow: hidden;
}
.seg button {
  border: 0;
  background: var(--surface);
  padding: 7px 12px;
  cursor: pointer;
  font-weight: 500;
}
.seg button + button {
  border-left: 1px solid var(--border);
}
.seg button[aria-pressed='true'] {
  background: var(--accent);
  color: var(--on-accent);
}

/* acciones del entrenador */
.acts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}
.act {
  min-height: 52px;
  border-radius: var(--r-md);
  border: 2px solid var(--c, var(--border-input));
  background: var(--surface);
  cursor: pointer;
  font-weight: 700;
  font-size: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text);
}
.act:hover:not(:disabled) {
  background: var(--surface-2);
}
.act .kbd {
  font-size: 10px;
}
.act:disabled {
  cursor: default;
}
.act.chosen {
  background: var(--c);
  color: #fff;
}

/* chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text);
  white-space: nowrap;
}
.chip.good {
  background: var(--success-soft);
  color: var(--success);
}
.chip.bad {
  background: var(--danger-soft);
  color: var(--danger);
}
.chip.warn {
  background: var(--warning-soft);
  color: var(--warning);
}
.chip.accent {
  background: var(--accent-soft);
  color: var(--accent);
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--c);
  flex: none;
}

/* cartas: baraja de cuatro colores */
.cards {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.card {
  width: 46px;
  height: 64px;
  border-radius: 7px;
  background: var(--card-bg);
  border: 1px solid #c9d1ca;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-family: var(--f-display);
  font-weight: 700;
  color: var(--suit, #16201a);
}
.card .r {
  font-size: 24px;
}
.card .s {
  font-size: 18px;
  margin-top: 2px;
}
.card.lg {
  width: 64px;
  height: 90px;
}
.card.lg .r {
  font-size: 34px;
}
.card.lg .s {
  font-size: 24px;
}
.card.sm {
  width: 30px;
  height: 40px;
  border-radius: 5px;
}
.card.sm .r {
  font-size: 15px;
}
.card.sm .s {
  font-size: 12px;
  margin-top: 0;
}
.card.back {
  background: repeating-linear-gradient(45deg, var(--card-back) 0 6px, color-mix(in srgb, var(--card-back) 80%, #000) 6px 12px);
  border-color: transparent;
}
.card.empty {
  background: none;
  border: 1.5px dashed var(--border-input);
  box-shadow: none;
}
.s-s {
  --suit: var(--suit-s);
}
.s-h {
  --suit: var(--suit-h);
}
.s-d {
  --suit: var(--suit-d);
}
.s-c {
  --suit: var(--suit-c);
}
.inline-card {
  font-family: var(--f-mono);
  font-weight: 600;
  color: var(--suit);
}
.inline-card.s-s {
  color: var(--text);
}

/* mesa */
.felt {
  background: radial-gradient(120% 90% at 50% 40%, color-mix(in srgb, var(--accent) 16%, var(--surface)), var(--surface));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  display: grid;
  gap: 16px;
}
.seat {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.seat .who {
  display: grid;
  gap: 2px;
}
.potline {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: space-between;
}
.pot {
  font: 600 15px var(--f-mono);
}
.log {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
}
.log .step {
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: 999px;
}
.log .step.street {
  background: none;
  font-weight: 700;
  color: var(--text-muted);
  padding-left: 0;
}

/* feedback */
.verdict {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.verdict strong {
  font-family: var(--f-display);
  font-size: 22px;
}
.fbt {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.fbt th {
  text-align: left;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  padding: 4px 6px;
}
.fbt td {
  padding: 6px;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}
.fbt tr.mine td {
  background: var(--surface-2);
}
.fbt .bar {
  height: 10px;
  border-radius: 3px;
  background: var(--c);
  min-width: 2px;
}
.fbt .barwrap {
  width: 100%;
  min-width: 60px;
  background: var(--surface-2);
  border-radius: 3px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.stat {
  background: var(--surface-2);
  border-radius: var(--r-md);
  padding: 10px 12px;
  display: grid;
  gap: 0;
}
.stat b {
  font: 600 22px var(--f-mono);
  font-variant-numeric: tabular-nums;
}
.stat span {
  font-size: 12px;
  color: var(--text-muted);
}

/* matriz 13×13 */
.matrix {
  display: grid;
  grid-template-columns: repeat(13, minmax(0, 1fr));
  gap: 2px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.cell {
  position: relative;
  aspect-ratio: 1 / 1;
  min-width: 0;
  border-radius: 3px;
  background: var(--cell-empty);
  overflow: hidden;
  cursor: pointer;
  border: 0;
  padding: 0;
}
.cell .fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
}
.cell .lbl {
  position: absolute;
  left: 3px;
  top: 2px;
  font: 600 clamp(8px, 1.15vw, 12px)/1 var(--f-mono);
  color: var(--text);
  z-index: 1;
  text-shadow:
    0 0 2px var(--surface),
    0 0 2px var(--surface);
}
.cell .val {
  position: absolute;
  right: 3px;
  bottom: 2px;
  font: 500 clamp(7px, 0.9vw, 10px)/1 var(--f-mono);
  color: var(--text);
  z-index: 1;
  text-shadow: 0 0 2px var(--surface);
}
.cell.sel {
  outline: 2px solid var(--text);
  outline-offset: -2px;
  z-index: 2;
}
.cell.dim .lbl {
  opacity: 0.45;
}
.cell:focus-visible {
  outline: 2px solid var(--accent);
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 13px;
}
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.aggbar {
  display: flex;
  height: 26px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-2);
}
.aggbar div {
  height: 100%;
  background: var(--c);
}
.summary {
  display: grid;
  gap: 6px;
}
.summary button {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 10px;
  align-items: center;
  text-align: left;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 8px 10px;
  cursor: pointer;
}
.summary button:hover {
  border-color: var(--border-input);
  background: var(--surface-2);
}
.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  font-size: 13px;
}
.crumbs button {
  border: 0;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 3px 9px;
  cursor: pointer;
}
.crumbs button:hover {
  background: var(--border);
}
.crumbs .cur {
  font-weight: 700;
  padding: 3px 4px;
}
.combos {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.combos td,
.combos th {
  padding: 4px 4px;
  border-top: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}
.combos th {
  border-top: 0;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}
.combos td:first-child,
.combos th:first-child {
  text-align: left;
}
.minibar {
  display: flex;
  height: 9px;
  border-radius: 2px;
  overflow: hidden;
  min-width: 70px;
  background: var(--surface-2);
}
.minibar div {
  background: var(--c);
}
.scroll {
  overflow-x: auto;
}
.viewsw {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
}

/* selector de cartas */
.picker {
  display: grid;
  grid-template-columns: repeat(13, minmax(0, 1fr));
  gap: 3px;
}
.picker button {
  aspect-ratio: 3 / 4;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--suit);
  font: 700 clamp(10px, 1.2vw, 14px)/1 var(--f-display);
  cursor: pointer;
  padding: 0;
  min-width: 0;
}
.picker button[aria-pressed='true'] {
  outline: 3px solid var(--accent);
  outline-offset: -1px;
}
.picker button:disabled {
  opacity: 0.22;
  cursor: not-allowed;
}

/* spots */
.grid-spots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.spot {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  display: grid;
  gap: 12px;
  align-content: start;
}
.spot .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.spot .story {
  font-size: 14px;
  color: var(--text-muted);
}
.spot .facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  font-size: 13px;
}
.spot .facts div {
  display: grid;
}
.spot .facts b {
  font: 600 15px var(--f-mono);
}
.spot .row {
  margin-top: auto;
}

/* formularios */
.form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.field {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.field > span {
  font-size: 13px;
  font-weight: 600;
}
.field small {
  color: var(--text-muted);
  font-size: 12px;
}
input[type='text'],
input[type='number'],
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border-input);
  border-radius: var(--r-sm);
  background: var(--surface);
  padding: 8px 10px;
}
textarea {
  min-height: 84px;
  resize: vertical;
  font-family: var(--f-mono);
  font-size: 13px;
}
input[type='range'] {
  width: 100%;
  accent-color: var(--accent);
}
.check {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.err {
  color: var(--danger);
  font-size: 14px;
}
.box {
  border-radius: var(--r-md);
  padding: 10px 12px;
  font-size: 14px;
}
.box.info {
  background: var(--accent-soft);
}
.box.warn {
  background: var(--warning-soft);
  color: var(--text);
  border-left: 4px solid var(--warning);
}
.box.bad {
  background: var(--danger-soft);
  border-left: 4px solid var(--danger);
}
.sizes {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.sizes th,
.sizes td {
  padding: 6px;
  text-align: left;
  border-top: 1px solid var(--border);
}
.sizes th {
  font-size: 12px;
  color: var(--text-muted);
  border-top: 0;
}
.sizes input {
  min-height: 34px;
}

/* progreso */
.overlay {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  z-index: 20;
  padding: 16px;
}
.dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
  width: min(460px, 100%);
  padding: 20px;
  display: grid;
  gap: 14px;
}
.progress {
  height: 10px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.progress div {
  height: 100%;
  background: var(--accent);
  width: 0;
  transition: width 0.2s;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: var(--r-md);
  z-index: 30;
  font-weight: 500;
  max-width: calc(100% - 32px);
}
.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  display: grid;
  gap: 8px;
  justify-items: center;
}
.hist {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.hist td,
.hist th {
  text-align: right;
  padding: 4px 6px;
  border-top: 1px solid var(--border);
}
.hist th {
  border-top: 0;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
}
.hist td:first-child,
.hist th:first-child {
  text-align: left;
}
@media (max-width: 600px) {
  /* cabecera compacta: marca y tema arriba, pestañas en una sola fila que se desliza */
  .top {
    padding-block: 6px;
  }
  .top-in {
    gap: 4px 12px;
  }
  .top .spacer {
    order: 2;
  }
  #theme {
    order: 3;
  }
  .tabs {
    order: 4;
    flex: 1 0 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .tabs::-webkit-scrollbar {
    display: none;
  }
  .tab {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 10px 12px;
  }
  .seg {
    max-width: 100%;
    overflow-x: auto;
  }
  .seg button {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .play-head .lede {
    display: none;
  }
  h1 {
    font-size: 23px;
  }
  .card.lg {
    width: 54px;
    height: 76px;
  }
  .card.lg .r {
    font-size: 28px;
  }
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* gráfica de progreso (RF-028) */
.chart {
  margin: 0;
  display: grid;
  gap: 6px;
}
.chart .plot {
  position: relative;
}
.chart svg {
  display: block;
  overflow: visible;
  max-width: 100%;
}
.chart .grid {
  stroke: var(--border);
  stroke-width: 1;
}
.chart .axis {
  fill: var(--text-muted);
  font: 11px var(--f-mono);
}
.chart .direct {
  fill: var(--text);
  font: 600 12px var(--f-mono);
}
.chart .line {
  fill: none;
  stroke: var(--chart-line);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.chart .dotm {
  fill: var(--chart-line);
  stroke: var(--surface);
  stroke-width: 2;
}
.chart .hit {
  fill: transparent;
  cursor: pointer;
}
.chart .hit:focus-visible {
  outline: none;
  stroke: var(--accent);
  stroke-width: 2;
}
.chart .tip {
  position: absolute;
  transform: translate(-50%, calc(-100% - 12px));
  background: var(--text);
  color: var(--bg);
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 3;
}
.trainopts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.progress-chip {
  font: 600 13px var(--f-mono);
}

/* menú principal (spec 017) */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.menu-card {
  color: inherit;
  text-decoration: none;
}
.menu-card:hover,
.menu-card:focus-visible {
  border-color: var(--accent);
}
.menu-card h2 {
  margin: 0;
}

/* en pantallas táctiles no hay teclado: sobran los atajos */
@media (pointer: coarse) {
  .kbd {
    display: none;
  }
}

/* Spec 029 · actividad de los últimos 14 días */
.act-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 96px;
  margin: 8px 0;
}
.act-day {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  height: 100%;
  min-width: 0;
}
.act-bar {
  width: 100%;
  min-height: 2px;
  background: var(--act-agg-1);
  border-radius: 2px 2px 0 0;
}
.act-bar.today {
  background: var(--accent);
}

/* Spec 031 · aviso de versión nueva y pie del menú */
.pwa-update {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 12px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
}
.app-foot {
  margin-top: 24px;
}
