/* =========================================================
   계엄령.com — TRANSMISSION TERMINAL
   Decommissioned emergency broadcast CRT
   Palette: Phosphor Amber on Void Black with Seal Red
   ========================================================= */

:root {
    --void-black: #0a0b07;
    --dust-black: #1a1c14;
    --phosphor-amber: #f4b942;
    --phosphor-highlight: #ffd97a;
    --phosphor-decay: #6b5a2a;
    --seal-red: #c1272d;
    --crt-green: #2d4a2e;
    --paper-white: #e8e3d2;

    --mono: 'JetBrains Mono', 'Space Mono', monospace;
    --ko: 'IBM Plex Sans KR', 'JetBrains Mono', monospace;
    --display: 'Major Mono Display', 'JetBrains Mono', monospace;
    --stamp: 'Bagel Fat One', serif;
    --meta: 'Space Mono', monospace;

    --scanline-alpha: 0.08;
    --bloom-primary: 0 0 0.4em #f4b942cc, 0 0 1.2em #f4b94266;
}

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

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    background: var(--void-black);
    color: var(--phosphor-amber);
    font-family: var(--mono);
    font-size: 14px;
    line-height: 20px;
    -webkit-font-smoothing: antialiased;
}

body {
    position: relative;
    padding: 0;
}

::selection {
    background: var(--phosphor-highlight);
    color: var(--void-black);
}

/* ---------- CRT OVERLAYS ---------- */

.crt-scanlines {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100;
    background: repeating-linear-gradient(
        to bottom,
        rgba(10, 11, 7, 0) 0,
        rgba(10, 11, 7, 0) 1px,
        rgba(10, 11, 7, var(--scanline-alpha)) 1px,
        rgba(10, 11, 7, var(--scanline-alpha)) 2px
    );
    animation: scanBreathe 3.3s ease-in-out infinite;
}

@keyframes scanBreathe {
    0%, 100% { opacity: 0.95; }
    50%      { opacity: 1.00; }
}

.crt-vignette {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 101;
    background: radial-gradient(
        ellipse at center,
        rgba(0,0,0,0) 45%,
        rgba(0,0,0,0.55) 95%,
        rgba(0,0,0,0.80) 100%
    );
}

.crt-flicker {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 102;
    background: rgba(244, 185, 66, 0.015);
    animation: flicker 0.14s steps(2, end) infinite;
}

@keyframes flicker {
    0%   { opacity: 0.35; }
    50%  { opacity: 0.55; }
    100% { opacity: 0.40; }
}

.glitch-tear {
    position: fixed;
    left: 0;
    right: 0;
    top: -10%;
    height: 4px;
    pointer-events: none;
    z-index: 103;
    background: linear-gradient(
        to right,
        transparent 0%,
        rgba(193, 39, 45, 0.5) 20%,
        rgba(244, 185, 66, 0.6) 50%,
        rgba(45, 74, 46, 0.5) 80%,
        transparent 100%
    );
    mix-blend-mode: screen;
    opacity: 0;
}

.glitch-tear.active {
    animation: tearFall 0.12s linear;
}

@keyframes tearFall {
    0%   { top: -5%;   opacity: 0.9; }
    100% { top: 105%;  opacity: 0.9; }
}

/* ---------- STAMP ---------- */

.stamp-gyeeom {
    position: fixed;
    top: 22%;
    right: 8%;
    font-family: var(--stamp);
    font-size: 180px;
    color: var(--seal-red);
    opacity: 0.12;
    transform: rotate(-7deg);
    letter-spacing: -0.05em;
    pointer-events: none;
    z-index: 2;
    user-select: none;
    text-shadow: 0 0 30px rgba(193, 39, 45, 0.4);
}

/* ---------- HUD FRAME ---------- */

.hud-frame {
    position: fixed;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: 20px;
    width: calc(100% - 40px);
    height: calc(100% - 40px);
    pointer-events: none;
    z-index: 5;
    filter: drop-shadow(0 0 3px rgba(244, 185, 66, 0.6));
}

