@import url('https://fonts.googleapis.com/css2?family=Courier+Prime:wght@400;700&family=Special+Elite&display=swap');

:root {
    --telegraph-yellow: #F4E4C1;
    --ribbon-black: #000000;
    --stamp-red: #D32F2F;
    --western-orange: #FF6F00;
    --tape-punch: rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
}

body {
    background: var(--telegraph-yellow);
    color: var(--ribbon-black);
    font-family: 'Courier Prime', monospace;
    margin: 0;
    display: flex;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Telegraph Tape Background Decoration */
body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 50px;
    width: 30px;
    height: 100%;
    background-image: radial-gradient(var(--tape-punch) 4px, transparent 4px);
    background-size: 30px 40px;
    pointer-events: none;
    z-index: 0;
}

/* Fixed Sidebar as Telegraph Key Panel */
.sidebar {
    width: 300px;
    background: #E8D8B0;
    border-right: 5px solid var(--ribbon-black);
    padding: 20px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 10;
    box-shadow: 10px 0 20px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
}

.logo h2 {
    font-family: 'Special Elite', cursive;
    color: var(--ribbon-black) !important;
    text-shadow: none !important;
    border-bottom: 3px double var(--ribbon-black);
    padding-bottom: 10px;
    letter-spacing: 2px;
}

.user-info {
    background: transparent;
    border: 2px solid var(--ribbon-black);
    padding: 10px;
    margin: 20px 0;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.8rem;
}

nav a {
    color: var(--ribbon-black) !important;
    font-family: 'Special Elite', cursive;
    text-transform: uppercase;
    border: 1px solid transparent;
    padding: 10px !important;
    transition: all 0.2s;
}

nav a:hover {
    background: var(--ribbon-black) !important;
    color: var(--telegraph-yellow) !important;
}

/* Priority Wires (Trending) */
.trending-section {
    margin-top: 30px;
    border-top: 2px solid var(--ribbon-black);
    padding-top: 20px;
}

.trending-title {
    font-family: 'Special Elite', cursive;
    color: var(--stamp-red) !important;
    text-transform: uppercase;
    font-size: 1.1rem;
}

.trending-topic {
    display: block;
    padding: 10px;
    border-bottom: 1px dashed var(--ribbon-black);
    text-decoration: none;
    color: var(--ribbon-black);
    font-size: 0.85rem;
    font-weight: bold;
}

.trending-topic::after {
    content: " [TRANSMITTING: 45 WPM]";
    font-size: 0.6rem;
    color: var(--western-orange);
    float: right;
}

/* Central Feed */
.fyp-container {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    z-index: 1;
}

#posts-container {
    max-width: 700px;
    margin: 0 auto;
}

/* Telegram Slip Style */
.post {
    background: #FFFBF0;
    margin-bottom: 40px;
    padding: 30px;
    border: 1px solid #D1C1A1;
    box-shadow: 5px 5px 0px rgba(0, 0, 0, 0.05);
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.post:hover {
    transform: translateY(-5px) rotate(0.5deg);
    box-shadow: 15px 15px 0px rgba(0, 0, 0, 0.03);
    border-color: var(--western-orange);
}

/* Perforated Edges Effect */
.post::before,
.post::after {
    content: "• — • — • — • — • — • — • — • — • — • — • — • — • — •";
    position: absolute;
    left: 0;
    width: 100%;
    font-size: 8px;
    color: rgba(0, 0, 0, 0.1);
    text-align: center;
    overflow: hidden;
    white-space: nowrap;
}

.post::before {
    top: -10px;
}

.post::after {
    bottom: -10px;
}

#back-to-top:hover {
    background: rgba(211, 47, 47, 0.2) !important;
    opacity: 1 !important;
    transform: translateY(-2px);
}

/* Telegram Header */
.post-header {
    border-bottom: 2px solid var(--ribbon-black);
    margin-bottom: 20px;
    padding-bottom: 15px;
    font-weight: bold;
    font-size: 0.8rem;
    letter-spacing: 1px;
}

.post-meta {
    display: flex !important;
    flex-direction: column !important;
    gap: 5px;
}

.post-id {
    color: var(--stamp-red) !important;
    font-family: 'Special Elite', cursive;
    font-size: 1.1rem;
}

.post-author {
    color: var(--ribbon-black) !important;
    text-decoration: underline !important;
}

.post-date {
    color: var(--ribbon-black) !important;
    font-size: 0.7rem !important;
    background: var(--telegraph-yellow);
    padding: 2px 5px;
    width: fit-content;
}

/* Message Body */
.post-content {
    font-family: 'Courier Prime', monospace;
    font-size: 1.1rem !important;
    line-height: 1.6 !important;
    color: var(--ribbon-black) !important;
    text-transform: uppercase;
    margin: 20px 0;
    min-height: 80px;
    word-break: break-all;
}

.markdown-content p {
    margin-bottom: 1rem;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
    margin: 1rem 0;
    border-bottom: 1px solid var(--ribbon-black);
}

.markdown-content code {
    background: #eee;
    padding: 2px 4px;
}

.markdown-content img {
    max-width: 100%;
    border: 1px solid var(--ribbon-black);
    padding: 5px;
    background: white;
}

.post-content::after {
    content: " [MESSAGE TERMINATED - STOP]";
    font-weight: bold;
    color: var(--stamp-red);
    display: inline-block;
    margin-left: 10px;
}

/* Urgent Stamp */
.post-footer {
    border-top: 1px solid #ccc;
    padding-top: 15px;
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.vote-btn {
    background: transparent !important;
    border: 1px solid var(--ribbon-black) !important;
    color: var(--ribbon-black) !important;
}

.vote-btn:hover {
    background: var(--ribbon-black) !important;
    color: var(--telegraph-yellow) !important;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--telegraph-yellow);
}

::-webkit-scrollbar-thumb {
    background: var(--ribbon-black);
    border: 2px solid var(--telegraph-yellow);
}

@media (max-width: 1000px) {
    .sidebar {
        width: 200px;
    }
}