@import url("identidad/tokens.css");
@import url("https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;600;700&family=Nunito:wght@400;600;700&family=Patrick+Hand&display=swap");

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--tb-bg);
  color: var(--tb-text);
  font-family: var(--tb-font-body);
  line-height: 1.5;
  padding: env(safe-area-inset-top) 0 0;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .display { font-family: var(--tb-font-display); }
button { font-family: var(--tb-font-display); cursor: pointer; }
:focus-visible { outline: 3px solid var(--tb-cielo); outline-offset: 2px; border-radius: 8px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.app { max-width: 720px; margin: 0 auto; padding: 16px 18px 120px; }

/* Cabecera */
.top { display: flex; align-items: center; gap: 12px; padding: 8px 0 4px; }
.top img { height: 54px; }
.top .saludo { font-family: var(--tb-font-display); color: var(--tb-verde); font-size: 1.5rem; line-height: 1.1; }
.top .fecha { color: var(--tb-text-muted); font-size: .95rem; }
.top .marca-mini { font-size: .72rem; color: var(--tb-oro); font-family: var(--tb-font-body); font-weight: 700; }
.top .perfil-btn { margin-left: auto; align-self: flex-start; background: var(--tb-papel-2); border: 2px solid var(--tb-border);
  border-radius: 999px; padding: 8px 14px; color: var(--tb-verde-oscuro); font-size: .95rem; }

/* Modos de imagen */
.modos { display: flex; gap: 8px; margin-bottom: 12px; }
.modo { flex: 1; background: var(--tb-papel); border: 3px solid var(--tb-border); border-radius: 14px;
  padding: 10px 4px; color: var(--tb-text-muted); font-size: 1rem; }
.modo.sel { border-color: var(--tb-verde); background: #EAF7EE; color: var(--tb-verde-oscuro); }
.preview-box { position: relative; border: 3px dashed var(--tb-cielo); border-radius: 16px; background: #fff;
  min-height: 240px; display: grid; place-items: center; overflow: hidden; }
.preview-box img { width: 100%; max-height: 340px; object-fit: contain; display: none; }
.preview-box img[src] { display: block; }
.preview-box #previewVacio { color: var(--tb-text-muted); font-family: var(--tb-font-body); }
.preview-box img[src] ~ #previewVacio { display: none; }

/* Tarjeta de campo */
.card { background: var(--tb-surface); border: 3px solid var(--tb-border); border-radius: var(--tb-radio);
  padding: 16px; margin: 16px 0; box-shadow: 0 4px 0 rgba(0,0,0,.04); }
.card > .label { display: flex; align-items: center; gap: 10px; font-family: var(--tb-font-display);
  font-size: 1.25rem; color: var(--tb-verde-oscuro); margin-bottom: 10px; }
.card .clover-dot { width: 26px; height: 26px; flex: 0 0 auto; }

/* Ánimo */
.moods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.mood { background: var(--tb-papel); border: 3px solid var(--tb-border); border-radius: 16px;
  padding: 10px 4px; display: grid; gap: 6px; justify-items: center; font-size: .9rem; color: var(--tb-text-muted); }
.mood svg { width: 46px; height: 46px; }
.mood.sel { border-color: var(--tb-verde); background: #EAF7EE; color: var(--tb-verde-oscuro); font-weight: 700; }

/* Campos de texto + voz */
.field { position: relative; }
textarea, input[type=text], input[type=number] {
  width: 100%; font-family: var(--tb-font-mano); font-size: 1.35rem; color: var(--tb-tinta);
  background: var(--tb-papel); border: 3px solid var(--tb-border); border-radius: 14px;
  padding: 14px 56px 14px 14px; resize: vertical; line-height: 1.9;
  background-image: repeating-linear-gradient(transparent, transparent 47px, #EADFC4 47px, #EADFC4 49px);
}
textarea:focus, input:focus { border-color: var(--tb-cielo); outline: none; }
.mic { position: absolute; right: 10px; bottom: 10px; width: 46px; height: 46px; border-radius: 50%;
  border: none; background: var(--tb-cielo); color: #fff; font-size: 1.4rem; display: grid; place-items: center;
  box-shadow: 0 3px 0 rgba(0,0,0,.12); }
.mic.rec { background: var(--tb-coral); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{ transform: scale(1);} 50%{ transform: scale(1.12);} }
.mic[hidden] { display: none; }

/* Dibujo */
.canvas-wrap { position: relative; }
canvas { width: 100%; height: 260px; background: #fff; border: 3px dashed var(--tb-verde);
  border-radius: 16px; touch-action: none; display: block; }
.tools { display: flex; gap: 8px; margin-top: 10px; }
.tool { background: var(--tb-papel-2); border: 2px solid var(--tb-border); border-radius: 999px;
  padding: 8px 14px; color: var(--tb-verde-oscuro); font-size: .95rem; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--tb-border); }
.swatch.sel { box-shadow: 0 0 0 3px var(--tb-tinta); }

/* Barra inferior */
.bottom { position: fixed; left: 0; right: 0; bottom: 0; background: var(--tb-surface);
  border-top: 3px solid var(--tb-border); padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  display: flex; gap: 10px; justify-content: center; }
.btn { border: none; border-radius: 999px; padding: 14px 20px; font-size: 1.05rem; }
.btn-primary { background: var(--tb-verde); color: #fff; box-shadow: 0 4px 0 #218a3f; }
.btn-ghost { background: var(--tb-papel-2); color: var(--tb-verde-oscuro); border: 2px solid var(--tb-border); }
.saved { text-align: center; color: var(--tb-verde); font-size: .9rem; height: 20px; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(20,40,30,.5); display: none; place-items: center; padding: 20px; z-index: 30; }
.modal.open { display: grid; }
.sheet { background: var(--tb-surface); border-radius: 24px; padding: 22px; width: min(520px, 100%); max-height: 86vh; overflow: auto; }
.sheet h2 { color: var(--tb-verde); margin: 0 0 14px; }
.sheet label { display: block; font-family: var(--tb-font-display); color: var(--tb-verde-oscuro); margin: 12px 0 4px; }
.sheet input { padding-right: 14px; background-image: none; font-family: var(--tb-font-body); font-size: 1.1rem; }
.dias { display: grid; gap: 8px; }
.dia { display: flex; gap: 10px; align-items: center; background: var(--tb-papel); border: 2px solid var(--tb-border);
  border-radius: 12px; padding: 10px 12px; text-align: left; width: 100%; color: var(--tb-tinta); }
.dia b { color: var(--tb-verde-oscuro); }
.dia .dia-txt { flex: 1; text-align: left; }
.dia .exp { flex: 0 0 auto; background: var(--tb-verde); color: #fff; border: none; border-radius: 999px;
  padding: 8px 12px; font-size: .9rem; font-family: var(--tb-font-display); }
.nino { cursor: pointer; }
.nino.activo { border-color: var(--tb-verde); background: #EAF7EE; }
.nino .edit { background: var(--tb-papel-2); border: 2px solid var(--tb-border); border-radius: 999px;
  padding: 6px 10px; font-size: .85rem; color: var(--tb-verde-oscuro); }
.nino-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--tb-grad-sol); display: grid;
  place-items: center; font-family: var(--tb-font-display); color: var(--tb-verde-oscuro); flex: 0 0 auto; }
.nota { font-size: .85rem; color: var(--tb-text-muted); }
.hint-voz { font-size: .8rem; color: var(--tb-text-muted); margin-top: 6px; }