.hud-frame .hud-rect,
.hud-frame .hud-line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawStroke 1.2s ease-out forwards;
}

.hud-frame .hud-line:nth-of-type(2) { animation-delay: 0.3s; }
.hud-frame .hud-line:nth-of-type(3) { animation-delay: 0.4s; }
.hud-frame .hud-line:nth-of-type(4) { animation-delay: 0.5s; }
.hud-frame .hud-line:nth-of-type(5) { animation-delay: 0.6s; }

@keyframes drawStroke {
    to { stroke-dashoffset: 0; }
}

/* ---------- BOOT SCREEN ---------- */

.boot-screen {
    position: fixed;
    inset: 0;
    background: var(--void-black);
    z-index: 500;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 60px 80px;
    font-family: var(--mono);
    color: var(--phosphor-amber);
    font-size: 14px;
    line-height: 22px;
    text-shadow: var(--bloom-primary);
    transition: opacity 0.5s ease-out, visibility 0.5s;
}

.boot-screen.done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.boot-cursor {
    white-space: pre-wrap;
    max-width: 900px;
}

.cursor-block {
    display: inline-block;
    animation: blink 1s steps(2) infinite;
    color: var(--phosphor-highlight);
}

@keyframes blink {
    0%, 49%   { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* ---------- MAIN TERMINAL ---------- */

.terminal {
    position: relative;
    width: 100%;
    height: 100vh;
    padding: 26px 32px 26px 32px;
    display: grid;
    grid-template-rows: 44px 1fr 38px;
    gap: 10px;
    z-index: 10;
    color: var(--phosphor-amber);
    text-shadow: var(--bloom-primary);
}

/* ---------- HEADER ---------- */

.hud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px dashed var(--phosphor-decay);
    font-size: 13px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.hdr-left, .hdr-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.hdr-domain {
    font-family: var(--ko);
    font-weight: 500;
    color: var(--phosphor-highlight);
    letter-spacing: 0.02em;
}

.hdr-title {
    font-family: var(--display);
    color: var(--phosphor-amber);
}

.hdr-sep {
    color: var(--phosphor-decay);
    letter-spacing: 0;
}

.hdr-date, .hdr-clock {
    font-family: var(--mono);
    color: var(--phosphor-amber);
    font-variant-numeric: tabular-nums;
}

.hdr-feed, .hdr-directive {
    font-family: var(--meta);
    font-size: 11px;
    color: var(--phosphor-decay);
}

.feed-status {
    color: var(--phosphor-amber);
}

.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border: 1px solid var(--seal-red);
    background: rgba(193, 39, 45, 0.08);
    color: var(--seal-red);
    font-family: var(--meta);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-shadow: 0 0 6px rgba(193, 39, 45, 0.7);
    transition: transform 0.6s ease-out;
    position: relative;
    transform-origin: center center;
}

.live-dot {
    width: 7px;
    height: 7px;
    background: var(--seal-red);
    border-radius: 50%;
    animation: livePulse 1.2s ease-in-out infinite;
    box-shadow: 0 0 6px var(--seal-red);
}

@keyframes livePulse {
    0%, 100% { opacity: 1;   box-shadow: 0 0 6px var(--seal-red); }
    50%      { opacity: 0.3; box-shadow: 0 0 14px var(--seal-red); }
}

/* ---------- BODY ---------- */

.hud-body {
    display: grid;
    grid-template-columns: 260px 1fr 220px;
    gap: 18px;
    min-height: 0;
    overflow: hidden;
}

/* ---------- LEFT RAIL ---------- */

.rail-left {
    border-right: 1px dashed var(--phosphor-decay);
    padding-right: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: var(--phosphor-decay) transparent;
}

.rail-left::-webkit-scrollbar { width: 6px; }
.rail-left::-webkit-scrollbar-track { background: transparent; }
.rail-left::-webkit-scrollbar-thumb { background: var(--phosphor-decay); }

.rail-title {
    font-family: var(--meta);
    font-size: 11px;
    letter-spacing: 0.12em;
    color: var(--phosphor-amber);
    margin-bottom: 4px;
}

.rail-subtitle {
    font-family: var(--meta);
    font-size: 10px;
    letter-spacing: 0.18em;
    color: var(--phosphor-decay);
    margin-bottom: 14px;
}

.directive-list {
    list-style: none;
    flex: 1;
    min-height: 0;
}

.directive-item {
    display: grid;
    grid-template-columns: 24px 1fr;
    column-gap: 8px;
    padding: 6px 8px 6px 4px;
    cursor: pointer;
    border-left: 2px solid transparent;
    transition: background 0.1s linear, border-color 0.1s linear;
    font-size: 12px;
    line-height: 17px;
    user-select: none;
}

.directive-item:hover {
    background: rgba(244, 185, 66, 0.06);
    border-left-color: var(--phosphor-decay);
}

.directive-item.focused {
    background: var(--phosphor-amber);
    color: var(--void-black);
    border-left-color: var(--seal-red);
    text-shadow: none;
}

.directive-item.focused .dir-num,
.directive-item.focused .dir-year,
.directive-item.focused .dir-region,
.directive-item.focused .dir-tag {
    color: var(--void-black);
}

.directive-item.past {
    color: var(--phosphor-decay);
}

.dir-num {
    font-family: var(--mono);
    font-weight: 700;
    color: var(--phosphor-decay);
    letter-spacing: 0.05em;
}

.dir-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.dir-year {
    font-family: var(--mono);
    font-weight: 500;
    color: var(--phosphor-highlight);
    font-size: 12px;
}

.dir-region {
    font-family: var(--ko);
    font-size: 11px;
    color: var(--phosphor-amber);
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dir-tag {
    font-family: var(--meta);
    font-size: 9px;
    color: var(--phosphor-decay);
    letter-spacing: 0.12em;
    margin-top: 1px;
}

.rail-footer {
    margin-top: 18px;
    padding-top: 10px;
    border-top: 1px dashed var(--phosphor-decay);
}

.rail-ascii {
    font-family: var(--mono);
    font-size: 11px;
    line-height: 14px;
    color: var(--phosphor-decay);
    white-space: pre;
}

.rail-ascii span {
    color: var(--phosphor-amber);
}

/* ---------- TRANSMISSION ---------- */

.transmission {
    overflow-y: auto;
    padding: 0 24px;
    scrollbar-width: thin;
    scrollbar-color: var(--phosphor-decay) transparent;
    position: relative;
}

.transmission::-webkit-scrollbar { width: 6px; }
.transmission::-webkit-scrollbar-track { background: transparent; }
.transmission::-webkit-scrollbar-thumb { background: var(--phosphor-decay); }

.transmission.degauss::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 30px;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(232, 227, 210, 0.85) 45%,
        rgba(244, 185, 66, 0.4) 55%,
        transparent 100%
    );
    animation: degaussSweep 0.8s linear forwards;
    pointer-events: none;
    z-index: 5;
    mix-blend-mode: screen;
}

