/* styles.css - v3.0 (ปรับปรุงใหม่ จาก styles_old.css + เพิ่มส่วนใหม่) */
/* ============================================================ */

:root {
    /* ========== COLOR SYSTEM ========== */
    /* Primary Colors (จาก old) */
    --primary-50: #f5f3ff;
    --primary-100: #ede9fe;
    --primary-200: #ddd6fe;
    --primary-300: #c4b5fd;
    --primary-400: #a78bfa;
    --primary-500: #8b5cf6;
    --primary-600: #7c3aed;
    --primary-700: #6d28d9;
    --primary-800: #5b21b6;
    --primary-900: #4c1d95;
    --primary-950: #2e1065;
    
    /* Secondary Colors (จาก old) */
    --secondary-50: #f0f9ff;
    --secondary-100: #e0f2fe;
    --secondary-200: #bae6fd;
    --secondary-300: #7dd3fc;
    --secondary-400: #38bdf8;
    --secondary-500: #0ea5e9;
    --secondary-600: #0284c7;
    --secondary-700: #0369a1;
    --secondary-800: #075985;
    --secondary-900: #0c4a6e;
    
    /* Neutral Colors (จาก old) */
    --neutral-50: #fafafa;
    --neutral-100: #f5f5f5;
    --neutral-200: #e5e5e5;
    --neutral-300: #d4d4d4;
    --neutral-400: #a3a3a3;
    --neutral-500: #737373;
    --neutral-600: #525252;
    --neutral-700: #404040;
    --neutral-800: #262626;
    --neutral-900: #171717;
    
    /* Semantic Colors (จาก old) */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
    
    /* สีเพิ่มเติมจาก new (สำหรับ glass effect) */
    --bg-dark: #0f172a;
    --bg-glass: rgba(30, 30, A0, 0.6);
    --bg-card: rgba(255, 255, 255, 0.03);
    
    /* สีข้อความเพิ่มเติม (new) */
    --text-white: #ffffff;
    --text-slate-300: #cbd5e1;
    --text-slate-400: #94a3b8;
    --text-indigo-300: #a5b4fc;
    --text-purple-300: #d8b4fe;
    --text-yellow-300: #fde047;
    --text-green-300: #86efac;
    
    /* เงา (new) */
    --shadow-lg: 0 20px 30px -10px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.5);
    
    /* ขนาดเพิ่มเติม (new) */
    --radius-lg: 2rem;
    --radius-md: 1.5rem;
    --radius-sm: 1rem;
    
    /* คงเดิมจาก old */
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark mode (จาก old) */
[data-theme="dark"] {
    --bg-primary: var(--neutral-900);
    --bg-secondary: var(--neutral-800);
    --bg-card: var(--neutral-800);
    --bg-overlay: rgba(0, 0, 0, 0.7);
    
    --text-primary: var(--neutral-50);
    --text-secondary: var(--neutral-300);
    --text-muted: var(--neutral-400);
    --text-inverse: var(--neutral-900);
    
    --border-color: var(--neutral-700);
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.3);
}

/* ========== BASE STYLES (จาก old) ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

/*
body {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a, #1e293b, #312e81); 
    color: var(--text-white); /* จาก new */
    font-family: 'Sarabun', sans-serif;
    line-height: 1.6;
    transition: background-color var(--transition-base), color var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
*/


body {
    background: linear-gradient(145deg, #0b2545, #1b3b6a, #0d2c4a);
    position: relative;
}
body::before {
    content: '';
    position: fixed;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="rgba(100,150,255,0.1)" d="M0,256L48,234.7C96,213,192,171,288,176C384,181,480,235,576,250.7C672,267,768,245,864,213.3C960,181,1056,139,1152,138.7C1248,139,1344,181,1392,202.7L1440,224L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>') repeat-x bottom;
    background-size: cover;
    opacity: 0.3;
    pointer-events: none;
}





h1, h2, h3, h4, h5, h6 {
    font-family: 'Kanit', sans-serif;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: var(--spacing-md);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: var(--spacing-md);
}

a {
    color: var(--primary-600);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-700);
    text-decoration: underline;
}

