:root {
    --room: #0b0908;
    --bezel: #c9c0aa;
    --bezel-d: #8e8571;
    --bg: #120c05;
    --ph: #ffb000;
    --ph-hi: #ffe0a0;
    --ph-2: #c98a1a;
    --ph-3: #6b4a12;
    --ph-4: #2a1c08;
    --red: #ff7a5c;
    --glow: 0 0 4px rgba(255, 176, 0, .45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
    background: radial-gradient(ellipse at 50% 40%, #1d1712 0%, var(--room) 70%);
    color: var(--ph);
    font-family: 'Galmuri11', monospace;
    -webkit-font-smoothing: none;
}
button, input, textarea { font: inherit; color: inherit; }
.hide { display: none !important; }
.grow { flex: 1; }

/* ---------- stage ---------- */
#stage {
    position: absolute; left: 50%; top: 50%;
    width: 1280px; height: 720px;
    transform-origin: 50% 50%;
}
#monitor {
    position: absolute; left: 36px; top: 12px; width: 1208px; height: 696px;
    background: linear-gradient(170deg, #d8d0bb 0%, var(--bezel) 40%, #b3aa93 100%);
    border-radius: 26px;
    padding: 26px 30px 0;
    box-shadow: 0 30px 60px rgba(0,0,0,.6), inset 0 2px 0 rgba(255,255,255,.5), inset 0 -4px 0 rgba(0,0,0,.18);
}
#screen {
    position: relative; width: 1148px; height: 616px;
    background: var(--bg);
    border-radius: 18px / 22px;
    overflow: hidden;
    box-shadow: 0 0 0 6px #5c5545, 0 0 0 8px #3b362c, inset 0 0 60px rgba(0,0,0,.9);
    text-shadow: var(--glow);
}
#chin { display: flex; align-items: center; gap: 12px; height: 54px; padding: 0 10px; color: #5e5747; text-shadow: none; }
#chin .brand { font-family: 'Galmuri9'; letter-spacing: 3px; font-size: 12px; }
#chin .knob { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ddd5c0, #8e8571); box-shadow: 0 1px 2px rgba(0,0,0,.4); }
#led { width: 8px; height: 8px; border-radius: 50%; background: #3a2a10; margin-left: 8px; }
#led.on { background: #ffb000; box-shadow: 0 0 6px #ffb000; }

/* CRT effects */
.fx { position: absolute; inset: 0; pointer-events: none; z-index: 50; border-radius: inherit;
    background:
        repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0px, rgba(0,0,0,0) 2px, rgba(0,0,0,.22) 3px),
        radial-gradient(ellipse at 50% 50%, rgba(0,0,0,0) 60%, rgba(0,0,0,.55) 100%);
    animation: flick 6s infinite steps(1);
}
@keyframes flick { 0%, 100% { opacity: 1; } 47% { opacity: .93; } 48% { opacity: 1; } 81% { opacity: .96; } }

/* ---------- os ---------- */
#os { position: absolute; inset: 0; display: grid; grid-template-columns: 300px 1fr 250px; grid-template-rows: 28px 1fr; gap: 10px; padding: 0 12px 12px; }
#bar { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; margin: 0 -12px; padding: 0 14px; background: var(--ph); color: var(--bg); text-shadow: none; font-size: 12px; }
#bar b { letter-spacing: 1px; }
#bar button { background: var(--bg); color: var(--ph); border: 0; padding: 2px 8px; cursor: pointer; font-size: 11px; }
#bar button:hover { background: var(--ph-4); }

section { min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--ph-3); padding: 8px; }
.ptitle { font-size: 12px; color: var(--ph-2); margin-bottom: 6px; display: flex; gap: 8px; align-items: baseline; }
.ptitle em { font-style: normal; color: var(--ph-3); font-size: 11px; }
.ptitle.sub { margin-top: auto; padding-top: 8px; border-top: 1px dashed var(--ph-3); }