@keyframes degaussSweep {
    0%   { top: -30px; opacity: 1; }
    100% { top: 100%;  opacity: 0.9; }
}

.trans-meta {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 14px;
    padding: 4px 0 14px 0;
    border-bottom: 1px dashed var(--phosphor-decay);
    margin-bottom: 18px;
    align-items: center;
}

.seal-svg {
    width: 56px;
    height: 56px;
    filter: drop-shadow(0 0 4px rgba(244, 185, 66, 0.5));
    animation: sealRotate 90s linear infinite;
}

@keyframes sealRotate {
    to { transform: rotate(360deg); }
}

.trans-code {
    font-family: var(--display);
    font-size: 16px;
    color: var(--phosphor-highlight);
    letter-spacing: 0.08em;
}

.trans-origin {
    font-family: var(--meta);
    font-size: 11px;
    color: var(--phosphor-amber);
    letter-spacing: 0.14em;
    margin-top: 3px;
}

.trans-timestamp {
    font-family: var(--meta);
    font-size: 10px;
    color: var(--phosphor-decay);
    letter-spacing: 0.16em;
    margin-top: 2px;
}

.article-header {
    padding: 4px 0 12px 0;
}

.article-no {
    font-family: var(--ko);
    font-weight: 500;
    font-size: 17px;
    color: var(--phosphor-highlight);
    letter-spacing: 0.02em;
    text-shadow:
        0 0 0.4em #ffd97acc,
        0 0 1em #ffd97a66,
        1.2px 0 0 rgba(193,39,45,0.45),
       -1.2px 0 0 rgba(45,74,46,0.45);
}

