*,*::before,*::after{margin:0;padding:0;box-sizing:border-box}
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;background:#f5f7fa;height:100vh;height:100dvh;overflow:hidden;-webkit-font-smoothing:antialiased}

/* ── AUTH ── */
#authScreen{display:flex;align-items:center;justify-content:center;height:100vh;height:100dvh;background:linear-gradient(135deg,#667eea,#764ba2);padding:16px;overflow-y:auto}
.auth-card{background:white;border-radius:20px;padding:28px 20px;width:100%;max-width:440px;box-shadow:0 20px 60px rgba(0,0,0,.2)}
.auth-logo{text-align:center;margin-bottom:24px}
.auth-logo .emoji{font-size:44px}
.auth-logo h1{font-size:22px;font-weight:800;color:#1f2937;margin-top:8px}
.auth-logo p{font-size:13px;color:#6b7280;margin-top:3px;word-break:break-all}
.auth-tabs{display:flex;background:#f3f4f6;border-radius:10px;padding:4px;margin-bottom:20px}
.auth-tab{flex:1;padding:9px;border:none;background:none;border-radius:8px;font-size:13px;font-weight:600;cursor:pointer;color:#6b7280;transition:.2s}
.auth-tab.active{background:white;color:#667eea;box-shadow:0 2px 8px rgba(0,0,0,.1)}
.form-row{display:grid;gap:12px;margin-bottom:12px}
.form-row.cols2{grid-template-columns:1fr 1fr}
.form-group{display:flex;flex-direction:column;gap:5px}
.form-group label{font-size:12px;font-weight:600;color:#374151}
.form-input{padding:10px 13px;border:2px solid #e5e7eb;border-radius:9px;font-size:14px;font-family:inherit;transition:.2s;width:100%;min-width:0;box-sizing:border-box}
.form-input:focus{outline:none;border-color:#667eea}
.form-input.error-field{border-color:#ef4444}
select.form-input{appearance:auto}
.auth-btn{width:100%;padding:13px;border:none;border-radius:10px;background:linear-gradient(135deg,#667eea,#764ba2);color:white;font-size:15px;font-weight:700;cursor:pointer;margin-top:8px;transition:.15s}
.auth-btn:disabled{opacity:.6;cursor:not-allowed}
.auth-btn:active:not(:disabled){transform:scale(.98)}
.auth-error{background:#fef2f2;border:1px solid #fecaca;color:#dc2626;padding:10px 14px;border-radius:8px;font-size:13px;margin-bottom:14px;display:none;word-wrap:break-word}
.auth-error.show{display:block}
.auth-success{background:#f0fdf4;border:1px solid #bbf7d0;color:#166534;padding:12px 14px;border-radius:8px;font-size:13px;margin-bottom:14px;display:none;line-height:1.5;word-wrap:break-word}
.auth-success.show{display:block}
.auth-link{text-align:center;margin-top:14px;font-size:13px;color:#6b7280}
.auth-link button{background:none;border:none;color:#667eea;cursor:pointer;font-weight:600;font-size:13px}
.section-divider{font-size:11px;font-weight:700;color:#9ca3af;text-transform:uppercase;letter-spacing:.5px;margin:16px 0 10px}
.field-err{display:block;font-size:11px;color:#dc2626;margin-top:3px;min-height:14px}

/* pending verify banner */
.verify-banner{background:#fef3c7;border:1px solid #fcd34d;border-radius:12px;padding:20px;text-align:center}
.verify-banner .icon{font-size:44px;margin-bottom:10px}
.verify-banner h2{color:#92400e;font-size:16px;margin-bottom:8px}
.verify-banner p{color:#92400e;font-size:13px;line-height:1.5;margin-bottom:14px}
.resend-btn{padding:9px 22px;border:2px solid #f59e0b;background:white;border-radius:8px;color:#92400e;font-weight:600;cursor:pointer;font-size:13px}

/* ── APP ── */
#appScreen{display:none;height:100vh;height:100dvh;flex-direction:column}
#appScreen.show{display:flex}
.app-body{display:flex;flex:1;overflow:hidden}

/* header */
.hdr{background:linear-gradient(135deg,#667eea,#764ba2);color:white;padding:12px 14px;flex-shrink:0}
.hdr-r1{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}
.hdr-left{display:flex;align-items:center;gap:9px}
.tutor-brand-avatar{width:38px;height:38px;flex-shrink:0;filter:drop-shadow(0 6px 10px rgba(14,26,73,.22))}
.hdr-left h1{font-size:17px;font-weight:700}
.hdr-left p{font-size:11px;opacity:.85}
.hdr-right{display:flex;align-items:center;gap:7px}
.avatar{width:33px;height:33px;border-radius:50%;background:rgba(255,255,255,.25);display:flex;align-items:center;justify-content:center;font-weight:700;font-size:14px;cursor:pointer;border:2px solid rgba(255,255,255,.4)}
.menu-btn{padding:6px;border:none;border-radius:8px;background:rgba(255,255,255,.2);color:white;cursor:pointer;font-size:17px;line-height:1}
.hdr-r2{display:flex;gap:7px;flex-wrap:wrap}
.lang-sel{flex:1;min-width:130px;padding:8px 10px;border:none;border-radius:8px;font-size:12px;font-weight:600;cursor:pointer}
.mode-btn{padding:8px 12px;border:none;border-radius:8px;font-size:12px;font-weight:600;cursor:pointer;background:rgba(255,255,255,.2);color:white;transition:.2s}
.mode-btn.active{background:white;color:#667eea}
.prog-bar{margin-top:9px}
.prog-label{display:flex;justify-content:space-between;font-size:11px;margin-bottom:4px;opacity:.9}
.prog-track{height:5px;background:rgba(255,255,255,.3);border-radius:3px;overflow:hidden}
.prog-fill{height:100%;background:white;transition:width .4s;border-radius:3px}

/* messages */
.chat{flex:1;display:flex;flex-direction:column;background:white;min-width:0}
.tts-player{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 14px;border-bottom:1px solid #eef2f7;background:linear-gradient(180deg,#fbfcff,#f5f7fb)}
.tts-meta{display:flex;flex-direction:column;gap:2px;min-width:0}
.tts-meta strong{font-size:12px;color:#1f2937}
.tts-meta span{font-size:11px;color:#6b7280;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
.tts-controls{display:flex;align-items:center;gap:8px;flex-shrink:0}
.tts-btn{padding:7px 10px;border:none;border-radius:8px;background:#e9eefb;color:#334155;cursor:pointer;font-weight:700}
.tts-btn:disabled{opacity:.45;cursor:not-allowed}
.tts-speed-wrap{display:flex;align-items:center;gap:6px;font-size:11px;color:#475569}
.tts-speed{border:1px solid #dbe2f0;border-radius:8px;padding:5px 8px;background:white;font-size:11px;color:#1f2937}
.msgs{flex:1;overflow-y:auto;padding:14px;-webkit-overflow-scrolling:touch}
.empty-st{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;color:#9ca3af;text-align:center}
.empty-st span{font-size:48px;margin-bottom:12px;display:block}
.msg{display:flex;margin-bottom:12px;animation:fi .25s}
@keyframes fi{from{opacity:0;transform:translateY(7px)}to{opacity:1;transform:none}}
.msg.user{justify-content:flex-end}
.assistant-row{display:flex;align-items:flex-end;gap:10px;max-width:88%}
.assistant-avatar{width:34px;height:34px;border-radius:12px;background:linear-gradient(135deg,#7c9bff,#6f4db8);padding:3px;flex-shrink:0;box-shadow:0 10px 18px rgba(74,76,170,.18)}
.assistant-avatar img{display:block;width:100%;height:100%}
.bubble{max-width:78%;padding:10px 14px;border-radius:16px;word-break:break-word;font-size:14px;line-height:1.5}
.user .bubble{background:linear-gradient(135deg,#667eea,#764ba2);color:white;border-bottom-right-radius:4px}
.assistant .bubble{background:#f3f4f6;color:#1f2937;border-bottom-left-radius:4px}
.transl{font-size:12px;opacity:.65;padding-top:6px;border-top:1px solid rgba(0,0,0,.08);margin-top:6px;line-height:1.4}
.vbtns{display:flex;gap:5px;margin-top:7px}
.vbtn{padding:4px 9px;border:none;border-radius:6px;font-size:11px;cursor:pointer;background:rgba(0,0,0,.06);transition:.15s}
.vbtn.playing{background:#10b981;color:white}
.user .vbtns{justify-content:flex-end;margin-top:5px}
.user .vbtn{background:rgba(255,255,255,.22);color:rgba(255,255,255,.95)}
.user .vbtn.playing{background:#10b981;color:white}
.mtime{font-size:10px;opacity:.5;margin-top:4px}
.typing{display:flex;gap:4px;padding:8px}
.dot{width:7px;height:7px;background:#9ca3af;border-radius:50%;animation:bounce 1.3s infinite ease-in-out both}
.dot:nth-child(1){animation-delay:-.32s}.dot:nth-child(2){animation-delay:-.16s}
@keyframes bounce{0%,80%,100%{transform:scale(0)}40%{transform:scale(1)}}

/* input */
.inp-area{padding:11px 13px;background:white;border-top:1px solid #e5e7eb;display:flex;gap:7px;align-items:flex-end}
.inp-wrap{flex:1;display:flex;flex-direction:column;min-width:0}
.voice-status{font-size:11px;color:#6b7280;margin-top:6px;min-height:15px}
.voice-status.active{color:#2563eb}
.voice-status.error{color:#dc2626}
.voice-status.success{color:#059669}
.char-count{font-size:10px;color:#9ca3af;text-align:right;margin-top:2px;transition:color .2s}
.char-count.warn{color:#f59e0b}
.char-count.danger{color:#ef4444}
.mic-btn{padding:10px;border:none;border-radius:10px;background:#f3f4f6;cursor:pointer;font-size:17px;flex-shrink:0;transition:.2s}
.mic-btn.rec{background:#ef4444}
.wave{display:none;align-items:center;gap:2px;height:18px;flex-shrink:0}
.wave.active{display:flex}
.wave span{display:block;width:3px;border-radius:2px;background:#ef4444;animation:wv .8s ease-in-out infinite alternate}
.wave span:nth-child(1){height:6px;animation-delay:0s}
.wave span:nth-child(2){height:12px;animation-delay:.15s}
.wave span:nth-child(3){height:18px;animation-delay:.3s}
.wave span:nth-child(4){height:12px;animation-delay:.45s}
.wave span:nth-child(5){height:6px;animation-delay:.6s}
@keyframes wv{from{transform:scaleY(.4)}to{transform:scaleY(1)}}
.txt-inp{width:100%;padding:10px 13px;border:2px solid #e5e7eb;border-radius:10px;font-size:14px;resize:none;max-height:100px;font-family:inherit;line-height:1.4}
.txt-inp:focus{outline:none;border-color:#667eea}
.snd-btn{padding:10px 16px;border:none;border-radius:10px;background:linear-gradient(135deg,#667eea,#764ba2);color:white;cursor:pointer;font-size:15px;flex-shrink:0;transition:.15s}
.snd-btn:disabled{opacity:.4;cursor:not-allowed}

/* sidebar */
.sidebar{width:290px;background:white;border-left:1px solid #e5e7eb;overflow-y:auto;display:none;flex-shrink:0}
@media(min-width:768px){.sidebar{display:block}.menu-btn{display:none}.bubble{max-width:60%}}
@media(max-width:767px){.sidebar.open{display:block;position:fixed;top:0;right:0;bottom:0;z-index:200;box-shadow:-4px 0 20px rgba(0,0,0,.12);width:270px}}
.sec{padding:13px;border-bottom:1px solid #f0f0f0}
.sec-title{font-size:11px;font-weight:700;color:#6b7280;text-transform:uppercase;letter-spacing:.5px;margin-bottom:9px}
.fb-item{padding:8px 10px;margin-bottom:6px;border-radius:7px;font-size:12px;line-height:1.4}
.fb-success{background:#d1fae5;color:#065f46}.fb-warning{background:#fef3c7;color:#92400e}.fb-info{background:#dbeafe;color:#1e40af}
.goal-item{display:flex;gap:7px;padding:8px;background:#f9fafb;border-radius:7px;margin-bottom:6px;font-size:12px;align-items:flex-start}
.goal-text{flex:1;line-height:1.4}
.goal-del{color:#ef4444;cursor:pointer;font-weight:700;opacity:0;font-size:13px}
.goal-item:hover .goal-del{opacity:1}
.add-goal{width:100%;padding:8px;border:2px dashed #d1d5db;background:none;border-radius:7px;color:#6b7280;cursor:pointer;font-size:12px}
.add-goal:hover{border-color:#667eea;color:#667eea}
.stat-row{display:flex;justify-content:space-between;margin-bottom:6px;font-size:12px}
.stat-l{color:#6b7280}.stat-v{font-weight:600;color:#1f2937}
.save-sess{width:100%;padding:9px;border:none;border-radius:7px;background:#10b981;color:white;font-weight:600;cursor:pointer;margin-top:9px;font-size:12px}
.jentry{padding:8px;background:#f9fafb;border-radius:7px;margin-bottom:6px;font-size:11px;line-height:1.5}
.jdate{font-weight:600;color:#1f2937;margin-bottom:2px}
.jdetail{color:#6b7280}

/* user menu */
.umenu{position:absolute;top:60px;right:14px;background:white;border-radius:12px;box-shadow:0 8px 24px rgba(0,0,0,.15);width:210px;z-index:300;overflow:hidden;display:none}
.umenu.open{display:block}
.umenu-hdr{padding:14px;background:linear-gradient(135deg,#667eea,#764ba2);color:white}
.umenu-name{font-weight:700;font-size:14px}
.umenu-email{font-size:11px;opacity:.85;margin-top:2px}
.umenu-item{width:100%;padding:11px 14px;border:none;background:none;text-align:left;cursor:pointer;font-size:13px;color:#374151;display:flex;align-items:center;gap:9px;transition:.15s}
.umenu-item:hover{background:#f9fafb}
.umenu-item.danger{color:#dc2626}

/* overlay */
.overlay{position:fixed;inset:0;background:rgba(0,0,0,.4);display:flex;align-items:center;justify-content:center;z-index:500}
.ovl-box{background:white;border-radius:14px;padding:28px 36px;text-align:center}
.spinner{width:34px;height:34px;border:3px solid #e5e7eb;border-top-color:#667eea;border-radius:50%;animation:spin .8s linear infinite;margin:0 auto 10px}
@keyframes spin{to{transform:rotate(360deg)}}

/* install bar */
.inst-bar{position:fixed;bottom:0;left:0;right:0;background:white;border-top:1px solid #e5e7eb;padding:10px 14px;display:none;align-items:center;gap:10px;box-shadow:0 -4px 12px rgba(0,0,0,.07);z-index:100}
.inst-bar.show{display:flex}
.inst-bar p{flex:1;font-size:12px;color:#374151}
.inst-bar button{padding:7px 14px;border:none;border-radius:7px;font-weight:600;cursor:pointer;font-size:12px}
.inst-yes{background:#667eea;color:white}
.inst-no{background:#f3f4f6;color:#6b7280}

/* estilo tutor + cenário */
.style-grid{display:grid;grid-template-columns:1fr 1fr;gap:5px;margin-bottom:8px}
.style-btn{padding:6px 4px;border:2px solid #e5e7eb;border-radius:7px;background:white;font-size:11px;cursor:pointer;text-align:center;color:#374151;transition:.15s;line-height:1.3}
.style-btn:hover{border-color:#667eea;color:#667eea}
.style-btn.active{border-color:#667eea;background:#667eea;color:white;font-weight:700}
.scene-sel{width:100%;padding:7px 9px;border:2px solid #e5e7eb;border-radius:7px;font-size:11px;color:#374151;background:white;cursor:pointer;font-family:inherit}
.scene-sel:focus{outline:none;border-color:#667eea}

/* =========================== */
/* MEDIA QUERIES - MOBILE */
/* =========================== */

/* Telas pequenas (até 400px) */
@media(max-width:400px){
  .auth-card{padding:24px 16px;border-radius:16px}
  .auth-logo .emoji{font-size:36px}
  .auth-logo h1{font-size:19px}
  .auth-tab{font-size:12px;padding:8px 6px}
  .form-row.cols2{grid-template-columns:1fr}
  .form-group label{font-size:11px}
  .form-input{font-size:13px;padding:9px 11px}
  .auth-btn{font-size:14px;padding:11px}
  .section-divider{font-size:10px}
  .verify-banner{padding:16px}
  .verify-banner .icon{font-size:36px}
  .verify-banner h2{font-size:15px}
  .verify-banner p{font-size:12px}
  .resend-btn{padding:8px 18px;font-size:12px}
}

/* Header app mobile */
@media(max-width:500px){
  .hdr{padding:10px 12px}
  .hdr-left h1{font-size:15px}
  .hdr-left p{font-size:10px}
  .tutor-brand-avatar{width:34px;height:34px}
  .hdr-r2{gap:6px}
  .lang-sel{min-width:110px;font-size:11px;padding:7px 9px}
  .mode-btn{font-size:11px;padding:7px 10px}
  .avatar{width:30px;height:30px;font-size:13px}
  .menu-btn{font-size:16px;padding:5px}
}

/* Mensagens mobile */
@media(max-width:500px){
  .tts-player{padding:9px 10px;gap:8px}
  .tts-meta span{max-width:140px}
  .tts-btn{padding:6px 8px}
  .tts-speed-wrap{font-size:10px}
  .bubble{max-width:85%;font-size:13px;padding:9px 12px}
  .assistant-row{max-width:100%;gap:8px}
  .assistant-avatar{width:30px;height:30px;border-radius:10px}
  .transl{font-size:11px}
  .vbtn{font-size:10px;padding:3px 8px}
  .mtime{font-size:9px}
  .msgs{padding:12px}
}

/* Input área mobile */
@media(max-width:500px){
  .inp-area{padding:10px 11px;gap:6px}
  .mic-btn{padding:9px;font-size:16px}
  .txt-inp{font-size:13px;padding:9px 11px}
  .snd-btn{padding:9px 14px;font-size:14px}
}

/* Sidebar mobile */
@media(max-width:500px){
  .sidebar.open{width:85%;max-width:280px}
  .sec{padding:11px}
  .sec-title{font-size:10px}
  .fb-item{font-size:11px;padding:7px 9px}
  .goal-item{font-size:11px;padding:7px}
  .goal-text{font-size:11px}
  .add-goal{font-size:11px;padding:7px}
  .stat-row{font-size:11px}
  .save-sess{font-size:11px;padding:8px}
  .jentry{font-size:10px;padding:7px}
}

/* User menu mobile */
@media(max-width:400px){
  .umenu{width:calc(100vw - 32px);max-width:280px;right:16px}
  .umenu-hdr{padding:12px}
  .umenu-name{font-size:13px}
  .umenu-email{font-size:10px}
  .umenu-item{font-size:12px;padding:10px 12px}
}

/* Overlay mobile */
@media(max-width:400px){
  .ovl-box{padding:24px 28px}
  .spinner{width:30px;height:30px}
}

/* Install bar mobile */
@media(max-width:400px){
  .inst-bar{padding:9px 12px;gap:8px;flex-wrap:wrap}
  .inst-bar p{font-size:11px;flex:1 1 100%;margin-bottom:4px}
  .inst-bar button{flex:1;padding:6px 12px;font-size:11px}
}

