:root {
    --bg-color: #05070a;
    --card-bg: #0f141e;
    --text-primary: #e0e6ed;
    --text-secondary: #94a3b8;
    --accent-politics: #3b82f6; /* Blue */
    --accent-economy: #f59e0b; /* Amber */
    --accent-tech: #8b5cf6;    /* Purple */
    --accent-society: #10b981; /* Emerald */
    --border-color: #1e293b;
    --highlight-color: #00f3ff;
    --font-mono: 'Courier New', Courier, monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* P3-1????????? */
body.theme-light {
    --bg-color: #f0f4f8;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #cbd5e1;
    --highlight-color: #0284c7;
}
body.theme-light {
    background-image:
        radial-gradient(circle at 50% 50%, rgba(226, 232, 240, 0.5) 0%, transparent 100%),
        linear-gradient(0deg, rgba(0,0,0,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,0.05) 1px, transparent 1px);
}
body.theme-light header,
body.theme-light footer {
    background: rgba(255, 255, 255, 0.9);
}
body.theme-light .news-item {
    background: rgba(255, 255, 255, 0.8);
}
body.theme-light .news-item:hover {
    background: rgba(255, 255, 255, 1);
}
body.theme-light .date-bar,
body.theme-light .search-bar {
    background: rgba(255, 255, 255, 0.7);
}
body.theme-light .cat-tab {
    background: rgba(255, 255, 255, 0.7);
}
body.theme-light h1 {
    background: linear-gradient(90deg, #1e293b, #64748b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
body.theme-light .scanline {
    opacity: 0.05;
}

.web-language-select {
    min-width: 126px;
    height: 32px;
    padding: 0 28px 0 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.78rem;
    cursor: pointer;
}

.web-language-select:focus {
    border-color: var(--highlight-color);
    outline: none;
}

.action-notice {
    position: fixed;
    left: 50%;
    bottom: 72px;
    z-index: 1400;
    transform: translateX(-50%);
    padding: 9px 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.85rem;
}

/* P3-1????????????? */
.theme-toggle-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
    align-self: center;
}
.theme-toggle-btn:hover {
    border-color: var(--highlight-color);
    color: var(--highlight-color);
}
.theme-toggle-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}


* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-sans);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background-image: 
        radial-gradient(circle at 50% 50%, rgba(15, 23, 42, 0.5) 0%, transparent 100%),
        linear-gradient(0deg, rgba(0,0,0,0.2) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,0.2) 1px, transparent 1px);
    background-size: 100% 100%, 40px 40px, 40px 40px;
}

/* ?????????? */
header {
    height: 70px;
    background: rgba(15, 20, 30, 0.9);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    fill: var(--highlight-color);
    animation: pulse 2s infinite;
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    background: linear-gradient(90deg, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-right {
    display: flex;
    gap: 1rem;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.status-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.status-label {
    font-size: 0.7rem;
    opacity: 0.7;
}

.status-value {
    color: var(--highlight-color);
    font-weight: bold;
}

/* ??????????? */
main {
    flex: 1;
    padding: 1.5rem 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

/* ?????????? */
.date-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    margin-bottom: 1rem;
    background: rgba(15, 20, 30, 0.6);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.current-date {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 500;
}

.filter-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ????????? */
.timeline-container {
    position: relative;
    padding-left: 60px;
}

/* ??????? */
.timeline-container::before {
    content: '';
    position: absolute;
    left: 25px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--highlight-color), var(--border-color));
}

/* ??????????? */
.news-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 1rem 1.2rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
}

/* ??????? */
.news-item::before {
    content: '';
    position: absolute;
    left: -43px;
    top: 1.2rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--highlight-color);
    border: 2px solid var(--bg-color);
    box-shadow: 0 0 8px var(--highlight-color);
}

/* ????? */
.time-label {
    position: absolute;
    left: -88px;
    top: 1.1rem;
    font-size: 0.65rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    transform: none;
    white-space: nowrap;
}

