/* =========================================================
   HERZIO TOOLS · base común (usa los tokens de style.css)
   ========================================================= */
.tool-page .footer { padding-right: var(--gutter); padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
.tool-bg { position: fixed; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(10, 6, 18, 0.55) 0%, var(--night) 70%), url("images/fondo-synthwave.svg") center 30% / cover no-repeat; opacity: 0.5; }
.tool-back svg, .tool-page .btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; }
.tool-shell { width: 100%; max-width: 1240px; margin: 0 auto; padding: 120px var(--gutter) 64px; }
.tool-head { margin-bottom: 32px; }
.tool-page button:disabled { opacity: 0.4; cursor: not-allowed; }
@keyframes item-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.tool-input { width: 100%; min-width: 0; min-height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.05); color: var(--text); font-family: var(--body); font-size: 16px; transition: border-color 0.2s, background 0.2s, box-shadow 0.2s; }
.tool-input::placeholder { color: #8a7eaa; }
.tool-input:focus { outline: none; border-color: var(--teal); background: rgba(46, 230, 214, 0.06); }
.tool-input.is-error { border-color: var(--pink); animation: shake 0.4s; }
.tool-label { font-family: var(--display); font-size: 17px; letter-spacing: 2px; color: var(--muted); text-transform: uppercase; }
.tool-row { display: flex; gap: 10px; }
.tool-row > .tool-input { flex: 1 1 auto; }
.tool-mini-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--text-2); font-family: var(--display); font-size: 17px; letter-spacing: 2px; text-transform: uppercase; transition: background 0.2s, border-color 0.2s, color 0.2s; }
.tool-mini-btn:hover:not(:disabled) { border-color: var(--teal); color: #fff; background: rgba(46, 230, 214, 0.1); }
.tool-mini-btn svg { width: 16px; height: 16px; stroke-width: 2.2; }
.tool-mini-btn.danger:hover:not(:disabled) { border-color: var(--pink); background: rgba(255, 61, 139, 0.12); }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 250; transform: translate(-50%, 20px); padding: 12px 20px; border-radius: 999px; background: var(--teal); color: var(--night); font-weight: 600; font-size: 15px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); opacity: 0; pointer-events: none; transition: opacity 0.3s, transform 0.3s cubic-bezier(.2,.8,.2,1); }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 1024px) { .tool-page .site-nav { padding-top: 12px; padding-bottom: 12px; } .tool-shell { padding-top: 96px; } }
@media (max-width: 600px) { .tool-back { padding: 0 14px; font-size: 17px; } }

/* =========================================================
   EL MARCADOR
   ========================================================= */
.score-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 340px); gap: 28px; align-items: start; }
.score-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.score-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 18px; }
.round { display: flex; align-items: baseline; gap: 10px; font-family: var(--display); letter-spacing: 2px; text-transform: uppercase; }
.round-label { font-size: 18px; color: var(--muted); }
.round-num { font-size: 44px; line-height: 1; }
.round-target { font-size: 16px; color: var(--teal); }
.score-bar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.add-player { padding: 16px 18px; }
.add-player .tool-row { margin-top: 8px; }

