/* Mi Turno — estilos del prototipo
   Paleta: papel cálido + verde profundo + ámbar. */

:root {
  --papel: #F6F1E7;
  --papel-2: #EFE7D8;
  --tinta: #14312C;
  --tinta-suave: #5C6B64;
  --teal: #1F5C50;
  --teal-osc: #123B34;
  --ambar: #E0A458;
  --blanco: #FFFFFF;
  --borde: #DED7C7;
  --sombra: 0 8px 0 rgba(20, 49, 44, .06), 0 2px 10px rgba(20, 49, 44, .05);
  --radio: 26px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(1200px 600px at 10% -10%, #FBF7EF 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 110%, #EFE6D4 0%, transparent 55%),
    var(--papel);
  color: var(--tinta);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; color: inherit; }
button, input { font-size: 100%; }
img { display: block; }
.oculto { display: none !important; }

:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

/* ---------- Inicio ---------- */

.inicio {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center;
  padding: 24px;
}
.inicio-caja {
  width: min(520px, 100%);
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.inicio-logo {
  width: 96px; height: 96px; border-radius: 28px;
  box-shadow: 0 14px 30px rgba(20, 49, 44, .18);
  margin-bottom: 10px;
}
.inicio-kicker {
  margin: 0; font-size: 11px; font-weight: 800; letter-spacing: .18em;
  text-transform: uppercase; color: var(--tinta-suave);
}
.inicio h1 {
  margin: 2px 0 0; font-size: clamp(40px, 8vw, 68px); line-height: .95;
  letter-spacing: -.03em;
}
.inicio-bajada {
  margin: 6px 0 16px; font-size: clamp(16px, 2.4vw, 21px);
  color: var(--tinta-suave); max-width: 34ch;
}
.inicio-nota {
  margin: 14px 0 0; font-size: 13px; color: var(--tinta-suave); max-width: 40ch;
}
.btn-grande { font-size: 20px; padding: 18px 52px; border-radius: 20px; }

/* ---------- Botones base ---------- */

.btn-principal {
  border: 0; background: var(--teal); color: #fff; font-weight: 800;
  padding: 12px 22px; border-radius: 14px; cursor: pointer;
  box-shadow: 0 4px 0 var(--teal-osc);
}
.btn-principal:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--teal-osc); }
.btn-secundario {
  border: 1px solid var(--borde); background: var(--blanco); color: var(--teal);
  font-weight: 700; padding: 11px 16px; border-radius: 14px; cursor: pointer;
}
.btn-texto {
  border: 0; background: none; color: var(--teal); font-weight: 700;
  text-decoration: underline; cursor: pointer; padding: 8px; font-size: 13px;
}
.icono {
  width: 46px; height: 46px; flex: 0 0 auto; border: 0; border-radius: 14px;
  background: var(--blanco); color: var(--teal);
  display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 2px 0 rgba(20, 49, 44, .08);
}
.icono svg { width: 23px; height: 23px; }
.icono.activo { background: var(--ambar); color: var(--teal-osc); }
.icono-chico {
  width: 38px; height: 38px; border: 0; border-radius: 12px;
  background: #EDE7DA; color: var(--teal); display: grid; place-items: center;
  cursor: pointer;
}
.icono-chico svg { width: 19px; height: 19px; }
.icono-chico:disabled { opacity: .35; cursor: default; }

/* ---------- App ---------- */

.app {
  height: 100dvh;
  display: flex; flex-direction: column;
  gap: clamp(8px, 1.2vh, 12px);
  padding: clamp(8px, 1.4vh, 14px) clamp(10px, 1.8vw, 26px) clamp(8px, 1.2vh, 12px);
}