.news-item:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(0, 243, 255, 0.3);
    transform: translateX(5px);
}

/* ?????? */
.category-tag {
    display: inline-block;
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.tag-politics { background: rgba(59, 130, 246, 0.2); color: var(--accent-politics); }
.tag-economy { background: rgba(245, 158, 11, 0.2); color: var(--accent-economy); }
.tag-tech { background: rgba(139, 92, 246, 0.2); color: var(--accent-tech); }
.tag-society { background: rgba(16, 185, 129, 0.2); color: var(--accent-society); }

.news-title {
    display: block;
    width: 100%;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    padding: 0;
    border: 0;
    background: transparent;
    font-family: var(--font-sans);
    line-height: 1.5;
    text-align: left;
    color: var(--text-primary);
}

.news-summary {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0.8rem;
}

.news-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: #64748b;
    font-family: var(--font-mono);
}

.source-tag {
    background: rgba(255, 255, 255, 0.1);
    padding: 3px 8px;
    border-radius: 4px;
}

/* ????????? */
.action-buttons {
    display: flex;
    gap: 1rem;
    color: #64748b;
}

.action-btn {
    cursor: pointer;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
}

.action-btn:hover {
    color: var(--highlight-color);
}

.action-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* ?????????????????? */
.category-column, .column-header, .news-scroll-wrapper, .news-list, .cat-icon {
    display: none;
}

/* ???????? */
footer {
    height: 40px;
    background: rgba(15, 20, 30, 0.9);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.stat-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* ???????? */
@keyframes scrollUp {
    0% { transform: translateY(0); }
    100% { transform: translateY(-50%); }
}

@keyframes pulse {
    0% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
    100% { opacity: 0.6; transform: scale(1); }
}

@keyframes flashHighlight {
    0% { background-color: rgba(0, 243, 255, 0.03); border-left-color: var(--border-color); }
    50% { background-color: rgba(0, 243, 255, 0.3); border-left-color: var(--highlight-color); box-shadow: 0 0 15px var(--highlight-color); }
    100% { background-color: rgba(255, 255, 255, 0.03); border-left-color: var(--border-color); }
}

.highlight-anim {
    animation: flashHighlight 1s ease-out;
}

/* ??????? */
@media (max-width: 1200px) {
    main { grid-template-columns: repeat(2, 1fr); overflow-y: auto; }
    body { overflow: auto; height: auto; }
    header { padding: 0 1rem; }
    .header-right .status-item { display: none; }
    .header-right { margin-left: auto; gap: 0.5rem; }
}

@media (max-width: 768px) {
    main { grid-template-columns: 1fr; }
    header { flex-direction: column; height: auto; padding: 1rem; gap: 1rem; }
    .header-right { width: 100%; justify-content: space-between; }
}

/* ????????? */
.scanline {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0) 50%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.1));
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 999;
    opacity: 0.3;
}

/* P0-2????????????? */
.btn-favorited {
    color: var(--accent-economy) !important;
}

/* P0-3???????????? */
.news-title-link {
    cursor: pointer;
}
.news-title-link:hover,
.news-title-link:focus-visible {
    color: var(--highlight-color);
    text-decoration: underline;
    text-underline-offset: 3px;
    outline: none;
}

/* P0-1?????????????????? */
.news-item[data-important="true"] {
    border-left: 3px solid var(--accent-economy);
}

/* P2-2???????? */
.search-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    margin-bottom: 0.6rem;
    background: rgba(15, 20, 30, 0.6);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: border-color 0.2s;
}
.search-bar:focus-within {
    border-color: rgba(0, 243, 255, 0.4);
}
.search-icon {
    width: 16px;
    height: 16px;
    fill: var(--text-secondary);
    flex-shrink: 0;
}
#search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: var(--font-sans);
}
#search-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}
.search-clear {
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color 0.2s;
}
.search-clear:hover {
    color: var(--highlight-color);
}