.players { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.players:empty { display: none; }
.player { --c: var(--pink); position: relative; display: flex; flex-direction: column; gap: 12px; padding: 18px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--c); backdrop-filter: blur(12px); transition: box-shadow 0.4s, border-color 0.4s; animation: item-in 0.35s cubic-bezier(.2,.8,.2,1); }
.player.is-leader { box-shadow: 0 0 0 1px var(--c), 0 0 36px color-mix(in srgb, var(--c) 35%, transparent); }
.player-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.player-pos { flex-shrink: 0; min-width: 34px; height: 28px; padding: 0 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); font-family: var(--display); font-size: 18px; letter-spacing: 1px; display: flex; align-items: center; justify-content: center; }
.player-name { flex: 1 1 auto; min-width: 0; font-family: var(--display); font-size: 26px; letter-spacing: 1px; line-height: 1; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-crown { width: 24px; height: 24px; flex-shrink: 0; fill: var(--sun); stroke: none; filter: drop-shadow(0 0 6px rgba(255, 176, 87, 0.8)); }
.player-score-wrap { position: relative; display: flex; justify-content: center; }
.player-score { font-family: var(--display); font-size: clamp(72px, 9vw, 104px); line-height: 0.95; letter-spacing: 2px; color: #fff; text-shadow: 0 0 30px color-mix(in srgb, var(--c) 55%, transparent); font-variant-numeric: tabular-nums; }
.player-score.is-bump { animation: bump 0.35s cubic-bezier(.2,1.6,.4,1); }
@keyframes bump { 40% { transform: scale(1.12); } }
.delta-float { position: absolute; top: 0; right: 10%; font-family: var(--display); font-size: 30px; pointer-events: none; animation: float-up 0.9s ease-out forwards; }
.delta-float.up { color: var(--teal); }
.delta-float.down { color: var(--pink-soft); }
@keyframes float-up { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-40px); } }
.player-controls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.pc-btn { min-height: 48px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.04); font-family: var(--display); font-size: 22px; letter-spacing: 1px; transition: background 0.15s, border-color 0.15s, transform 0.1s; }
.pc-btn:hover { border-color: var(--c); background: color-mix(in srgb, var(--c) 18%, transparent); }
.pc-btn:active { transform: scale(0.95); }
.pc-btn.minus { color: var(--pink-soft); }
.player-custom { display: flex; gap: 8px; }
.player-custom .tool-input { min-height: 44px; text-align: center; }
.player-custom .pc-btn { flex: 0 0 64px; font-size: 18px; }
.player-remove { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 10px; display: none; align-items: center; justify-content: center; color: var(--muted); }
.player-remove svg { width: 16px; height: 16px; }
.editing .player-remove { display: flex; }
.editing .player-crown { display: none; }
.player-remove:hover { color: var(--pink-soft); background: rgba(255, 61, 139, 0.12); }

.score-empty { padding: 40px 20px; border-radius: 20px; border: 1px dashed var(--line-2); text-align: center; color: var(--muted); }
.score-empty strong { display: block; font-family: var(--display); font-size: 30px; letter-spacing: 2px; color: var(--text); font-weight: 400; margin-bottom: 4px; }
.score-empty[hidden] { display: none; }
.finished-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-radius: 16px; border: 1px solid var(--sun); background: linear-gradient(90deg, rgba(255, 176, 87, 0.18), rgba(255, 61, 139, 0.08)); }
.finished-banner[hidden] { display: none; }
.finished-banner strong { font-family: var(--display); font-size: 24px; letter-spacing: 2px; font-weight: 400; }

.score-side { display: flex; flex-direction: column; gap: 20px; }
.rules { display: flex; flex-direction: column; gap: 14px; }
.rules .card-title { margin-bottom: 0; }
.mode-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 5px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); }
.mode-switch label { position: relative; }
.mode-switch input { position: absolute; opacity: 0; inset: 0; }
.mode-switch span { display: flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 8px; border-radius: 10px; font-size: 14px; font-weight: 500; text-align: center; color: var(--text-2); cursor: pointer; transition: background 0.2s, color 0.2s; }
.mode-switch input:checked + span { background: var(--grad-cta); color: #fff; }
.mode-switch input:focus-visible + span { outline: 2px solid var(--teal); outline-offset: 2px; }
.rules-hint { font-size: 14px; color: var(--muted); }
.history { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; scrollbar-width: thin; }
.history li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); padding: 6px 0; border-bottom: 1px solid var(--line); }
.history li:last-child { border-bottom: 0; }
.history .h-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex-shrink: 0; }
.history .h-delta { margin-left: auto; font-family: var(--display); font-size: 18px; letter-spacing: 1px; }
.history .h-delta.up { color: var(--teal); }
.history .h-delta.down { color: var(--pink-soft); }
.history .h-round { color: var(--muted); font-style: italic; }
.history-empty { font-size: 14px; color: var(--muted); }
.mp-name { font-family: var(--display); font-size: clamp(30px, 5vw, 56px); letter-spacing: 4px; color: #fff; text-transform: uppercase; margin-top: 6px; }

@media (max-width: 960px) {
  .score-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .players { grid-template-columns: minmax(0, 1fr); }
  .player-score { font-size: 84px; }
  .score-bar { padding: 12px 14px; }
}

/* =========================================================
   LABORATORIO DE COLOR
   ========================================================= */
.lab-layout { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 28px; align-items: start; }
.lab-controls { display: flex; flex-direction: column; gap: 18px; }
.lab-controls .card-title { margin-bottom: 0; }
.color-field { display: flex; flex-direction: column; gap: 8px; }
.color-pair { display: flex; gap: 10px; align-items: center; }
.color-swatch { position: relative; flex-shrink: 0; width: 56px; height: 52px; border-radius: 14px; border: 2px solid var(--line-2); overflow: hidden; cursor: pointer; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.25); }
.color-swatch input { position: absolute; inset: -10px; width: calc(100% + 20px); height: calc(100% + 20px); border: 0; padding: 0; cursor: pointer; opacity: 0; }
.color-swatch:focus-within { outline: 2px solid var(--teal); outline-offset: 3px; }
.color-pair .tool-input { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; text-transform: uppercase; letter-spacing: 1px; }
.lab-buttons { display: flex; flex-wrap: wrap; gap: 8px; }

