:root {
    --end-bg: #070707;
    --end-surface: #0d0d0d;
    --end-raised: #131313;
    --end-text: #e5e2dc;
    --end-muted: #817e78;
    --end-faint: #4b4a47;
    --end-line: rgba(229, 226, 220, .12);
    --end-line-strong: rgba(229, 226, 220, .24);
    --end-danger: #d84a45;
    --end-warning: #c9ad67;
    --end-signal: #7f9d83;
    --end-font: "Noto Sans KR", system-ui, sans-serif;
    --end-serif: "Noto Serif KR", serif;
    --end-mono: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--end-bg); }
body {
    min-height: 100vh;
    margin: 0;
    color: var(--end-text);
    background: var(--end-bg);
    font-family: var(--end-font);
    letter-spacing: 0;
}
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -3;
    background: url("/image/scenery15.png") center / cover no-repeat;
    filter: grayscale(1) contrast(1.3) brightness(.18);
    opacity: .42;
}
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(7,7,7,.97) 0%, rgba(7,7,7,.82) 52%, rgba(7,7,7,.94) 100%),
        repeating-linear-gradient(0deg, transparent 0 3px, rgba(255,255,255,.018) 3px 4px);
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.end-noise, .end-scanline { position: fixed; inset: 0; pointer-events: none; }
.end-noise {
    z-index: 1000;
    opacity: .035;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.end-scanline {
    z-index: 999;
    height: 22vh;
    opacity: .09;
    background: linear-gradient(transparent, rgba(216,74,69,.25), transparent);
    animation: end-scan 11s linear infinite;
}
@keyframes end-scan { from { transform: translateY(-24vh); } to { transform: translateY(124vh); } }

.end-header {
    position: sticky;
    top: 0;
    z-index: 100;
    min-height: 68px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 24px;
    padding: 0 28px;
    border-bottom: 1px solid var(--end-line);
    background: rgba(7, 7, 7, .88);
    backdrop-filter: blur(18px);
}
.end-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.end-brand-mark { width: 7px; height: 7px; background: var(--end-danger); box-shadow: 0 0 16px rgba(216,74,69,.7); animation: signal 2.8s steps(1) infinite; }
@keyframes signal { 0%, 72%, 100% { opacity: 1; } 73%, 78% { opacity: .15; } }
.end-brand-name { font-family: var(--end-mono); font-size: .82rem; font-weight: 600; text-transform: uppercase; }
.end-brand-sub { color: var(--end-faint); font-family: var(--end-mono); font-size: .62rem; }
.end-nav { display: flex; align-items: center; gap: 4px; }
.end-nav a, .end-nav span {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    color: var(--end-muted);
    font-family: var(--end-mono);
    font-size: .68rem;
    text-transform: uppercase;
    border-bottom: 1px solid transparent;
}
.end-nav a:hover, .end-nav .active { color: var(--end-text); border-color: var(--end-danger); }
.end-status { justify-self: end; display: flex; align-items: center; gap: 9px; color: var(--end-muted); font-family: var(--end-mono); font-size: .64rem; white-space: nowrap; }
.status-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--end-signal); box-shadow: 0 0 10px rgba(127,157,131,.55); }

.end-shell { width: min(1160px, calc(100% - 48px)); margin: 0 auto; padding: 72px 0 92px; }
.end-hero {
    min-height: 290px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    align-items: end;
    gap: 64px;
    padding-bottom: 42px;
    border-bottom: 1px solid var(--end-line-strong);
}
.end-kicker { margin: 0 0 18px; color: var(--end-danger); font-family: var(--end-mono); font-size: .65rem; text-transform: uppercase; }
.end-title { max-width: 780px; margin: 0; font-family: var(--end-serif); font-size: clamp(2.5rem, 6vw, 5.8rem); font-weight: 300; line-height: 1; }
.end-title .ghost { color: transparent; -webkit-text-stroke: 1px rgba(229,226,220,.38); }
.is-unstable { text-shadow: 2px 0 var(--end-danger), -2px 0 rgba(127,157,131,.75); transform: translateX(1px); }
.end-intro { margin: 24px 0 0; color: var(--end-muted); font-family: var(--end-serif); font-size: .92rem; line-height: 1.9; }
.terminal-block { width: 100%; min-width: 0; border-left: 1px solid var(--end-danger); padding: 4px 0 4px 18px; font-family: var(--end-mono); font-size: .67rem; color: var(--end-muted); line-height: 1.9; }
.terminal-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; }
.terminal-row strong { justify-self: end; color: var(--end-text); font-weight: 500; }

