:root {
  --blue: #0B6BDD;
  --blue-dark: #084FB2;
  --navy: #0F2747;
  --bg: #F5F7FA;
  --surface: #FFFFFF;
  --text: #222222;
  --muted: #697386;
  --border: #D8DEE8;
  --correct: #36A269;
  --present: #D6A72C;
  --absent: #7B8494;
  --tile-size: min(13.5vw, 64px);
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: radial-gradient(circle at top, #FFFFFF 0, var(--bg) 48%, #EAF0F7 100%);
  color: var(--text);
  font-family: "Ubuntu", system-ui, sans-serif;
}
button { font: inherit; }
.app-shell { width: min(100%, 620px); min-height: 100vh; margin: auto; padding: 14px 16px 26px; display: flex; flex-direction: column; }
.topbar { min-height: 86px; display: grid; grid-template-columns: 46px 1fr 46px; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); }
.brand { text-align: center; }
.brand-kicker { display: block; color: var(--blue); font-size: .72rem; font-weight: 700; letter-spacing: .18em; }
h1 { margin: 2px 0 0; color: var(--navy); font-size: clamp(1.75rem, 7vw, 2.35rem); line-height: 1; }
.brand p { margin: 5px 0 0; color: var(--muted); font-size: .78rem; }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--navy); font-weight: 700; font-size: 1.2rem; cursor: pointer; box-shadow: 0 5px 15px rgba(15,39,71,.06); }
.day-marker { width: 46px; min-height: 42px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--blue-dark); font-size: .66rem; font-weight: 700; letter-spacing: .02em; box-shadow: 0 5px 15px rgba(15,39,71,.06); }
main { flex: 1; display: flex; flex-direction: column; align-items: center; }
.status { width: 100%; text-align: center; min-height: 72px; padding-top: 14px; }
.status p { margin: 0 0 4px; font-weight: 700; color: var(--navy); }
.status span { color: var(--muted); font-size: .85rem; }
.tablero { display: grid; grid-template-rows: repeat(6, var(--tile-size)); gap: 6px; margin: 4px auto 20px; }
.fila { display: grid; grid-template-columns: repeat(5, var(--tile-size)); gap: 6px; }
.celda { display: grid; place-items: center; width: var(--tile-size); height: var(--tile-size); border: 2px solid var(--border); border-radius: 10px; background: rgba(255,255,255,.9); color: var(--navy); font-size: clamp(1.45rem, 7vw, 2rem); font-weight: 700; text-transform: uppercase; }
.celda.filled { border-color: #9AA7B7; animation: pop .08s ease; }
.celda.correct, .tecla.correct { background: var(--correct); border-color: var(--correct); color: #fff; }
.celda.present, .tecla.present { background: var(--present); border-color: var(--present); color: #fff; }
.celda.absent, .tecla.absent { background: var(--absent); border-color: var(--absent); color: #fff; }
.celda.reveal { animation: flip .45s ease both; }
.teclado { width: 100%; display: grid; gap: 7px; user-select: none; }
.teclado-fila { display: flex; justify-content: center; gap: 5px; }
.tecla { min-width: 0; flex: 1 1 0; height: 50px; max-width: 48px; padding: 0 4px; border: 0; border-radius: 8px; background: #DCE3EC; color: var(--navy); font-weight: 700; cursor: pointer; }
.tecla.wide { flex: 1.55 1 0; max-width: 76px; font-size: .73rem; }
.resultado-button { min-width: 150px; }
.resumen-diario { width: 100%; }
.resumen-diario[hidden] { display: none; }
.resumen-encabezado { display: flex; align-items: center; justify-content: center; gap: 12px; padding-right: 22px; text-align: left; }
.resumen-insignia { width: 48px; height: 48px; display: grid; place-items: center; flex: 0 0 48px; border-radius: 50%; background: #EAF3FF; color: var(--blue); font-size: 1.5rem; font-weight: 700; }
.resumen-kicker { display: block; color: var(--blue); font-size: .68rem; font-weight: 700; letter-spacing: .12em; }
.resumen-diario h2 { margin: 2px 0 0; color: var(--navy); font-size: 1.3rem; }
.resumen-frase { margin: 16px auto 18px; text-align: center; color: var(--navy); font-weight: 500; line-height: 1.45; }
.resumen-metricas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.resumen-metricas div { min-width: 0; padding: 11px 5px; border-radius: 12px; background: var(--bg); text-align: center; }
.resumen-metricas strong { display: block; color: var(--navy); font-size: 1.3rem; }
.resumen-metricas span { display: block; margin-top: 3px; color: var(--muted); font-size: .68rem; line-height: 1.15; }
.resumen-acciones { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.resumen-acciones button { width: 100%; }
.sheet-handle { display: none; }
.acciones { min-height: 54px; display: flex; gap: 10px; justify-content: center; align-items: center; margin: 18px 0 4px; }
.primary-button, .secondary-button { border-radius: 12px; padding: 12px 17px; font-weight: 700; cursor: pointer; }
.primary-button { border: 0; background: var(--blue); color: #fff; }
.secondary-button { border: 1px solid var(--blue); background: #fff; color: var(--blue-dark); }
footer { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); text-align: center; color: var(--muted); display: grid; gap: 3px; }
footer strong { color: var(--navy); }
footer small { margin-top: 4px; font-size: .68rem; }
dialog { width: min(92vw, 480px); border: 0; border-radius: 18px; padding: 0; box-shadow: 0 24px 80px rgba(15,39,71,.25); }
dialog::backdrop { background: rgba(15,39,71,.48); }
dialog.modal-resultado { width: min(92vw, 520px); border-radius: 22px; overflow: visible; }
dialog.modal-resultado[open] { animation: modalIn .22s ease-out both; }
.resumen-sheet { position: relative; padding: 26px; background: var(--surface); border-radius: inherit; }
.modal-card { position: relative; padding: 28px; }
.modal-card h2 { margin-top: 0; color: var(--navy); }
.modal-close { position: absolute; right: 15px; top: 12px; border: 0; background: transparent; font-size: 1.7rem; cursor: pointer; color: var(--muted); }
.ejemplos { display: grid; gap: 12px; margin: 22px 0; }
.ejemplos div { display: flex; align-items: center; gap: 12px; }
.ejemplos p { margin: 0; }
.mini { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; border-radius: 7px; color: #fff; font-weight: 700; }
.mini.correct { background: var(--correct); }.mini.present { background: var(--present); }.mini.absent { background: var(--absent); }
.nota { color: var(--muted); font-size: .9rem; }
.toast { position: fixed; left: 50%; top: 112px; transform: translate(-50%, -20px); background: var(--navy); color: white; padding: 10px 15px; border-radius: 10px; opacity: 0; pointer-events: none; transition: .2s; font-weight: 700; z-index: 20; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.shake { animation: shake .35s ease; }
@keyframes pop { 50% { transform: scale(1.08); } }
@keyframes flip { 0% { transform: rotateX(0); } 50% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
@keyframes shake { 20%,60% { transform: translateX(-5px); } 40%,80% { transform: translateX(5px); } }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes sheetUp { from { opacity: 0; transform: translateY(100%); } to { opacity: 1; transform: translateY(0); } }
@media (max-height: 720px) { :root { --tile-size: min(11.5vw, 54px); } .topbar{min-height:72px}.status{min-height:58px;padding-top:9px}.tecla{height:44px}.tablero{margin-bottom:12px}.acciones{margin-top:10px} footer{display:none} }
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { animation-duration:.01ms!important; transition-duration:.01ms!important; } }

@media (max-width: 600px) {
  dialog.modal-resultado {
    width: 100%;
    max-width: none;
    max-height: min(92dvh, 720px);
    margin: auto 0 0;
    border-radius: 24px 24px 0 0;
  }
  dialog.modal-resultado[open] { animation: sheetUp .28s ease-out both; }
  .resumen-sheet {
    max-height: min(92dvh, 720px);
    overflow-y: auto;
    padding: 12px 18px calc(18px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
  }
  .sheet-handle {
    display: block;
    width: 42px;
    height: 5px;
    margin: 0 auto 13px;
    border-radius: 999px;
    background: #C9D1DC;
  }
  .resumen-encabezado { justify-content: flex-start; padding-right: 28px; }
  .resumen-frase { margin: 14px 0 16px; text-align: left; }
  .resumen-metricas { grid-template-columns: repeat(2, 1fr); }
  .resumen-metricas div { padding: 11px 7px; }
  .resumen-acciones { grid-template-columns: 1fr; }
  .resumen-acciones .primary-button { order: 1; }
  .resumen-acciones .secondary-button { order: 2; }
}
@media (max-width: 360px) {
  .resumen-sheet { padding-inline: 14px; }
  .resumen-insignia { width: 44px; height: 44px; flex-basis: 44px; }
}
