@charset "utf-8";
/* ROOT VARIABLES */
:root {
    --primary-color: #1E90FF;
    --secondary-color: #4169E1;
    --accent-color: #6A5ACD;
    --purple-ish: #8A2BE2;
    --text-color: #1e293b;
    --text-light: #334155;
    --text-muted: #64748b;
    --bg-main: linear-gradient(135deg, #f0f4f8 0%, #d9e2ec 25%, #c0cdda 50%, #a7b8c9 75%, #8fa0b5 100%);
    --bg-container: rgba(255, 255, 255, 0.95);
    --bg-section: rgba(255, 255, 255, 0.93);
    --bg-card-item: rgba(255, 255, 255, 0.98);
    --bg-input: rgba(255, 255, 255, 0.96);
    --bg-prompt-text: rgba(241, 245, 249, 0.98);
    --bg-placeholder: rgba(248, 250, 252, 0.88);
    --border-color-soft: rgba(71, 85, 105, 0.1);
    --border-color-input: #d1d5db;
    --border-color: rgba(71, 85, 105, 0.1);
    --shadow-main: 0 30px 80px rgba(71, 85, 105, 0.15);
    --shadow-card: 0 10px 30px rgba(71, 85, 105, 0.08);
    --card-shadow: 0 9px 22px rgba(71, 85, 105, 0.07);
    --blur-amount: 20px;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --primary-color-rgb: 30, 144, 255;
    --purple-ish-rgb: 138, 43, 226;
}


/* ซ่อน Histats counter */
#histats_counter {
    display: none !important;
}



/* GENERAL RESETS AND BODY STYLING */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { -webkit-tap-highlight-color: transparent; }
input, textarea, select, button { -webkit-appearance: none; -moz-appearance: none; appearance: none; font-family: inherit; }
body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-main);
    min-height: 100vh;
    padding: 8px; /* For desktop view */
    position: relative;
    overflow-x: hidden; /* Prevent horizontal scroll on body for all views */
    color: var(--text-color);
}
.container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--bg-container);
    backdrop-filter: blur(calc(var(--blur-amount) + 10px));
    border-radius: 25px;
    box-shadow: var(--shadow-main), inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 0 0 1px var(--border-color-soft);
    overflow: hidden;
    position: relative;
    z-index: 1;
    border: 1px solid var(--border-color-soft);
    animation: fadeInContainer 0.6s ease-out;
}
@keyframes fadeInContainer { from { opacity: 0.6; transform: scale(0.98); } to { opacity: 1; transform: scale(1); } }