.archive-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin: 54px 0 14px; }
.archive-head h2 { margin: 0; font-family: var(--end-mono); font-size: .72rem; font-weight: 500; text-transform: uppercase; }
.archive-count { color: var(--end-faint); font-family: var(--end-mono); font-size: .64rem; }
.year-block { margin-top: 34px; }
.year-label { display: flex; align-items: center; gap: 12px; margin-bottom: 0; color: var(--end-muted); font-family: var(--end-mono); font-size: .7rem; }
.year-label::after { content: ""; height: 1px; flex: 1; background: var(--end-line); }
.end-entry {
    min-height: 132px;
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr) 36px;
    align-items: center;
    gap: 22px;
    border-bottom: 1px solid var(--end-line);
    transition: background-color .2s, padding .2s;
}
.end-entry:hover { padding: 0 14px; background: rgba(229,226,220,.035); }
.entry-code { color: var(--end-faint); font-family: var(--end-mono); font-size: .62rem; }
.entry-main { min-width: 0; }
.entry-top { display: flex; align-items: baseline; gap: 12px; }
.entry-title { margin: 0; font-family: var(--end-serif); font-size: 1.16rem; font-weight: 400; line-height: 1.5; }
.entry-mood { color: var(--end-danger); font-family: var(--end-mono); font-size: .56rem; text-transform: uppercase; }
.entry-excerpt { margin: 9px 0 0; color: var(--end-muted); font-size: .78rem; line-height: 1.65; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-arrow { color: var(--end-faint); font-family: var(--end-mono); font-size: 1rem; transition: color .2s, transform .2s; }
.end-entry:hover .entry-arrow { color: var(--end-danger); transform: translateX(4px); }
.sign-entry .entry-title { font-family: var(--end-mono); }
.sign-entry .entry-code { color: var(--end-warning); }
.empty-state { min-height: 320px; display: grid; place-items: center; text-align: center; color: var(--end-muted); font-family: var(--end-serif); line-height: 2; }

.end-footer { width: min(1160px, calc(100% - 48px)); margin: 0 auto; padding: 24px 0 30px; display: flex; justify-content: space-between; gap: 18px; border-top: 1px solid var(--end-line); color: var(--end-faint); font-family: var(--end-mono); font-size: .6rem; }
.icon-action {
    width: 42px; height: 42px; display: inline-grid; place-items: center;
    border: 1px solid var(--end-line-strong); background: var(--end-surface); color: var(--end-muted); cursor: pointer;
}
.icon-action:hover { color: var(--end-text); border-color: var(--end-danger); }
.write-action { position: fixed; right: 28px; bottom: 28px; z-index: 50; }

.document-shell { width: min(900px, calc(100% - 48px)); margin: 0 auto; padding: 62px 0 100px; }
.document-nav { display: flex; justify-content: space-between; gap: 18px; margin-bottom: 76px; color: var(--end-muted); font-family: var(--end-mono); font-size: .66rem; }
.document-nav a:hover { color: var(--end-danger); }
.document-header { padding-bottom: 34px; border-bottom: 1px solid var(--end-line-strong); }
.document-meta { display: flex; gap: 18px; margin-bottom: 20px; color: var(--end-muted); font-family: var(--end-mono); font-size: .62rem; text-transform: uppercase; }
.document-meta .warning { color: var(--end-danger); }
.document-title { max-width: 760px; margin: 0; font-family: var(--end-serif); font-size: clamp(2rem, 5vw, 4rem); font-weight: 300; line-height: 1.3; }
.document-body { max-width: 720px; margin: 58px auto 0; white-space: pre-wrap; overflow-wrap: anywhere; color: #d2cfc9; font-family: var(--end-serif); font-size: 1.02rem; line-height: 2.15; }
.document-end { margin: 72px auto 0; max-width: 720px; padding-top: 24px; border-top: 1px solid var(--end-line); color: var(--end-faint); font-family: var(--end-mono); font-size: .62rem; }
.delete-action { position: fixed; right: 28px; bottom: 28px; z-index: 50; }
.delete-action button { color: var(--end-danger); }

.form-shell { width: min(820px, calc(100% - 48px)); margin: 0 auto; padding: 62px 0 100px; }
.form-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; padding-bottom: 30px; border-bottom: 1px solid var(--end-line-strong); }
.form-head h1 { margin: 0; font-family: var(--end-serif); font-size: 2.4rem; font-weight: 300; }
.form-head p { margin: 0; color: var(--end-muted); font-family: var(--end-mono); font-size: .62rem; }
.end-form { display: grid; gap: 30px; margin-top: 42px; }
.form-field label { display: block; margin-bottom: 9px; color: var(--end-muted); font-family: var(--end-mono); font-size: .62rem; text-transform: uppercase; }
.form-field input, .form-field textarea, .form-field select {
    width: 100%; border: 1px solid var(--end-line); border-radius: 0; outline: none;
    background: rgba(13,13,13,.82); color: var(--end-text); padding: 14px 15px;
}
.form-field input:focus, .form-field textarea:focus, .form-field select:focus { border-color: var(--end-danger); }
.form-field textarea { min-height: 380px; resize: vertical; font-family: var(--end-serif); line-height: 1.9; }
.form-actions { display: flex; justify-content: flex-end; }
.command-btn { min-height: 42px; padding: 0 20px; border: 1px solid var(--end-danger); background: transparent; color: var(--end-text); font-family: var(--end-mono); font-size: .66rem; cursor: pointer; }
.command-btn:hover { background: var(--end-danger); color: #fff; }

.error-shell { min-height: calc(100vh - 68px); display: grid; place-items: center; padding: 48px 24px; }
.error-content { width: min(720px, 100%); }
.error-code { margin: 0; color: transparent; -webkit-text-stroke: 1px rgba(216,74,69,.75); font-family: var(--end-mono); font-size: clamp(6rem, 24vw, 15rem); line-height: .8; }
.error-message { margin: 42px 0 26px; font-family: var(--end-serif); font-size: 1rem; line-height: 2; }
.text-link { color: var(--end-muted); font-family: var(--end-mono); font-size: .65rem; }
.text-link:hover { color: var(--end-danger); }

.reveal { opacity: 0; transform: translateY(10px); animation: reveal .7s ease forwards; }
.reveal-delay { animation-delay: .12s; }
@keyframes reveal { to { opacity: 1; transform: none; } }

@media (max-width: 760px) {
    .end-header { min-height: 112px; grid-template-columns: 1fr auto; align-content: center; padding: 12px 16px; gap: 8px; }
    .end-nav { grid-column: 1 / -1; grid-row: 2; justify-content: center; border-top: 1px solid var(--end-line); padding-top: 7px; }
    .end-status { grid-column: 2; grid-row: 1; }
    .end-brand-sub, .end-status .status-label { display: none; }
    .end-shell { width: min(100% - 28px, 1160px); padding-top: 42px; }
    .end-hero { min-height: 0; grid-template-columns: 1fr; gap: 34px; }
    .end-title { font-size: 3.1rem; }
    .archive-count { display: none; }
    .end-entry { grid-template-columns: 54px minmax(0, 1fr) 20px; gap: 12px; min-height: 116px; }
    .entry-top { display: block; }
    .entry-mood { display: block; margin-top: 5px; }
    .entry-excerpt { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
    .end-footer { width: min(100% - 28px, 1160px); display: block; line-height: 1.8; }
    .document-shell, .form-shell { width: min(100% - 30px, 900px); padding-top: 38px; }
    .document-nav { margin-bottom: 48px; }
    .document-body { margin-top: 38px; font-size: .96rem; line-height: 2; }
    .form-head { display: block; }
    .form-head p { margin-top: 12px; }
    .write-action, .delete-action { right: 16px; bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
    .end-scanline { display: none; }
}
