/* static/web/hf-phase1.css — Happy Fox 2.0 Web, phase one
 * Styles for hf-phase1.js: help cards, legends, tour, avatar picker, class
 * chat. Everything is prefixed .hfp- so it can't clash with the SPA.
 * WIRING: index.html, next to hf-web.css (after it).  REMOVAL: drop the link.
 */
:root { --hfp-red: var(--blue, #e63946); --hfp-dark: var(--dark, #1d3557); --hfp-teal: var(--teal, #2ec4b6); }

/* ── Help cards ─────────────────────────────────────────────────────────── */
.hfp-help { margin: 0 0 1rem; }
.hfp-help-pill { display: none; border: 2px solid #ffe0da; background: #fff; color: var(--hfp-dark); font: 800 .78rem Nunito, sans-serif; padding: .35rem .8rem; border-radius: 20px; cursor: pointer; }
.hfp-help.closed .hfp-help-pill { display: inline-block; }
.hfp-help.closed .hfp-help-body { display: none; }
.hfp-help-body { background: #fffaf3; border: 2px solid #ffe3b8; border-radius: 16px; padding: .9rem 1.1rem .8rem; }
.hfp-help-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; font: 800 .95rem Nunito, sans-serif; color: var(--hfp-dark); margin-bottom: .4rem; }
.hfp-help-tag { font-size: .66rem; background: #ffe3b8; color: #8a5300; border-radius: 10px; padding: .12rem .5rem; white-space: nowrap; }
.hfp-help ul { margin: 0 0 .6rem 1.05rem; padding: 0; }
.hfp-help li { font-size: .84rem; line-height: 1.45; color: #3b4a5e; margin: .22rem 0; }
.hfp-help-ok { border: none; background: var(--hfp-dark); color: #fff; font: 800 .78rem Nunito, sans-serif; padding: .42rem 1rem; border-radius: 10px; cursor: pointer; }

/* ── Legend bubble ──────────────────────────────────────────────────────── */
.hfp-why { position: fixed; left: 50%; bottom: 24px; z-index: 3000; transform: translate(-50%, 140%); transition: transform .28s cubic-bezier(.2,.9,.3,1.2);
  width: min(520px, calc(100vw - 24px)); display: flex; align-items: center; gap: .7rem; background: #fff; color: var(--hfp-dark);
  border-radius: 16px; padding: .8rem .9rem; box-shadow: 0 12px 40px rgba(29,53,87,.28); border-left: 6px solid var(--hfp-teal); font: 600 .9rem/1.4 Nunito, sans-serif; }
.hfp-why.show { transform: translate(-50%, 0); }
.hfp-why.warn { border-left-color: #f4a261; }
.hfp-why-icon { font-size: 1.6rem; flex-shrink: 0; }
.hfp-why-text { flex: 1; }
.hfp-why-act { border: none; background: var(--hfp-red); color: #fff; font: 800 .8rem Nunito, sans-serif; padding: .45rem .8rem; border-radius: 10px; cursor: pointer; white-space: nowrap; }
.hfp-why-x { border: none; background: none; font-size: 1.3rem; line-height: 1; color: #9aa5b1; cursor: pointer; padding: 0 .2rem; }
@media (max-width: 760px) { .hfp-why { bottom: calc(84px + env(safe-area-inset-bottom)); } }

.hfp-net { position: fixed; top: 0; left: 0; right: 0; z-index: 3100; background: #f4a261; color: #3b2200; text-align: center;
  font: 700 .82rem Nunito, sans-serif; padding: calc(.45rem + env(safe-area-inset-top)) 1rem .45rem; transform: translateY(-100%); transition: transform .25s; }
.hfp-net.show { transform: translateY(0); }

/* ── Shared ─────────────────────────────────────────────────────────────── */
.hfp-btn { border: none; background: linear-gradient(135deg, var(--hfp-red), var(--blue-dark, #b5212e)); color: #fff; font: 800 .86rem Nunito, sans-serif; padding: .6rem 1.1rem; border-radius: 12px; cursor: pointer; }
.hfp-btn:disabled { opacity: .6; cursor: default; }
.hfp-av { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; font-size: 1.25rem; flex-shrink: 0; box-shadow: inset 0 0 0 2px rgba(255,255,255,.7); }
.hfp-av.sm { width: 26px; height: 26px; font-size: .95rem; margin-right: .4rem; vertical-align: middle; }
.hfp-av.xl { width: 88px; height: 88px; font-size: 3rem; }
.hfp-hdr-av { transition: background .2s; }
.hfp-big-av { transition: background .2s; }
.hfp-av-edit { display: block; margin: .5rem auto 0; border: 2px solid rgba(255,255,255,.6); background: rgba(255,255,255,.15); color: inherit; font: 800 .78rem Nunito, sans-serif; padding: .3rem .8rem; border-radius: 20px; cursor: pointer; }

.hfp-modal { position: fixed; inset: 0; z-index: 2600; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.hfp-modal-box { position: relative; background: #fff; border-radius: 22px; padding: 1.3rem 1.3rem 1.1rem; width: min(460px, 100%); max-height: calc(100dvh - 2rem); overflow-y: auto; font-family: Nunito, sans-serif; }
.hfp-modal-box h3 { font: 800 1.25rem 'Baloo 2', cursive; color: var(--hfp-dark); margin: 0 0 .6rem; text-align: center; }
.hfp-modal-x { position: absolute; top: .6rem; right: .8rem; border: none; background: none; font-size: 1.6rem; color: #9aa5b1; cursor: pointer; }
.hfp-av-preview { text-align: center; font-weight: 800; color: var(--hfp-dark); margin-bottom: .6rem; }
.hfp-av-preview > div { margin-top: .3rem; }
.hfp-sub { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: #8795a8; margin: .6rem 0 .4rem; }
.hfp-av-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .45rem; }
.hfp-av-opt { aspect-ratio: 1; border-radius: 50%; border: 3px solid transparent; font-size: 1.6rem; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.hfp-av-opt.on { border-color: var(--hfp-dark); transform: scale(1.06); }
.hfp-bg-grid { display: flex; flex-wrap: wrap; gap: .45rem; }
.hfp-bg-opt { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px #d9dee5; cursor: pointer; }
.hfp-bg-opt.on { box-shadow: 0 0 0 3px var(--hfp-dark); }
.hfp-note { font-size: .76rem; color: #8795a8; margin: .8rem 0; text-align: center; }
.hfp-save { width: 100%; }

.hfp-prof-extra { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin: 0 0 1rem; }
.hfp-chip-btn { border: 2px solid #eef0f4; background: #fff; color: var(--hfp-dark); font: 800 .82rem Nunito, sans-serif; padding: .55rem 1rem; border-radius: 12px; cursor: pointer; }

/* ── Tour ───────────────────────────────────────────────────────────────── */
.hfp-tour-shade { position: fixed; inset: 0; z-index: 2800; background: rgba(15,23,42,.6); }
.hfp-tour-shade.clear { background: transparent; }
.hfp-tour-ring { position: fixed; z-index: 2801; border-radius: 14px; box-shadow: 0 0 0 4px #ffd166, 0 0 0 9999px rgba(15,23,42,.6); pointer-events: none; transition: all .25s; }
.hfp-tour-card { position: fixed; z-index: 2802; background: #fff; border-radius: 18px; padding: 1rem 1.1rem .9rem; box-shadow: 0 18px 50px rgba(0,0,0,.3); font-family: Nunito, sans-serif; width: 330px; max-width: calc(100vw - 24px); }
.hfp-tour-card.center { left: 50% !important; top: 50% !important; transform: translate(-50%, -50%); width: min(380px, calc(100vw - 24px)); text-align: center; }
.hfp-tour-card h4 { font: 800 1.15rem 'Baloo 2', cursive; color: var(--hfp-dark); margin: .1rem 0 .3rem; }
.hfp-tour-card p { font-size: .9rem; line-height: 1.45; color: #3b4a5e; margin: 0 0 .8rem; }
.hfp-tour-step { font-size: .7rem; font-weight: 800; color: #9aa5b1; }
.hfp-tour-btns { display: flex; gap: .5rem; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.hfp-tour-card.center .hfp-tour-btns { justify-content: center; }
.hfp-tour-skip { border: none; background: none; color: #8795a8; font: 800 .82rem Nunito, sans-serif; cursor: pointer; margin-right: auto; }
.hfp-tour-card.center .hfp-tour-skip { margin-right: 0; }

/* ── Chat button + badge ────────────────────────────────────────────────── */
.hfp-chat-btn { position: relative; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); width: 34px; height: 34px; border-radius: 9px; cursor: pointer; font-size: .95rem; padding: 0; display: flex; align-items: center; justify-content: center; }
.hfp-chat-btn:hover { background: rgba(255,255,255,.22); }
.hfp-chat-btn .hfp-badge { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; border-radius: 9px; background: #ffd166; color: #3b2200; font: 900 .65rem Nunito, sans-serif; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.hfp-badge[hidden] { display: none !important; }

/* ── Chat panel ─────────────────────────────────────────────────────────── */
.hfp-chat { position: fixed; inset: 0; z-index: 2400; background: rgba(15,23,42,.4); display: none; justify-content: flex-end; }
.hfp-chat.open { display: flex; }
.hfp-chat-box { width: min(440px, 100%); height: 100%; height: 100dvh; background: #f6f8fb; display: flex; flex-direction: column; font-family: Nunito, sans-serif; box-shadow: -10px 0 40px rgba(0,0,0,.2); }
.hfp-chat-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: calc(.75rem + env(safe-area-inset-top)) 1rem .75rem; background: linear-gradient(135deg, var(--hfp-red), var(--blue-light, #ff7b5f)); color: #fff; }
.hfp-chat-title { font: 800 1.1rem 'Baloo 2', cursive; }
.hfp-chat-sub { font-size: .74rem; opacity: .9; }
.hfp-chat-tools { display: flex; gap: .35rem; }
.hfp-chat-tools button { border: none; background: rgba(255,255,255,.2); color: #fff; width: 34px; height: 34px; border-radius: 10px; font: 800 .85rem Nunito, sans-serif; cursor: pointer; }
.hfp-chat-x { font-size: 1.4rem !important; }
.hfp-chat-rules { background: #fff; margin: .6rem .8rem 0; padding: .7rem .9rem; border-radius: 12px; font-size: .8rem; color: #3b4a5e; }
.hfp-chat-rules ul { margin: .3rem 0 0 1rem; padding: 0; }
.hfp-chat-list { flex: 1; overflow-y: auto; padding: .8rem; display: flex; flex-direction: column; gap: .55rem; }
.hfp-chat-empty { text-align: center; color: #8795a8; font-weight: 700; margin: auto; }
.hfp-msg { display: flex; gap: .45rem; align-items: flex-end; max-width: 92%; }
.hfp-msg.mine { flex-direction: row-reverse; align-self: flex-end; }
.hfp-bubble { position: relative; background: #fff; border-radius: 16px 16px 16px 4px; padding: .45rem .7rem .4rem; box-shadow: 0 2px 8px rgba(29,53,87,.08); min-width: 90px; }
.hfp-msg.mine .hfp-bubble { background: #ffe9e4; border-radius: 16px 16px 4px 16px; }
.hfp-msg-meta { font-size: .68rem; color: #8795a8; margin-bottom: .1rem; }
.hfp-bubble .en { font-weight: 800; color: var(--hfp-dark); font-size: .95rem; }
.hfp-bubble .es { font-size: .74rem; color: #8795a8; }
.hfp-chat.nohints .es { display: none; }
.hfp-msg-emoji { font-size: 2rem; line-height: 1.1; }
.hfp-reacts { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .25rem; }
.hfp-react-chip { font-size: .72rem; background: #f1f4f8; border-radius: 10px; padding: .05rem .4rem; cursor: pointer; }
.hfp-react-chip.mine { background: #ffe3b8; }
.hfp-react-add { border: none; background: none; color: #b0b9c6; font-size: .75rem; cursor: pointer; padding: 0 .2rem; }
.hfp-react-pop { position: absolute; bottom: 100%; left: 0; background: #fff; border-radius: 20px; box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: .25rem; display: flex; gap: .1rem; z-index: 2; }
.hfp-react-pop button { border: none; background: none; font-size: 1.3rem; cursor: pointer; padding: .15rem .25rem; border-radius: 50%; }
.hfp-react-pop button:hover { background: #f1f4f8; }
.hfp-chat-closed { margin: 0 .8rem .5rem; background: #eef2f7; color: #3b4a5e; border-radius: 12px; padding: .6rem .8rem; font-size: .82rem; font-weight: 700; }
.hfp-chat-compose { background: #fff; border-top: 1px solid #e6eaf0; padding: .55rem .6rem calc(.6rem + env(safe-area-inset-bottom)); }
.hfp-chat-compose.off .hfp-chat-cats, .hfp-chat-compose.off .hfp-chat-phrases { opacity: .4; pointer-events: none; }
.hfp-chat-compose.off .hfp-chat-preview { display: none; }
.hfp-chat-preview { display: flex; align-items: center; gap: .45rem; background: #fff7ef; border: 2px solid #ffe3b8; border-radius: 14px; padding: .45rem .55rem; margin-bottom: .5rem; }
.hfp-chat-preview[hidden] { display: none; }
.hfp-chat-prev-txt { flex: 1; display: flex; flex-direction: column; }
.hfp-chat-prev-txt .en { font-weight: 800; color: var(--hfp-dark); }
.hfp-chat-prev-txt .es { font-size: .74rem; color: #8795a8; }
.hfp-chat-prev-txt .big { font-size: 1.8rem; }
.hfp-chat-say, .hfp-chat-cancel { border: none; background: #fff; width: 34px; height: 34px; border-radius: 10px; cursor: pointer; font-size: 1rem; }
.hfp-chat-say[hidden] { display: none; }
.hfp-chat-cats { display: flex; gap: .3rem; overflow-x: auto; padding-bottom: .35rem; scrollbar-width: none; }
.hfp-chat-cats::-webkit-scrollbar { display: none; }
.hfp-cat { flex-shrink: 0; border: 2px solid #eef0f4; background: #fff; color: var(--hfp-dark); border-radius: 20px; padding: .28rem .65rem; font: 800 .74rem Nunito, sans-serif; cursor: pointer; }
.hfp-cat.on { border-color: var(--hfp-red); background: #fff0ed; }
.hfp-chat-phrases { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; max-height: 30vh; max-height: 30dvh; overflow-y: auto; }
.hfp-phrase { text-align: left; border: none; background: #f4f7fb; border-radius: 12px; padding: .45rem .6rem; cursor: pointer; display: flex; flex-direction: column; font-family: Nunito, sans-serif; }
.hfp-phrase:hover { background: #eaf0f7; }
.hfp-phrase .en { font-weight: 800; font-size: .82rem; color: var(--hfp-dark); }
.hfp-phrase .es { font-size: .7rem; color: #8795a8; }
.hfp-stickers { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .3rem; }
.hfp-sticker { border: none; background: #f4f7fb; border-radius: 12px; font-size: 1.6rem; width: 52px; height: 52px; cursor: pointer; }
.hfp-nav-chat .hfp-badge { margin-left: auto; }
body.hfp-chat-on { overflow: hidden; }
@media (max-width: 760px) {
  .hfp-chat-box { width: 100%; }
  .hf-header-right .hf-xp-pill { padding-left: .55rem; padding-right: .55rem; }
}
@media (max-width: 380px) { .hfp-chat-phrases { grid-template-columns: 1fr; } }

/* ── 2.0: avatar accessory + frame, builder steps ───────────────────────── */
.hfp-av { position: relative; overflow: visible; }
.hfp-acc { position: absolute; font-size: .62em; line-height: 1; pointer-events: none; filter: drop-shadow(0 1px 1px rgba(0,0,0,.25)); }
.hfp-acc-top { top: -.42em; left: 50%; transform: translateX(-50%) rotate(-8deg); }
.hfp-acc-tl  { top: -.25em; left: -.2em; transform: rotate(-18deg); }
.hfp-acc-br  { bottom: -.2em; right: -.25em; }
.hfp-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: .3rem; margin: .4rem 0 .7rem; }
.hfp-step { border: 2px solid #eef0f4; background: #fff; border-radius: 10px; padding: .4rem .2rem; font: 800 .72rem Nunito, sans-serif; color: var(--hfp-dark); cursor: pointer; }
.hfp-step.on { border-color: var(--hfp-red); background: #fff0ed; }
.hfp-acc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; }
.hfp-acc-opt, .hfp-frame-opt { border: 2px solid #eef0f4; background: #f8fafc; border-radius: 12px; padding: .45rem .2rem; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: .2rem; font-family: Nunito, sans-serif; }
.hfp-acc-opt .e { font-size: 1.5rem; line-height: 1.1; }
.hfp-acc-opt .l, .hfp-frame-opt .l { font-size: .68rem; font-weight: 800; color: #5b6b80; }
.hfp-acc-opt.on, .hfp-frame-opt.on { border-color: var(--hfp-dark); background: #fff; }
.hfp-frame-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; }
.hfp-frame-opt .hfp-av { margin: .25rem 0; }
.hfp-av-actions { display: flex; gap: .5rem; }
.hfp-av-actions .hfp-save { flex: 1; width: auto; }
.hfp-av-preview .hfp-av.xl { margin-top: .5rem; }

/* ── 2.0: chat quick replies ────────────────────────────────────────────── */
.hfp-qr { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; margin: -.15rem 0 .2rem 2.9rem; }
.hfp-qr-l { font-size: .68rem; font-weight: 800; color: #8795a8; }
.hfp-qr button { border: 2px solid #ffe3b8; background: #fffaf3; color: var(--hfp-dark); border-radius: 14px; padding: .25rem .6rem; font: 800 .74rem Nunito, sans-serif; cursor: pointer; }
.hfp-qr button:hover { background: #ffe9c9; }
@media (max-width: 380px) { .hfp-acc-grid, .hfp-frame-grid { grid-template-columns: repeat(3, 1fr); } }
