/* การประกาศตัวแปรระบบสี Dollar Sine Ecosystem Liquid Glass (Light Edition) */
:root {
    --bg-light-base: #faf6f7; /* สีพื้นหลังสว่างอมชมพู-แดงระเรื่อธรรมชาติ */
    --primary-red: #db0c23; /* สีแดงคริมสันประจำแบรนด์ Dollar Sine */
    --primary-red-glow: rgba(219, 12, 35, 0.08);
    --glass-background: rgba(255, 255, 255, 0.82); /* กระจกขาวฝ้าสว่างโปร่งแสงสูง */
    --glass-border: rgba(219, 12, 35, 0.12); /* เส้นขอบแก้วสีแดงอ่อนประณีต */
    --text-primary: #1f0103; /* สีตัวอักษรหลักโทนเข้มเพื่อความคมชัดสูงสุดบนพื้นสว่าง */
    --text-secondary: #5f151b; /* สีตัวอักษรรองโทนแดงอิฐลึก อ่านง่ายสบายตา */
    --text-light-gray: #7c6264; /* สีเทาอมแดงสำหรับรายละเอียดปลีกย่อย */
    --accent-green: #059669; /* เข็มขัดสีเขียวสำหรับสถานะเสร็จสิ้น */
    --accent-blue: #1d4ed8; /* สีน้ำเงินสว่างสำหรับสถานะทั่วไป */
    --accent-yellow: #b45309; /* สีส้มทองสำหรับแถบพลังงานแคลอรี */
    --border-radius-lg: 24px;
    --border-radius-sm: 14px;
    --font-primary: 'Inter', 'Sarabun', sans-serif;
    --transition-standard: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    --shadow-premium: 0 8px 30px rgba(219, 12, 35, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
    --shadow-active: 0 12px 35px rgba(219, 12, 35, 0.12);
}

/* ตั้งค่ามาตรฐานและรีเซ็ตพื้นฐาน */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent; /* ป้องกันแถบฟ้าค้างขณะสัมผัสบนมือถือ */
}

