:root {
    color-scheme: dark;
    font-family: "Pretendard", "Noto Sans KR", "Malgun Gothic", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #eee;
    background: #303030;
    font-synthesis: none;
    --muted: #b2b2b2;
    --line: #ffffff20;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .3; }
a, a:link, a:visited, a:hover, a:active { color: inherit; text-decoration: none; }
button, a, input, select, summary { outline-offset: 5px; }
:focus-visible { outline: 2px solid #deded5; }
h1, h2, p { margin: 0; }
.muted { color: var(--muted); font-size: .82rem; line-height: 1.7; }
.eyebrow { font-size: .65rem; letter-spacing: .23em; color: #bcbcbc; font-weight: 500; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* Identical circular light falloff and centered input on desktop and mobile. */
.entrance {
    min-height: 100vh;
    min-height: 100svh;
    background: radial-gradient(circle at center, #b1b1b1 0%, #8d8d8d 17%, #646464 38%, #3d3d3d 67%, #292929 100%);
}
.entrance-center { min-height: 100vh; min-height: 100svh; display: grid; place-items: center; }
#kotodama {
    display: block;
    width: min(78vw, 24rem);
    padding: .65rem .25rem;
    border: 0;
    border-radius: 0;
    outline: none;
    background: transparent;
    box-shadow: none;
    color: #ffe477;
    caret-color: #ffe477;
    text-align: center;
    font-size: 1.35rem;
    line-height: 1.6;
    letter-spacing: .12em;
}

/* Broad horizontal bands fade from dark to light gray. */
.archive-page {
    min-height: 100vh;
    min-height: 100svh;
    background: repeating-linear-gradient(180deg, #292929 0, #3f3f3f 140px, #494949 210px, #363636 330px, #292929 440px);
    background-attachment: fixed;
}
.archive-shell { max-width: 960px; width: calc(100% - 64px); min-height: 100svh; margin: 0 auto; padding: 76px 0 28px; display: flex; flex-direction: column; }
.archive-header { text-align: center; margin-bottom: 64px; }
.year-navigation { display: flex; justify-content: center; align-items: center; gap: 38px; margin: 10px 0 6px; }
.year-navigation h1 { font-size: clamp(3.6rem, 9vw, 5.5rem); font-weight: 300; letter-spacing: -.04em; font-variant-numeric: tabular-nums; line-height: 1.3; }
.year-changing .year-navigation h1 { animation: archive-year-glow 2s ease-in-out both; }
@keyframes archive-year-glow {
    0%, 100% { color: #eee; text-shadow: 0 0 0 #d7b7ff00; }
    30%, 65% { color: #e2c9f5; text-shadow: 0 0 18px #cfa8ef66; }
}
.year-arrow { width: 44px; height: 44px; flex-shrink: 0; display: grid; place-items: center; color: #bdbdbd; font-size: 1.6rem; border-radius: 50%; transition: background .18s, color .18s; }
.year-arrow:hover { color: #fff; background: #ffffff12; }
.year-form { margin: 0; min-width: 0; }
.year-input { display: block; width: 4.2ch; min-width: 0; border: 0; border-radius: 0; padding: 0; background: transparent; color: inherit; text-align: center; font: inherit; letter-spacing: inherit; line-height: inherit; font-variant-numeric: tabular-nums; }
.year-input:focus-visible { outline: 1px solid #ffffff60; }
.year-caption { font-size: .78rem; font-weight: 400; color: #bfbfbf; letter-spacing: .05em; }
.current-year { display: inline-block; font-size: .73rem; color: #dedede; border-bottom: 1px solid #ffffff40; margin-top: 18px; padding-bottom: 4px; }
.archive-content { display: grid; gap: 32px; margin-bottom: 70px; }
.standalone-heading { font-size: 1.6rem; line-height: 1.6; font-weight: 500; overflow-wrap: anywhere; padding-top: 12px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.section-heading h2 { font-size: 1rem; font-weight: 500; line-height: 1.6; overflow-wrap: anywhere; }
.table-scroll { max-width: 100%; overflow-x: auto; }
.game-table { width: 100%; border-collapse: collapse; background: transparent; border-top: 1px solid #ffffff38; table-layout: fixed; }
.game-table[data-columns="3"] { min-width: 540px; }
.game-table[data-columns="4"] { min-width: 720px; }
.game-table[data-columns="5"] { min-width: 900px; }
.game-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .85rem; line-height: 1.7; color: #c7d3c9; }
.game-list .game-text { max-width: 50%; }
.game-table th, .game-table td { padding: 22px 26px; border-bottom: 1px solid #ffffff16; text-align: center; vertical-align: middle; }
.game-table thead th { padding-top: 14px; padding-bottom: 14px; color: #bcbcbc; font-size: .7rem; font-weight: 700; }
.game-table tbody td { font-size: .92rem; font-weight: 400; overflow-wrap: anywhere; line-height: 1.7; }
.game-table .action-cell { text-align: center; }
.game-table tbody .game-button { font-weight: 400; max-width: 100%; white-space: normal; }
.game-table .row-bold td, .game-table .row-bold .game-text, .game-table .row-bold .game-button { font-weight: 700; }
.game-button, .game-button:link, .game-button:visited {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    min-width: 116px;
    min-height: 42px;
    padding: 11px 16px;
    border: 1px solid #e0e0dc;
    border-radius: 3px;
    color: #333;
    background: #e0e0dc;
    font-size: .75rem;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
    text-decoration: none;
    transition: background .18s, border-color .18s;
}
.game-button:hover, .game-button:active, .game-button:focus-visible { background: #fff; border-color: #fff; color: #222; text-decoration: none; }
.game-button span { font-size: .95rem; font-weight: 400; color: #5d5d59; }
.game-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid #ffffff38; }
.game-list li { display: flex; align-items: center; gap: 22px; border-bottom: 1px solid #ffffff24; padding: 22px 2px; }
.game-number { font-size: .7rem; color: #aaa; font-variant-numeric: tabular-nums; }
.game-name { flex: 1; min-width: 0; font-size: .92rem; line-height: 1.7; overflow-wrap: anywhere; }
.section-empty { padding: 28px; border-top: 1px solid var(--line); font-size: .82rem; color: var(--muted); }
.empty-state { padding: 65px 12px 110px; text-align: center; line-height: 1.8; color: #d2d2d2; }
.empty-mark { font-size: 2rem; color: #929292; display: block; margin-bottom: 22px; font-weight: 200; }
.empty-state p { font-size: .94rem; }
.empty-state:not([role="alert"]) { color: #bfd2c2; }
.empty-state small { display: block; color: #a0b8a5; font-size: .75rem; margin-top: 10px; }
.empty-state.erased-state p { color: #ef7979; }
.empty-state.erased-state small { color: #c69b9b; }
.archive-page.notice-active::before, .archive-page.future-active::before {
    --notice-peak: 1;
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(180deg, #8718184d, #9c1f1f66, #69121240);
    opacity: 0;
    animation: archive-notice-tint 1s ease-in-out both;
}
.archive-page.future-active::before { background: linear-gradient(180deg, #0794a066, #16c3d080, #087e8966); }
.archive-page.notice-active .archive-shell, .archive-page.future-active .archive-shell { position: relative; z-index: 1; }
@keyframes archive-notice-tint {
    0%, 100% { opacity: 0; }
    35%, 50% { opacity: var(--notice-peak, 1); }
}
.archive-alert { width: min(360px, calc(100% - 40px)); margin: auto; padding: 26px; border: 1px solid #ffffff30; border-radius: 8px; background: #303030; color: #eee; box-shadow: 0 18px 60px #0008; }
.archive-alert::backdrop { background: #0006; }
.archive-alert form { display: flex; flex-direction: column; gap: 22px; }
.archive-alert p { font-size: .95rem; line-height: 1.8; }
.archive-alert .button { align-self: flex-end; min-width: 80px; }
.archive-footer { display: flex; justify-content: space-between; gap: 16px; margin-top: auto; padding-top: 22px; border-top: 1px solid #ffffff1f; font-size: .58rem; color: #aaa; letter-spacing: .12em; }
.archive-footer span:last-child { text-align: right; }

.admin-page { background: #252525; min-height: 100svh; }
.admin-shell { width: calc(100% - 64px); max-width: 1000px; margin: 0 auto; padding: 55px 0 32px; }
.admin-header { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 20px; }
.admin-header h1 { margin-top: 12px; font-size: 2.8rem; font-weight: 300; }
.admin-header h1 span { margin-left: 16px; font-size: 1.15rem; font-weight: 400; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.admin-intro { font-size: .84rem; color: #b6b6b6; line-height: 1.8; margin-bottom: 32px; }
.button, .button:link, .button:visited { display: inline-flex; align-items: center; justify-content: center; gap: 16px; background: #3c3c3c; color: #eee; border: 1px solid #ffffff24; min-height: 44px; border-radius: 4px; padding: 11px 17px; font-size: .8rem; line-height: 1.5; white-space: nowrap; text-decoration: none; }
.button:hover { background: #4a4a4a; text-decoration: none; }
.button.primary { color: #252525; background: #dfdfd9; border-color: #dfdfd9; font-weight: 600; }
.button.primary:hover { background: #f5f5f2; }
.button.ghost { background: transparent; }
.add-section, .editor-card { background: #303030; border: 1px solid #ffffff16; padding: 24px; border-radius: 6px; }
.add-section { margin-bottom: 38px; }
.block-fields { display: flex; gap: 14px; align-items: flex-end; }
label { display: flex; flex-direction: column; gap: 8px; font-size: .73rem; line-height: 1.6; color: #c6c6c6; min-width: 0; }
label.grow { flex: 1; }
.admin-page input:not([type="hidden"]), .admin-page select, .admin-page textarea { width: 100%; min-width: 0; min-height: 44px; border: 1px solid #ffffff26; border-radius: 4px; padding: 10px 12px; background: #252525; color: #f0f0f0; font-size: .85rem; line-height: 1.5; }
.admin-page textarea { resize: vertical; font-family: inherit; }
.admin-page [hidden] { display: none !important; }
select { min-width: 110px; }
input::placeholder { color: #888; }
.editor-heading { display: flex; justify-content: space-between; align-items: center; margin: 0 0 16px; }
.editor-heading h2 { font-size: 1rem; font-weight: 500; }
.editor-card { margin-bottom: 20px; }
.editor-card-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.type-tag { padding: 3px 8px; font-size: .65rem; border: 1px solid #ffffff20; border-radius: 3px; color: #c9c9c9; }
.editor-toolbar { display: flex; gap: 8px; margin-top: 14px; }
.push-right { margin-left: auto; }
.small-button { min-width: 38px; min-height: 38px; border: 1px solid #ffffff20; background: transparent; border-radius: 3px; color: #bbb; font-size: .72rem; padding: 7px 10px; }
.small-button:not(:disabled):hover { background: #ffffff0a; color: #fff; }
.small-button.danger { color: #d5aaaa; }
.small-button.save-button { background: #464646; color: #eee; }
.game-editors { margin-top: 22px; }
.game-editor { display: flex; gap: 18px; border-top: 1px solid var(--line); padding: 22px 0; align-items: flex-start; }
.game-editor-number { color: #999; font-size: .7rem; padding-top: 34px; font-variant-numeric: tabular-nums; }
.game-fields { display: grid; grid-template-columns: minmax(0, 1fr) 130px; gap: 12px; flex: 1; min-width: 0; }
.url-field { grid-column: 1 / -1; }
.row-style-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.row-style-fields, .result-targets { min-width: 0; margin: 8px 0; padding: 16px; border: 1px solid #ffffff30; border-radius: 4px; }
.row-style-fields legend, .result-targets legend { padding: 0 6px; font-size: .8rem; font-weight: 700; }
.row-style-save { grid-column: 1 / -1; justify-self: start; }
.result-targets label { flex-direction: row; align-items: center; margin-top: 10px; }
.admin-page .result-targets input[type="checkbox"] { width: 18px; min-height: 18px; flex: 0 0 18px; }
.result-return { display: flex; justify-content: center; padding: 36px 0; }
.row-style-fields select { min-width: 0; }
.game-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 26px; }
.game-actions .save-button, .game-actions .danger { grid-column: 1 / -1; }
.add-game { border-top: 1px solid var(--line); margin-top: 8px; }
.add-game summary { cursor: pointer; font-size: .82rem; padding: 20px 0 0; color: #ccc; }
.add-game summary span { float: right; }
.add-game form { margin-top: 20px; }
.add-game-footer { display: flex; justify-content: flex-end; margin-top: 16px; }
.notice { margin: 0 0 22px; padding: 14px 18px; font-size: .82rem; line-height: 1.8; background: #dde5dc13; border-left: 2px solid #b7c8b2; border-radius: 0 4px 4px 0; }
.notice.error { background: #e6bdbd0d; border-left-color: #ca9797; color: #ebc5c5; }
.admin-empty { text-align: center; padding: 48px 16px; border: 1px dashed #ffffff24; border-radius: 6px; font-size: .82rem; line-height: 1.8; color: #aaa; }
.admin-footer { margin-top: 32px; font-size: .73rem; line-height: 1.8; text-align: center; color: #999; }
.login-shell { width: min(100% - 48px, 360px); min-height: 100svh; margin: auto; display: flex; flex-direction: column; justify-content: center; padding: 60px 0; }
.login-shell h1 { font-size: 2rem; font-weight: 400; margin: 14px 0; }
.login-shell > .notice { margin-top: 24px; }
.login-form { display: flex; flex-direction: column; gap: 10px; margin-top: 28px; }
.login-form .button { margin-top: 10px; }
.quiet-link { font-size: .75rem; color: #aaa; align-self: center; padding: 24px 0 0; }

@media (max-width: 600px) {
    .archive-shell { width: calc(100% - 40px); padding-top: 48px; }
    .archive-header { margin-bottom: 42px; }
    .year-navigation { gap: 20px; }
    .archive-content { gap: 28px; }
    .game-table th, .game-table td { padding: 18px 14px; }
    .game-button, .game-button:link, .game-button:visited { min-width: 104px; gap: 12px; padding: 10px 12px; }
    .game-list li { gap: 12px; padding: 18px 0; }
    .game-table tbody td, .game-name { font-size: .83rem; }
    .standalone-heading { font-size: 1.35rem; }
    .empty-state { padding-top: 45px; }
    .admin-shell { width: calc(100% - 32px); padding-top: 30px; }
    .admin-header { align-items: flex-start; flex-direction: column; gap: 18px; }
    .admin-header h1 { font-size: 2.4rem; }
    .add-section, .editor-card { padding: 18px; }
    .section-heading { align-items: baseline; gap: 10px; }
    .section-heading > .muted { font-size: .7rem; }
    .block-fields { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
    .block-fields label.grow { grid-column: 1 / -1; }
    .game-editor { flex-wrap: wrap; gap: 10px; }
    .game-editor-number { display: none; }
    .game-fields { grid-template-columns: minmax(0, 1fr) 108px; width: 100%; flex-basis: 100%; }
    .game-actions { display: flex; width: 100%; margin: 0; }
    .game-actions .danger { margin-left: auto; }
    .game-actions .save-button { min-width: 64px; }
    .editor-toolbar { gap: 6px; }
    .small-button { padding: 7px 8px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
    .archive-page.notice-active::before, .archive-page.future-active::before { --notice-peak: .65; }
    .year-changing .year-navigation h1 { text-shadow: none !important; }
}

/* Separate list and detail editor. */
.editor-tabs, .detail-picker { display:flex; flex-wrap:wrap; gap:10px; margin:24px 0; }
.editor-card h2, .add-section h2 { font-size:1rem; margin-bottom:18px; }
.detail-meta { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; margin-top:20px; }
.cell-editor-grid { width:100%; table-layout:fixed; border-collapse:collapse; margin-top:20px; }
.cell-editor-grid td { border:1px solid #ffffff30; padding:10px; vertical-align:top; }
.cell-preview { white-space:pre-wrap; overflow-wrap:anywhere; text-align:center; min-height:70px; padding:12px; }
.cell-editor-grid summary { font-size:.8rem; padding:12px 0; cursor:pointer; }
.cell-editor-grid form { display:grid; gap:10px; }
.cell-editor-grid select { min-width:0; }
.detail-page .archive-shell { padding-bottom:130px; }
.detail-content h1 { font-size:2rem; text-align:center; margin:20px 0; overflow-wrap:anywhere; }
.detail-content h2 { font-size:1.2rem; text-align:center; margin:16px 0 32px; color:#c7d3c9; overflow-wrap:anywhere; }
.detail-text { white-space:pre-wrap; overflow-wrap:anywhere; line-height:1.8; padding:24px 0; }
.detail-table { width:100%; table-layout:fixed; border-collapse:collapse; background:transparent; }
.detail-table th, .detail-table td { padding:18px 14px; text-align:center; vertical-align:middle; border:1px solid #ffffff26; white-space:pre-wrap; overflow-wrap:anywhere; }
.detail-page .result-return { position:fixed; inset:auto 0 0; z-index:10; padding:14px 20px calc(14px + env(safe-area-inset-bottom)); background:#262626ed; border-top:1px solid #ffffff25; }
.detail-page .result-return .button { min-width:160px; }
@media(max-width:640px) { .detail-meta { grid-template-columns:1fr; } .detail-content h1 { font-size:1.6rem; } }

.year-admin { display:flex; flex-wrap:wrap; justify-content:space-between; gap:20px; padding:20px; border:1px solid #ffffff26; border-radius:6px; margin:24px 0; }