button {
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    border: none;
    outline: none;
    background: none;
    transition: all var(--transition-fast);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul, ol {
    list-style-position: inside;
    margin-bottom: var(--spacing-md);
}

/* ===== Utility (จาก new) ===== */
.hidden {
    display: none !important;
}

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* ========== LAYOUT & CONTAINERS (จาก old) ========== */
.section {
    padding: var(--spacing-2xl) 0;
}

.grid {
    display: grid;
    gap: var(--spacing-lg);
}

.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

.flex {
    display: flex;
    gap: var(--spacing-md);
}

.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.items-center { align-items: center; }
.items-right { align-items: right; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-xs { gap: var(--spacing-xs); }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

/* ========== COMPONENTS ========== */

/* Cards (จาก old + glass-card จาก new) */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    margin-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--spacing-md);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0;
}

.card-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
}

/* Glass Card (เพิ่มจาก new) */
.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(1px);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
}

/* Buttons  */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    font-size: 0.875rem;
    line-height: 1.25rem;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 0 15px currentColor;
    transition: all 0.2s ease;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9); /* จาก new */
    color: white;
    border-color: var(--primary-600);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--secondary-600);
    color: white;
    border-color: var(--secondary-600);
}

.btn-secondary:hover {
    background-color: var(--secondary-700);
    border-color: var(--secondary-700);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background-color: var(--bg-secondary);
    border-color: var(--primary-300);
}

.btn-ghost {
    background-color: transparent;
    color: var(--text-primary);
}

.btn-ghost:hover {
    background-color: var(--bg-secondary);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669); 
    color: white;
    border-color: var(--success);
}

.btn-error {
    background-color: var(--error);
    color: white;
    border-color: var(--error);
}