body {
    background-color: var(--bg-light-base);
    color: var(--text-primary);
    font-family: var(--font-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.6;
    letter-spacing: -0.1px;
}

/* แอนิเมชันของวงของเหลวพริ้วไหวสีพาสเทลแดงอมส้มหลังกระจกฝ้า */
@keyframes liquidMove {
    0% { transform: translate(0px, 0px) scale(1); }
    33% { transform: translate(30px, -40px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
    100% { transform: translate(0px, 0px) scale(1); }
}

.liquid-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(circle at 50% 50%, #fffefe 0%, #f7eaed 100%);
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.35; /* ปรับให้อ่อนละมุนเพื่อไม่ให้กวนสายตาบนพื้นหลังสว่าง */
}

.orb-1 {
    top: 10%;
    left: 5%;
    width: 500px;
    height: 500px;
    background: #ffb3ba; /* แดงพาสเทลอ่อน */
    animation: liquidMove 18s infinite alternate;
}

.orb-2 {
    bottom: 10%;
    right: 5%;
    width: 600px;
    height: 600px;
    background: #ffdfd3; /* ส้มพีชพาสเทล */
    animation: liquidMove 22s infinite alternate-reverse;
}

.orb-3 {
    top: 40%;
    left: 40%;
    width: 400px;
    height: 400px;
    background: #fbc4c4; /* แดงกุหลาบพาสเทล */
    animation: liquidMove 14s infinite alternate;
}

/* โครงสร้างครอบคอนเทนเนอร์หลัก (ปรับแต่งให้เป็นแบบ Full App บนมือถือ) */
.dashboard-wrapper {
    max-width: 1400px;
    margin: 25px auto;
    padding: 25px;
    min-height: calc(100vh - 50px);
    background: var(--glass-background);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-premium);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* ปรับแต่งส่วนหัวและแถบเป้าหมายการซ้อมอาหาร */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(219, 12, 35, 0.08);
}

.header-branding {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.header-branding h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.8px;
    background: linear-gradient(135deg, #4c050a, #db0c23);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.badge {
    align-self: flex-start;
    background: rgba(219, 12, 35, 0.06);
    color: var(--primary-red);
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid rgba(219, 12, 35, 0.18);
    text-transform: uppercase;
}

/* แถบรายงานเป้าหมายสรุป Metrics */
.metrics-grid {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    flex-grow: 1;
    max-width: 100%;
}

.metric-card {
    flex: 1;
    min-width: 240px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(219, 12, 35, 0.06);
    padding: 14px 18px;
    border-radius: var(--border-radius-sm);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.metric-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.metric-label {
    color: var(--text-secondary);
    font-weight: 600;
}

.metric-val {
    color: var(--text-primary);
    font-weight: 700;
}

/* รางและตัวเติมเต็มความก้าวหน้า */
.progress-bar-track {
    background: rgba(219, 12, 35, 0.04);
    height: 10px;
    border-radius: 50px;
    overflow: hidden;
    border: 1px solid rgba(219, 12, 35, 0.05);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #db0c23, #ff576c);
    border-radius: 50px;
    width: 0%;
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.progress-bar-fill.cal {
    background: linear-gradient(90deg, #d97706, #f59e0b);
}

.progress-bar-fill.protein {
    background: linear-gradient(90deg, #2563eb, #3b82f6);
}

/* แผนผังหลักแบบกริดกว้าง */
.dashboard-content {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 25px;
}

/* แถบนำทางด้านข้าง */
.sidebar-navigation h2 {
    font-size: 0.8rem;
    color: var(--text-light-gray);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 12px;
    font-weight: 700;
}

.sidebar-section-title {
    margin-top: 25px;
}

.nav-tabs {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(219, 12, 35, 0.05);
    color: var(--text-secondary);
    padding: 14px 16px;
    border-radius: var(--border-radius-sm);
    text-align: left;
    cursor: pointer;
    font-size: 0.95rem;
    transition: var(--transition-standard);
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 4px rgba(219, 12, 35, 0.01);
}

.tab-btn:hover {
    background: rgba(219, 12, 35, 0.04);
    color: var(--primary-red);
    border-color: rgba(219, 12, 35, 0.15);
}

.tab-btn.active {
    background: rgba(219, 12, 35, 0.08);
    color: var(--primary-red);
    border: 1px solid rgba(219, 12, 35, 0.25);
    box-shadow: var(--shadow-active);
    font-weight: 600;
}

.tab-btn .tab-sub {
    display: block;
    font-size: 0.75rem;
    opacity: 0.8;
    margin-top: 3px;
    color: var(--text-light-gray);
}

/* ส่วนแผงแสดงงานหลัก */
.main-display-panel {
    min-height: 520px;
}

.content-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.panel-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #3a0307;
}

.subtitle {
    color: var(--text-light-gray);
    font-size: 0.88rem;
}

/* โมดูลจับเวลาพักซ้อม */
.timer-box {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(219, 12, 35, 0.1);
    padding: 10px 18px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    gap: 12px;
}

.timer-label {
    font-size: 0.78rem;
    color: var(--text-light-gray);
    font-weight: 600;
}

.timer-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.timer-display {
    font-family: monospace;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-red);
}

/* การออกแบบปุ่มตามมาตรฐาน UI/UX มือถือ */
.btn {
    padding: 12px 20px; /* ขยายขนาดเพื่อให้เหมาะแก่การกดด้วยนิ้วโป้ง */
    border-radius: var(--border-radius-sm);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition-standard);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    user-select: none;
}

.btn:active {
    transform: scale(0.97); /* เพิ่มเอฟเฟกต์ยุบเมื่อสัมผัสจริงแบบ App */
}

.btn-action {
    background: var(--primary-red);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(219, 12, 35, 0.18);
}

.btn-action:hover {
    background: #f7132e;
    box-shadow: 0 6px 18px rgba(219, 12, 35, 0.25);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-secondary);
    border-color: rgba(219, 12, 35, 0.12);
}

.btn-secondary:hover {
    background: rgba(219, 12, 35, 0.04);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.78rem;
    border-radius: 8px;
}

.btn-full {
    width: 100%;
}

/* กริดโครงสร้างตารางท่าฝึก */
.exercises-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 15px;
}

/* ดีไซน์การ์ดท่าฝึกฟิตเนส */
.exercise-card {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(219, 12, 35, 0.06);
    border-radius: var(--border-radius-sm);
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    transition: var(--transition-standard);
    box-shadow: 0 4px 12px rgba(219, 12, 35, 0.01);
}

.exercise-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-red);
    opacity: 0.8;
}

.exercise-card.completed::after {
    background: var(--accent-green);
}

.exercise-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(219, 12, 35, 0.15);
    box-shadow: var(--shadow-active);
}

.exercise-card.completed {
    border-color: rgba(5, 150, 105, 0.15);
    background: rgba(5, 150, 105, 0.02);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #3a0307;
}

/* กล่อง Checkbox สไตล์แอปมือถือ */
.checkbox-container {
    display: block;
    position: relative;
    padding-left: 26px;
    cursor: pointer;
    font-size: 0.85rem;
    user-select: none;
    color: var(--text-light-gray);
    font-weight: 600;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 2px;
    left: 0;
    height: 18px;
    width: 18px;
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(219, 12, 35, 0.15);
    border-radius: 6px;
    transition: var(--transition-standard);
}

