:root {
    --wall: #2e2622;
    --wall-2: #3a302a;
    --wall-line: #241d1a;
    --wood: #5b402e;
    --wood-2: #4a3325;
    --wood-dark: #2e2018;
    --paper: #e9dfc6;
    --paper-2: #ddd0b2;
    --paper-line: #c9b994;
    --ink: #2b2622;
    --ink-soft: #5d5246;
    --red-ink: #b0372b;
    --green-ink: #3f6e3c;
    --blue-ink: #2f4f7a;
    --crt: #0b1710;
    --crt-fg: #86e3a0;
    --crt-dim: #4f8a62;
    --sticky: #e3cb67;
    --pink: #e6b8ae;
    --hl: #f5d76e;
    --ui: 'Galmuri11', 'Apple SD Gothic Neo', sans-serif;
    --mono: 'GalmuriMono11', 'Galmuri11', ui-monospace, monospace;
    --big: 'Galmuri14', 'Galmuri11', sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    background: #0f0c0b;
    color: var(--ink);
    font-family: var(--ui);
    -webkit-font-smoothing: none;
    user-select: none;
}

button { font: inherit; cursor: pointer; }

#stage {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 1280px;
    height: 720px;
    transform-origin: 50% 50%;
    overflow: hidden;
    background: #000;
}

/* ───────── 위쪽 벽 ───────── */
#top {
    position: absolute;
    inset: 0 0 auto 0;
    height: 220px;
    background:
        repeating-linear-gradient(90deg, transparent 0 79px, var(--wall-line) 79px 80px),
        linear-gradient(var(--wall-2), var(--wall));
    border-bottom: 6px solid #1a1411;
}

#top::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 14px;
    background: linear-gradient(#20190f00, #00000055);
}

#door {
    position: absolute;
    left: 18px;
    top: 18px;
    width: 140px;
    height: 202px;
    background: #1d1714;
    padding: 8px 8px 0;
}

#door .leaf {
    position: relative;
    height: 100%;
    background: linear-gradient(90deg, #5a4a3e, #4b3d33);
    border: 3px solid #2a211c;
    border-bottom: 0;
    transition: transform 1.2s steps(8);
    transform-origin: left center;
}

#door .leaf::before {
    content: "";
    position: absolute;
    left: 24px;
    right: 24px;
    top: 22px;
    height: 46px;
    background: #1a2a2a;
    border: 3px solid #2a211c;
    box-shadow: inset 0 0 0 2px #2f4444;
}

#door .leaf::after {
    content: "";
    position: absolute;
    right: 12px;
    top: 104px;
    width: 14px;
    height: 6px;
    background: #b9a27a;
    box-shadow: 0 2px 0 #6b5a40;
}

#door.open .leaf { transform: perspective(300px) rotateY(-70deg); }

#door .plate {
    position: absolute;
    left: 50%;
    top: 84px;
    transform: translateX(-50%);
    font: 11px var(--mono);
    color: #d8c8a4;
    background: #2a211c;
    padding: 1px 6px;
    white-space: nowrap;
}

#door .lamp {
    position: absolute;
    left: 50%;
    top: -12px;
    width: 30px;
    height: 10px;
    transform: translateX(-50%);
    background: #3b1d1a;
    border: 2px solid #120d0c;
}

#door.locked .lamp { background: #ff4a3a; box-shadow: 0 0 18px 4px #ff3a2a88; animation: lamp 1s steps(1) infinite; }
#door.unlocked .lamp { background: #59e07a; box-shadow: 0 0 18px 4px #59e07a88; }

@keyframes lamp { 50% { background: #7a2018; box-shadow: none; } }
@keyframes blink { 50% { opacity: 0; } }

#intercom {
    position: absolute;
    left: 178px;
    top: 30px;
    width: 64px;
    height: 104px;
    background: #8d8576;
    border: 3px solid #1b1714;
    box-shadow: 4px 4px 0 #0005;
}

#intercom .grill {
    position: absolute;
    inset: 10px 10px 34px;
    background: repeating-linear-gradient(#2c2824 0 3px, #8d8576 3px 6px);
}

#intercom .led {
    position: absolute;
    left: 50%;
    bottom: 12px;
    width: 10px;
    height: 10px;
    transform: translateX(-50%);
    background: #3a2f2a;
    border: 2px solid #1b1714;
}