/* HEADER STYLES */
.header { background: linear-gradient(135deg, #1E90FF 0%, #4169E1 25%, #6A5ACD 50%, #8A2BE2 100%); padding: 20px 15px; text-align: center; color: white; position: relative; border-bottom: 1px solid rgba(71, 85, 105, 0.1); }
.header h1 { font-size: clamp(1.8rem, 6vw, 3.8rem); margin-bottom: 15px; font-weight: 800; text-shadow: 2px 2px 8px rgba(0,0,0,0.3); background: linear-gradient(135deg, #ffffff, #f0f8ff, #e6f3ff); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; letter-spacing: -1px; word-break: break-word; }
.header p { font-size: clamp(0.9rem, 3vw, 1.4rem); opacity: 0.95; color: rgba(255, 255, 255, 0.9); line-height: 1.4; }

/* USER MENU & ONLINE STATUS */
.user-menu-container { position: absolute; top: 15px; left: 15px; z-index: 10; }
.user-menu { background: rgba(255, 255, 255, 0.15); backdrop-filter: blur(8px); padding: 8px 15px; border-radius: 25px; border: 1px solid rgba(255, 255, 255, 0.25); font-size: 12px; display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; }
.user-menu a { color: white; text-decoration: none; font-weight: 500; transition: opacity 0.3s ease; white-space: nowrap; font-size: 12px; padding: 3px 5px; }
.user-menu a i { margin-right: 5px; }
.user-menu a:hover { opacity: 0.8; text-decoration: underline; }
.member-badge { background: rgba(255, 255, 255, 0.25); padding: 3px 10px; border-radius: 12px; font-size: 10px; }
.user-points-display { color: white; font-weight: 500; font-size: 11px; margin-left: 5px; padding: 3px 8px; background: rgba(255,255,255,0.15); border-radius: 10px; }
.user-points-display i { color: #ffd700; }
.online-status-container { position: absolute; top: 15px; right: 15px; z-index: 10; }
.online-status { background: rgba(0, 0, 0, 0.25); backdrop-filter: blur(8px); padding: 8px 15px; border-radius: 25px; border: 1px solid rgba(255, 255, 255, 0.15); display: flex; align-items: center; gap: 6px; animation: onlineStatusPulse 3s infinite ease-in-out; }
@keyframes onlineStatusPulse { 0%, 100% { box-shadow: 0 0 10px rgba(46, 204, 113, 0.2); } 50% { box-shadow: 0 0 18px rgba(46, 204, 113, 0.5); } }
.online-indicator { display: inline-flex; align-items: center; gap: 5px; color: white; font-size: 12px; font-weight: 500; }
.online-dot { width: 8px; height: 8px; background: linear-gradient(45deg, #2ecc71, #27ae60); border-radius: 50%; animation: pulse 1.5s infinite; box-shadow: 0 0 5px rgba(46, 204, 113, 0.35); }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.7; transform: scale(1.08); } }

/* MAIN LAYOUT */
.main-content-grid {
    display: grid;
    grid-template-columns: 1fr; /* Mobile first: single column */
    gap: 20px;
    padding: 15px;
    margin-top: 20px;
}

/* Desktop Layout (min-width: 992px) */
@media (min-width: 992px) {
    .main-content-grid {
        display: grid;
        grid-template-columns: 380px 1fr; /* Left col (form+articles), Right col (results) */
        grid-template-rows: auto auto;    /* Row 1 for Gallery, Row 2 for Main L/R content */
        grid-template-areas:
            "gallery_top_area      gallery_top_area"
            "main_left_content   main_right_content";
        gap: 25px;
        padding: 20px;
    }
    .gallery-section { grid-area: gallery_top_area; }
    .main-left-column-stack { grid-area: main_left_content; display: flex; flex-direction: column; gap: 25px; }
    .result-section { grid-area: main_right_content; margin-bottom: 0; }
    .main-col-left, .main-col-right, .bottom-row-content { display: contents; }
}

/* SECTIONS */
.form-section, .result-section, .gallery-section, .examples-section, .marketplace-preview-section, .articles-section {
    background: var(--bg-section);
    backdrop-filter: blur(var(--blur-amount));
    padding: 20px;
    border-radius: 16px;
    border: 1px solid var(--border-color-soft);
    box-shadow: var(--card-shadow);
    position: relative;
    width: 100%;
    box-sizing: border-box;
}
.form-section::before, .result-section::before, .gallery-section::before, .examples-section::before, .marketplace-preview-section::before, .articles-section::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3.5px;
    border-radius: 16px 16px 0 0;
}
.form-section::before, .result-section::before { background: linear-gradient(90deg, var(--primary-color), var(--secondary-color), var(--accent-color), var(--purple-ish)); }
.examples-section::before { background: linear-gradient(90deg, var(--success-color), #16a34a, var(--accent-color)); }
.marketplace-preview-section::before { background: linear-gradient(90deg, var(--purple-ish), var(--accent-color), var(--secondary-color)); }
.gallery-section::before { background: linear-gradient(90deg, var(--accent-color), var(--purple-ish), #FF69B4, #FFD700); }
.articles-section::before { background: linear-gradient(90deg, #4CAF50, #8BC34A, #CDDC39); }

.section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; font-size: 1.3rem; font-weight: 700; color: var(--text-color); }
.section-icon { display: flex; align-items: center; justify-content: center; width: 35px; height: 35px; background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)); border-radius: 10px; color: white; font-size: 1rem; }

/* FORM ELEMENTS */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--text-color); font-size: 14px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 12px 15px; border: 2px solid var(--border-color-input);
    border-radius: 12px; background: var(--bg-input); font-size: 14px;
    transition: all 0.3s ease; backdrop-filter: blur(10px);
    box-sizing: border-box;
}
.form-group select { cursor: pointer; }
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--text-muted); opacity: 0.7; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.1); background: white;
}
.form-group textarea { min-height: 100px; resize: vertical; }

/* BUTTONS */
.generate-btn {
    width: 100%; padding: 18px 25px; background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white; border: none; border-radius: 15px; font-size: 16px; font-weight: 700; cursor: pointer;
    transition: all 0.3s ease; box-shadow: 0 8px 20px rgba(var(--primary-color-rgb), 0.3); text-transform: none;
}
.generate-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 25px rgba(var(--primary-color-rgb), 0.4); }
.generate-btn:disabled { background: #9ca3af; cursor: not-allowed; transform: none; box-shadow: none; }

.copy-btn {
    background: var(--success-color); color: white; border: none; padding: 10px 20px;
    border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer;
    transition: all 0.3s ease; margin-top: 10px;
}
.copy-btn:hover { background: #059669; transform: translateY(-1px); }

.refresh-btn {
    background: var(--accent-color); color: white; border: none; padding: 10px 15px;
    border-radius: 8px; font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.3s ease;
}
.refresh-btn:hover { background: #5a4caf; transform: translateY(-1px); }

/* PROMPT OUTPUT & PLACEHOLDER */
.prompt-output { background: var(--bg-prompt-text); border-radius: 12px; padding: 15px; border: 1px solid var(--border-color-soft); }
.prompt-output h3 { margin-bottom: 10px; color: var(--text-color); font-size: 14px; font-weight: 600; }
.prompt-text {
    background: white; border: 1px solid var(--border-color-soft); border-radius: 8px;
    padding: 12px 15px; font-size: 13px; line-height: 1.5; color: var(--text-color);
    max-height: 150px; overflow-y: auto; word-wrap: break-word;
}
.prompt-text::-webkit-scrollbar { width: 6px; }
.prompt-text::-webkit-scrollbar-thumb { background: var(--accent-color); border-radius: 3px; }
.prompt-text::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 3px; }

.placeholder-message { text-align: center; padding: 40px 20px; background: var(--bg-placeholder); border-radius: 12px; border: 2px dashed var(--border-color-soft); }
.placeholder-message i { font-size: 3rem; color: var(--accent-color); margin-bottom: 15px; }
.placeholder-message h3 { color: var(--text-color); margin-bottom: 10px; font-size: 1.2rem; }
.placeholder-message p { color: var(--text-muted); line-height: 1.5; }

/* LIMIT STATUS MESSAGES */
.limit-warning, .limit-info { padding: 12px 15px; border-radius: 8px; margin-bottom: 20px; font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.limit-warning { background: rgba(251, 146, 60, 0.1); border: 1px solid rgba(251, 146, 60, 0.3); color: #d97706; }
.limit-info { background: rgba(59, 130, 246, 0.1); border: 1px solid rgba(59, 130, 246, 0.3); color: #1d4ed8; }
.limit-warning a, .limit-info a { color: inherit; text-decoration: underline; font-weight: 600; }

/* GALLERY & EXAMPLES SECTION HEADERS */
.gallery-header, .examples-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; flex-wrap: wrap; gap: 15px; }
.gallery-header > div:first-child, .examples-header > div:first-child { flex: 1; }
.gallery-header h2, .examples-header h2 { color: var(--text-color); font-size: 1.3rem; font-weight: 700; margin-bottom: 5px; display: flex; align-items: center; gap: 10px; }
.gallery-header p, .examples-header p { color: var(--text-muted); font-size: 0.9rem; line-height: 1.4; }

   4. GENERIC CARD & SECTION STYLES
   ================================================================= */
.card, .form-section, .result-section, .gallery-section, .articles-section, .examples-section {
    background: white;
    padding: 20px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.section-title i {
    color: var(--accent-color);
}


/* =================================================================
   5. FORMS & BUTTONS
   ================================================================= */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-light);
    font-size: 0.9rem;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background-color: #f9fafb;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.2);
    background-color: white;
}
.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

/* Buttons */
.generate-btn {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px -5px rgba(var(--primary-color-rgb), 0.4);
}
.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 20px -5px rgba(var(--primary-color-rgb), 0.5);
}
.generate-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}


/* =================================================================
   6. GALLERY SECTION
   ================================================================= */
.gallery-header h3, .gallery-header p { margin: 0; }
.gallery-header > div:first-child { flex: 1; }

.gallery-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}
.gallery-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
}

.gallery-grid {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 5px 2px 20px 2px; /* Padding for scrollbar and shadow */
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}
.gallery-grid::-webkit-scrollbar { height: 8px; }
.gallery-grid::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 4px; }
.gallery-grid::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.gallery-grid::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.gallery-item {
    flex: 0 0 280px; /* Card width */
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.gallery-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.08);
}

