* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    cursor: url('https://i.gyazo.com/1f517fc1cbd14efc352c83f60eb42978.png'), auto;
}

a, button, input[type="submit"], .clickable {
    cursor: url('https://i.gyazo.com/2d0f2ccffc6f6e0d7060d515cc183f4a.png'), pointer !important;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #2c1810;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(8px);
    z-index: -1;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    z-index: -1;
}

/* Navigation */
nav {
    background: linear-gradient(180deg, #f4d9c6 0%, #e8c4a8 50%, #d4a57a 100%);
    padding: 0.6rem 2rem;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
    border-bottom: 3px solid #c8975e;
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Shared portal dialogs and account summary. */
.portal-modal,
.news-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(32, 17, 8, 0.72);
    box-sizing: border-box;
}

.portal-modal[hidden] {
    display: none;
}

.portal-modal__panel,
.news-modal__panel {
    width: min(100%, 900px);
    max-height: 90vh;
    overflow: auto;
    padding: 1.5rem;
    border: 3px solid #d4a57a;
    border-radius: 10px;
    background: linear-gradient(180deg, #fff7ed 0%, #f0dcc8 100%);
    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.4);
}

.portal-modal__panel {
    width: min(100%, 400px);
    text-align: center;
}

.portal-modal__title,
.portal-modal__message {
    color: #6b3410;
}

.portal-modal__button,
.news-modal button,
.news-state button,
.view-full-btn {
    padding: 0.55rem 1rem;
    border: 1px solid #b66d36;
    border-radius: 5px;
    background: linear-gradient(180deg, #e3b27e 0%, #c78450 100%);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.portal-modal__button {
    width: 100%;
    margin-top: 0.5rem;
}

.portal-account-stats {
    display: flex;
    justify-content: space-around;
    gap: 0.75rem;
    margin: 1rem 0;
    padding: 0.8rem;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.35);
}

.portal-account-stat {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: #8b4513;
    font-weight: 700;
}

#userInfo a {
    color: #8b4513;
    font-weight: 600;
    text-decoration: none;
}

/* Public news presentation. Content HTML is allow-listed by get-news.php. */
.news-state {
    padding: 2rem;
    color: #8b4513;
    text-align: center;
}

.news-state--error {
    display: grid;
    justify-items: center;
    gap: 0.75rem;
}

.news-post {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 1rem;
    padding: 1rem;
    border-left: 4px solid #d4a57a;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.44);
}

.news-post h3 {
    margin: 0 0 0.65rem;
    color: #8b4513;
    font-size: 1.4rem;
    overflow-wrap: anywhere;
}

.news-content-preview {
    position: relative;
    max-height: 380px;
    overflow: hidden;
    margin-bottom: 1rem;
    color: #6b3410;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.news-content-preview::after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 2rem;
    pointer-events: none;
    content: "";
    background: linear-gradient(transparent, rgba(250, 237, 222, 0.96));
}

.news-post__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-top: 0.8rem;
    border-top: 1px solid rgba(139, 69, 19, 0.2);
    color: #8b4513;
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.news-post__author {
    font-weight: 700;
}

.news-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid #d4a57a;
}

.news-modal__header h2 {
    margin: 0;
    color: #8b4513;
    overflow-wrap: anywhere;
}

.news-modal__byline {
    color: #8b4513;
    font-weight: 600;
}

.news-modal__content {
    color: #6b3410;
    font-size: 1.05rem;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.news-content-preview img,
.news-modal__content img {
    max-width: 100%;
    height: auto;
}

.news-content-preview iframe,
.news-modal__content iframe {
    display: block;
    width: min(100%, 800px);
    aspect-ratio: 16 / 9;
    height: auto;
    margin: 1rem auto;
    border: 0;
    border-radius: 8px;
}

@media (max-width: 650px) {
    .news-modal__header {
        align-items: stretch;
        flex-direction: column;
    }

    .news-post__footer {
        align-items: stretch;
        flex-direction: column;
    }
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 3rem;
}

.nav-left {
    display: flex;
    align-items: center;
}

.logo-container {
    display: flex;
    align-items: center;
}

.logo-img {
    height: 60px;
    width: auto;
}

.site-title {
    display: none;
}

.nav-links {
    display: flex;
    gap: 0.3rem;
    list-style: none;
    flex-wrap: wrap;
}

.nav-links a {
    color: #6b3410;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    padding: 0.4rem 0.8rem;
    border-radius: 5px;
    background: transparent;
}

.nav-links a:hover {
    background: rgba(255, 255, 255, 0.4);
    color: #8b4513;
    transform: translateY(-2px);
}

.nav-links a.active {
    background: rgba(255, 255, 255, 0.5);
    color: #8b4513;
}

/* Main Layout */
.main-container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 2rem;
    align-items: start;
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: 100px;
}