.barra { display: flex; align-items: center; gap: 12px; min-height: 58px; }
.barra-titulo { flex: 1; min-width: 0; }
.paso {
  margin: 0 0 2px; font-size: 11px; font-weight: 800; letter-spacing: .12em;
  text-transform: uppercase; color: var(--tinta-suave);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.barra h1 {
  margin: 0; font-size: clamp(21px, 3.2vw, 31px); line-height: 1.02;
  letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- Franja de frase ---------- */

.franja {
  display: flex; align-items: center; gap: 10px;
  min-height: 56px; padding: 6px 8px 6px 14px;
  background: var(--blanco); border-radius: 18px;
  box-shadow: 0 2px 0 rgba(20, 49, 44, .06);
}
.fichas {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px;
  overflow-x: auto; scrollbar-width: none; min-height: 40px;
}
.fichas::-webkit-scrollbar { display: none; }
.franja-vacia { font-size: 14px; color: #93A09A; font-weight: 600; white-space: nowrap; }
.ficha-frase {
  flex: 0 0 auto; border: 1px solid #C9DED7; background: #EAF3F0; color: var(--teal-osc);
  font-weight: 800; font-size: 15px; padding: 7px 13px; border-radius: 999px; cursor: pointer;
}
.ficha-frase:active { background: #DCEDE7; }
.franja-acciones { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.btn-decir {
  border: 0; background: var(--ambar); color: var(--teal-osc);
  font-weight: 900; font-size: 15px; padding: 10px 20px; border-radius: 13px; cursor: pointer;
  box-shadow: 0 3px 0 #C98C3E;
}
.btn-decir:active { transform: translateY(2px); box-shadow: 0 1px 0 #C98C3E; }
.btn-decir:disabled { opacity: .4; cursor: default; box-shadow: none; }

/* ---------- Tablero ---------- */

.tablero {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: clamp(9px, 1.5vw, 18px);
}

/* 5 fichas: 3 arriba, 2 centradas abajo */
.tablero.cinco { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.tablero.cinco .ficha { grid-column: span 2; }
.tablero.cinco .ficha:nth-child(4) { grid-column: 2 / span 2; }
.tablero.cinco .ficha:nth-child(5) { grid-column: 4 / span 2; }

.ficha {
  position: relative; min-height: 0; overflow: hidden;
  border: 0; border-radius: var(--radio); background: var(--blanco);
  box-shadow: var(--sombra);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 16px 12px 14px; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.ficha:active { transform: scale(.985); box-shadow: 0 2px 0 rgba(20, 49, 44, .06); }
.ficha .etiqueta-cat {
  position: absolute; top: 12px; left: 12px;
  background: var(--cat); color: var(--tinta-cat);
  font-size: 9.5px; font-weight: 900; letter-spacing: .13em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px;
}
.ficha .figura {
  position: relative; width: min(46%, 148px); aspect-ratio: 1;
  display: grid; place-items: center;
}
.ficha .figura-fondo {
  position: absolute; inset: 0; border-radius: 50%;
  background: var(--cat); opacity: .17;
}
.ficha .figura img {
  position: relative; width: 84%; height: 84%; object-fit: contain;
}
.ficha .nombre {
  font-size: clamp(17px, 2.3vw, 28px); font-weight: 850; letter-spacing: -.015em;
  line-height: 1.03; text-align: center;
}
.ficha .lapiz {
  position: absolute; top: 10px; right: 10px;
  width: 30px; height: 30px; border-radius: 10px; background: var(--teal); color: #fff;
  display: grid; place-items: center;
}
.ficha .lapiz svg { width: 16px; height: 16px; }

/* ---------- Núcleo ---------- */

.nucleo {
  display: grid; grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px; flex: 0 0 auto;
}
.boton-nucleo {
  border: 0; border-radius: 16px; background: var(--cat); color: var(--tinta-cat);
  min-height: 74px; padding: 7px 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-weight: 900; font-size: clamp(11px, 1.3vw, 14px); line-height: 1;
  box-shadow: 0 3px 0 rgba(20, 49, 44, .16); cursor: pointer;
  transition: transform .1s ease;
}
.boton-nucleo:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(20, 49, 44, .16); }
.boton-nucleo img { width: 26px; height: 26px; object-fit: contain; }

/* ---------- Pie ---------- */

.pie { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 42px; }
.btn-nav {
  border: 1px solid var(--borde); background: transparent; color: var(--teal);
  font-weight: 800; font-size: 13px; padding: 9px 16px; border-radius: 12px; cursor: pointer;
}
.btn-nav:active { background: #EDE7DA; }
.puntos { display: flex; align-items: center; gap: 6px; }
.punto { width: 7px; height: 7px; border-radius: 999px; background: #D5CDBD; transition: all .2s; }
.punto.activo { width: 22px; background: var(--teal); }

/* ---------- Menú ---------- */

.capa {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(20, 49, 44, .38);
  display: grid; align-items: end;
}
.hoja {
  width: 100%; max-height: 92dvh; overflow-y: auto;
  background: var(--papel); border-radius: 26px 26px 0 0;
  padding: 18px clamp(14px, 3vw, 28px) 22px;
  box-shadow: 0 -10px 40px rgba(20, 49, 44, .2);
}
.hoja-cabeza { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.hoja-cabeza h2 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.menu-tableros { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.menu-tablero {
  border: 0; border-radius: 16px; background: var(--blanco); padding: 14px 14px;
  text-align: left; cursor: pointer; box-shadow: 0 2px 0 rgba(20, 49, 44, .07);
  display: flex; flex-direction: column; gap: 3px;
}
.menu-tablero.actual { outline: 2px solid var(--teal); }
.menu-tablero .n { font-size: 10px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; color: var(--tinta-suave); }
.menu-tablero .t { font-size: 16px; font-weight: 850; letter-spacing: -.01em; }
.menu-tablero .s { font-size: 12px; color: var(--tinta-suave); }
.menu-extra { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* ---------- Diálogos ---------- */

.dlg {
  border: 0; padding: 0; border-radius: 24px;
  width: min(430px, calc(100% - 28px));
  background: var(--papel); color: var(--tinta);
  box-shadow: 0 30px 80px rgba(20, 49, 44, .35);
}
.dlg::backdrop { background: rgba(20, 49, 44, .45); backdrop-filter: blur(3px); }
.dlg-caja { padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.dlg h2 { margin: 0 0 2px; font-size: 22px; letter-spacing: -.02em; }
.dlg-texto { margin: 0; font-size: 14px; color: var(--tinta-suave); line-height: 1.45; }
.dlg-botones { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
.dlg-pista { margin: 2px 0 0; font-size: 11px; color: #99A39D; text-align: center; }
.error { margin: 0; color: #A63226; font-size: 13px; font-weight: 700; }
.campo { position: relative; display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 800; color: var(--tinta-suave); }
.campo input[type=text] {
  border: 1.5px solid var(--borde); background: var(--blanco); border-radius: 12px;
  padding: 12px 14px; font-size: 17px; font-weight: 700; color: var(--tinta);
}
.campo input[type=range] { accent-color: var(--teal); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 700; }
.check input { width: 20px; height: 20px; accent-color: var(--teal); }
.pin-input {
  border: 1.5px solid var(--borde); background: var(--blanco); border-radius: 14px;
  padding: 12px; font-size: 30px; letter-spacing: 14px; text-align: center; color: var(--tinta);
  font-weight: 800;
}
.edit-preview {
  display: flex; align-items: center; gap: 14px; background: var(--blanco);
  border-radius: 16px; padding: 12px; border: 1px solid var(--borde);
}
.edit-preview img { width: 64px; height: 64px; object-fit: contain; }
.edit-preview span { font-weight: 800; font-size: 17px; }
.archivo input { font-size: 13px; font-weight: 600; }
.creditos { margin: 0; padding-left: 18px; font-size: 13px; color: var(--tinta-suave); line-height: 1.5; }
#vol-valor { position: absolute; right: 0; top: 0; font-weight: 800; color: var(--teal); }

/* ---------- Toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 16px);
  background: var(--teal-osc); color: #fff; font-weight: 800; font-size: 14px;
  padding: 11px 20px; border-radius: 999px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 60; max-width: 90vw; text-align: center;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Modo calma ---------- */

body.calma { background: #EDE7DB; }
body.calma .ficha { box-shadow: none; border: 1px solid var(--borde); }
body.calma .ficha .figura-fondo { opacity: .08; }
body.calma .boton-nucleo { box-shadow: none; }
body.calma .franja { box-shadow: none; border: 1px solid var(--borde); }
body.calma .icono { box-shadow: none; border: 1px solid var(--borde); }

/* ---------- Responsive ---------- */

@media (max-width: 760px) {
  .app { gap: 7px; padding: 7px 8px 8px; }
  .barra { min-height: 50px; gap: 8px; }
  .barra h1 { font-size: 20px; }
  .paso { font-size: 9.5px; letter-spacing: .08em; }
  .icono { width: 40px; height: 40px; border-radius: 12px; }
  .icono svg { width: 20px; height: 20px; }
  .franja { min-height: 48px; padding: 4px 6px 4px 10px; border-radius: 15px; }
  .franja-vacia { font-size: 12px; }
  .ficha-frase { font-size: 13px; padding: 6px 10px; }
  .btn-decir { padding: 8px 14px; font-size: 13px; }
  .tablero { --cols: 2 !important; gap: 8px; }
  .tablero.cinco { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tablero.cinco .ficha,
  .tablero.cinco .ficha:nth-child(4),
  .tablero.cinco .ficha:nth-child(5) { grid-column: auto; }
  .ficha { border-radius: 18px; padding: 12px 8px 10px; }
  .ficha .etiqueta-cat { top: 8px; left: 8px; font-size: 8px; padding: 3px 7px; }
  .ficha .figura { width: min(52%, 120px); }
  .ficha .nombre { font-size: 16px; }
  .nucleo {
    display: flex; overflow-x: auto; gap: 7px; padding-bottom: 3px;
    scrollbar-width: none;
  }
  .nucleo::-webkit-scrollbar { display: none; }
  .boton-nucleo { flex: 0 0 72px; min-height: 62px; border-radius: 14px; font-size: 10.5px; }
  .boton-nucleo img { width: 22px; height: 22px; }
  .pie { min-height: 36px; }
  .btn-nav { padding: 8px 12px; font-size: 12px; }
  .hoja { border-radius: 22px 22px 0 0; }
}

@media (max-height: 560px) and (orientation: landscape) {
  .barra { min-height: 46px; }
  .franja { min-height: 44px; }
  .nucleo { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .boton-nucleo { min-height: 54px; font-size: 10px; }
  .boton-nucleo img { width: 20px; height: 20px; }
  .pie { min-height: 34px; }
  .ficha .figura { width: min(38%, 96px); }
  .ficha .nombre { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