.gallery-image-wrapper {
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    position: relative;
    background-color: #f0f2f5;
}
.gallery-actual-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-content {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.gallery-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 10px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.gallery-title i {
    color: var(--accent-color);
}

.gallery-prompt-container {
    margin-top: auto; /* Push to bottom */
    position: relative;
}
.gallery-prompt-text {
    background-color: #f8f9fa;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.8rem;
    color: var(--text-light);
    line-height: 1.5;
    min-height: 80px;
    max-height: 110px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    user-select: none;
    -webkit-user-select: none;
}

/* The larger copy button */
.gallery-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 18px; /* Increased padding */
    font-size: 0.9rem; /* Increased font size */
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.gallery-copy-btn:hover {
    background: var(--purple-ish);
    transform: translateY(-2px);
}
.gallery-copy-btn .fa-check { color: #a7f3d0; } /* Checkmark color */

/* ส่วนที่เหลือของ style.css ของคุณ ... */
/* (วางส่วน ARTICLES SECTION, EXAMPLES STYLES, REALTIME SIMULATION, FOOTER STYLES ฯลฯ ต่อจากนี้) */


/* ARTICLES SECTION - NEW STYLES FOR LINK LIST */
.articles-link-list { display: flex; flex-direction: column; gap: 10px; }
.article-link-item {
    display: block; padding: 10px 15px; background-color: rgba(241, 245, 249, 0.8);
    border: 1px solid rgba(203, 213, 225, 0.5); border-radius: 10px; text-decoration: none;
    color: var(--text-light); font-size: 0.9em; font-weight: 500;
    transition: background-color 0.25s ease, color 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
    display: flex; align-items: center;
}
.article-link-item:hover {
    background-color: rgba(255, 255, 255, 0.9); color: var(--primary-color);
    transform: translateX(3px); box-shadow: 0 3px 10px rgba(var(--primary-color-rgb), 0.1);
    border-color: rgba(var(--primary-color-rgb), 0.3);
}
.article-link-item i { margin-right: 10px; color: var(--accent-color); transition: color 0.25s ease; }
.article-link-item:hover i { color: var(--primary-color); }

/* EXAMPLES STYLES */
.examples-grid { display: grid; grid-template-columns: 1fr; gap: 15px; }
.example-card { background: var(--bg-card-item); border-radius: 12px; padding: 15px; box-shadow: var(--card-shadow); border: 1px solid var(--border-color-soft); transition: all 0.3s ease; position: relative; display: flex; flex-direction: column; }
.example-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--success-color), var(--accent-color)); border-radius: 12px 12px 0 0; }
.example-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(71, 85, 105, 0.1); }
.example-title { font-size: 0.95rem; font-weight: 600; color: var(--text-color); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.example-prompt { background: #f8fafc; border: 1px solid var(--border-color-soft); border-radius: 6px; padding: 10px; font-size: 0.8rem; line-height: 1.4; color: var(--text-color); max-height: 100px; overflow-y: auto; word-wrap: break-word; margin-bottom: 12px; flex-grow: 1; }
.example-prompt::-webkit-scrollbar { width: 4px; }
.example-prompt::-webkit-scrollbar-thumb { background: var(--accent-color); border-radius: 2px; }
.example-prompt::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 2px; }
.example-card .copy-btn { margin-top: auto; font-size: 12px; padding: 8px 15px; }

/* REALTIME SIMULATION */
.realtime-prompt-simulation { text-align: center; padding: 20px; background: rgba(59, 130, 246, 0.05); border-radius: 12px; border: 1px solid rgba(59, 130, 246, 0.2); }
.realtime-prompt-simulation p { color: var(--primary-color); font-weight: 500; margin-bottom: 10px; }
.typing-dots span { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--primary-color); margin: 0 2px; animation: typing 1.4s infinite ease-in-out; }
.typing-dots span:nth-child(1) { animation-delay: 0.2s; }
.typing-dots span:nth-child(2) { animation-delay: 0.4s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-15px); } }