.article-divider {
    color: var(--phosphor-decay);
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: -0.05em;
    overflow: hidden;
    white-space: nowrap;
    margin: 4px 0;
}

.article-body {
    padding: 10px 0;
    min-height: 260px;
}

.article-ko {
    font-family: var(--ko);
    font-weight: 400;
    font-size: 15px;
    line-height: 24px;
    color: var(--phosphor-amber);
    letter-spacing: 0.01em;
    text-shadow: var(--bloom-primary);
    margin-bottom: 18px;
    position: relative;
    white-space: pre-wrap;
    word-break: keep-all;
}

.article-ko::after,
.article-en::after {
    content: '▋';
    display: inline-block;
    color: var(--phosphor-highlight);
    opacity: 0;
    animation: blink 1s steps(2) infinite;
    margin-left: 2px;
}

.article-ko.typing::after,
.article-en.typing::after {
    opacity: 1;
}

.article-en {
    font-family: var(--mono);
    font-size: 13px;
    line-height: 20px;
    color: var(--phosphor-decay);
    letter-spacing: 0.01em;
    margin-bottom: 14px;
    position: relative;
    white-space: pre-wrap;
}

/* Redaction bars */
.redact {
    display: inline-block;
    background: var(--dust-black);
    color: transparent;
    padding: 0 4px;
    margin: 0 1px;
    border-radius: 0;
    user-select: none;
    position: relative;
    animation: redactJitter 8s ease-in-out infinite;
}

@keyframes redactJitter {
    0%, 100% { padding-right: 4px; }
    48%      { padding-right: 4px; }
    50%      { padding-right: 5px; }
    52%      { padding-right: 4px; }
}

.revealed {
    background: var(--paper-white);
    color: var(--void-black);
    text-shadow: none;
    padding: 1px 5px;
    font-family: var(--mono);
    letter-spacing: 0.02em;
}

.emphasis-red {
    color: var(--seal-red);
    text-shadow: 0 0 4px rgba(193,39,45,0.6);
}

.article-footer {
    padding: 10px 0 24px 0;
}

.article-sign {
    font-family: var(--meta);
    font-size: 10px;
    letter-spacing: 0.22em;
    color: var(--phosphor-decay);
    text-align: center;
    padding: 6px 0;
}

/* ---------- RIGHT META PANEL ---------- */

.rail-right {
    border-left: 1px dashed var(--phosphor-decay);
    padding-left: 16px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--phosphor-decay) transparent;
}

.rail-right::-webkit-scrollbar { width: 6px; }
.rail-right::-webkit-scrollbar-thumb { background: var(--phosphor-decay); }

.meta-block {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px dashed rgba(107, 90, 42, 0.35);
}

.meta-block:last-child { border-bottom: none; }

.meta-title {
    font-family: var(--meta);
    font-size: 10px;
    letter-spacing: 0.22em;
    color: var(--phosphor-highlight);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    font-family: var(--meta);
    font-size: 10px;
    letter-spacing: 0.12em;
    padding: 2px 0;
    color: var(--phosphor-decay);
}