.btn-warning {
    background-color: var(--warning);
    color: var(--neutral-900);
    border-color: var(--warning);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ปุ่ม action */
.btn-action {
    background: linear-gradient(145deg, #3d47a8, #1c20b3);
    border: none;
    border-radius: 1rem;
    padding: 0.75rem 1rem;
    color: white;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
    box-shadow: 0 4px 10px rgba(0, 255, 200, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
}


.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.4);
    background: linear-gradient(145deg, #3741a1, #1f29b7);
}

.btn-action i {
    font-size: 1rem;
}

/* ปุ่ม support (จาก new) */
.btn-support {
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-donate {
    background: rgba(239, 68, 68, 0.8);
    color: white;
}

.btn-donate:hover {
    background: #ef4444;
}

.btn-premium {
    background: rgba(245, 158, 11, 0.8);
    color: white;
}

.btn-premium:hover {
    background: #f59e0b;
}

.btn-info {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.btn-info:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ปุ่มเล่นเพลงขนาดใหญ่ (จาก new) */
.play-button-large {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(145deg, #303960, #2070a0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    box-shadow: var(--shadow-glow);
    transition: all 0.2s;
    margin: 0 auto;
    border: none;
    cursor: pointer;
    z-index: 1;
}

.play-button-large:hover {
    transform: scale(1.1);
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.8);
}

/* Forms (จาก old + เพิ่มจาก new) */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 500;
    color: var(--text-primary);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-hint {
    display: block;
    margin-top: var(--spacing-xs);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.form-error {
    display: block;
    margin-top: var(--spacing-xs);
    font-size: 0.75rem;
    color: var(--error);
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.form-checkbox input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary-600);
}

/* Option group (จาก new) */
.option-group {
    margin-bottom: 1.5rem;
}

.option-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-bottom: 0.5rem;
}

.option-radio {
    margin-right: 0.75rem;
    width: 1.2rem;
    height: 1.2rem;
    accent-color: #8b5cf6;
}

.option-card {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.option-card.active {
    background: rgba(139, 92, 246, 0.1);
    border-color: #8b5cf6;
}

.option-desc {
    font-size: 0.875rem;
    color: #6b7280;
}

/* Info box (จาก new) */
.info-box {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 0.5rem;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #1e40af;
    font-size: 0.875rem;
}

/* Premium Card (จาก new) */
.premium-card {
    background: linear-gradient(135deg, #fef3c7, #fed7aa);
    border: 1px solid #fcd34d;
    border-radius: 0.75rem;
    padding: 1.5rem;
}

.premium-list {
    list-style: none;
    padding: 0;
}

.premium-list li {
    margin-bottom: 0.5rem;
    color: #92400e;
}

/* Badges (จาก old) */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1;
}

.badge-primary {
    background-color: var(--primary-100);
    color: var(--primary-700);
}

.badge-secondary {
    background-color: var(--secondary-100);
    color: var(--secondary-700);
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-error {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Alerts (จาก old) */
.alert {
    padding: var(--spacing-md);
    border-radius: var(--border-radius-sm);
    margin-bottom: var(--spacing-md);
    border: 1px solid transparent;
}

.alert-info {
    background-color: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

.alert-success {
    background-color: #d1fae5;
    border-color: #a7f3d0;
    color: #065f46;
}

.alert-warning {
    background-color: #fef3c7;
    border-color: #fde68a;
    color: #92400e;
}

.alert-error {
    background-color: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7); /* จาก new */
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.modal-content { 
    background: white;
    color: #1f2937;
    border-radius: 1rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #6b7280;
    cursor: pointer;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
}

/* Toast (จาก old + new) */
.toast-container {
    position: fixed;
    bottom: var(--spacing-lg);
    right: var(--spacing-lg);
    z-index: 1100;
}

.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    padding: 0.75rem 1.5rem;
    background: #10b981;
    color: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 1002;
    animation: slideIn 0.3s ease;
}

.toast.error {
    background: #ef4444;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-icon {
    font-size: 1.25rem;
}

.toast-success .toast-icon {
    color: var(--success);
}

.toast-error .toast-icon {
    color: var(--error);
}

.toast-warning .toast-icon {
    color: var(--warning);
}

.toast-info .toast-icon {
    color: var(--info);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: var(--spacing-xs);
}

.toast-message {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--spacing-xs);
    border-radius: var(--border-radius-sm);
}

.toast-close:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

/* Loading Spinner (จาก old) */
.loading-spinner {
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-500);
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
}

/* Progress Bar (จาก old) */
.progress {
    width: 100%;
    height: 0.5rem;
    background-color: var(--border-color);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: var(--primary-500);
    border-radius: var(--border-radius-sm);
    transition: width var(--transition-base);
}

/* ===== Loading Screen (จาก new) ===== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #0f172a;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-screen .loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(79, 70, 229, 0.3);
    border-radius: 50%;
    border-top-color: #4f46e5;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

/* ===== Clock (จาก new) ===== */
.clock-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-left: 50px;
    margin-bottom: 0px;
    z-index: 10;
}

.clock-card {
    background: var(--bg-card);
    backdrop-filter: blur(70px);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    width: 120px;
    height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1;
}

.clock-number {
    font-size: 4rem;
    font-weight: 700;
    line-height: 1;
    color: white;
}

.clock-label {
    font-size: 0.8rem;
    color: var(--text-slate-400);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.am-pm-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 1.2rem;
    font-weight: 600;
    color: #fbbf24;
    margin-left: 0.5rem;
}

/* ===== Volume Control (จาก new) ===== */
.volume-control {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
    padding: 1rem;
    margin-top: 0px;
    margin-left: 0px;
    margin-right: 10px;
    max-width: 200px;
    text-align: center;
}

.volume-control label {
    color: var(--text-slate-300);
    font-size: 0.875rem;
    display: block;
    margin-bottom: 0.5rem;
}

.volume-slider {
    width: 100%;
    height: 6px;
    background: #334155;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #8b5cf6;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 8px #8b5cf6;
}

.volume-values {
    display: flex;
    justify-content: space-between;
    color: var(--text-slate-400);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* ===== Info Panel (จาก new) ===== */
.info-panel {
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
    border-radius: 2rem;
    padding: 1.5rem;
    margin-top: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.panel-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.song-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-indigo-300);
}

.song-info {
    font-size: 0.9rem;
    color: var(--text-slate-400);
    margin-top: 0.25rem;
}

.melody-notes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.number-details {
    font-size: 0.9rem;
    color: var(--text-slate-300);
    padding-right: 1rem;
}

.seed-numbers {
    font-family: monospace;
    color: var(--text-indigo-300);
}

/* ===== Settings Panel (จาก new) ===== */
.settings-panel {
    margin-top: 0rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-label {
    font-size: 0.9rem;
    color: var(--text-slate-400);
}

.settings-badge {
    font-size: 0.7rem;
    background: rgba(79, 70, 229, 0.3);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-top: 0rem;
    font-size: 0.8rem;
}

@media (min-width: 768px) {
    .settings-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ===== Support Section (จาก new) ===== */
.support-section {
    background: linear-gradient(135deg, #1e3a8a, #3b82f6);
    color: white;
    border-radius: 1.5rem;
    padding: 1.5rem;
    margin-top: 1.5rem;
}


.support-content {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
}

.support-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.storage-status {
    position: absolute;
    right: 0;
    margin-top: -1.2rem;
    margin-left: auto;   /* ดันไปทางขวา */
    padding-right: 1.5rem;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}


/* ===== Button Grid (จาก new) ===== */
.button-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* ===== App Title & User Info (จาก new) ===== */
.app-title {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #a5b4fc, #d8b4fe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.app-title  .edition-badge {
    -webkit-text-fill-color: initial; /* คืนค่าเริ่มต้น */
    display: inline-block;
    background: linear-gradient(135deg, #fbbf24, #d97706);
    -webkit-background-clip: border-box; /* ไม่ให้ background-clip text */
    background-clip: border-box;
    color: blue;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: bold;
    /*  margin-top: -1rem;  */
    
    transform: translateY(-0.7rem);
}


.user-info {
    color: var(--text-slate-300);
    font-size: 0.9rem;
}

/* ========== LAYOUT SECTIONS (จาก old) ========== */

/* Header */
.app-header {
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.logo-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}


.MissionMLQ_logo {
    width: 48px;
    height: 48px;
    border-radius: 20%;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    
    /* เพิ่มเส้นขอบสีน้ำเงินม่วง */
    border: 2px solid var(--primary-400);
    box-shadow: 0 0 5px rgba(139, 92, 246, 0.3);
    transition: all 0.3s ease;
}

/* เอฟเฟกต์เมื่อชี้เมาส์ (active) */
.MissionMLQ_logo:hover {
    border-color: var(--primary-300);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.6);
    transform: scale(1.05);
}


.header-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

/* Footer */
.app-footer {
    padding: var(--spacing-xl) 0;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    margin-top: var(--spacing-2xl);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-xl);
}

.footer-section h4 {
    font-size: 1rem;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: var(--spacing-sm);
}

.footer-links a {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.footer-links a:hover {
    color: var(--primary-600);
}

.footer-bottom {
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: var(--spacing-2xl) 0;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-500) 0%, transparent 100%);
    opacity: 0.1;
    z-index: -1;
}

.hero-title {
    font-size: 3rem;
    margin-bottom: var(--spacing-md);
    background: linear-gradient(135deg, var(--primary-600), var(--secondary-600));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto var(--spacing-xl);
}

.hero-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    flex-wrap: wrap;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-lg);
}

.feature-card {
    text-align: center;
    padding: var(--spacing-xl);
}

.feature-icon {
    width: 4rem;
    height: 4rem;
    margin: 0 auto var(--spacing-lg);
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.feature-title {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-sm);
}

.feature-description {
    color: var(--text-secondary);
}

/* ========== UTILITY CLASSES (จาก old) ========== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }
.text-info { color: var(--info); }

.bg-primary { background-color: var(--bg-primary); }
.bg-secondary { background-color: var(--bg-secondary); }
.bg-card { background-color: var(--bg-card); }

.m-0 { margin: 0; }
.mt-1 { margin-top: var(--spacing-xs); }
.mt-2 { margin-top: var(--spacing-sm); }
.mt-3 { margin-top: var(--spacing-md); }
.mt-4 { margin-top: var(--spacing-lg); }
.mt-5 { margin-top: var(--spacing-xl); }

.mb-1 { margin-bottom: var(--spacing-xs); }
.mb-2 { margin-bottom: var(--spacing-sm); }
.mb-3 { margin-bottom: var(--spacing-md); }
.mb-4 { margin-bottom: var(--spacing-lg); }
.mb-5 { margin-bottom: var(--spacing-xl); }

.p-0 { padding: 0; }
.p-1 { padding: var(--spacing-xs); }
.p-2 { padding: var(--spacing-sm); }
.p-3 { padding: var(--spacing-md); }
.p-4 { padding: var(--spacing-lg); }
.p-5 { padding: var(--spacing-xl); }

.w-full { width: 100%; }
.h-full { height: 100%; }

.rounded { border-radius: var(--border-radius); }
.rounded-sm { border-radius: var(--border-radius-sm); }
.rounded-lg { border-radius: var(--border-radius-lg); }
.rounded-full { border-radius: 9999px; }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }

.hidden { display: none !important; }
.block { display: block !important; }
.inline-block { display: inline-block !important; }
.flex { display: flex !important; }
.grid { display: grid !important; }

/* ========== RESPONSIVE DESIGN (จาก old) ========== */
@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
    
    .container {
        padding: 0 var(--spacing-sm);
    }
    
    .hero-title {
        font-size: 2.25rem;
    }
    
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: 1fr;
    }
    
    .modal {
        width: 95%;
    }
    
    .toast-container {
        bottom: var(--spacing-md);
        right: var(--spacing-md);
        left: var(--spacing-md);
    }
    
    .toast {
        min-width: auto;
        max-width: none;
    }
}