.checkbox-container:hover input ~ .checkmark {
    border-color: var(--primary-red);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--accent-green);
    border-color: var(--accent-green);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* พารามิเตอร์ข้อมูลรายละเอียดท่า */
.exercise-meta {
    display: flex;
    gap: 12px;
    font-size: 0.82rem;
    margin-bottom: 15px;
    padding: 8px 12px;
    background: rgba(219, 12, 35, 0.02);
    border-radius: 6px;
    border: 1px solid rgba(219, 12, 35, 0.05);
}

.exercise-meta span {
    color: var(--text-light-gray);
}

.exercise-meta strong {
    color: var(--text-primary);
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.short-tip {
    font-size: 0.75rem;
    color: var(--text-light-gray);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

/* แผนผังหน้าโภชนาการ (Nutrition Grid Layout) */
.nutrition-layout-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.glass-card {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(219, 12, 35, 0.08);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-premium);
}

.nutrition-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 4px;
    border-left: 4px solid var(--primary-red);
    padding-left: 8px;
    color: #3a0307;
}

.card-divider {
    border: 0;
    height: 1px;
    background: rgba(219, 12, 35, 0.08);
    margin: 20px 0;
}

/* แผงปุ่มอาหารด่วน Quick Add */
.quick-food-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.btn-quick-food {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(219, 12, 35, 0.06);
    border-radius: var(--border-radius-sm);
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-standard);
    display: flex;
    flex-direction: column;
    gap: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.01);
}

.btn-quick-food:hover {
    background: rgba(219, 12, 35, 0.04);
    border-color: rgba(219, 12, 35, 0.2);
    transform: translateY(-1px);
}

.btn-quick-food:active {
    transform: scale(0.96);
}

.btn-quick-food .food-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.btn-quick-food .food-stats {
    font-size: 0.7rem;
    color: var(--text-light-gray);
}

/* ฟอร์มเขียนอาหารด้วยตนเอง */
.custom-food-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 0.78rem;
    color: var(--text-light-gray);
    font-weight: 600;
}

.custom-food-form input {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(219, 12, 35, 0.12);
    border-radius: var(--border-radius-sm);
    padding: 12px 14px;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.95rem; /* ป้องกันการ Auto-zoom บนอุปกรณ์ iOS */
    outline: none;
    transition: var(--transition-standard);
}

.custom-food-form input:focus {
    border-color: var(--primary-red);
    background: #ffffff;
    box-shadow: 0 0 8px rgba(219, 12, 35, 0.08);
}

/* ตารางแสดงรายงานประวัติมื้ออาหาร */
.card-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.food-log-table-container {
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid rgba(219, 12, 35, 0.06);
    border-radius: var(--border-radius-sm);
    background: rgba(255, 255, 255, 0.4);
}

.food-log-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.85rem;
}

.food-log-table th, .food-log-table td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(219, 12, 35, 0.04);
}

.food-log-table th {
    background: rgba(219, 12, 35, 0.02);
    color: var(--text-secondary);
    font-weight: 700;
}

.btn-delete-item {
    background: transparent;
    border: none;
    color: var(--text-light-gray);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
    transition: var(--transition-standard);
}

.btn-delete-item:hover {
    color: var(--primary-red);
}

.nutrition-summary-row {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    padding-top: 12px;
    border-top: 1px solid rgba(219, 12, 35, 0.08);
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.summary-item .label {
    font-size: 0.78rem;
    color: var(--text-light-gray);
    font-weight: 600;
}

.summary-item .val-cal {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--accent-yellow);
}

.summary-item .val-protein {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--accent-blue);
}

/* ระบบแผงลอยเปิดคำชี้แจง (Instruction Modal) */
.modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(31, 1, 3, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 16px;
}

.modal-content {
    max-width: 500px;
    width: 100%;
    background: #ffffff;
    border: 1px solid rgba(219, 12, 35, 0.15);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 20px 50px rgba(31, 1, 3, 0.15);
    padding: 24px;
    animation: modalShow 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalShow {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(219, 12, 35, 0.08);
    padding-bottom: 10px;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 800;
    color: #3a0307;
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-light-gray);
    font-size: 1.6rem;
    cursor: pointer;
    line-height: 1;
}

.btn-close:hover {
    color: var(--primary-red);
}

.meta-section {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 0.85rem;
}

.meta-item {
    background: rgba(219, 12, 35, 0.03);
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(219, 12, 35, 0.05);
}