.meta-val {
    color: var(--phosphor-amber);
    font-variant-numeric: tabular-nums;
}

.meta-unit {
    color: var(--phosphor-decay);
    margin-left: 2px;
}

.oscillo {
    width: 100%;
    height: 60px;
    display: block;
    margin: 6px 0;
    border: 1px solid var(--phosphor-decay);
    background: rgba(244, 185, 66, 0.02);
}

.meta-ascii {
    font-family: var(--mono);
    font-size: 10px;
    line-height: 12px;
    color: var(--phosphor-amber);
    white-space: pre;
    margin: 0;
}

.meta-ref {
    font-family: var(--meta);
    font-size: 10px;
    letter-spacing: 0.12em;
    color: var(--phosphor-amber);
    padding: 2px 0;
    position: relative;
    padding-left: 10px;
}

.meta-ref::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--phosphor-decay);
}

/* ---------- FOOTER ---------- */

.hud-footer {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 18px;
    align-items: center;
    padding: 6px 16px;
    border-top: 1px dashed var(--phosphor-decay);
    font-family: var(--meta);
    font-size: 10px;
    letter-spacing: 0.14em;
    color: var(--phosphor-decay);
    text-transform: uppercase;
}

.ftr-label { color: var(--phosphor-decay); }
.ftr-label span { color: var(--phosphor-amber); }
.ftr-sep    { color: var(--dust-black); }

.ftr-barcode {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 20px;
    padding: 0 10px;
    overflow: hidden;
}

.ftr-barcode span {
    display: inline-block;
    background: var(--phosphor-amber);
    height: 100%;
    animation: barcodeBreathe 12s ease-in-out infinite;
    box-shadow: 0 0 2px rgba(244, 185, 66, 0.5);
}

@keyframes barcodeBreathe {
    0%, 100% { transform: scaleX(1); }
    50%      { transform: scaleX(1.04); }
}

.ftr-ticker {
    color: var(--phosphor-amber);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.04em;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- NO SCRIPT FALLBACK ---------- */

.noscript-fallback {
    position: fixed;
    inset: 40px;
    z-index: 9999;
    background: var(--void-black);
    color: var(--phosphor-amber);
    padding: 40px;
    font-family: var(--mono);
    text-shadow: var(--bloom-primary);
    border: 1px solid var(--phosphor-amber);
}

.noscript-fallback h1, .noscript-fallback h2 {
    font-family: var(--ko);
    font-weight: 500;
    margin-bottom: 18px;
    color: var(--phosphor-highlight);
}

.noscript-fallback p {
    margin-bottom: 16px;
    max-width: 720px;
    font-size: 14px;
    line-height: 22px;
}

/* ---------- RESPONSIVE ---------- */

@media (max-width: 1100px) {
    .hud-body {
        grid-template-columns: 220px 1fr 180px;
        gap: 12px;
    }
    .rail-right { padding-left: 12px; }
    .rail-left  { padding-right: 12px; }
}

@media (max-width: 900px) {
    .hud-body {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }
    .rail-left, .rail-right {
        border: none;
        padding: 10px 0;
        max-height: none;
    }
    .stamp-gyeeom { font-size: 120px; top: 15%; }
    .hdr-left, .hdr-right { font-size: 10px; gap: 6px; }
    .terminal { padding: 16px; }
}

@media (max-width: 600px) {
    html, body { font-size: 12px; }
    .terminal { padding: 12px; }
    .stamp-gyeeom { font-size: 80px; right: 5%; top: 10%; }
    .hud-header { flex-direction: column; align-items: flex-start; gap: 4px; }
    .ftr-barcode { display: none; }
    .hud-footer { grid-template-columns: 1fr 1fr; gap: 6px; font-size: 9px; }
}
