:root {
    --primary: #0969da;
    /* GitHub Blue */
    --background: #ffffff;
    --card-bg: #ffffff;
    --text: #1f2328;
    --text-light: #636c76;
    --border: #d0d7de;
    --shadow: 0 1px 0 rgba(27, 31, 35, 0.04);
    --radius: 6px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    background-color: var(--background);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 700px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    padding: 60px 0 40px;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: #0f172a;
}

header p {
    color: var(--text-light);
    margin-top: 8px;
}

.feed {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.ad-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.2s ease;
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

.ad-card:hover {
    border-color: #8c959f;
}

.ad-images {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2px;
}

.ad-images img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    cursor: zoom-in;
}

.ad-images.single img {
    height: auto;
    max-height: 600px;
}

.ad-content {
    padding: 20px;
}

.ad-text {
    font-size: 1rem;
    white-space: pre-wrap;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

.ad-text.expanded {
    -webkit-line-clamp: unset;
    line-clamp: unset;
    max-height: 1000px;
    /* Large enough to show all text */
}

.read-more-btn {
    display: none;
    color: var(--primary);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 16px;
    background: transparent;
    border: none;
    padding: 0;
    -webkit-appearance: none;
    appearance: none;
}

.read-more-btn:hover {
    text-decoration: underline;
}

.ad-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: #0f172a;
    line-height: 1.2;
}

.ad-footer {
    display: flex;
    justify-content: flex-end;
    font-size: 0.875rem;
    color: var(--text-light);
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.ad-text a {
    color: var(--primary);
    text-decoration: none;
}

.ad-text a:hover {
    text-decoration: underline;
}

/* Admin Plate Styles */
.admin-plate {
    background: #f6f8fa;
    border-bottom: 1px solid #d0d7de;
    padding: 20px 0;
    margin-bottom: 30px;
}

.admin-plate-inner {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

.admin-plate form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.admin-plate .form-row {
    display: flex;
    gap: 15px;
}

.admin-plate .form-row>div {
    flex: 1;
}

/* Admin Announcement Plate */
.admin-announcement-plate {
    background: #fff8c5;
    border: 1px solid rgba(212, 167, 44, 0.4);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    position: relative;
}

.announcement-badge {
    background: #d4a72c;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 0;
    position: absolute;
    top: -10px;
    left: 12px;
}

.announcement-text {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #1f2328;
    flex: 1;
}

.announcement-text a {
    color: #0969da;
    text-decoration: underline;
    font-weight: 500;
}

#loading-trigger {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    visibility: hidden;
}

.admin-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 24px;
    background: #ffffff;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    box-shadow: 0 1px 0 rgba(27, 31, 35, 0.04);
}

.admin-plate-inner {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@media (max-width: 600px) {
    .container {
        padding: 12px;
    }

    header {
        padding: 40px 0 20px;
    }

    header h1 {
        font-size: 1.75rem;
    }

    .ad-images img {
        height: 200px;
    }
}