@media (max-width: 640px) {
    .clock-card {
        width: 100px;
        height: 120px;
    }
    .clock-number {
        font-size: 3rem;
    }
    .button-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .app-title {
        font-size: 1.2rem;
    }
    .modal-content {
        width: 95%;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.75rem;
    }
    
    .hero-actions {
        flex-direction: column;
    }
    
    .hero-actions .btn {
        width: 100%;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}

/* ========== PRINT STYLES (จาก old) ========== */
@media print {
    .app-header,
    .app-footer,
    .hero-actions,
    .btn,
    .modal-overlay,
    .toast-container,
    .loading-overlay {
        display: none !important;
    }
    
    body {
        background-color: white;
        color: black;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ========== ACCESSIBILITY (จาก old) ========== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

@media (prefers-contrast: high) {
    :root {
        --primary-500: #0000ff;
        --primary-600: #0000cc;
        --text-primary: #000000;
        --text-secondary: #333333;
        --border-color: #000000;
    }
}

/* Focus styles for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Install Banner Styles  */
.install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #4f46e5, #3730a3);
    color: white;
    padding: 16px;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.install-banner.show {
    transform: translateY(0);
}

.banner-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.install-btn {
    background: white;
    color: #4f46e5;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
}

.dismiss-btn {
    background: transparent;
    color: white;
    border: 1px solid white;
    padding: 8px 16px;
    border-radius: 8px;
    margin-left: 8px;
    cursor: pointer;
}

/* ===== Story Display (จาก old) ===== */
.numerology-story-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 20px;
    margin: 2rem 0;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.numerology-story-header h2 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #ffecd2 0%, #fcb69f 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.story-chapter {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-left: 5px solid #fcb69f;
    transition: transform 0.3s ease;
}

.story-chapter:hover {
    transform: translateX(10px);
    background: rgba(255, 255, 255, 0.15);
}

.chapter-timeline {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.chapter-duration {
    font-family: 'Courier New', monospace;
    background: rgba(0,0,0,0.3);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
    margin-right: 1rem;
}

.timeline-bar {
    flex-grow: 1;
    height: 3px;
    background: linear-gradient(to right, #fcb69f, #667eea);
    border-radius: 3px;
}

.chapter-title {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: #ffecd2;
}

.chapter-content {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.chapter-content ul {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
}

.chapter-content li {
    margin-bottom: 0.5rem;
    padding-left: 0.5rem;
}

.chapter-visuals {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.visual-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.9rem;
    backdrop-filter: blur(5px);
}

.story-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    font-style: italic;
}

/* Insights cards */
.insight-card {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    margin: 1rem 0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border-left: 5px solid;
}

.insight-card[data-type="dominant_influence"] {
    border-left-color: #667eea;
}

.insight-card[data-type="data_coverage"] {
    border-left-color: #fcb69f;
}

.insight-card[data-type="unique_characteristics"] {
    border-left-color: #764ba2;
}

.insight-card[data-type="energy_balance"] {
    border-left-color: #4fd1c7;
}

.insight-card .insight-icon {
    font-size: 2rem;
    margin-right: 1rem;
    float: left;
}

.insight-card h4 {
    color: #2d3748;
    margin-bottom: 0.5rem;
}

.insight-card p {
    color: #4a5568;
    line-height: 1.5;
}

/* Footer สำหรับ DestiBlue */
.destiblue-footer {
    margin-top: 2rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.2), rgba(139, 92, 246, 0.1));
    border-radius: 1rem;
    text-align: center;
    border: 1px solid rgba(139, 92, 246, 0.3);
    transition: all 0.3s ease;
}

.destiblue-footer:hover {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.3), rgba(139, 92, 246, 0.2));
    border-color: rgba(139, 92, 246, 0.6);
}