#intercom.on .led { background: #6cf08a; box-shadow: 0 0 8px #6cf08a; }
#intercom.talk .led { animation: talk .25s steps(1) infinite; }
#intercom.dead .led { background: #2a2420; }

@keyframes talk { 50% { background: #2f6a3d; box-shadow: none; } }

#intercom span {
    position: absolute;
    left: 0;
    right: 0;
    top: 110px;
    text-align: center;
    font-size: 11px;
    color: #a99b85;
}

/* 대사창 */
#dialog {
    position: absolute;
    left: 258px;
    top: 16px;
    width: 500px;
    height: 188px;
    background: #15110f;
    border: 3px solid #0b0908;
    box-shadow: inset 0 0 0 2px #3b322b;
    padding: 12px 16px;
    color: #eadfc8;
    cursor: pointer;
}

#dialog .who {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 24px;
    font-size: 13px;
    color: #c9b79a;
}

#dialog .face {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    font-style: normal;
    font-size: 11px;
    color: #15110f;
    background: #8d8576;
}

#dialog .text {
    margin-top: 8px;
    font-size: 16px;
    line-height: 26px;
    white-space: pre-wrap;
    height: 110px;
    overflow: hidden;
}

#dialog .more {
    position: absolute;
    right: 14px;
    bottom: 8px;
    font-size: 12px;
    color: #c9b79a;
    animation: blink 1s steps(1) infinite;
}

#dialog.idle { cursor: default; }
#dialog.idle .more { display: none; }
#dialog.think .text { color: #b8ab95; font-style: italic; }

.face.arc { background: #86e3a0 !important; }
.face.baek { background: #e39a5e !important; }
.face.do { background: #8fc6ee !important; }
.face.yoon { background: #c6a8f0 !important; }
.face.kim { background: #f0d79a !important; }
.face.me { background: #d8cdb8 !important; }

/* 평면도 */
#map {
    position: absolute;
    left: 776px;
    top: 16px;
    width: 304px;
    height: 188px;
    background: #0d1714;
    border: 3px solid #0b0908;
    box-shadow: inset 0 0 0 2px #24342e;
    color: #7fc7a0;
    font-family: var(--mono);
}

#map .label {
    position: absolute;
    left: 10px;
    top: 6px;
    font-size: 11px;
    color: #5f9a7c;
}

#map svg {
    position: absolute;
    left: 2px;
    top: 22px;
    width: 300px;
    height: 160px;
    shape-rendering: crispEdges;
}

#map text { font: 10px 'Galmuri9', var(--ui); fill: #5f9a7c; }
#map .floor { fill: #13221c; stroke: #2a4a3c; stroke-width: 1; }
#map .path { fill: none; stroke: #2a4a3c; stroke-width: 2; stroke-dasharray: 3 3; }
#map .gate { fill: #ff5a48; }
#map .gate.open { fill: #39574a; }
#map .you { fill: #f5d76e; }
#map .dot { fill: #ff7a5a; }
#map .guard { fill: #8fc6ee; }
#map .b7 { fill: #3a1d1a; stroke: #ff5a48; stroke-width: 1; }
#map .tag { font-size: 10px; fill: #ffb08a; }

/* 시계 */
#clockbox {
    position: absolute;
    left: 1096px;
    top: 16px;
    width: 168px;
    height: 188px;
    background: #15110f;
    border: 3px solid #0b0908;
    box-shadow: inset 0 0 0 2px #3b322b;
    text-align: center;
    color: #c9b79a;
    padding-top: 12px;
}

#clockbox .date { font-size: 12px; }

#clock {
    font: 44px/1.1 var(--mono);
    color: #ff7a5a;
    text-shadow: 0 0 10px #ff5a3a66;
    margin: 6px 0 2px;
    letter-spacing: 1px;
}

#clockbox .sub { font-size: 12px; color: #9b8d76; min-height: 18px; }

#clockbox .pen {
    font-size: 12px;
    color: #ff7a5a;
    height: 16px;
}