.sidebar-section {
    background: linear-gradient(180deg, #f9ede0 0%, #f0dcc8 100%);
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
    border: 2px solid #d4a57a;
    margin-bottom: 2rem;
}

.sidebar-section h3 {
    color: #8b4513;
    margin-bottom: 1rem;
    font-size: 1.3rem;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.5);
}

.login-form input {
    width: 100%;
    padding: 0.8rem;
    margin-bottom: 1rem;
    border: 2px solid #d4a57a;
    border-radius: 5px;
    font-size: 1rem;
    background: #fff;
    transition: border 0.3s;
}

.login-form input:focus {
    outline: none;
    border-color: #c8975e;
}

.login-form button {
    width: 100%;
    padding: 0.8rem;
    background: linear-gradient(180deg, #d4a57a 0%, #c8975e 100%);
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    transition: transform 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.login-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.register-link {
    text-align: center;
    margin-top: 1rem;
}

.register-link a {
    color: #8b4513;
    text-decoration: none;
    font-weight: 600;
}

.register-link a:hover {
    text-decoration: underline;
}

/* Social Media Links */
.social-links {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.social-link, .social-link img {
    cursor: url('https://i.gyazo.com/2d0f2ccffc6f6e0d7060d515cc183f4a.png'), pointer !important;
}

.social-link {
    display: block;
    transition: transform 0.2s, filter 0.2s;
    width: 100%;
    max-width: 300px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.4);
    padding: 10px;
    text-align: center;
}

.social-link:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.6);
}

.social-icon {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 4px;
}

.user-info {
    text-align: center;
}

.user-info h4 {
    color: #8b4513;
    margin-bottom: 1rem;
}

.user-info p {
    margin-bottom: 1rem;
    color: #6b3410;
}

