:root {
  --bg: #070b0e; --panel: #0f181d; --line: #24403c; --green: #3dffa2; --text: #d3ece2; --dim: #86a59a; --warn: #ffb454;
  --arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='24'%3E%3Cpath d='M2 2v17l5-4 3 7 3-1-3-7h7z' fill='%230b1714' stroke='%233dffa2' stroke-width='1.5' stroke-linejoin='round'/%3E%3C/svg%3E") 2 2, default;
  --hand: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='24'%3E%3Cpath d='M2 2v17l5-4 3 7 3-1-3-7h7z' fill='%233dffa2' stroke='%23eafff5' stroke-width='1.5' stroke-linejoin='round'/%3E%3C/svg%3E") 2 2, pointer;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { overflow: hidden; background: var(--bg); color: var(--text); font: 15px/1.6 "Malgun Gothic", "Apple SD Gothic Neo", sans-serif; cursor: var(--arrow); }
button, input, select, textarea { font: inherit; color: inherit; background: #15242499; border: 1px solid var(--line); border-radius: 5px; padding: 5px 10px; }
button, select, label, input[type="checkbox"], input[type="range"] { cursor: var(--hand); }
button { transition: background .12s, border-color .12s; }
button:hover:not(:disabled) { background: #1f3b36; }
button:hover:not(:disabled), button:focus-visible, input:focus { border-color: var(--green); outline: none; }
button:disabled { opacity: .4; cursor: not-allowed; }
input[type="text"], textarea { cursor: text; }
pre { margin: 0; font: 15px/1.6 Consolas, "Malgun Gothic", monospace; white-space: pre-wrap; overflow-wrap: anywhere; cursor: text; }
h1, h2, h3 { color: var(--green); margin: 6px 0; line-height: 1.3; }
.dim { color: var(--dim); white-space: pre-line; }
.warn { color: var(--warn); }
.cr { color: var(--green); }
.grow { flex: 1; }

/* 아이콘 */
.ico { display: inline-block; width: 20px; height: 20px; flex: none; vertical-align: -4px; }
.ico svg { display: block; width: 100%; height: 100%; }
.ico g { fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.ico-app g { stroke: var(--c); stroke-width: 2.4; }
.ico-tile { fill: color-mix(in srgb, var(--c) 16%, #0d1619); stroke: color-mix(in srgb, var(--c) 45%, #0d1619); stroke-width: 1.5; }

/* 부팅과 로그인 */
#boot { position: fixed; inset: 0; z-index: 82; display: grid; place-items: center; background: #000; cursor: none; }
.post { align-self: start; justify-self: start; padding: 28px 34px; color: #b9d8cb; cursor: none; }
.boot-skip { position: absolute; bottom: 16px; color: #4d6a60; }
.boot-logo { display: grid; justify-items: center; gap: 14px; color: var(--green); }
.boot-logo .ico { width: 110px; height: 110px; filter: drop-shadow(0 0 16px #3dffa280); }
.boot-logo h1 { font: bold 40px Consolas, monospace; letter-spacing: 8px; }
#boot.login { background: radial-gradient(circle at 70% 25%, #10433a, transparent 55%), radial-gradient(circle at 20% 80%, #1a2a55, transparent 55%), #05090c; }
.login-box { display: grid; justify-items: center; gap: 8px; animation: fade .4s; }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: var(--green); background: #16332c; border: 1px solid var(--line); }
.login .avatar { width: 110px; height: 110px; }
.login .avatar .ico { width: 64px; height: 64px; }
.login-pass { width: 230px; height: 38px; padding: 5px 14px; letter-spacing: 6px; background: #0008; border: 1px solid var(--green); border-radius: 6px; }
.spinner { display: inline-block; width: 34px; height: 34px; border: 3px solid #3dffa230; border-top-color: var(--green); border-radius: 50%; animation: spin .9s linear infinite; }
.loading { display: grid; place-items: center; align-content: center; height: 100%; min-height: 120px; color: var(--dim); cursor: progress; }
@keyframes spin { to { transform: rotate(1turn); } }
@keyframes fade { from { opacity: 0; } }

/* 바탕화면 */
#os { position: fixed; inset: 0; display: flex; flex-direction: column; isolation: isolate; user-select: none; }
#os.fade-in { animation: fade .7s; }
#os pre, #os .msg p, #os td, #os .chat-list { user-select: text; }
#wallpaper { position: absolute; inset: 0; z-index: -1; overflow: hidden; background: linear-gradient(150deg, #071018, #0a1a1c 50%, #0b1022); }
#wallpaper i { position: absolute; width: 80vmax; height: 80vmax; border-radius: 50%; will-change: transform; animation: drift 34s ease-in-out infinite alternate; }
#wallpaper i:nth-child(1) { left: -25vmax; top: 10vmax; background: radial-gradient(closest-side, #1b7d5c66, transparent); }
#wallpaper i:nth-child(2) { right: -30vmax; top: -35vmax; background: radial-gradient(closest-side, #2d4fa866, transparent); animation-duration: 46s; animation-direction: alternate-reverse; }
#wallpaper i:nth-child(3) { left: 35vmax; top: 25vmax; background: radial-gradient(closest-side, #5a2c8a40, transparent); animation-duration: 58s; }
#wallpaper::after { content: ""; position: absolute; inset: 0; background: repeating-conic-gradient(from 12deg at 72% 118%, #ffffff06 0 1deg, transparent 1deg 7deg); }
#wallpaper.paused i { animation-play-state: paused; }
@keyframes drift { to { transform: translate(14vmax, -10vmax) scale(1.15); } }
#desktop { position: relative; flex: 1; min-height: 0; overflow: hidden; isolation: isolate; }
#icons { position: absolute; inset: 0; touch-action: none; }
.desk-icon { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 88px; padding: 6px 2px; background: none; border-color: transparent; font-size: 13px; line-height: 1.25; word-break: keep-all; text-shadow: 0 1px 3px #000, 0 0 6px #000; touch-action: none; }
.desk-icon .ico { width: 46px; height: 46px; }
.desk-icon:hover:not(:disabled) { background: #ffffff10; border-color: transparent; }
.desk-icon.on { background: #3dffa226; border-color: #3dffa260; }
#select-box { position: absolute; background: #3dffa220; border: 1px solid #3dffa2a0; pointer-events: none; }

/* 창 */
.win { position: absolute; display: flex; flex-direction: column; background: var(--panel); border: 1px solid #2b3a3f; border-radius: 9px; overflow: hidden; box-shadow: 0 10px 34px #000a; }
.win.active { border-color: #3dffa27a; box-shadow: 0 14px 44px #000d; }
.win.max { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; border-radius: 0; }
.win-bar { display: flex; align-items: center; gap: 4px; padding: 4px 5px 4px 10px; color: #7d938c; background: #141d21; touch-action: none; }
.win.active .win-bar { color: var(--text); background: linear-gradient(#1d3a35, #16292a); }
.win:not(.active) .win-bar .ico { opacity: .55; }
.win-title { flex: 1; padding-left: 5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.win-btn { width: 32px; height: 26px; padding: 0; line-height: 1; border-color: transparent; background: none; }
.win-btn.close:hover:not(:disabled) { background: #b3344c; border-color: transparent; }
.win-body { flex: 1; min-height: 0; overflow: auto; padding: 12px; }
.win-body:has(> .split), .win-body:has(> .terminal), .win-body:has(> .rank-app), .win-body:has(> .messenger) { padding: 0; }
.edge { position: absolute; touch-action: none; }
.win.max .edge { display: none; }
.edge-n, .edge-s { left: 8px; right: 8px; height: 6px; cursor: ns-resize; }
.edge-e, .edge-w { top: 8px; bottom: 8px; width: 6px; cursor: ew-resize; }
.edge-n { top: 0; } .edge-s { bottom: 0; } .edge-e { right: 0; } .edge-w { left: 0; }
.edge-ne, .edge-nw, .edge-se, .edge-sw { width: 12px; height: 12px; }
.edge-ne { top: 0; right: 0; width: 5px; height: 5px; cursor: nesw-resize; } .edge-nw { top: 0; left: 0; cursor: nwse-resize; }
.edge-se { bottom: 0; right: 0; cursor: nwse-resize; } .edge-sw { bottom: 0; left: 0; cursor: nesw-resize; }

/* 앱 공통 */
.split { display: flex; height: 100%; }
.side { width: 150px; flex: none; overflow: auto; padding: 6px; border-right: 1px solid var(--line); background: #0b1216; }
.side.wide { width: 210px; }
.side button, .item { display: block; width: 100%; text-align: left; background: none; border-color: transparent; }
.side button { margin-bottom: 2px; font-size: 14px; }
.side button.on, .item.on { background: #1b3a31; border-color: var(--green); }
.item { display: flex; align-items: center; gap: 8px; }
.main { flex: 1; min-width: 0; overflow: auto; padding: 10px; }
.tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; }
.file-main { display: flex; flex-direction: column; gap: 8px; }
.file-list { flex: 1; min-height: 0; overflow: auto; border-top: 1px solid var(--line); padding-top: 6px; }
.file-status { color: var(--dim); font-size: 12px; }
.address { width: 100%; font-size: 14px; }
.picture { height: 100%; display: grid; place-items: center; font-size: 90px; }
th { text-align: left; padding-right: 14px; color: var(--dim); font-weight: normal; white-space: nowrap; vertical-align: top; }
.terminal { height: 100%; overflow: auto; padding: 10px; background: #030605; color: var(--green); cursor: text; }
.prompt { display: flex; font: 15px/1.6 Consolas, monospace; white-space: pre; }
.prompt input { flex: 1; min-width: 0; padding: 0; border: none; background: none; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.card { display: flex; flex-direction: column; gap: 2px; padding: 10px; text-align: left; }
.card small, .card span { color: var(--dim); font-size: 13px; }
.card.cleared span, .card.now span { color: var(--green); }
.card.now { border-color: var(--green); }
.danger { color: #ff8b9b; }
.answer { display: flex; gap: 6px; }
.answer input { flex: 1; min-width: 0; }
.answer button { flex: none; }

/* 메신저 */
.messenger { display: flex; height: 100%; }
.msg-contacts { width: 150px; flex: none; padding: 8px; background: #0b1216; border-right: 1px solid var(--line); }
.contact { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 6px; background: #1b3a31; line-height: 1.3; }
.contact small { display: block; font-size: 11px; }
.msg-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.msg-head { display: flex; gap: 6px; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.msg-head b { flex: 1; }
.msg-head button { font-size: 12px; padding: 2px 8px; }
.msg-list { flex: 1; min-height: 0; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 84%; align-self: flex-start; }
.msg p { margin: 0; padding: 7px 12px; white-space: pre-line; word-break: keep-all; overflow-wrap: anywhere; background: #1a282d; border-radius: 4px 12px 12px 12px; }
.msg.me { align-self: flex-end; text-align: right; }
.msg.me p { text-align: left; color: #03150d; background: #37d98c; border-radius: 12px 4px 12px 12px; }
.msg small { color: var(--dim); font-size: 11px; }
.typing { color: var(--dim); font-size: 13px; }
.typing i::after { content: "..."; display: inline-block; overflow: hidden; vertical-align: bottom; width: 0; animation: dots 1s steps(4) infinite; }
@keyframes dots { to { width: 1.4em; } }
.msg-report { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 10px; font-size: 13px; border-top: 1px solid var(--line); background: #0d1619; }
.msg-report:empty { display: none; }
.msg-input { display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--line); }
.msg-input input { flex: 1; min-width: 0; }

/* 작업 표시줄 */
#taskbar { position: relative; z-index: 2; display: flex; align-items: center; gap: 6px; height: 46px; flex: none; padding: 0 8px; background: #0a1115e6; border-top: 1px solid #ffffff14; }
#start-button { padding: 4px 8px; color: var(--green); background: none; border-color: transparent; }
#start-button .ico { width: 26px; height: 26px; vertical-align: middle; }
#task-buttons { flex: 1; min-width: 0; display: flex; gap: 4px; overflow: hidden; }
.task { position: relative; display: flex; align-items: center; gap: 7px; min-width: 42px; max-width: 160px; height: 36px; padding: 0 9px; font-size: 13px; background: none; border-color: transparent; border-bottom: 2px solid transparent; }
.task span:not(.ico) { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.task.open { border-bottom-color: #3dffa270; }
.task.on { background: #ffffff16; border-bottom-color: var(--green); }
.badge { position: absolute; left: 24px; top: 1px; min-width: 17px; padding: 0 4px; font: bold 11px/17px sans-serif; text-align: center; color: #fff; background: #e0405e; border-radius: 9px; }
#tray { display: flex; align-items: center; gap: 4px; font-size: 13px; white-space: nowrap; }
#tray button { padding: 3px 6px; background: none; border-color: transparent; }
#tray-count { padding: 0 4px; color: var(--green); }
#tray-net.busy { animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: .3; } }
#tray-clock { padding-left: 8px; font-size: 12px; line-height: 1.3; text-align: right; white-space: pre; }
#start-menu { position: absolute; z-index: 3; left: 8px; bottom: 54px; width: 290px; max-height: calc(100% - 70px); display: flex; flex-direction: column; background: #101b20f5; border: 1px solid #ffffff1c; border-radius: 12px; box-shadow: 0 16px 44px #000c; animation: rise .16s; overflow: hidden; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.start-user { display: flex; align-items: center; gap: 12px; padding: 14px 16px; line-height: 1.4; border-bottom: 1px solid #ffffff14; overflow-wrap: anywhere; }
.start-user .ico { width: 32px; height: 32px; color: var(--green); }
.start-user .cr { font-size: 12px; }
.start-apps { flex: 1; min-height: 0; overflow: auto; padding: 8px; }
.start-apps button, .start-foot button, #context-menu button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border-color: transparent; }
.start-apps .ico { width: 26px; height: 26px; }
.start-foot { display: flex; padding: 6px; border-top: 1px solid #ffffff14; }
.start-foot button { justify-content: center; gap: 6px; padding: 5px 4px; font-size: 13px; }
#context-menu { position: fixed; z-index: 4; min-width: 150px; padding: 5px; background: #101b20fa; border: 1px solid #ffffff1c; border-radius: 8px; box-shadow: 0 8px 26px #000c; }

/* 알림과 창 */
#notices { position: absolute; z-index: 2; right: 14px; bottom: 60px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.notice { position: relative; display: flex; gap: 12px; align-items: center; width: 310px; padding: 10px 14px; text-align: left; line-height: 1.4; background: #14222af5; border-color: #ffffff24; border-radius: 10px; box-shadow: 0 8px 26px #000b; overflow: hidden; pointer-events: auto; animation: slide .25s; }
.notice > .ico { width: 34px; height: 34px; }
.notice p { margin: 0; color: var(--dim); font-size: 13px; overflow-wrap: anywhere; }
.notice-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: #0006; }
.notice-bar i { display: block; height: 100%; background: var(--green); animation: fill 1.75s ease-in-out forwards; }
@keyframes slide { from { opacity: 0; transform: translateX(40px); } }
@keyframes fill { from { width: 0; } to { width: 100%; } }
#modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: #000a; }
.modal-box { min-width: 300px; max-width: 90vw; padding: 20px 28px; text-align: center; background: var(--panel); border: 1px solid var(--green); border-radius: 10px; animation: rise .16s; }
.modal-box p { white-space: pre-line; }
.row { display: flex; gap: 8px; justify-content: center; }
#toast { position: fixed; z-index: 90; bottom: 64px; left: 50%; transform: translateX(-50%); padding: 8px 18px; background: #14241f; border: 1px solid var(--green); border-radius: 6px; opacity: 0; pointer-events: none; transition: opacity .2s; }
#toast.show { opacity: 1; }

@media (max-width: 700px) {
  .task span:not(.ico), #tray-count { display: none; }
  .msg-contacts { display: none; }
  .side { width: 110px; }
}

/* 암호 해독기 */
.decoder { display: flex; flex-direction: column; gap: 10px; min-height: 100%; }
.decoder input { width: 80px; }
.decoder textarea { font-family: Consolas, monospace; resize: none; }
.decoded { flex: 1; min-height: 60px; padding: 8px; border: 1px dashed var(--line); border-radius: 4px; }

/* 표, 경로, 단계 */
.table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.table th, .table td { padding: 4px 8px; text-align: left; border-bottom: 1px solid var(--line); }
.clickable tr:has(td) { cursor: pointer; }
.clickable tr.on td { background: #1b3a31; }
.tools input[type="time"], .tools select { padding: 3px 5px; }
.steps { margin: 4px 0 14px; padding: 0; list-style: none; }
.damaged { padding: 8px 0; border-bottom: 1px solid var(--line); }
#modal.ending { background: radial-gradient(#0f2f27, #020504 75%); }
#modal.ending .modal-box { border: none; background: none; }
#modal.ending h2 { font-size: 40px; text-shadow: 0 0 18px #3dffa2; }
#modal.ending p { font-size: 18px; }

/* 온라인 */
#anim { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; background: #000e; }
#anim pre { width: min(420px, 90vw); min-height: 130px; color: var(--green); font-size: 18px; text-shadow: 0 0 10px #3dffa2; }
.chat { display: flex; flex-direction: column; gap: 8px; height: 100%; }
.chat-list { flex: 1; min-height: 0; overflow: auto; overflow-wrap: anywhere; }

/* 랭킹 */
.rank-name { display: inline-block; width: 22ch; overflow: hidden; white-space: nowrap; vertical-align: top; }
.rank-app { position: relative; display: flex; flex-direction: column; height: 100%; background: #000; color: #23b36f; font: 15px/1.6 Consolas, "Malgun Gothic", monospace; }
.rank-app::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(transparent 0 2px, #3dffa212 2px 3px); }
.rank-screen { flex: 1; min-height: 0; overflow: auto; padding: 10px 12px; }
.rank-bar { flex: none; padding: 6px 12px; text-align: right; border-top: 1px solid var(--line); }
.rank-row { display: grid; grid-template-columns: 6ch minmax(0, 1fr) 7ch 12ch 7ch; white-space: nowrap; }
.rank-row span { overflow: hidden; text-overflow: ellipsis; }
.rank-head { margin-top: 6px; border-bottom: 1px dashed #23b36f; }
.rank-top { color: #8dffcb; font-weight: bold; text-shadow: 0 0 8px #3dffa2; }
.rank-me { background: #3dffa220; }
.rank-cursor { animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }


/* 타이틀 */
#title-screen { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; overflow: hidden; background: #000; font-family: Consolas, "Malgun Gothic", monospace; }
#rain { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .75; }
#title-box { position: relative; padding: 28px 48px; text-align: center; background: radial-gradient(closest-side, #000e 60%, transparent); }
#title-logo { position: relative; margin: 0; font: bold clamp(42px, 10vw, 92px)/1.1 Consolas, monospace; letter-spacing: .12em; white-space: nowrap; text-shadow: 0 0 22px #3dffa2a0; animation: flicker 5s infinite; }
#title-logo::before, #title-logo::after { content: attr(data-text); position: absolute; inset: 0; opacity: 0; text-shadow: none; }
#title-logo::before { color: #ff4f8b; animation: glitch 4s steps(1) infinite; }
#title-logo::after { color: #4fd8ff; animation: glitch 4s steps(1) .12s infinite reverse; }
@keyframes flicker { 0%, 41%, 43%, 70%, 73%, 100% { opacity: 1; } 42% { opacity: .55; } 71% { opacity: .7; } }
@keyframes glitch {
  0%, 100% { opacity: 0; }
  46% { opacity: .7; transform: translateX(-5px); clip-path: inset(15% 0 60% 0); }
  48% { opacity: .7; transform: translateX(5px); clip-path: inset(62% 0 12% 0); }
  50% { opacity: 0; }
}
#title-line { min-height: 1.6em; margin: 14px 0 6px; color: var(--green); font-size: 18px; }
#title-menu { display: flex; flex-direction: column; align-items: center; }
#title-menu p { min-height: 1.6em; margin: 4px 0 8px; }
.title-item { min-width: 280px; padding: 5px 16px; text-align: left; white-space: pre; color: var(--green); background: none; border: none; border-radius: 0; font-size: 19px; }
.title-item::before { content: "> "; display: inline-block; width: 1.8em; }
.title-item.on { color: #000; background: var(--green); }
.title-item.on::before { content: "▶ "; }
#title-footer { position: absolute; bottom: 16px; color: var(--dim); text-shadow: 0 0 6px #000, 0 0 6px #000; }
#rank-overlay { position: fixed; inset: 0; z-index: 85; display: grid; place-items: center; background: #000c; }
.rank-overlay-box { display: flex; flex-direction: column; width: min(640px, 94vw); height: min(520px, 88vh); border: 1px solid var(--green); background: #000; }
.rank-overlay-bar { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 4px 12px; background: #14241f; }
.rank-overlay-body { flex: 1; min-height: 0; }
@media (prefers-reduced-motion: reduce) { #title-logo, #title-logo::before, #title-logo::after { animation: none; } }