.cbtns { display: flex; gap: 4px; justify-content: center; margin-top: 4px; }

#menuBtn, #mute {
    background: #2a231f;
    border: 2px solid #0b0908;
    color: #c9b79a;
    font-size: 11px;
    padding: 3px 8px;
}

/* ───────── 책상 ───────── */
#desk {
    position: absolute;
    left: 0;
    top: 220px;
    width: 1280px;
    height: 500px;
    overflow: hidden;
    background:
        repeating-linear-gradient(0deg, transparent 0 22px, #00000014 22px 24px),
        linear-gradient(90deg, var(--wood-2), var(--wood) 40%, var(--wood-2));
}

#lamp {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse 60% 70% at 58% 30%, #ffd9a022, transparent 70%);
    z-index: 1;
}

/* ARC 모니터 */
#monitor {
    position: absolute;
    left: 14px;
    top: 14px;
    width: 292px;
    height: 186px;
    background: #8c8577;
    border: 3px solid #1b1714;
    padding: 10px;
    box-shadow: 6px 6px 0 #0006;
    z-index: 2;
}

#monitor .screen {
    height: 120px;
    background: var(--crt);
    border: 3px solid #1b1714;
    padding: 6px 8px;
    font: 12px/18px var(--mono);
    color: var(--crt-fg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

#monitor .screen::after {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(#0000 0 2px, #0003 2px 3px);
    pointer-events: none;
}

#monitor .head { color: var(--crt-dim); border-bottom: 1px dashed #24442f; margin-bottom: 4px; }

#log {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: none;
    white-space: pre-wrap;
    user-select: text;
}

#log::-webkit-scrollbar { display: none; }
#log .do { color: #8fc6ee; }
#log .warn { color: #ff8a70; }
#log .me { color: #b9c2a8; }

#help {
    margin-top: 8px;
    width: 100%;
    background: #2e2a24;
    border: 2px solid #1b1714;
    color: #e9dfc6;
    padding: 6px;
    font-size: 13px;
}

#help:hover:not(:disabled) { background: #3d372f; }
#help:disabled { opacity: .45; cursor: not-allowed; }

/* 업무 지시 */
#task {
    position: absolute;
    left: 22px;
    top: 214px;
    width: 280px;
    min-height: 180px;
    background: var(--sticky);
    padding: 14px 16px;
    transform: rotate(-1.5deg);
    box-shadow: 5px 6px 0 #0005;
    z-index: 2;
    font-size: 13px;
    line-height: 20px;
}

#task b { display: block; font-size: 14px; margin-bottom: 6px; border-bottom: 2px solid #b39a3a; padding-bottom: 4px; }
#task ul { list-style: none; margin: 0; padding: 0; }
#task li { padding-left: 20px; position: relative; margin-bottom: 6px; }
#task li::before { content: "□"; position: absolute; left: 0; }
#task li.done { color: #7a6a2a; text-decoration: line-through; }
#task li.done::before { content: "■"; color: var(--green-ink); }

/* 서류 공통 */
#docs { position: absolute; inset: 0; z-index: 3; }

.doc {
    position: absolute;
    background: var(--paper);
    color: var(--ink);
    padding: 14px 16px;
    font-size: 13px;
    line-height: 20px;
    box-shadow: 0 0 0 1px #00000030, 6px 7px 0 #0000004d;
    cursor: grab;
    animation: drop .28s steps(4);
}

