body { 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif; 
    background: #fff5f7; 
    padding: 15px; 
    text-align: center; 
    margin: 0; 
    color: #4a3b32;
}
.card { 
    background: #ffffff; 
    padding: 24px; 
    border-radius: 24px; 
    max-width: 480px; 
    margin: 20px auto; 
    box-shadow: 0 10px 30px rgba(244, 114, 182, 0.08); 
    border: 1px solid #fce7f3;
}
.wide-card { max-width: 600px; }

/* โค้ดสำคัญที่ใช้ซ่อนหน้าต่างที่ยังไม่ได้เปิด */
#loginView, #profileView, #homeView, #menuView, #chapterSelectView, #learnView, #examView, #dashboardView { display: none; }

/* สไตล์หน้า Login */
.brand-title { color: #831843; font-size: 24px; font-weight: 800; margin: 0 0 6px 0; }
.brand-subtitle { color: #9d7888; font-size: 14px; margin: 0 0 20px 0; }
.field-label { text-align: left; font-size: 13px; font-weight: 700; color: #701a35; margin: 10px 0 4px 4px; display: block; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"], select { 
    width: 100%; padding: 12px 14px; margin-bottom: 8px; border: 1.5px solid #fbcfe8; 
    border-radius: 12px; font-size: 15px; box-sizing: border-box; background: #fffafc; color: #4a3b32;
}
input:focus, select:focus { outline: none; border-color: #f472b6; box-shadow: 0 0 0 3px rgba(244, 114, 182, 0.2); }

.tab-group { display: flex; gap: 8px; background: #fdf2f8; padding: 4px; border-radius: 14px; margin-bottom: 16px; border: 1px solid #fce7f3; }
.tab-btn { flex: 1; padding: 10px; border: none; border-radius: 10px; font-size: 14px; font-weight: 700; cursor: pointer; background: transparent; color: #9d7888; }
.tab-btn.active { background: #fbcfe8; color: #831843; border: 1px solid #f472b6; }

button.primary-btn { 
    background: #f472b6; color: white; width: 100%; font-size: 16px; font-weight: 700; 
    padding: 14px; border: none; border-radius: 14px; cursor: pointer; margin-top: 10px; 
    box-shadow: 0 4px 12px rgba(244, 114, 182, 0.3); transition: 0.2s;
}
button.primary-btn:hover { background: #ec4899; }
button.google-btn { 
    background: #ffffff; color: #4a3b32; border: 1.5px solid #fbcfe8; border-radius: 14px;
    display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px; width: 100%;
    font-weight: 700; font-size: 15px; cursor: pointer;
}
.divider { display: flex; align-items: center; margin: 18px 0; color: #be9ca8; font-size: 13px; }
.divider::before, .divider::after { content: ''; flex: 1; border-bottom: 1px solid #fce7f3; }
.divider::before { margin-right: 10px; } .divider::after { margin-left: 10px; }

/* Menu Grid */
.menu-grid { display: flex; flex-direction: column; gap: 12px; margin-top: 15px; }
.menu-card { 
    background: #fffafc; border: 1.5px solid #fce7f3; padding: 16px 20px; border-radius: 16px; 
    text-align: left; cursor: pointer; display: flex; justify-content: space-between; align-items: center;
    transition: all 0.2s;
}
.menu-card:hover { border-color: #f472b6; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(244,114,182,0.15); }
.menu-title { font-weight: 800; font-size: 16px; color: #831843; }
.menu-desc { font-size: 13px; color: #9d7888; margin-top: 4px; }

/* กล่องเนื้อหาบทเรียน (Item Box) */
.item-card { 
    background: #fffafc; border: 1.5px solid #fce7f3; border-radius: 16px; 
    padding: 16px; margin-bottom: 16px; text-align: left; 
}
.item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.speaker-badge { font-size: 11px; font-weight: bold; padding: 2px 8px; border-radius: 8px; background: #fce7f3; color: #db2777; }
.item-hanzi { font-size: 26px; font-weight: bold; color: #1e293b; line-height: 1.3; }
.item-pinyin { font-size: 15px; font-weight: 600; color: #db2777; margin: 2px 0 4px 0; }
.item-thai { font-size: 14px; color: #64748b; }

.btn-tts-sub { 
    background: #fdf2f8; color: #db2777; border: 1px dashed #fbcfe8; border-radius: 10px; 
    padding: 8px 12px; font-size: 13px; font-weight: bold; cursor: pointer; width: 100%; margin-top: 10px; 
}
.btn-tts-sub:hover { background: #fce7f3; }

/* เครื่องมืออัดเสียงในการทดสอบ */
.exam-tools { margin-top: 12px; padding-top: 12px; border-top: 1px dashed #fbcfe8; }
.tool-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.btn-small { padding: 8px 14px; font-size: 13px; font-weight: bold; border-radius: 20px; border: none; cursor: pointer; }
.btn-rec { background: #fb7185; color: white; }
.btn-stop { background: #94a3b8; color: white; }
.btn-eval { background: #db2777; color: white; }
.btn-small:disabled { background: #e2e8f0 !important; color: #94a3b8; cursor: not-allowed; }

.score-pill { font-size: 13px; font-weight: bold; padding: 4px 10px; border-radius: 10px; display: inline-block; }
.score-pass { background: #dcfce7; color: #16a34a; }
.score-fail { background: #fee2e2; color: #dc2626; }

/* Top Nav */
.nav-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; border-bottom: 2px solid #fdf2f8; padding-bottom: 10px; }
.user-info { font-size: 13px; color: #701a35; font-weight: bold; text-align: left;}
.role-badge { font-size:10px; padding:2px 6px; border-radius:4px; margin-left:4px; font-weight:bold;}
.role-student { background:#fce7f3; color:#db2777; }
.role-teacher { background:#fef08a; color:#854d0e; }
.role-admin { background:#fee2e2; color:#991b1b; }
.role-user { background:#f1f5f9; color:#475569; }

.dashboard-table { width: 100%; border-collapse: collapse; margin-top: 15px; font-size: 13px; }
.dashboard-table th, .dashboard-table td { padding: 10px 8px; border-bottom: 1px solid #fce7f3; text-align: left; }
.dashboard-table th { background: #fdf2f8; font-weight: bold; color: #831843; }

/* ==========================================
   สไตล์หน้าแรก (Home View)
========================================== */
#homeView { display: none; }

.home-menu-container { 
    display: flex; flex-direction: column; gap: 14px; margin-top: 25px; 
}
/* เปลี่ยนเป็นกล่องธรรมดา ไม่มี cursor: pointer และ hover effect */
.home-step-box {
    background: #fffafc; border: 1.5px solid #fce7f3; border-radius: 18px; padding: 18px 20px;
    display: flex; align-items: center; gap: 15px; text-align: left;
}
.step-num {
    background: #f472b6; color: white; font-size: 18px; font-weight: 800; width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center; border-radius: 50%; flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(244,114,182,0.3);
}
.step-text { 
    color: #831843; font-size: 16px; font-weight: 700; line-height: 1.4; 
}

/* ==========================================
   สไตล์หน้า Login โฉมใหม่
========================================== */
.big-auth-btn {
    width: 100%;
    padding: 16px;
    margin-bottom: 14px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 14px;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.big-auth-btn:hover {
    transform: translateY(-2px);
}
.login-btn {
    background: #db2777;
    color: white;
    box-shadow: 0 4px 12px rgba(219, 39, 119, 0.3);
}
.register-btn {
    background: #fdf2f8;
    color: #db2777;
    border: 2px solid #fbcfe8;
}
.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px;
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    margin-bottom: 15px;
    transition: background 0.2s;
}
.google-btn:hover { background: #f8fafc; }
.google-btn img { width: 24px; height: 24px; }

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
    margin-bottom: 15px;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e2e8f0;
}
.divider span { padding: 0 10px; }

.form-input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    margin-bottom: 12px;
    font-size: 15px;
    box-sizing: border-box;
}
