*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; padding: 20px; font-family: 'Google Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: #1F2328; background-color: #F0F2F5; direction: rtl; text-align: right; line-height: 1.5; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
.main-header-table { background: linear-gradient(135deg, #243449 0%, #1a2533 100%); border-radius: 8px !important; margin-bottom: 16px !important; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); border: none !important; border-collapse: separate !important; border-spacing: 0 !important; overflow: hidden; }
.header-td { padding: 16px 24px !important; border: none !important; vertical-align: middle !important; background-color: transparent !important; }
.logo-container { display: flex !important; align-items: center; gap: 12px; text-decoration: none !important; }
.logo-icon { font-size: 32px; line-height: 1; background: #000000; color: #D9FFFF; width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: 0 2px 8px rgba(0,0,0,0.35); }
.logo-text { color: #FFFFFF; font-weight: 700; font-size: 20px; letter-spacing: 0.3px; white-space: normal; line-height: 1.2; flex-shrink: 1; }
a:link { color: #0969DA; text-decoration: none; } a:visited { color: #8250DF; } a:hover { color: #0550AE; text-decoration: underline; }
select, textarea, input[type="text"], input[type="password"] { font-family: 'Google Sans', sans-serif; font-size: 14px; background-color: #FFFFFF; border: 1px solid #D0D7DE; border-radius: 6px; padding: 8px 12px; color: #1F2328; transition: border-color 0.2s; max-width: 100%; vertical-align: middle; }
input:focus, textarea:focus, select:focus { outline: none; border-color: #0969DA; box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.2); }
input[type="submit"], input[type="image"] { cursor: pointer; background-color: #243449; color: #FFFFFF; font-family: 'Google Sans', sans-serif; font-weight: 500; font-size: 14px; border: none; border-radius: 6px; padding: 8px 16px; transition: background-color 0.2s; -webkit-appearance: none; -moz-appearance: none; appearance: none; vertical-align: middle; }
input[type="submit"]:hover, input[type="image"]:hover { background-color: #1A2533; } form { margin: 0; } hr { border: 0; height: 1px; color: #D0D7DE; background-color: #D0D7DE; }
.smaller { font-size: 12px; color: #656D76; } .small { font-size: 13px; } .medium { font-size: 15px; }
table { border-collapse: collapse !important; border-spacing: 0 !important; width: 100%; }
table[bgcolor], table[bgcolor="#243449"], table[cellspacing="1"][cellpadding="4"] { background-color: #FFFFFF !important; border: 1px solid #D0D7DE !important; border-radius: 8px !important; overflow: hidden !important; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important; margin-bottom: 16px; }
td[bgcolor] { background-color: transparent !important; padding: 12px 16px !important; border-bottom: 1px solid #EAECEF !important; border-top: none !important; border-left: none !important; border-right: none !important; vertical-align: middle !important; color: #1F2328; }
td table { border: none !important; box-shadow: none !important; margin-bottom: 0 !important; border-radius: 0 !important; }
table[cellpadding="0"][cellspacing="0"][border="0"] td { padding: 0 !important; border: none !important; }
tr.heading, tr.heading td, td.heading { background-color: #243449 !important; color: #FFFFFF !important; font-weight: 600 !important; font-size: 13px !important; letter-spacing: 0.3px; border: none !important; border-bottom: 2px solid #1a2533 !important; padding: 14px 16px !important; }
.heading a:link, .heading a:visited { color: #FFFFFF !important; text-decoration: none; display: inline-block; } .heading a:hover { text-decoration: underline; }
tr.heading > td > a:only-child, tr.section > td > a:only-child, td.heading > a:only-child, td.section > a:only-child { display: block !important; margin: -14px -16px !important; padding: 14px 16px !important; }
tr.section, tr.section td, td.section { background-color: #F6F8FA !important; color: #24292F !important; font-weight: 600 !important; font-size: 14px !important; border: none !important; border-bottom: 1px solid #D0D7DE !important; padding: 10px 16px !important; }
.section a:link, .section a:visited { color: #24292F !important; text-decoration: none; display: inline-block; } .section a:hover { color: #243449 !important; text-decoration: underline; }
td[width="1%"] { width: 40px !important; text-align: center !important; } td[nowrap] { white-space: nowrap !important; }
.postbit { width: 100%; overflow-x: auto; overflow-y: hidden; word-wrap: break-word; margin-bottom: 0; max-width: 100%; } .postbit img { max-width: 100%; height: auto; } pre, code { white-space: pre-wrap !important; word-wrap: break-word !important; }
.heading forms { display: flex !important; flex-wrap: wrap !important; align-items: center !important; justify-content: center !important; gap: 8px !important; width: 100% !important; }
.heading select { margin: 0 !important; max-width: 150px !important; } .heading input[type="image"] { padding: 0 !important; background: transparent !important; height: 22px; margin: 0 !important; } td { text-align: right; }

/* Accessibility Fix: Fix low-contrast opacity on footer text */
span[style*="opacity: 0.6"], span[style*="opacity: 0.7"] { opacity: 0.9 !important; color: #57606a !important; }

/* Mobile inline stats: hidden on desktop, shown on mobile */
.mobile-stats { display: none; }

@media (max-width: 768px) {
    body { padding: 10px; font-size: 14px; }
    /* Fix thread.php not entering mobile mode by preventing horizontal overflow */
    body { overflow-x: hidden; }
    * { word-wrap: break-word; overflow-wrap: break-word; }
    table { width: 100% !important; max-width: 100% !important; }
    td { white-space: normal !important; }
    .postbit { max-width: 100% !important; overflow-x: auto !important; }
    .postbit img { max-width: 100% !important; height: auto !important; }
    pre, code { white-space: pre-wrap !important; word-wrap: break-word !important; }

    .header-td { padding: 12px 16px !important; } .logo-container { gap: 10px; } .logo-text { font-size: 16px; line-height: 1.3; } .logo-icon { width: 40px; height: 40px; font-size: 24px; }
    .smaller { font-size: 12px; } .small { font-size: 13px; } .medium { font-size: 14px; } select, textarea, input[type="text"], input[type="password"] { font-size: 16px !important; } input[type="submit"], input[type="image"] { font-size: 14px !important; } .heading select { max-width: 120px !important; font-size: 14px !important; }
    td[bgcolor], .heading td, .section td { padding: 8px 10px !important; }
    tr.heading > td > a:only-child, tr.section > td > a:only-child { margin: -8px -10px !important; padding: 8px 10px !important; }

    /* Mobile Optimization: Hide non-essential columns completely */
    table[bgcolor] td[width="5%"],
    table[bgcolor] td[width="15%"],
    table[bgcolor] td[width="19%"],
    .count-col,
    .lastpost-col {
        display: none !important;
    }

    /* Hide the main table header row (Forum/Topics/Posts/Last Post) entirely on mobile */
    table[bgcolor]:not([id^="post"]):not(.main-header-table) > tbody > tr.heading:first-child {
        display: none !important;
    }

    /* Hide sort/filter form on mobile */
    .sort-filter-form {
        display: none !important;
    }

    /* Hide non-essential columns in thread listing */
    .td-icon, .td-author, .td-replies, .td-views {
        display: none !important;
    }

    /* Adjust last post cell to only show arrow */
    .td-lastpost table { width: 100% !important; }
    .td-lastpost-info { display: none !important; }
    .td-lastpost-arrow { text-align: left !important; width: 100% !important; display: block !important; padding-top: 8px; }
    .td-lastpost-arrow a { font-size: 18px; }

    table[bgcolor]:not([id^="post"]):not(.main-header-table) { display: block !important; width: 100% !important; overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
    table[bgcolor]:not([id^="post"]):not(.main-header-table) > tbody { display: table !important; width: 100% !important; }
    table[bgcolor] > tbody > tr > td { padding: 8px 8px !important; }
    table[id^="post"] { display: block !important; width: 100% !important; margin-bottom: 16px !important; } table[id^="post"] > tbody { display: block !important; width: 100% !important; } table[id^="post"] > tbody > tr { display: block !important; width: 100% !important; }
    table[id^="post"] > tbody > tr > td { display: block !important; width: 100% !important; padding: 10px !important; text-align: right !important; white-space: normal !important; word-wrap: break-word !important; overflow-wrap: break-word !important; }
    table[id^="post"] > tbody > tr > td[width="175"] { background-color: #F6F8FA !important; border-bottom: 1px solid #D0D7DE !important; }
    table[id^="post"] td table { display: table !important; width: 100% !important; margin: 0 !important; } table[id^="post"] td table tbody { display: table-row-group !important; } table[id^="post"] td table tr { display: table-row !important; } table[id^="post"] td table td { display: table-cell !important; width: auto !important; padding: 5px !important; }
    table td[width="50%"] { display: block !important; width: 100% !important; padding: 4px 10px !important; } table td[width="50%"] b { display: block; margin-bottom: 4px; color: #243449; }
    img { max-width: 100%; height: auto; } .postbit { max-width: 100%; overflow-x: auto; }

    /* Adjust LTR description for mobile so it wraps neatly without stretching */
    .ltr-description {
        display: inline-block;
        width: fit-content;
        max-width: 90%;
        font-size: 10px;
        padding: 3px 6px;
    }

    /* Mobile inline stats: show under forum description */
    .mobile-stats {
        display: block;
        margin-top: 4px;
        color: #656D76;
        font-size: 11px;
        line-height: 1.5;
    }
    .mobile-lastpost {
        color: #8b949e;
        font-size: 10px;
    }
}

body { padding: 0 !important; }
body > table.main-header-table, body > table[bgcolor="#FFFFFF"] { width: 80% !important; max-width: 1100px !important; margin-right: auto !important; margin-left: auto !important; }
body > table.main-header-table { margin-top: 20px !important; margin-bottom: 16px !important; } body > table[bgcolor="#FFFFFF"] { margin-bottom: 40px !important; }

@media (max-width: 768px) {
    body > table.main-header-table, body > table[bgcolor="#FFFFFF"] { width: 100% !important; margin-right: 0 !important; margin-left: 0 !important; border-radius: 0 !important; }
    body > table[bgcolor="#FFFFFF"] > tbody > tr > td { padding: 10px !important; }
}

.ml-letter-bar { max-width: 1100px; width: 80%; margin-left: auto; margin-right: auto; display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; align-items: center; padding: 10px 12px; background: #FFFFFF; border: 1px solid #D0D7DE; border-radius: 8px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04); }
.ml-letter-bar a { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; border-radius: 5px; text-decoration: none !important; font-size: 13px; font-weight: 500; color: #656D76 !important; transition: background 0.15s, color 0.15s; }
.ml-letter-bar a:hover { background: #F6F8FA; color: #243449 !important; text-decoration: none !important; }
.ml-letter-bar a.ml-active { background: #243449; color: #FFFFFF !important; font-weight: 600; box-shadow: 0 1px 3px rgba(36, 52, 73, 0.25); }
.ml-letter-sep { width: 1px; height: 20px; background: #D0D7DE; margin: 0 6px; flex-shrink: 0; }
.ml-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 6px; vertical-align: middle; flex-shrink: 0; }
.ml-dot-online { background: #10b981; box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2); } .ml-dot-offline { background: #d0d7de; }
.ml-member-row td { border-bottom: 1px solid #EAECEF !important; } .ml-row-alt td { background-color: #FDFBF7 !important; }
.ml-pagination { padding: 16px 0 8px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; }
.ml-pagination a, .ml-pagination b, .ml-pagination span { padding: 2px 6px; } .ml-pagination b { color: #243449; background: #F6F8FA; border-radius: 4px; border: 1px solid #D0D7DE; }

@media (max-width: 768px) {
    .ml-letter-bar { width: 100%; gap: 2px; padding: 8px 6px; border-radius: 0; } .ml-letter-bar a { min-width: 24px; height: 26px; font-size: 12px; } .ml-letter-sep { margin: 0 4px; }
}

.mention-link { color: #e65100; font-weight: bold; text-decoration: none; background-color: #fff3e0; padding: 1px 5px; border-radius: 4px; transition: background-color 0.2s, color 0.2s; display: inline-block; line-height: 1.4; }
.mention-link:hover { color: #bf360c; background-color: #ffe0b2; text-decoration: none; }

.ltr-description {
    direction: ltr;
    unicode-bidi: isolate;
    text-align: left;
    display: inline-block;
    max-width: 100%;
    box-sizing: border-box;
    border: 1px solid #D0D7DE;
    border-radius: 6px;
    padding: 4px 8px;
    background-color: #F6F8FA;
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.4;
    word-break: break-word;
}