.doc.dragging { cursor: grabbing; box-shadow: 0 0 0 1px #00000030, 12px 14px 0 #00000040; }

@keyframes drop {
    from { transform: translateY(-30px) scale(1.04); opacity: 0; }
}

.doc.leaving { transition: transform .4s steps(5), opacity .4s steps(5); transform: translateX(900px) rotate(6deg); opacity: 0; }

.doc h3 {
    margin: 0 0 8px;
    font: 15px var(--big);
    text-align: center;
    letter-spacing: 3px;
    border-bottom: 2px solid var(--ink);
    padding-bottom: 6px;
}

.doc .meta { font-size: 11px; color: var(--ink-soft); }
.doc .tag {
    position: absolute;
    top: -10px;
    left: 10px;
    background: var(--ink);
    color: var(--paper);
    font-size: 11px;
    padding: 0 6px;
}

.doc table { border-collapse: collapse; width: 100%; font-size: 12px; }
.doc td, .doc th { border: 1px solid var(--paper-line); padding: 3px 6px; text-align: left; }
.doc th { background: var(--paper-2); font-weight: 400; }

.doc.lined { background: repeating-linear-gradient(var(--paper) 0 19px, #c8d4e0 19px 20px); background-position: 0 6px; }
.doc.print { background: #e4e7dc; font-family: var(--mono); font-size: 12px; border-left: 10px dotted #cfd3c6; border-right: 10px dotted #cfd3c6; }
.doc.yellow { background: #efe28c; }
.doc.photo { background: #f3efe6; padding: 10px 10px 12px; }
.doc.card { background: #dfe5ea; padding: 10px 12px; }
.doc.cite { background: var(--pink); font-size: 12px; transform: rotate(2deg); pointer-events: none; }
.doc.book { background: #e8dcc0; border-left: 14px solid #6a2a24; }
.doc.form { background: #eef0e8; }

.seal {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 2px solid var(--red-ink);
    border-radius: 50%;
    color: var(--red-ink);
    font-size: 11px;
    transform: rotate(-12deg);
    vertical-align: middle;
}

/* 단서 */
.clue { padding: 0 1px; }
body.inspect .clue { outline: 2px dashed #b48a1e; outline-offset: 1px; background: #f5d76e40; cursor: crosshair; }
body.inspect .clue:hover { background: #f5d76e99; }
.clue.sel { outline: 2px solid var(--red-ink) !important; background: #f5d76ecc !important; }
.clue.found { background: #f0a39a66; box-shadow: inset 0 -2px 0 var(--red-ink); }

body.inspect #desk::before {
    content: "";
    position: absolute;
    inset: 0;
    background: #0b1a2a55;
    z-index: 3;
    pointer-events: none;
}

body.inspect .doc { cursor: default; }

#lines { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 6; pointer-events: none; }
#lines line { stroke-width: 3; stroke-dasharray: 8 4; }
#lines line.ok { stroke: #3fae4f; }
#lines line.no { stroke: var(--red-ink); }
#lines text { font: 14px var(--big); paint-order: stroke; stroke: #000; stroke-width: 3px; }

/* 수집 단어 */
.term { border-bottom: 2px dotted var(--blue-ink); color: var(--blue-ink); cursor: pointer; }
.term.got { border-bottom-style: solid; background: #2f4f7a22; }

/* 대조 버튼 */
#inspectBtn {
    position: absolute;
    right: 18px;
    bottom: 18px;
    width: 96px;
    height: 84px;
    background: #2c2621;
    border: 3px solid #120e0c;
    color: #e9dfc6;
    font-size: 12px;
    box-shadow: 4px 4px 0 #0007;
    z-index: 8;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

#inspectBtn svg { width: 36px; height: 36px; shape-rendering: crispEdges; }
#inspectBtn.on { background: #b48a1e; color: #1b1510; }
#inspectBtn:disabled { opacity: .4; cursor: not-allowed; }

/* 도장 서랍 */
#drawer {
    position: absolute;
    right: -150px;
    top: 120px;
    width: 140px;
    background: #3a2a1f;
    border: 3px solid #120e0c;
    border-right: 0;
    padding: 10px;
    z-index: 7;
    transition: right .3s steps(5);
    box-shadow: -4px 4px 0 #0006;
}

#drawer.open { right: 0; }
#drawer .handle { color: #d8c8a4; font-size: 12px; margin-bottom: 8px; text-align: center; }

.stampbtn {
    display: block;
    width: 100%;
    height: 84px;
    margin-bottom: 8px;
    padding: 0;
    background: #24170f;
    border: 3px solid #120b07;
    box-shadow: inset 0 4px 0 #0008;
    position: relative;
}

.stampbtn .stampTop { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -54%) scale(.9); }
.stampbtn:hover .stampTop { transform: translate(-50%, -58%) scale(.92); }
.stampbtn.held .stampTop { opacity: .18; }
.stampbtn.held::after { content: "사용 중"; position: absolute; left: 0; right: 0; bottom: 4px; font-size: 11px; color: #a8957a; }

/* 위에서 내려다본 도장 */
.stampTop { display: block; position: relative; width: 112px; height: 62px; }
.stampTop .rubber { position: absolute; left: 3px; right: 3px; bottom: -5px; height: 9px; background: #8a2a20; border: 2px solid #1a0f0a; }
.stampTop .base {
    position: absolute;
    inset: 0;
    background: linear-gradient(#8a5e3c, #6b4529 60%, #563620);
    border: 3px solid #1a0f0a;
    box-shadow: inset 0 3px 0 #b07e52, inset 0 -5px 0 #3e2616;
}
.stampTop .knob {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 46px;
    height: 46px;
    transform: translate(-50%, -56%);
    border-radius: 50%;
    background: radial-gradient(circle at 36% 30%, #e0b484 0 12%, #a8703f 30%, #74451f 62%, #3e2410 100%);
    border: 3px solid #1a0f0a;
    box-shadow: 0 5px 0 #0007;
}
.stampTop .label {
    position: absolute;
    left: 5px;
    bottom: 5px;
    padding: 0 3px;
    background: #e9dfc6;
    border: 1px solid #1a0f0a;
    font: 11px var(--big);
    color: #1a0f0a;
    letter-spacing: 1px;
    line-height: 14px;
}

#ghost {
    position: absolute;
    z-index: 30;
    pointer-events: none;
    display: none;
    transform: translate(-50%, -50%);
    filter: drop-shadow(16px 22px 0 #0006);
}

.stampFx {
    position: absolute;
    z-index: 30;
    pointer-events: none;
    transform: translate(-50%, -50%);
    animation: stampFx .62s steps(9) forwards;
}

@keyframes stampFx {
    0% { transform: translate(-50%, -50%) scale(1.06); filter: drop-shadow(16px 22px 0 #0006); }
    22% { transform: translate(-50%, -50%) scale(.92); filter: drop-shadow(2px 3px 0 #0008); }
    40% { transform: translate(-50%, -50%) scale(.92); filter: drop-shadow(2px 3px 0 #0008); opacity: 1; }
    100% { transform: translate(-50%, -120%) scale(1.3); filter: drop-shadow(30px 40px 0 #0000); opacity: 0; }
}

.ink {
    position: absolute;
    transform: translate(-50%, -50%) rotate(var(--r, -6deg));
    border: 3px solid currentColor;
    box-shadow: inset 0 0 0 2px #0000, inset 0 0 0 3px currentColor;
    padding: 4px 12px;
    font: 22px var(--big);
    text-shadow: 1px 0 currentColor, 0 1px currentColor;
    letter-spacing: 5px;
    color: var(--red-ink);
    opacity: .92;
    filter: url(#inkrough);
    animation: inkin .25s steps(2);
    pointer-events: none;
    white-space: nowrap;
    mix-blend-mode: multiply;
}

.ink.green { color: var(--green-ink); }
.ink.blue { color: var(--blue-ink); }



body.holding #desk { cursor: crosshair; }
body.holding .doc { cursor: crosshair; }

/* 배너 */
#banner {
    position: absolute;
    left: 50%;
    top: 40%;
    transform: translate(-50%, -50%) rotate(-3deg);
    z-index: 20;
    font: 34px var(--big);
    color: var(--green-ink);
    border: 6px solid currentColor;
    padding: 8px 28px;
    background: #e9dfc6ee;
    letter-spacing: 6px;
    display: none;
    pointer-events: none;
}

#banner.show { display: block; animation: slam .3s steps(3); }

@keyframes slam { from { transform: translate(-50%, -50%) rotate(-3deg) scale(1.8); opacity: 0; } }

/* 작업 서류 내부 요소 */
.grid { width: 100%; border-collapse: collapse; margin-top: 6px; }
.grid th, .grid td { border: 1px solid var(--paper-line); text-align: center; padding: 3px; font-size: 12px; }
.grid td.cell { cursor: pointer; width: 54px; height: 26px; }
.grid td.cell:hover { background: #f5d76e55; }
.grid td.cell.t { color: var(--green-ink); }
.grid td.cell.f { color: var(--red-ink); }
.grid td.count { font-family: var(--mono); }
.grid td.count.one { background: #3f6e3c22; color: var(--green-ink); }

.kb { display: grid; gap: 4px; margin-top: 6px; }
.kb .row { display: flex; gap: 4px; }
.kb .row:nth-child(2) { padding-left: 16px; }
.kb .row:nth-child(3) { padding-left: 36px; }

.key {
    width: 40px;
    height: 40px;
    background: #f6f1e4;
    border: 2px solid #8b7f68;
    box-shadow: 0 3px 0 #8b7f68;
    position: relative;
    font-size: 16px;
    padding-top: 12px;
    text-align: center;
    color: var(--ink);
}

.key i { position: absolute; left: 3px; top: 0; font: 11px var(--mono); font-style: normal; color: var(--blue-ink); }
.key:hover { background: #fff8d8; }
.key:active, .key.press { transform: translateY(2px); box-shadow: 0 1px 0 #8b7f68; background: #fff3c8; }
.key.wide { width: 84px; font-size: 13px; padding-top: 0; }

.slots { display: flex; gap: 4px; align-items: flex-end; margin: 8px 0; }
.slot { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.slot .c { font: 14px var(--mono); color: var(--ink-soft); }
.slot button {
    width: 34px;
    height: 38px;
    background: #fff;
    border: 2px solid #8b7f68;
    font-size: 18px;
    color: var(--ink);
    padding: 0;
}
.slot button.sel { border-color: var(--red-ink); background: #fff3c8; }
.slot button.bad { border-color: var(--red-ink); color: var(--red-ink); }
.slot.space { width: 18px; }

.preview {
    margin-top: 4px;
    font: 22px var(--big);
    letter-spacing: 4px;
    min-height: 32px;
    border-bottom: 2px solid var(--ink);
    padding: 0 4px;
}

.btnrow { display: flex; gap: 8px; margin-top: 10px; justify-content: flex-end; }

.pbtn {
    background: var(--ink);
    color: var(--paper);
    border: 0;
    padding: 6px 14px;
    font-size: 13px;
    box-shadow: 0 3px 0 #000;
}

.pbtn.ghost { background: transparent; color: var(--ink); border: 2px solid var(--ink); box-shadow: none; }
.pbtn:active { transform: translateY(2px); box-shadow: 0 1px 0 #000; }

.sentence { font-size: 14px; line-height: 32px; word-break: keep-all; }

.blank {
    display: inline-block;
    min-width: 84px;
    height: 26px;
    margin: 0 4px;
    padding: 0 8px;
    vertical-align: middle;
    line-height: 20px;
    border: 2px dashed #9aa3b5;
    background: #f3f0e6;
    color: var(--blue-ink);
    font-size: 14px;
    cursor: default;
}

.blank:empty::before { content: "\00a0"; }
.blank[data-v]:not([data-v=""]) {
    border: 1px solid var(--blue-ink);
    background: #fbf6e6;
    box-shadow: 2px 2px 0 #0003;
    cursor: grab;
}
.blank.bad { border-color: var(--red-ink) !important; background: #f0a39a44 !important; }
.blank.ok { border-color: var(--green-ink) !important; color: var(--green-ink); }

.bank { flex: 1; font-size: 12px; color: var(--ink-soft); line-height: 22px; }
.foot { display: flex; gap: 10px; align-items: flex-end; margin-top: 8px; padding-top: 6px; border-top: 1px dashed var(--paper-line); }
.foot .btnrow { margin-top: 0; }
.chip {
    display: inline-block;
    margin: 3px 4px 0 0;
    padding: 1px 8px;
    background: #fbf6e6;
    border: 1px solid var(--blue-ink);
    box-shadow: 2px 2px 0 #0003;
    color: var(--blue-ink);
    cursor: grab;
    touch-action: none;
}
.chip:hover { background: #fff3c8; }
.chip.used { opacity: .35; box-shadow: none; }

.chipfly {
    position: absolute;
    z-index: 33;
    transform: translate(-50%, -60%) rotate(-3deg);
    padding: 2px 10px;
    background: #fbf6e6;
    border: 2px solid var(--blue-ink);
    color: var(--blue-ink);
    font-size: 14px;
    box-shadow: 6px 8px 0 #0005;
    pointer-events: none;
}

.blank.hover { background: #f5d76e88; outline: 2px dashed var(--blue-ink); }

.diff del { color: var(--red-ink); }
.diff ins { color: var(--green-ink); text-decoration: none; background: #3f6e3c22; }

/* ───────── 오버레이 ───────── */
#overlay {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: none;
    background: #0d0a09;
    color: #e9dfc6;
    text-align: center;
}

#overlay.show { display: flex; flex-direction: column; align-items: center; justify-content: center; }

.title-logo {
    font: 120px/1 var(--big);
    letter-spacing: 18px;
    color: #e9dfc6;
    text-shadow: 6px 6px 0 #6a2a24;
    margin-right: -18px;
}

.title-sub { font: 16px var(--mono); letter-spacing: 8px; color: #9b8d76; margin-top: 18px; }
.title-tag { font-size: 14px; color: #c9b79a; margin-top: 30px; line-height: 24px; }

.menu { display: flex; flex-direction: column; gap: 10px; margin-top: 36px; min-width: 260px; }

.mbtn {
    background: #2a221e;
    border: 3px solid #4a3b33;
    color: #e9dfc6;
    padding: 12px 20px;
    font-size: 16px;
    box-shadow: 0 4px 0 #000;
}

.mbtn:hover { background: #3a2f29; border-color: #8a6a50; }
.mbtn.primary { background: #6a2a24; border-color: #9a4a3a; }
.mbtn.primary:hover { background: #803328; }

.small-note { margin-top: 26px; font-size: 12px; color: #6f6455; line-height: 20px; }

.card-day { font: 18px/2 var(--mono); color: #c9b79a; }
.card-day b { display: block; font: 46px var(--big); color: #e9dfc6; letter-spacing: 4px; margin-bottom: 8px; }
.card-hint { margin-top: 40px; font-size: 13px; color: #6f6455; animation: blink 1.4s steps(1) infinite; }

.report {
    width: 560px;
    background: var(--paper);
    color: var(--ink);
    padding: 24px 32px;
    text-align: left;
    box-shadow: 10px 10px 0 #000;
    font-size: 14px;
    line-height: 24px;
}

.report h2 { margin: 0 0 10px; font: 22px var(--big); text-align: center; letter-spacing: 6px; border-bottom: 3px double var(--ink); padding-bottom: 8px; }
.report table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.report td { padding: 4px 6px; border-bottom: 1px dashed var(--paper-line); }
.report td:last-child { text-align: right; font-family: var(--mono); }
.report .grade { text-align: center; margin: 12px 0 4px; }
.report .grade b { display: inline-block; font: 54px var(--big); color: var(--red-ink); border: 5px solid currentColor; padding: 0 18px; transform: rotate(-6deg); }
.report .teaser { margin-top: 12px; font-size: 13px; color: var(--red-ink); white-space: pre-wrap; }

.bad-text { font-size: 18px; line-height: 34px; color: #c9b79a; white-space: pre-wrap; }
.bad-text b { display: block; font: 40px var(--big); color: #ff6a50; margin-bottom: 20px; letter-spacing: 6px; }

/* 소형 화면 차단 */
#small {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    place-items: center;
    background: #0d0a09;
    color: #e9dfc6;
    text-align: center;
    padding: 24px;
    font-size: 15px;
    line-height: 28px;
}

#small b { display: block; font: 48px var(--big); letter-spacing: 10px; margin-bottom: 18px; }

@media (max-width: 899px), (hover: none) and (pointer: coarse) {
    #small { display: grid; }
}

.lrow { display: grid; grid-template-columns: 46px 1fr; gap: 8px; padding: 3px 0; border-bottom: 1px dashed #c3c7b8; }
.lrow b { font-weight: 400; color: var(--ink-soft); }
.law { margin-top: 4px; line-height: 19px; }
#report .sentence { font-size: 13px; line-height: 30px; }
#report h3 { margin-bottom: 4px; }

#menuBtn { color: #f0e2c4; background: #4a3a30; }
#menuBtn:hover, #mute:hover { background: #5a483c; }

/* 대사 대기 */
#dialog.wait { box-shadow: inset 0 0 0 2px #3b322b, 0 0 0 3px #f5d76e; animation: waitglow 1.2s steps(2) infinite; }
@keyframes waitglow { 50% { box-shadow: inset 0 0 0 2px #3b322b, 0 0 0 3px #f5d76e55; } }
#dialog.wait .more { color: #f5d76e; font-size: 13px; }

/* 업무 완료 */
#taskFoot { white-space: pre-wrap; margin-top: 8px; font-size: 12px; line-height: 18px; color: var(--green-ink); }
#task .doneStamp {
    position: absolute;
    right: 10px;
    top: 6px;
    font: 22px var(--big);
    letter-spacing: 4px;
    color: var(--green-ink);
    border: 3px solid currentColor;
    padding: 0 8px;
    transform: rotate(-12deg);
    opacity: 0;
    mix-blend-mode: multiply;
}
#task.complete .doneStamp { opacity: .9; animation: slam .3s steps(3); }

/* 메뉴 */
#menu {
    position: absolute;
    inset: 0;
    z-index: 50;
    display: none;
    place-items: center;
    background: #0d0a09dd;
}
#menu.show { display: grid; }
.menu-card {
    width: 460px;
    background: #1a1512;
    border: 3px solid #4a3b33;
    box-shadow: 8px 8px 0 #000;
    padding: 28px 32px;
    text-align: center;
    color: #e9dfc6;
}
.menu-title { font: 30px var(--big); letter-spacing: 8px; }
.menu-where { margin-top: 6px; font: 14px var(--mono); color: #9b8d76; }
.menu-card .menu { margin-top: 20px; }
.howto { margin-top: 16px; text-align: left; font-size: 13px; line-height: 22px; color: #c9b79a; border-top: 1px dashed #4a3b33; padding-top: 12px; }

.hide { display: none !important; }

@keyframes inkin { from { opacity: 1; filter: none; } }

/* 숨김과 등장 */
.off { visibility: hidden !important; opacity: 0 !important; }
.flick { animation: flick .55s steps(1); }
@keyframes flick { 0% { opacity: 0; } 20% { opacity: 1; } 35% { opacity: .15; } 55% { opacity: 1; } 70% { opacity: .4; } 100% { opacity: 1; } }

/* 안내 말풍선 */
.coach {
    position: absolute;
    z-index: 35;
    max-width: 250px;
    padding: 7px 11px;
    background: #f5d76e;
    color: #1b1510;
    border: 2px solid #1b1510;
    box-shadow: 3px 3px 0 #000a;
    font-size: 13px;
    line-height: 19px;
    white-space: pre-wrap;
    pointer-events: none;
    animation: bob 1s steps(2) infinite;
}
.coach::after {
    content: "";
    position: absolute;
    width: 0;
    height: 0;
    border: 8px solid transparent;
}
.coach.top::after { left: 50%; top: 100%; margin-left: -8px; border-top-color: #1b1510; }
.coach.bottom::after { left: 50%; bottom: 100%; margin-left: -8px; border-bottom-color: #1b1510; }
.coach.left::after { top: 50%; left: 100%; margin-top: -8px; border-left-color: #1b1510; }
.coach.right::after { top: 50%; right: 100%; margin-top: -8px; border-right-color: #1b1510; }
@keyframes bob { 50% { translate: 0 -3px; } }

#toast {
    position: absolute;
    left: 50%;
    bottom: 24px;
    z-index: 34;
    transform: translateX(-50%);
    background: #2a1512;
    color: #ffb4a8;
    border: 2px solid #6a2a24;
    padding: 8px 16px;
    font-size: 14px;
    display: none;
    box-shadow: 4px 4px 0 #000a;
}
#toast.show { display: block; }

/* 지금 써야 할 도구: 대사창 대기 표시와 같은 노란 테두리 */
.attn { outline: 3px solid #f5d76e; outline-offset: 2px; animation: attn 1.2s steps(2) infinite; }
@keyframes attn { 50% { outline-color: #f5d76e55; } }