.meta-section strong {
    color: var(--primary-red);
}

.instruction-section, .tip-section {
    margin-bottom: 15px;
}

.instruction-section h4 {
    font-size: 0.9rem;
    margin-bottom: 6px;
    color: var(--text-primary);
    font-weight: 700;
}

.tip-section h4 {
    font-size: 0.9rem;
    margin-bottom: 6px;
    color: var(--primary-red);
    font-weight: 700;
}

.instruction-section p, .tip-section p {
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

/* ปรับปรุงโครงสร้าง Responsive บนหน้าจอขนาดต่างๆ */

/* หน้าจอไอแพด หรือ แท็บเล็ต (Medium Screen) */
@media (max-width: 992px) {
    .dashboard-wrapper {
        margin: 15px auto;
        padding: 18px;
        gap: 20px;
    }

    .dashboard-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .sidebar-navigation h2 {
        margin-bottom: 8px;
    }

    .sidebar-section-title {
        margin-top: 15px;
    }

    /* สลับปุ่มแท็บมาเป็นแบบแถวเลื่อนแนวนอน ปิด scrollbar เพื่อลุคแอปพกพา */
    .nav-tabs {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 8px;
        gap: 8px;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
    }

    .nav-tabs::-webkit-scrollbar {
        display: none; /* ซ่อนแถบเลื่อนบน Chrome, Safari และ Opera */
    }

    .nav-tabs {
        -ms-overflow-style: none;  /* ซ่อนแถบเลื่อนบน IE และ Edge */
        scrollbar-width: none;  /* ซ่อนแถบเลื่อนบน Firefox */
    }

    .tab-btn {
        flex: 0 0 auto;
        min-width: 170px;
        padding: 10px 14px;
        scroll-snap-align: start;
    }

    .tab-btn .tab-sub {
        font-size: 0.7rem;
    }
}

/* หน้าจอโทรศัพท์มือถือทุกขนาด (Mobile Screen) */
@media (max-width: 768px) {
    body {
        background-color: #ffffff; /* เปลี่ยนเป็นขาวหมดจดเมื่อแสดงบนมือถือเพื่อเพิ่มมิติ */
    }

    /* ปรับแต่ง Dashboard ให้ชิดขอบจอเพื่อจำลองรูปแบบแอปพลิเคชันพื้นเมือง (Native App Layout) */
    .dashboard-wrapper {
        margin: 0;
        padding: 14px;
        min-height: 100vh;
        border-radius: 0;
        border: none;
        box-shadow: none;
        gap: 15px;
        background: #ffffff;
    }

    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding-bottom: 14px;
    }

    .header-branding h1 {
        font-size: 1.7rem;
    }

    .metrics-grid {
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }

    .metric-card {
        min-width: 100%;
        padding: 10px 12px;
    }

    .panel-header h2 {
        font-size: 1.3rem;
    }

    .timer-box {
        width: 100%;
        justify-content: space-between;
        padding: 8px 14px;
    }

    .exercises-grid {
        grid-template-columns: 1fr; /* ตารางแถวเดียวพรีเมียมบนมือถือ */
        gap: 10px;
    }

    .exercise-card {
        padding: 16px;
    }

    .card-header h3 {
        font-size: 1.05rem;
    }

    .exercise-meta {
        padding: 6px 10px;
        margin-bottom: 12px;
        font-size: 0.78rem;
    }

    /* หน้าต่างตารางบันทึกโภชนาการแบบมือถือ */
    .nutrition-layout-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .glass-card {
        padding: 15px;
        border-radius: var(--border-radius-sm);
    }

    .quick-food-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 คอลัมน์สมบูรณ์สำหรับนิ้วกดบนมือถือ */
        gap: 8px;
    }

    .btn-quick-food {
        padding: 8px;
    }

    .custom-food-form input {
        padding: 10px 12px;
    }

    .form-row {
        gap: 10px;
    }

    .food-log-table th, .food-log-table td {
        padding: 8px 10px;
        font-size: 0.78rem;
    }

    .nutrition-summary-row {
        margin-top: 12px;
        padding-top: 10px;
    }

    .summary-item .val-cal, .summary-item .val-protein {
        font-size: 1.15rem;
    }

    /* จัดระเบียบ Modal บนสมาร์ตโฟน */
    .modal-content {
        padding: 20px;
        border-radius: var(--border-radius-sm);
    }

    .modal-header h3 {
        font-size: 1.1rem;
    }

    .meta-section {
        flex-direction: column;
        gap: 8px;
    }

    .meta-item {
        font-size: 0.78rem;
    }
}