/* =========================================
   Root Portal Styles (main.css)
   ========================================= */
body { font-family: 'Mali', cursive; background-color: #f3e5f5; margin: 0; padding: 20px; text-align: center; overscroll-behavior-y: none; }
.app-container { max-width: 600px; margin: auto; background: white; padding: 30px; border-radius: 25px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); border: 5px solid #ce93d8; position: relative;}
h1 { color: #8e24aa; font-size: 32px; margin-bottom: 5px; }
p { color: #666; font-size: 18px; margin-bottom: 30px; }

/* =========================================
   Navigation & Buttons
   ========================================= */
.browser-nav { display: flex; justify-content: space-between; margin-bottom: 15px; }
.browser-btn { background: #9fa8da; color: white; border: none; padding: 10px 15px; border-radius: 10px; font-size: 18px; cursor: pointer; font-weight: bold; font-family: inherit; }
.back-btn { background: #e0e0e0; border: none; padding: 10px 20px; border-radius: 15px; font-size: 18px; cursor: pointer; margin-bottom: 20px; font-family: inherit; font-weight: bold; width: 100%;}

/* =========================================
   Card Grids & Colors
   ========================================= */
.menu-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
.subject-card { 
    border-radius: 20px; padding: 20px; font-size: 20px; 
    font-weight: bold; text-decoration: none; display: flex; 
    align-items: center; justify-content: space-between; 
    transition: 0.3s; cursor: pointer; border: 3px solid;
    text-align: left; color: inherit; 
}
.subject-card:active { transform: translateY(5px); box-shadow: none !important; }
.icon { font-size: 35px; }

/* =========================================
   Dynamic Theme Classes
   ========================================= */
.main-thai { background: #ffe0b2; border-color: #ffb74d; color: #e65100; box-shadow: 0 5px 0 #ffb74d; }
.main-math { background: #c8e6c9; border-color: #81c784; color: #1b5e20; box-shadow: 0 5px 0 #81c784; }
.main-eng  { background: #bbdefb; border-color: #42a5f5; color: #0d47a1; box-shadow: 0 5px 0 #42a5f5; } /* โทนสีฟ้าสำหรับภาษาอังกฤษ */
.main-ss   { background: #e1bee7; border-color: #ba68c8; color: #4a148c; box-shadow: 0 5px 0 #ba68c8; } /* โทนสีม่วงสำหรับสังคมศึกษา */

.set-1 { background: #fff9c4; border-color: #fbc02d; color: #f57f17; box-shadow: 0 5px 0 #fbc02d; } 
.set-2 { background: #e1f5fe; border-color: #4fc3f7; color: #0277bd; box-shadow: 0 5px 0 #4fc3f7; } 
.set-3 { background: #fce4ec; border-color: #f06292; color: #c2185b; box-shadow: 0 5px 0 #f06292; } 
.set-4 { background: #d7ccc8; border-color: #a1887f; color: #4e342e; box-shadow: 0 5px 0 #a1887f; } /* โทนสีเอิร์ธโทน/น้ำตาล สำหรับบทย่อยสังคม */

#chapter-selection { display: none; }