/* FOOTER STYLES */
.site-footer { background: #2c3e50; color: #bdc3c7; padding: 30px 15px; text-align: center; font-size: 0.85rem; margin-top: 30px; }
.footer-links { margin-bottom: 15px; }
.footer-links a { color: #ecf0f1; text-decoration: none; margin: 0 10px; transition: color 0.3s ease; }
.footer-links a:hover { color: var(--primary-color); }
.footer-socials { margin-bottom: 15px; }
.footer-socials a { color: #ecf0f1; margin: 0 8px; transition: color 0.3s ease; }
.footer-socials i { font-size: 1.3rem; }
.footer-socials a:hover i { color: var(--primary-color); }
.footer-copyright { margin-top: 15px; font-size: 0.75rem; }

/* --- RESPONSIVE STYLES --- */
@media (min-width: 768px) and (max-width: 991px) {
    .header { padding: 20px; }
    .user-menu-container { left: 20px; top: 20px; }
    .online-status-container { right: 20px; top: 20px; }
    .user-menu { max-width: calc(100% - 220px); }
    .main-content-grid {
        grid-template-columns: 1fr !important;
        grid-template-areas:
            "gallery_top_area"
            "main_right_content"
            "main_left_content"
            !important;
        padding: 20px; gap: 20px;
    }
    .gallery-section { grid-area: gallery_top_area; }
    .result-section { grid-area: main_right_content; }
    .main-left-column-stack { grid-area: main_left_content; }
    .form-section, .result-section, .gallery-section, .articles-section { padding: 20px; margin-bottom: 0; }
    .articles-section { margin-top: 0; }
    .section-title { font-size: 1.2rem; }
}

@media (max-width: 767px) {
    body { padding: 0; }
    .container { border-radius: 0; margin: 0; max-width: 100vw; width: 100%; border: none; box-shadow: none; overflow-x: hidden !important; }
    .header { padding: 15px 10px; border-radius: 0 0 20px 20px; }
    .header h1 { font-size: clamp(1.4rem, 5vw, 1.8rem); }
    .header p { font-size: clamp(0.75rem, 2.2vw, 0.85rem); }
    .user-menu-container, .online-status-container { position: static; margin: 8px auto; width: auto; max-width: 95%; display: flex; justify-content: center; }
    .user-menu { overflow-x: auto; flex-wrap: nowrap; justify-content: flex-start; padding: 6px 10px; border-radius: 15px; }
    .user-menu a, .online-indicator, .user-points-display { font-size: 10px; }
    .user-menu a { padding: 2px 4px; }
    .member-badge { font-size: 8px; padding: 2px 6px; }
    .online-status { padding: 6px 10px; border-radius: 15px;}
    .main-content-grid {
        grid-template-columns: 1fr !important;
        grid-template-areas: "gallery_top_area" "main_right_content" "main_left_content" !important;
        padding: 10px; gap: 15px; width: 100%; box-sizing: border-box;
    }
    .gallery-section { grid-area: gallery_top_area; }
    .result-section { grid-area: main_right_content; }
    .main-left-column-stack { grid-area: main_left_content; }
    .form-section, .result-section, .gallery-section, .articles-section { padding: 15px; margin-bottom: 0; border-radius: 12px; width: 100% !important; box-sizing: border-box; overflow-x: hidden; }
    .articles-section { margin-top: 0; }
    .section-title { font-size: 1rem; margin-bottom: 12px; }
    .section-icon { width: 30px; height: 30px; font-size: 0.85rem; }
    .form-group label { font-size: 11px; margin-bottom: 5px;}
    .form-group input, .form-group select, .form-group textarea { padding: 9px 10px; font-size: 13px; border-radius: 8px;}
    .generate-btn { padding: 12px 20px; font-size: 13.5px; }
    .prompt-output { padding: 12px; } .prompt-output h3 { font-size: 13px; margin-bottom: 8px;}
    .prompt-text { padding: 8px 10px; font-size: 11.5px; max-height: 100px;}
    .copy-btn { padding: 8px 15px; font-size: 11.5px;}
    .gallery-header h2, .examples-header h2 { font-size: 1.05rem; }
    .gallery-header p, .examples-header p { font-size: 0.7rem; }

    /* Responsive Gallery Item */
    .gallery-item {
        min-width: 220px !important; /* ปรับความกว้างขั้นต่ำสำหรับจอเล็ก */
        max-width: 240px !important; /* ปรับความกว้างสูงสุด */
        flex: 0 0 auto; /* ให้ยืดหยุ่นตาม min/max */
    }
    .gallery-image {
        height: 140px; /* ปรับความสูงของรูปภาพสำหรับจอขนาดกลาง */
    }
    .gallery-title { font-size: 0.85rem; }
    .gallery-description { font-size: 0.7rem; -webkit-line-clamp: 2; max-height: 2.8em; } /* จำกัด 2 บรรทัด */
    .gallery-prompt { font-size: 0.65rem; -webkit-line-clamp: 2; max-height: 2.4em; } /* จำกัด 2 บรรทัด */
    .gallery-actions .copy-btn { font-size: 0.7rem; padding: 6px 10px;}

    .site-footer { padding: 20px 10px; font-size: 0.8rem;}
    .footer-links a { margin: 0 6px; font-size: 0.75rem;}
    .footer-socials i { font-size: 1.1rem; }
}

@media (max-width: 480px) {
    .gallery-item {
        min-width: 180px !important; /* กว้างขึ้นอีกนิดสำหรับจอเล็กมาก */
        max-width: 200px !important;
    }
    .gallery-image {
        height: 120px; /* ความสูงสำหรับจอเล็กมาก */
    }
     .gallery-content { padding: 10px; }
    .gallery-title { font-size: 0.8rem; }
}