.destiblue-footer a {
    color: #a5b4fc;
    text-decoration: none;
    font-weight: 500;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.destiblue-footer a:hover {
    color: #d8b4fe;
    text-decoration: underline;
}

.destiblue-footer i {
    font-size: 1.2rem;
}


/* ===================================================== */
/* RESPONSIVE: มือถือแนวตั้ง (Portrait)                   */
/* ===================================================== */

/* สำหรับหน้าจอแคบกว่า 768px และอยู่ในแนวตั้ง */
@media (max-width: 768px) and (orientation: portrait) {

    /* ---------- พื้นที่หลัก ---------- */
    .glass-card {
        padding: 0.75rem !important;
    }

    /* ---------- นาฬิกาปัจจุบัน (Clock) ---------- */
    .clock-container {
        display: flex !important;
        flex-direction: row !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 0.5rem !important;
        margin: 0.5rem 0 !important;
        flex-wrap: wrap !important;
    }
    .clock-card {
        width: 70px !important;
        height: 80px !important;
        padding: 0.3rem 0 !important;
    }
    .clock-number {
        font-size: 2rem !important;
    }
    .clock-label {
        font-size: 0.6rem !important;
    }
    /* ปรับ AM/PM badge ให้เล็กลงและอยู่ติดกัน */
    .am-pm-badge {
        font-size: 0.7rem !important;
        padding: 0.2rem 0.6rem !important;
        margin-left: 0 !important;
    }

    /* ---------- Stop Clock (นาฬิกาตั้งเวลาหยุด) ---------- */
    .stop-clock-container {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.8rem !important;
        margin-top: 0.5rem !important;
    }

    /* แต่ละการ์ดของ Hr, Min, Sec และ Status */
    .stop-clock-card {
        width: auto !important;
        min-width: 0 !important;
        max-width: 180px !important;
        margin: 0 auto !important;
        padding: 0.3rem 0.8rem !important;
    }

    /* ปรับการ์ดของ Min + Sec + Status ให้อยู่ในแนวตั้งทั้งหมด */
    .stop-right-column {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.6rem !important;
    }

    /* จัดกลุ่ม Min และ Sec ให้อยู่แถวเดียวกัน (แนวนอน) แต่ Status แยกด้านล่าง */
    .stop-min-sec-row {
        display: flex !important;
        flex-direction: row !important;
        justify-content: center !important;
        gap: 0.8rem !important;
        flex-wrap: wrap !important;
    }

    /* ส่วนปุ่ม Timer Toggle + Status */
    .timer-toggle-row {
        margin-top: 0 !important;
    }
    .timer-status {
        font-size: 0.7rem !important;
        margin-top: 0.2rem !important;
        text-align: center !important;
    }

    /* ขนาดตัวเลขและปุ่ม +/– */
    .stop-clock-number {
        font-size: 1.4rem !important;
    }
    .adj-btn {
        width: 30px !important;
        height: 30px !important;
        font-size: 1rem !important;
    }
    .stop-clock-label {
        font-size: 0.6rem !important;
    }
    .stop-ampm {
        font-size: 0.65rem !important;
    }

    /* ปุ่มเปิด/ปิด Timer */
    .btn-timer {
        padding: 0.3rem 1rem !important;
        font-size: 0.7rem !important;
    }

    /* ---------- ปุ่มเล่นเพลง ---------- */
    .play-button-large {
        width: 48px !important;
        height: 48px !important;
        font-size: 1.4rem !important;
    }

    /* ---------- Header และ User Info ---------- */
    .flex-wrap.justify-between {
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.5rem !important;
        text-align: center !important;
    }
    .logo-icon {
        width: 45px !important;
        height: 45px !important;
    }
    .app-title {
        font-size: 1.2rem !important;
    }
    .user-info {
        font-size: 0.7rem !important;
    }

    /* ---------- Info Panel ---------- */
    .info-panel {
        padding: 0.7rem !important;
        margin-top: 1rem !important;
    }
    .song-title {
        font-size: 1.1rem !important;
    }
    .melody-notes {
        gap: 0.3rem !important;
        flex-wrap: wrap !important;
    }
    .storage-status {
        position: relative !important;
        margin-top: 0.5rem !important;
        justify-content: center !important;
        padding-right: 0 !important;
        font-size: 0.65rem !important;
    }

    /* ---------- Form Elements ---------- */
    .form-group .flex.gap-2 {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }
    .date-time-row {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }
    .modal-content {
        max-width: 95% !important;
        width: 95% !important;
        margin: 1rem auto !important;
    }

    /* ---------- Support Section ---------- */
    .support-content {
        flex-direction: column !important;
        text-align: center !important;
        gap: 0.8rem !important;
    }
    .support-buttons {
        justify-content: center !important;
    }
    .btn-support {
        font-size: 0.75rem !important;
        padding: 0.4rem 0.8rem !important;
    }

    /* ---------- Footer ---------- */
    .destiblue-footer a {
        font-size: 0.8rem !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 0.3rem !important;
    }
}

/* ===================================================== */
/* ปรับเพิ่มเติมสำหรับหน้าจอที่แคบมาก (< 480px portrait) */
/* ===================================================== */
@media (max-width: 480px) and (orientation: portrait) {
    .clock-card {
        width: 60px !important;
        height: 70px !important;
    }
    .clock-number {
        font-size: 1.6rem !important;
    }
    .clock-label {
        font-size: 0.55rem !important;
    }
    .am-pm-badge {
        font-size: 0.65rem !important;
        padding: 0.15rem 0.5rem !important;
    }
    .stop-clock-number {
        font-size: 1.2rem !important;
    }
    .adj-btn {
        width: 26px !important;
        height: 26px !important;
        font-size: 0.9rem !important;
    }
    .stop-min-sec-row {
        gap: 0.5rem !important;
    }
    .btn-timer {
        font-size: 0.65rem !important;
        padding: 0.25rem 0.8rem !important;
    }
    .play-button-large {
        width: 42px !important;
        height: 42px !important;
        font-size: 1.2rem !important;
    }
    .glass-card {
        padding: 0.5rem !important;
    }
}

/* ===================================================== */
/* ป้องกันการล้นของ stop-min-sec-row ในกรณีที่เบียดเกินไป */
/* ===================================================== */
@media (max-width: 380px) and (orientation: portrait) {
    .stop-min-sec-row {
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.5rem !important;
    }
    .stop-min-sec-row .stop-clock-card {
        width: 100% !important;
        max-width: 140px !important;
    }
}




/* ===================================================== */
/* มือถือแนวตั้ง – จัด Timer 4 ช่องแนวนอน (ใช้ Flexbox)   */
/* ===================================================== */
@media (max-width: 768px) and (orientation: portrait) {
    /* ทำให้ container หลักเป็น flex แนวนอน */
    .stop-clock-container {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        align-items: stretch !important;
        gap: 0.3rem !important;
        margin-top: 0.75rem !important;
    }

    /* ซ่อน wrapper กลาง – ให้ลูกของการ์ดทั้งหมดอยู่ในกระแส layout */
    .stop-right-column,
    .stop-min-sec-row {
        display: contents !important;
    }

    /* เลือกการ์ดทั้ง 4 ใบโดยตรง (ใช้ > + sibling combinator) */
    .stop-clock-container > .stop-clock-card,
    .stop-min-sec-row .stop-clock-card {
        flex: 1 1 0 !important;          /* ให้แต่ละช่องกว้างเท่ากัน */
        min-width: 0 !important;         /* ป้องกัน overflow */
        margin: 0 !important;
        padding: 0.2rem 0.1rem !important;
    }

    /* การ์ดตัวที่ 3 (Timer Control) – อาจต้องปรับ padding ต่างหาก */
    .stop-min-sec-row .stop-clock-card:nth-child(3) {
        flex: 1 1 0 !important;
        padding: 0.2rem 0 !important;
    }

    /* ปรับขนาดตัวเลขและปุ่มภายในแต่ละการ์ดให้เล็กลง */
    .stop-clock-number {
        font-size: 1rem !important;
    }
    .adj-btn {
        width: 22px !important;
        height: 22px !important;
        font-size: 0.7rem !important;
        margin: 2px 1px !important;
    }
    .stop-clock-label {
        font-size: 0.5rem !important;
    }
    .stop-ampm {
        font-size: 0.55rem !important;
        margin-top: 0px !important;
    }

    /* ปุ่ม Timer และข้อความภายในช่องที่ 4 */
    .btn-timer {
        padding: 0.2rem 0.3rem !important;
        font-size: 0.55rem !important;
        white-space: nowrap;
    }
    .timer-status {
        font-size: 0.5rem !important;
        margin-top: 0.1rem !important;
        white-space: normal;
        word-break: keep-all;
    }

    /* ซ่อน div เปล่าที่อาจมี */
    .stop-min-sec-row .stop-clock-card:nth-child(3) div:empty {
        display: none;
    }
}

/* จอแคบมาก (< 400px) – ลดขนาดอักษรและปุ่มลงอีก */
@media (max-width: 400px) and (orientation: portrait) {
    .stop-clock-number {
        font-size: 0.85rem !important;
    }
    .adj-btn {
        width: 18px !important;
        height: 18px !important;
        font-size: 0.6rem !important;
    }
    .btn-timer {
        font-size: 0.5rem !important;
        padding: 0.15rem 0.2rem !important;
    }
    .timer-status {
        font-size: 0.45rem !important;
    }
    .stop-clock-label {
        font-size: 0.45rem !important;
    }
}