.lab-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.lab-preview { border-radius: 22px; padding: clamp(24px, 4vw, 40px); border: 1px solid var(--line-2); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; transition: background 0.25s, color 0.25s; }
.lab-preview h2 { font-family: var(--display); font-weight: 400; font-size: clamp(40px, 5vw, 60px); line-height: 0.95; letter-spacing: 2px; }
.lab-preview p { font-size: 17px; line-height: 1.6; max-width: 620px; }
.lab-preview small { font-size: 13px; opacity: 1; }
.lab-preview-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 6px; }
.lab-preview-btn { min-height: 44px; padding: 0 20px; border-radius: 999px; border: 2px solid currentColor; font-family: var(--display); font-size: 19px; letter-spacing: 2px; background: transparent; color: inherit; }
.lab-preview a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

.lab-results { display: grid; grid-template-columns: minmax(200px, 260px) minmax(0, 1fr); gap: 20px; align-items: center; }
.ratio { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.ratio-value { font-family: var(--display); font-size: clamp(64px, 8vw, 92px); line-height: 0.9; letter-spacing: 2px; font-variant-numeric: tabular-nums; }
.ratio-value small { font-size: 0.45em; color: var(--muted); margin-left: 4px; }
.ratio-verdict { font-family: var(--display); font-size: 22px; letter-spacing: 3px; text-transform: uppercase; }
.ratio-verdict.good { color: var(--teal); }
.ratio-verdict.ok { color: var(--sun); }
.ratio-verdict.bad { color: var(--pink-soft); }
.checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.check { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); font-size: 14px; }
.check svg { width: 20px; height: 20px; flex-shrink: 0; stroke-width: 2.6; }
.check.pass svg { color: var(--teal); }
.check.fail svg { color: var(--pink-soft); }
.check strong { font-family: var(--display); font-weight: 400; font-size: 18px; letter-spacing: 1px; }
.check span { color: var(--muted); }
.check .check-min { margin-left: auto; font-variant-numeric: tabular-nums; }

.suggest-title { font-family: var(--display); font-size: 20px; letter-spacing: 3px; color: var(--sun); text-transform: uppercase; }
.suggest-lead { font-size: 15px; color: var(--muted); margin-top: 4px; }
.suggestions { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-top: 14px; }
.suggestion { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 16px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.suggestion-demo { display: flex; align-items: center; justify-content: center; min-height: 70px; border-radius: 12px; font-family: var(--display); font-size: 30px; letter-spacing: 2px; border: 1px solid var(--line); }
.suggestion-info { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 14px; color: var(--muted); }
.suggestion-info code { font-family: ui-monospace, Menlo, monospace; color: var(--text); font-size: 15px; }
.suggestion-actions { display: flex; gap: 8px; }
.suggestion-actions .tool-mini-btn { flex: 1 1 0; }
.lab-perfect { display: flex; align-items: center; gap: 12px; color: var(--text-2); }
.lab-perfect svg { width: 28px; height: 28px; color: var(--teal); flex-shrink: 0; stroke-width: 2.6; }

@media (max-width: 960px) {
  .lab-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .lab-results { grid-template-columns: minmax(0, 1fr); }
  .checks { grid-template-columns: minmax(0, 1fr); }
}

/* Títulos largos ("Laboratorio") en móviles estrechos */
@media (max-width: 600px) {
  .tool-head .section-title { font-size: clamp(40px, 11vw, 64px); overflow-wrap: anywhere; }
}