/* search */
#searchForm { display: flex; align-items: center; gap: 6px; border: 1px solid var(--ph-2); padding: 4px 8px; }
#searchForm:focus-within { border-color: var(--ph); box-shadow: 0 0 6px rgba(255,176,0,.35); }
#q { flex: 1; background: transparent; border: 0; outline: 0; color: var(--ph-hi); caret-color: var(--ph); font-size: 14px; text-shadow: var(--glow); }
#q::placeholder { color: var(--ph-3); }
.prompt { color: var(--ph-2); }
#count { font-size: 11px; color: var(--ph-2); margin: 6px 0 4px; min-height: 14px; }
#count.warn { color: var(--ph-hi); }
#results { display: flex; flex-direction: column; gap: 4px; }
.res { border: 1px solid var(--ph-4); padding: 5px 7px 6px; cursor: pointer; }
.res:hover { border-color: var(--ph-2); background: rgba(255,176,0,.05); }
.res.cur { border-color: var(--ph); background: rgba(255,176,0,.09); }
.res .t { display: flex; gap: 6px; align-items: baseline; font-size: 12px; }
.res .t b { font-weight: normal; color: var(--ph-hi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.res .d { font-size: 10px; color: var(--ph-2); margin-top: 2px; display: flex; gap: 6px; }
.res .s { font-size: 11px; color: var(--ph-2); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res .s.old::before { content: '이전 판: '; color: var(--ph-3); }
.res.seen .t b { color: var(--ph-2); }
.tag { font-family: 'Galmuri9'; font-size: 10px; border: 1px solid currentColor; padding: 0 3px; line-height: 13px; white-space: nowrap; }
.tag.k { color: var(--ph-2); }
.tag.m { color: var(--ph-hi); }
.tag.x { color: var(--red); }
.tag.l { color: var(--ph); background: var(--ph-4); }
.tag.v { color: var(--ph-3); border-color: transparent; }
mark { background: var(--ph); color: var(--bg); text-shadow: none; }

#history { display: flex; flex-wrap: wrap; gap: 4px; max-height: 92px; overflow: hidden; }
#history button { background: transparent; border: 1px solid var(--ph-4); color: var(--ph-2); font-size: 11px; padding: 1px 6px; cursor: pointer; }
#history button:hover { border-color: var(--ph-2); color: var(--ph); }

/* viewer */
#viewer { padding: 0; }
#vEmpty { flex: 1; display: grid; place-items: center; color: var(--ph-3); font-size: 13px; }
#vRec { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.vh { padding: 10px 14px 8px; border-bottom: 1px solid var(--ph-3); }
.vh h2 { font-size: 16px; font-weight: normal; color: var(--ph-hi); display: flex; gap: 8px; align-items: center; }
.vmeta { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 2px 10px; margin-top: 6px; font-size: 11px; }
.vmeta dt { color: var(--ph-3); }
.vmeta dd { color: var(--ph-2); }
.vtools { display: flex; gap: 6px; padding: 6px 14px; border-bottom: 1px solid var(--ph-4); }
.vtools button, .rbtn { background: transparent; border: 1px solid var(--ph-2); color: var(--ph); font-size: 11px; padding: 2px 8px; cursor: pointer; }
.vtools button:hover, .rbtn:hover { background: var(--ph-4); }
.vtools button.on { background: var(--ph); color: var(--bg); text-shadow: none; }
.vtools button:disabled { opacity: .35; cursor: default; background: transparent; }
.vtools .grow { flex: 1; }
.vbody { flex: 1; overflow-y: auto; padding: 12px 16px 20px; font-size: 13px; line-height: 1.75; white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere; color: var(--ph); }
.vbody::selection, .vbody *::selection { background: var(--ph-hi); color: var(--bg); }
.vbody.gone { color: var(--ph-3); }
.revs { display: flex; flex-direction: column; gap: 3px; padding: 8px 14px; border-bottom: 1px solid var(--ph-4); }
.rev { display: flex; gap: 10px; font-size: 11px; padding: 3px 6px; border: 1px solid transparent; cursor: pointer; color: var(--ph-2); }
.rev:hover { border-color: var(--ph-3); }
.rev.on { border-color: var(--ph); color: var(--ph); }
.rev .n { width: 70px; }
.rev .w { width: 130px; }
.rev .a { width: 150px; }
.diffnote { font-size: 11px; color: var(--ph-3); margin-bottom: 8px; }
del { color: var(--red); text-decoration: line-through; text-shadow: 0 0 4px rgba(255,122,92,.4); }
ins { text-decoration: none; background: rgba(255,176,0,.22); color: var(--ph-hi); outline: 1px solid var(--ph-2); }

.lock { flex: 1; display: grid; place-items: center; text-align: center; font-size: 13px; color: var(--ph-2); line-height: 1.9; }
.lock form { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }
.lock input { width: 110px; background: transparent; border: 1px solid var(--ph-2); color: var(--ph-hi); text-align: center; letter-spacing: 6px; font-size: 16px; padding: 3px; outline: 0; }
.lock .err { color: var(--red); min-height: 20px; font-size: 12px; }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ph-3); }

/* messenger */
#msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 2px; margin-bottom: 8px; min-height: 0; }
.msg { font-size: 12px; line-height: 1.6; border-left: 2px solid var(--ph-2); padding: 2px 0 2px 7px; word-break: keep-all; }
.msg .ts { display: block; font-family: 'Galmuri9'; font-size: 10px; color: var(--ph-3); }
.msg.new { animation: pop .4s steps(3); }
.msg.typing { color: var(--ph-3); border-color: var(--ph-3); }
@keyframes pop { from { opacity: 0; } to { opacity: 1; } }
#notes { height: 150px; resize: none; background: transparent; border: 1px solid var(--ph-3); color: var(--ph-hi); font-size: 12px; line-height: 1.6; padding: 6px; outline: 0; text-shadow: var(--glow); }
#notes:focus { border-color: var(--ph-2); }
#notes::placeholder { color: var(--ph-3); }
#reportBtn { margin-top: 8px; padding: 7px; background: transparent; border: 1px solid var(--ph); color: var(--ph); cursor: pointer; font-size: 13px; }
#reportBtn:hover { background: var(--ph); color: var(--bg); text-shadow: none; }

/* report */
#report { position: absolute; inset: 28px 0 0; z-index: 20; background: rgba(18,12,5,.92); display: grid; place-items: center; }
.rcard { width: 900px; border: 1px solid var(--ph); background: var(--bg); padding: 22px 28px 20px; box-shadow: 0 0 24px rgba(255,176,0,.15); }
.rcard h3 { font-weight: normal; font-size: 15px; color: var(--ph-hi); display: flex; justify-content: space-between; }
.rcard h3 span { font-size: 11px; color: var(--ph-3); }
.rcard .rsub { font-size: 11px; color: var(--ph-2); margin: 4px 0 16px; }
.rtext { font-size: 14px; line-height: 2.6; word-break: keep-all; }
.rtext input { width: 120px; background: transparent; border: 0; border-bottom: 1px solid var(--ph); color: var(--ph-hi); text-align: center; outline: 0; font-size: 14px; padding: 0 4px; text-shadow: var(--glow); }
.rtext input:focus { background: var(--ph-4); }
.rtext input.w { width: 160px; }
.rfoot { display: flex; gap: 8px; align-items: center; margin-top: 18px; }
.rfoot .rmsg { flex: 1; font-size: 12px; color: var(--ph-2); }
.rfoot .rmsg.bad { color: var(--red); }
.rbtn.main { background: var(--ph); color: var(--bg); text-shadow: none; padding: 5px 14px; font-size: 13px; }
.rbtn.main:hover { background: var(--ph-hi); }

/* boot, menu */
#boot { position: absolute; inset: 0; z-index: 30; background: var(--bg); padding: 46px 60px; font-size: 14px; line-height: 1.9; white-space: pre-wrap; }
#boot .cur { display: inline-block; width: 9px; height: 15px; background: var(--ph); vertical-align: -2px; animation: blink 1s steps(1) infinite; }
#boot button { background: transparent; border: 1px solid var(--ph); color: var(--ph); padding: 3px 12px; margin-right: 10px; cursor: pointer; font-size: 13px; }
#boot button:hover { background: var(--ph); color: var(--bg); text-shadow: none; }
#boot .end { margin-top: 14px; }
#boot .dim { color: var(--ph-2); }
@keyframes blink { 50% { opacity: 0; } }

#menu { position: absolute; inset: 0; z-index: 40; background: rgba(18,12,5,.85); display: grid; place-items: center; }
#menu .card { width: 420px; border: 1px solid var(--ph); background: var(--bg); padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.mtitle { font-size: 15px; color: var(--ph-hi); margin-bottom: 6px; }
.mbtn { background: transparent; border: 1px solid var(--ph-3); color: var(--ph); padding: 6px; cursor: pointer; text-align: left; font-size: 13px; }
.mbtn:hover { border-color: var(--ph); background: var(--ph-4); }
.howto { font-size: 12px; line-height: 1.8; color: var(--ph-2); border-top: 1px dashed var(--ph-3); padding-top: 8px; margin-top: 4px; }

#small { display: none; }
@media (max-width: 899px), (hover: none) and (pointer: coarse) {
    #stage { display: none; }
    #small { display: grid; place-items: center; position: fixed; inset: 0; padding: 24px; text-align: center; line-height: 1.8; font-size: 14px; }
    #small b { display: block; font-size: 22px; margin-bottom: 10px; }
}