/* P2-3???????? Tab */
.category-tabs {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.8rem;
    flex-wrap: wrap;
}
.cat-tab {
    background: rgba(15, 20, 30, 0.6);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.78rem;
    padding: 4px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-sans);
}
.cat-tab:hover {
    border-color: rgba(0, 243, 255, 0.4);
    color: var(--text-primary);
}
.cat-tab.active {
    background: rgba(0, 243, 255, 0.15);
    border-color: var(--highlight-color);
    color: var(--highlight-color);
}
.cat-tab[data-cat="politics"].active { background: rgba(59,130,246,0.15); border-color: var(--accent-politics); color: var(--accent-politics); }
.cat-tab[data-cat="economy"].active  { background: rgba(245,158,11,0.15); border-color: var(--accent-economy);  color: var(--accent-economy);  }
.cat-tab[data-cat="tech"].active     { background: rgba(139,92,246,0.15);  border-color: var(--accent-tech);     color: var(--accent-tech);     }
.cat-tab[data-cat="society"].active  { background: rgba(16,185,129,0.15);  border-color: var(--accent-society);  color: var(--accent-society);  }

/* P2-4?????? */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
    gap: 1rem;
}
.empty-icon {
    width: 64px;
    height: 64px;
    color: var(--border-color);
    opacity: 0.6;
}
.empty-state p {
    font-size: 0.9rem;
    opacity: 0.7;
}
.retry-btn {
    background: rgba(0, 243, 255, 0.1);
    border: 1px solid rgba(0, 243, 255, 0.4);
    color: var(--highlight-color);
    font-size: 0.85rem;
    padding: 6px 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-sans);
}
.retry-btn:hover {
    background: rgba(0, 243, 255, 0.2);
}

/* P2-5?????????? */
.load-more-btn {
    display: block;
    width: 100%;
    margin: 1rem 0;
    padding: 10px;
    background: rgba(15, 20, 30, 0.6);
    border: 1px dashed var(--border-color);
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-sans);
}
.load-more-btn:hover {
    border-color: rgba(0, 243, 255, 0.4);
    color: var(--highlight-color);
}

/* ????????????????? */



.news-loading-tip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 2rem 1.5rem;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    animation: loading-pulse 1.5s ease-in-out infinite;
}

.news-loading-tip::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--highlight-color);
    animation: loading-dot 1.5s ease-in-out infinite;
}

@keyframes loading-pulse {
    0%, 100% { opacity: 0.5; }
    50%       { opacity: 1;   }
}

@keyframes loading-dot {
    0%, 100% { transform: scale(1);   opacity: 0.6; }
    50%       { transform: scale(1.4); opacity: 1;   }
}

body.modal-open {
    overflow: hidden;
}

.summary-modal-overlay,
.poster-preview-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(2, 6, 12, 0.82);
    backdrop-filter: blur(9px);
    overscroll-behavior: contain;
}

.poster-preview-overlay {
    z-index: 1300;
}

.summary-modal-overlay[hidden],
.poster-preview-overlay[hidden] {
    display: none;
}

.summary-modal,
.poster-preview {
    width: min(720px, 100%);
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    overflow: auto;
    border: 1px solid rgba(0, 243, 255, 0.28);
    border-radius: 16px;
    background: #0b111b;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.58);
    outline: none;
    animation: modal-enter 0.18s ease-out;
}

.summary-modal {
    padding: 24px;
}

.summary-modal-header,
.poster-preview-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.summary-modal-header .category-tag {
    margin-bottom: 0;
}

.modal-icon-btn {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary);
    font: 400 1.6rem/1 var(--font-sans);
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.modal-icon-btn:hover,
.modal-icon-btn:focus-visible {
    border-color: var(--highlight-color);
    background: rgba(0, 243, 255, 0.08);
    color: var(--highlight-color);
    outline: none;
}