.user-info button {
    width: 100%;
    padding: 0.8rem;
    background: linear-gradient(180deg, #d2691e 0%, #a0522d 100%);
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    transition: transform 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.user-info button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.discord-widget {
    width: 100%;
    height: 500px;
    border: none;
    border-radius: 10px;
    overflow: hidden;
}

/* Main Content */
.content {
    background: linear-gradient(180deg, #f9ede0 0%, #f0dcc8 100%);
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
    border: 2px solid #d4a57a;
    min-height: 600px;
    width: 100%;
    box-sizing: border-box;
}

/* Hero Section for all pages */
.hero {
    text-align: center;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: #8b4513;
    text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.5);
}

.hero p {
    font-size: 1.2rem;
    color: #6b3410;
    margin-bottom: 0;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.3);
}

/* Consistent heading styles */
.content h2 {
    color: #8b4513;
    margin-bottom: 1rem;
    font-size: 1.8rem;
    text-align: left;
}

.content h3 {
    color: #8b4513;
    margin-bottom: 1rem;
    font-size: 1.4rem;
    text-align: left;
}

.content h4 {
    color: #8b4513;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
    text-align: left;
}

.small-text {
    font-size: 0.9rem;
    color: #8b4513;
}

.modal-text {
    text-align: center;
    color: #8b4513;
    font-size: 0.9rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(212, 165, 122, 0.3);
    padding-bottom: 1rem;
}

.modal-title {
    color: #8b4513;
    margin: 0;
    font-size: 1.5rem;
    word-wrap: break-word;
}

.center-title {
    color: #8b4513;
    margin-bottom: 1rem;
    font-size: 1.8rem;
    text-align: center;
}

.card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.card {
    background: linear-gradient(180deg, #fff5eb 0%, #ffe8d1 100%);
    padding: 1rem;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 2px solid #e8c4a8;
    transition: transform 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.card h3 {
    margin-bottom: 0.5rem;
    color: #8b4513;
}

.card p {
    color: #6b3410;
}

/* Ensure news content displays properly on all devices */
.news-content-preview {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-wrap: break-word !important;
    min-height: 50px !important;
    pointer-events: auto !important;
}

.news-content-preview img {
    max-width: 100% !important;
    height: auto !important;
    display: inline-block !important;
}

.news-content-preview iframe {
    max-width: 100% !important;
    display: block !important;
    border: none !important;
    z-index: 5 !important;
}

.news-video {
    position: relative;
    width: 100%;
    height: 0;
    margin: 1rem 0;
    padding-bottom: 56.25%;
    overflow: hidden;
    border-radius: 8px;
    background: #201a17;
}

.news-video iframe {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    border: 0;
}

/* Ensure responsive video containers work properly */
.news-content-preview div[style*="padding-bottom: 56.25%"] {
    display: block !important;
    visibility: visible !important;
    overflow: hidden !important;
    z-index: 5 !important;
    margin: 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
}

.news-content-preview a {
    display: inline-block !important;
    pointer-events: auto !important;
}

#newsContent {
    display: block !important;
    visibility: visible !important;
    width: 100% !important;
    min-height: 100px !important;
}

.news-card {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-height: 150px !important;
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .main-container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        top: 0;
    }

    .discord-widget {
        height: 400px;
    }

    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .logo-container {
        flex-direction: column;
        gap: 0.5rem;
    }

    .site-title {
        font-size: 1.5rem;
    }

    .logo-img {
        height: 40px;
    }

    .nav-links {
        gap: 0.5rem;
        justify-content: center;
    }

    .nav-links a {
        font-size: 0.9rem;
        padding: 0.4rem 0.8rem;
    }
    
    /* Improved news display on mobile */
    .content {
        padding: 0.8rem;
        overflow: visible !important;
    }
    
    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1rem;
    }
    
    .modal-title {
        font-size: 1.3rem;
    }
    
    .center-title {
        font-size: 1.5rem;
    }
    
    .card-grid {
        overflow: visible !important;
    }
    
    .news-content-preview {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        max-height: none !important; /* Remove height restriction on mobile */
        overflow: visible !important;
        z-index: 5 !important;
        position: relative !important;
    }

    #newsContent {
        display: block !important;
        visibility: visible !important;
        width: 100% !important;
        overflow: visible !important;
        z-index: 5 !important;
        position: relative !important;
    }

    /* Ensure news cards are visible on mobile */
    .news-card {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 100% !important;
        box-sizing: border-box !important;
        margin-bottom: 1rem !important;
        overflow: visible !important;
        z-index: 5 !important;
        position: relative !important;
    }
    
    /* Improve YouTube video display on mobile */
    .news-content-preview iframe,
    .news-content-preview img {
        max-width: 100% !important;
        height: auto !important;
        display: inline-block !important;
    }
    
    /* Ensure iframe containers display properly on mobile */
    .news-content-preview div[style*="padding-bottom: 56.25%"] {
        margin: 0 auto 10px auto !important;
        width: 100% !important;
        max-width: 100% !important;
        background-color: #000 !important; /* Black background for video container */
        border-radius: 8px !important;
        overflow: hidden !important;
        border: 1px solid #d4a57a !important;
    }
    
    /* Ensure iframes are visible and clickable on mobile */
    .news-content-preview iframe {
        z-index: 10 !important;
        position: absolute !important;
        border: none !important;
        width: 100% !important;
        height: 100% !important;
    }
    
    /* Fix for mobile links */
    .news-content-preview a {
        display: inline-block !important;
        position: relative !important;
        z-index: 10 !important;
        pointer-events: auto !important;
    }
    
    /* Fix for YouTube thumbnails */
    .news-content-preview a img {
        border: 2px solid #d4a57a !important;
        margin: 5px auto !important;
    }

    /* Ensure buttons are clickable */
    .view-full-btn {
        position: relative !important;
        z-index: 10 !important;
        pointer-events: auto !important;
    }
}

/* The legacy mobile rule expected every video to have a ratio wrapper.
   Existing posts can contain a direct iframe, so keep that form in flow. */
@media (max-width: 768px) {
    .news-content-preview > iframe {
        position: static !important;
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 16 / 9;
    }

    .news-content-preview .news-video iframe {
        position: absolute !important;
        width: 100% !important;
        height: 100% !important;
    }
}
