*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Roboto', sans-serif; background-color: #0f172a; color: #0f172a; overflow-x: hidden; padding-bottom: 7rem; -webkit-font-smoothing: antialiased; }
::selection { background: #bfdbfe; color: #1e3a5f; }

/* ===================== LAYOUT ===================== */
.page-wrap { max-width: 1920px; margin: 0 auto; background: #f8fafc; min-height: 100vh; position: relative; box-shadow: 0 25px 60px rgba(0,0,0,0.4); display: flex; flex-direction: column; }
.form-main { max-width: 720px; margin: 0 auto; width: 100%; padding: 3rem 1rem; }

/* ===================== PROGRESS BAR ===================== */
.progress-track { position: fixed; top: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 1920px; height: 6px; background: #e2e8f0; z-index: 50; }
#progress-bar { height: 100%; background: #2563eb; width: 0; transition: width 0.5s ease-out; }

/* ===================== STICKY BANNER ===================== */
.sticky-banner { position: fixed; bottom: 0; left: 0; width: 100%; z-index: 60; background: white; border-top: 1px solid #e2e8f0; box-shadow: 0 -10px 30px rgba(0,0,0,0.1); padding: 0.75rem 1rem; padding-bottom: max(0.75rem, env(safe-area-inset-bottom)); animation: fadeInUp 0.5s ease-out forwards; }
.sticky-banner-inner { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 0.75rem; }
.banner-text { font-size: 0.875rem; font-weight: 500; color: #334155; display: flex; align-items: center; gap: 0.5rem; }
.ping-dot { position: relative; width: 12px; height: 12px; flex-shrink: 0; }
.ping-dot .ping-ring { position: absolute; inset: 0; border-radius: 50%; background: #4ade80; opacity: 0.75; animation: ping 1.5s cubic-bezier(0,0,0.2,1) infinite; }
.ping-dot .ping-core { position: relative; width: 12px; height: 12px; border-radius: 50%; background: #22c55e; }
@keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; } }
#btn-open-other { flex-shrink: 0; background: #0f172a; color: white; font-size: 0.8125rem; font-weight: 700; padding: 0.75rem 1.5rem; border-radius: 6px; border: none; cursor: pointer; letter-spacing: 0.06em; text-transform: uppercase; width: 100%; transition: background 0.2s; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
#btn-open-other:hover { background: #1e293b; }

/* ===================== IFRAME MODAL ===================== */
#iframe-modal { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.6); backdrop-filter: blur(8px); display: none; flex-direction: column; opacity: 0; transition: opacity 0.3s; }
#iframe-modal.visible { opacity: 1; }
#btn-close-iframe { position: absolute; top: 1rem; right: 1rem; z-index: 110; background: white; border: 1px solid #e2e8f0; border-radius: 50%; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: #1e293b; box-shadow: 0 10px 40px rgba(0,0,0,0.3); transition: all 0.2s; }
#btn-close-iframe:hover { background: #fff1f2; color: #dc2626; border-color: #fecaca; transform: scale(1.05); }
#iframe-loader { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: white; z-index: 105; gap: 1rem; color: #64748b; font-weight: 500; }
.iframe-wrap { width: 100%; height: 100%; background: white; position: relative; z-index: 106; }
#switch-iframe { width: 100%; height: 100%; border: none; }

/* ===================== FOOTER ===================== */
.site-footer { background-color: #0f172a; color: #94a3b8; text-align: center; padding: 2rem 1rem 6rem 1rem; font-size: 0.85rem; line-height: 1.6; border-top: 1px solid #1e293b; }
.site-footer strong { color: #cbd5e1; font-weight: 600; }

/* ===================== HERO ===================== */
.hero { background-color: #0f172a; background-image: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%); min-height: 60vh; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 4rem 1rem; width: 100%; }
.hero-inner { max-width: 1280px; margin: 0 auto; color: white; width: 100%; }
.hero-badges-container { max-width: 720px; margin: 0 auto 2rem auto; display: flex; justify-content: space-between; align-items: center; width: 100%; flex-wrap: wrap; gap: 0.75rem; text-align: left; }
.hero-badge { display: inline-block; padding: 0.25rem 0.75rem; border-radius: 9999px; background: rgba(59,130,246,0.2); color: #93c5fd; border: 1px solid rgba(59,130,246,0.3); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 0; }
.hero-badge-alt { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 9999px; background: rgba(220, 38, 38, 0.15); color: #fca5a5; border: 1px solid rgba(220, 38, 38, 0.25); font-size: 0.7rem; font-weight: 600; text-decoration: none; transition: all 0.2s; opacity: 0.85; text-align: right; }
.hero-badge-alt:hover { opacity: 1; background: rgba(220, 38, 38, 0.3); color: #fecaca; }
.hero h1 { font-family: 'Phudu', sans-serif; font-size: clamp(2rem, 5vw, 3.75rem); font-weight: 700; margin-bottom: 1.5rem; line-height: 1.2; color: white; }
.hero h1 .accent { color: #60a5fa; }
.hero-info { max-width: 720px; margin: 0 auto; width: 100%; text-align: left; background: rgba(30,41,59,0.5); backdrop-filter: blur(8px); border: 1px solid #334155; padding: 1.5rem 2rem; border-radius: 12px; display: flex; flex-direction: column; gap: 1rem; box-shadow: 0 20px 40px rgba(0,0,0,0.3); }
.hero-info p { color: #cbd5e1; line-height: 1.7; font-size: 0.9rem; }
.hero-info strong { color: white; }
.hero-info .hl { color: #60a5fa; font-weight: 700; text-decoration: underline; }

/* ===================== SECTION HEADINGS ===================== */
.section-heading { border-bottom: 3px solid #2563eb; margin-bottom: 1.5rem; padding-bottom: 0.5rem; margin-top: 2rem; }
.section-heading h2 { font-family: 'Phudu', sans-serif; font-size: clamp(1.5rem, 4vw, 2.25rem); font-weight: 700; color: #0f172a; text-transform: uppercase; letter-spacing: 0.05em; }

/* ===================== QUESTION CARD ===================== */
.q-card { background: white; padding: 1.5rem; border-radius: 12px; border: 1px solid #f1f5f9; margin-bottom: 2rem; }
.q-card h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.5rem; color: #0f172a; }
.q-card .q-desc { color: #64748b; margin-bottom: 1.5rem; font-size: 0.95rem; line-height: 1.6; }
.scale-labels { display: flex; justify-content: space-between; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; margin-bottom: 0.5rem; gap: 1rem; }
.scale-labels .lbl-low { color: #dc2626; max-width: 45%; }
.scale-labels .lbl-high { color: #2563eb; text-align: right; max-width: 45%; }
.scale-row { display: flex; justify-content: space-between; gap: 4px; background: #f8fafc; padding: 8px; border-radius: 9999px; overflow-x: auto; }
.scale-btn { flex: 1; min-width: 32px; aspect-ratio: 1; border-radius: 50%; font-weight: 700; font-size: 0.85rem; border: 1px solid rgba(0,0,0,0.05); cursor: pointer; background-color: var(--base-bg, #f1f5f9); color: var(--base-color, #475569); transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); flex-shrink: 0; font-family: 'Roboto', sans-serif; }
.scale-btn:hover { transform: translateY(-2px) scale(1.05); filter: brightness(0.95); }
.scale-btn.active { background-color: var(--active-bg, #3b82f6) !important; color: white; transform: scale(1.4) translateY(-2px); box-shadow: 0 12px 24px -6px var(--active-bg), 0 0 0 3px white; border-color: transparent !important; font-weight: 700; z-index: 20; position: relative; }

/* ===================== RADIO INPUTS ===================== */
.custom-radio { appearance: none; -webkit-appearance: none; width: 1.25rem; height: 1.25rem; border: 2px solid #cbd5e1; border-radius: 4px; outline: none; cursor: pointer; position: relative; background-color: white; transition: all 0.2s; margin-top: 2px; flex-shrink: 0; }
.custom-radio:checked { background-color: #2563eb; border-color: #2563eb; }
.custom-radio:checked::after { content: ''; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px; border: solid white; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.radio-label { cursor: pointer; transition: color 0.2s; display: flex; align-items: flex-start; gap: 0.75rem; font-size: 0.95rem; line-height: 1.5; color: #334155; }
.radio-label:hover { color: #2563eb; }
.radio-group { display: flex; flex-direction: column; gap: 0.75rem; }
.radio-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.radio-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.radio-row { display: flex; gap: 1.5rem; flex-wrap: wrap; }

/* ===================== DEMO BLOCK ===================== */
.demo-block { background: white; padding: 2rem; border-radius: 12px; border: 1px solid #e2e8f0; box-shadow: 0 2px 8px rgba(0,0,0,0.04); display: flex; flex-direction: column; gap: 2rem; margin-bottom: 3rem; }
.demo-block h3 { font-weight: 700; color: #1e293b; margin-bottom: 0.75rem; font-size: 0.95rem; }

/* ===================== STRESS BUTTONS ===================== */
.stress-btn { cursor: pointer; border: 2px solid #e2e8f0; border-radius: 12px; padding: 0.75rem 1rem; transition: all 0.2s; background: white; display: flex; align-items: center; gap: 0.75rem; text-align: left; width: 100%; font-family: 'Roboto', sans-serif; }
.stress-btn:hover { border-color: #93c5fd; background: #eff6ff; }
.stress-btn.active { border-color: #2563eb; background: #eff6ff; }
.stress-btn.active .stress-dot { background: #2563eb; border-color: #2563eb; }
.stress-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #cbd5e1; flex-shrink: 0; transition: all 0.2s; }
.stress-label { font-weight: 500; font-size: 0.9rem; line-height: 1.4; }
.stress-group { display: flex; flex-direction: column; gap: 0.6rem; }

/* ===================== LOGIC REVEAL ===================== */
.logic-reveal { max-height: 0; overflow: hidden; opacity: 0; margin-top: 0; transition: max-height 0.5s ease, opacity 0.5s ease, margin 0.4s ease; }
.logic-reveal.show { max-height: 600px; opacity: 1; margin-top: 1rem; }

/* ===================== SUBMIT BUTTON ===================== */
#sec-submit-p12 { text-align: center; margin-top: 2rem; margin-bottom: 5rem; }
#btn-submit-p12 { background: #2563eb; color: white; font-weight: 700; padding: 1.25rem 3.5rem; border-radius: 9999px; font-size: 1.1rem; text-transform: uppercase; border: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; box-shadow: 0 10px 30px rgba(37,99,235,0.4); transition: all 0.2s; font-family: 'Roboto', sans-serif; }
#btn-submit-p12:hover { background: #1d4ed8; }
#btn-submit-p12.disabled { opacity: 0.5; pointer-events: none; }

/* ===================== HIẾN KẾ ===================== */
#sec-hien-ke { background: #f8fafc; padding: 2.5rem; border-radius: 12px; border: 1px solid #e2e8f0; box-shadow: inset 0 2px 8px rgba(0,0,0,0.04); margin-bottom: 8rem; display: none; }
#sec-hien-ke .hk-title { font-family: 'Phudu', sans-serif; font-size: 1.5rem; font-weight: 700; text-transform: uppercase; margin-bottom: 0.25rem; }
#sec-hien-ke .hk-sub { color: #64748b; font-size: 0.875rem; margin-bottom: 1.5rem; }
#sec-hien-ke .hk-q { color: #374151; font-size: 1.05rem; font-weight: 500; margin-bottom: 1.5rem; line-height: 1.6; }
#auth-action-block { display: flex; flex-direction: column; gap: 1rem; }
#btn-auth-google { background: white; border: 2px solid #2563eb; color: #2563eb; font-weight: 700; padding: 1rem 1.5rem; border-radius: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 0.75rem; font-family: 'Roboto', sans-serif; transition: background 0.2s; }
#btn-auth-google:hover { background: #eff6ff; }
#btn-skip-submit { background: #1e293b; color: white; font-weight: 700; padding: 1rem 1.5rem; border-radius: 12px; border: none; cursor: pointer; font-family: 'Roboto', sans-serif; transition: background 0.2s; }
#btn-skip-submit:hover { background: #0f172a; }
#hien-ke-block { display: none; flex-direction: column; gap: 1rem; margin-top: 1.5rem; }
#hien-ke-block.flex { display: flex; }
#txt-hien-ke { width: 100%; padding: 1rem; border: 1px solid #93c5fd; border-radius: 12px; font-family: 'Roboto', sans-serif; font-size: 0.95rem; color: #1e293b; resize: none; outline: none; transition: box-shadow 0.2s; }
#txt-hien-ke:focus { box-shadow: 0 0 0 3px rgba(37,99,235,0.2); }
#btn-final-submit { background: #2563eb; color: white; font-weight: 700; padding: 1rem 1.5rem; border-radius: 12px; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-family: 'Roboto', sans-serif; transition: background 0.2s; }
#btn-final-submit:hover { background: #1d4ed8; }

/* ===================== COOLDOWN SCREEN ===================== */
#cooldown-screen { display: none; flex: 1; background: #0f172a; flex-direction: column; align-items: center; justify-content: center; padding: 1.5rem; text-align: center; z-index: 40; min-height: 100vh; }
#cooldown-screen.flex { display: flex; }
.cooldown-card { max-width: 720px; background: rgba(255,255,255,0.1); backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,0.2); border-radius: 20px; padding: 3rem; box-shadow: 0 25px 60px rgba(0,0,0,0.4); }
.cooldown-card svg { color: #60a5fa; margin: 0 auto 1.5rem; display: block; }
.cooldown-card h2 { font-family: 'Phudu', sans-serif; font-size: 2rem; font-weight: 700; color: white; margin-bottom: 1rem; }
.cooldown-card a { display: inline-block; margin-top: 1rem; background: #2563eb; color: white; font-weight: 700; padding: 1rem 2.5rem; border-radius: 9999px; text-decoration: none; transition: background 0.2s; box-shadow: 0 8px 24px rgba(37,99,235,0.4); }
.cooldown-card a:hover { background: #3b82f6; }

/* ===================== RESULTS OVERLAY ===================== */
#results-overlay { position: fixed; inset: 0; background: #0f172a; z-index: 100; display: none; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 1rem; opacity: 0; transition: opacity 0.7s; overflow-y: auto; }
#results-overlay.show { display: flex; }
#results-overlay.opacity-100 { opacity: 1; }
#results-overlay svg { color: #3b82f6; margin-bottom: 1.5rem; }
#results-overlay h2 { font-family: 'Phudu', sans-serif; font-size: clamp(1.75rem, 5vw, 3rem); font-weight: 700; color: white; margin-bottom: 1.5rem; }
#results-overlay > a { background: #2563eb; color: white; font-weight: 700; padding: 1rem 2rem; border-radius: 9999px; text-decoration: none; box-shadow: 0 8px 24px rgba(37,99,235,0.4); transition: background 0.2s; margin-top: 2rem; }
#results-overlay > a:hover { background: #3b82f6; }

/* ===================== SPINNER ===================== */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 0.8s linear infinite; }

/* ===================== FADE IN UP ===================== */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ===================== SURVEY SCREEN ===================== */
#survey-screen { flex: 1; display: none; flex-direction: column; }
#survey-screen.show { display: flex; }

/* ===================== ERROR MSG ===================== */
#global-error-msg { display: none; background: #fff1f2; border: 1px solid #fecaca; color: #dc2626; padding: 1rem; border-radius: 12px; margin-bottom: 2rem; font-weight: 500; text-align: center; }

/* ===================== BREAKOUT IMG ===================== */
.breakout-img { width: 100vw; max-width: 1920px; position: relative; left: 50%; transform: translateX(-50%); margin-bottom: 2rem; text-align: center; }

/* ===================== RESPONSIVE ===================== */
@media (min-width: 768px) {
    body { padding-bottom: 6rem; }
    .sticky-banner-inner { flex-direction: row; }
    #btn-open-other { width: auto; padding: 0.625rem 1.5rem; }
    .radio-grid-3 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 480px) {
    .radio-grid-2 { grid-template-columns: 1fr; }
    .radio-grid-3 { grid-template-columns: 1fr 1fr; }
    .scale-btn { min-width: 28px; font-size: 0.75rem; }
}