.summary-modal h2 {
    margin: 18px 0 10px;
    color: var(--text-primary);
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.summary-modal-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.76rem;
}

.summary-modal-content {
    margin-top: 22px;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.025);
}

.summary-section-heading {
    margin-bottom: 10px;
    color: var(--highlight-color);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.summary-modal-body {
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.85;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.summary-modal-status {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 20px;
    margin-top: 16px;
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.summary-modal-status::before {
    content: '';
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
    background: var(--text-secondary);
}

.summary-modal-status[data-state="working"]::before {
    background: var(--highlight-color);
    box-shadow: 0 0 8px var(--highlight-color);
    animation: loading-dot 1.2s ease-in-out infinite;
}

.summary-modal-status[data-state="ready"]::before {
    background: var(--accent-society);
}

.summary-modal-status[data-state="fallback"]::before {
    background: var(--accent-economy);
}

.summary-modal-actions,
.poster-preview-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.modal-btn {
    min-height: 42px;
    padding: 9px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font: 600 0.84rem/1.2 var(--font-sans);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, color 0.2s, opacity 0.2s;
}

.modal-btn:focus-visible {
    outline: 2px solid var(--highlight-color);
    outline-offset: 2px;
}

.modal-btn:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.modal-btn-secondary {
    background: rgba(255, 255, 255, 0.035);
    color: var(--text-primary);
}

.modal-btn-secondary:hover:not(:disabled) {
    border-color: var(--highlight-color);
    background: rgba(0, 243, 255, 0.08);
}

.modal-btn-primary {
    border-color: rgba(0, 243, 255, 0.55);
    background: rgba(0, 243, 255, 0.14);
    color: var(--highlight-color);
}

.modal-btn-primary:hover:not(:disabled) {
    background: rgba(0, 243, 255, 0.22);
}

.poster-preview {
    width: min(760px, 100%);
    padding: 20px;
}

.poster-preview-header h2 {
    color: var(--text-primary);
    font-size: 1.25rem;
    line-height: 1.35;
}

.poster-preview-header p {
    margin-top: 5px;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.poster-preview-image-wrap {
    display: flex;
    justify-content: center;
    max-height: 65vh;
    max-height: 65dvh;
    margin-top: 18px;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background-color: #d9dee7;
    background-image:
        linear-gradient(45deg, #c8ced8 25%, transparent 25%),
        linear-gradient(-45deg, #c8ced8 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #c8ced8 75%),
        linear-gradient(-45deg, transparent 75%, #c8ced8 75%);
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    background-size: 16px 16px;
}

.poster-preview-image-wrap img {
    display: block;
    width: min(100%, 540px);
    height: auto;
    align-self: flex-start;
    background: #07101d;
}

body.theme-light .summary-modal,
body.theme-light .poster-preview {
    background: #ffffff;
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.26);
}

body.theme-light .summary-modal-content {
    background: rgba(15, 23, 42, 0.025);
}

@keyframes modal-enter {
    from { opacity: 0; transform: translateY(8px) scale(0.99); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 640px) {
    .summary-modal-overlay,
    .poster-preview-overlay {
        align-items: flex-end;
        padding: 10px;
    }

    .summary-modal,
    .poster-preview {
        max-height: calc(100vh - 20px);
        max-height: calc(100dvh - 20px);
        border-radius: 14px;
    }

    .summary-modal {
        padding: 18px;
    }

    .summary-modal-content {
        padding: 16px;
    }

    .summary-modal-actions .modal-btn {
        flex: 1 1 calc(50% - 5px);
    }

    .summary-modal-actions .modal-btn-primary {
        flex-basis: 100%;
    }

    .poster-preview {
        padding: 16px;
    }

    .poster-preview-image-wrap {
        max-height: 60vh;
        max-height: 60dvh;
    }

    .poster-preview-actions .modal-btn {
        flex: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .summary-modal,
    .poster-preview {
        animation: none;
    }
}

