/* 초코블록 화면. ui.css · type.css 다음에 붙는다. */
:root {
  --ink: #2B211C;
  --muted: #6B625C;
  --line: #E6E1DC;
  --site: #FFF3DF; --site-ink: #E0702A;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; color: var(--ink); background: #FBF8F4; background-image: none;
  font-family: 'Pretendard Variable', Pretendard, 'Malgun Gothic', sans-serif; font-size: 16px;
  display: flex; flex-direction: column; overflow: hidden;
}
button { font: inherit; cursor: pointer; }

/* 머리 */
.bar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: #fff; border-bottom: 1px solid var(--line); flex: none; }
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); margin-right: 8px; }
.logo img { width: 34px; height: 34px; }
.logo b { font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.logo span { font-size: 13px; color: var(--muted); }
.go, .stopbtn { border: 2.5px solid var(--ink); border-radius: 999px; padding: 7px 20px; font-weight: 800; font-size: 16px; box-shadow: 0 3px 0 var(--ink); }
.go { background: #2FA84F; color: #fff; }
.go:disabled { background: #BFC7BF; box-shadow: none; cursor: wait; }
.stopbtn { background: #EF5350; color: #fff; }
.go:active, .stopbtn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.status { font-size: 14px; color: var(--muted); }
.spacer { flex: 1; }
.ghostbtn { background: #fff; border: 1.5px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 14px; color: var(--ink); }
.ghostbtn.sm { padding: 3px 10px; font-size: 13px; }
.ghostbtn:hover { border-color: var(--ink); }

/* 본문: 왼쪽 무대 · 오른쪽 블록판 */
.app { flex: 1; display: grid; grid-template-columns: minmax(300px, 420px) 1fr; min-height: 0; }
.left { padding: 14px; display: flex; flex-direction: column; gap: 12px; overflow: auto; border-right: 1px solid var(--line); }
.stage-wrap { position: relative; border: 2.5px solid var(--ink); border-radius: 16px; overflow: hidden; background: #fff; flex: none; }
#stage { display: block; width: 100%; aspect-ratio: 4 / 3; touch-action: none; }
.ask { position: absolute; left: 8px; right: 8px; bottom: 8px; background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 8px 10px; }
.ask p { margin: 0 0 6px; font-weight: 700; font-size: 15px; }
.ask form { display: flex; gap: 6px; }
.ask input { flex: 1; min-width: 0; border: 1.5px solid var(--line); border-radius: 10px; padding: 6px 10px; font-size: 16px; }
.ask button { border: 0; border-radius: 10px; background: #E457DC; color: #fff; font-weight: 700; padding: 6px 14px; }
.ask .yn { display: flex; gap: 8px; }
.ask .yn button { flex: 1; padding: 8px; font-size: 16px; }
.ask .yn button + button { background: #6B625C; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.objs { display: flex; flex-wrap: wrap; gap: 8px; }
.obj { position: relative; width: 84px; border: 2px solid var(--line); border-radius: 12px; padding: 4px 4px 2px; text-align: center; background: #fff; cursor: pointer; }
.obj.on { border-color: var(--site-ink); background: #FFF6EA; }
.obj canvas { width: 72px; height: 54px; display: block; margin: 0 auto; }
.obj span { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.obj .x { position: absolute; top: -8px; right: -8px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: #EF5350; color: #fff; font-size: 12px; line-height: 20px; padding: 0; display: none; }
.obj:hover .x { display: block; }
.bgpick { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 14px; color: var(--muted); }
.bgpick select { border: 1.5px solid var(--line); border-radius: 8px; padding: 3px 6px; }
.tip { font-size: 13px; color: var(--muted); margin: 8px 0 0; line-height: 1.5; }

.right { display: grid; grid-template-columns: 76px 300px 1fr; min-height: 0; }
.cats { display: flex; flex-direction: column; gap: 4px; padding: 10px 6px; background: #fff; border-right: 1px solid var(--line); overflow: auto; }
.cat { border: 0; background: none; padding: 8px 2px; border-radius: 10px; font-size: 13px; font-weight: 700; color: var(--ink); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.cat::before { content: ''; width: 20px; height: 20px; border-radius: 50%; background: var(--c); border: 2px solid var(--ink); }
.cat.on { background: #F4EDE4; }
.pal { overflow: auto; padding: 10px 12px 40px; background: #fff; border-right: 1px solid var(--line); }
.pal-title { font-weight: 800; font-size: 18px; margin: 2px 0 8px; }
.pal-row { margin: 0 0 12px; }
.pal-btn { width: 100%; border: 2px dashed #E457DC; background: #FFF4FE; border-radius: 12px; padding: 7px; font-weight: 700; margin-bottom: 12px; }
.pal-empty { font-size: 14px; color: var(--muted); line-height: 1.55; }
.pal input, .pal select { pointer-events: none; }
.pal .b { cursor: grab; }
.ws { overflow: auto; background: #F7F8FA; background-image: radial-gradient(#D7DCE4 1.3px, transparent 1.3px); background-size: 20px 20px; position: relative; }
.ws-canvas { position: relative; width: 2400px; height: 1800px; }
.ws-empty { position: absolute; left: 30px; top: 30px; color: var(--muted); }
.script { position: absolute; }
.script .b, .ghost .b { cursor: grab; }

/* 젤리 (기본 젤리): 둥근 캡슐 + 짙은 외곽선 + 흰 스티커 테두리 + 위가 밝은 색 + 반짝이 */
.list { display: flex; flex-direction: column; align-items: flex-start; }
.blk, .rep {
  --code: Consolas, 'D2Coding', 'Cascadia Mono', 'Pretendard Variable', Pretendard, monospace;
  position: relative; align-items: center; width: max-content; white-space: nowrap; user-select: none;
  color: #fff; font-family: var(--code); font-weight: 700; text-shadow: 0 1px 0 rgba(43,33,28,.35);
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 55%, #fff) 0%, var(--c) 58%, color-mix(in srgb, var(--c) 85%, #2B211C) 100%);
  border: 2.5px solid #2B211C; border-radius: 999px;
  box-shadow: 0 0 0 3px #fff, 0 4px 0 3px rgba(43,33,28,.18);
}
.blk::before, .rep::before {                   /* 반짝이 */
  content: ''; position: absolute; left: 10px; top: 3px; width: 34%; max-width: 70px; height: 5px;
  border-radius: 999px; background: rgba(255,255,255,.6); pointer-events: none;
}
.blk { display: flex; gap: 5px; font-size: 15px; padding: 6px 14px; margin: 7px 0; }
.blk.hat { border-radius: 26px 26px 18px 18px; padding: 10px 16px 7px; font-family: inherit; }
.blk.word { background: none; border: 0; box-shadow: none; padding: 0; margin: 0 0 0 -8px; text-shadow: none; display: flex; gap: 4px; }
.blk.word::before { display: none; }
.blk.word > .in, .blk.word > .rep, .blk.word > .hole, .blk.word > .pick { margin-top: 4px; }
.blk.word > .in { border: 2.5px solid var(--ink); }
.blk.unknown { --c: #9A9087; }
.rep { display: inline-flex; gap: 4px; font-size: 14px; padding: 2px 10px; margin: 2px 3px; box-shadow: 0 0 0 2.5px #fff, 0 2px 0 2.5px rgba(43,33,28,.15); }
.rep::before { top: 2px; height: 4px; }
.rep.cond { border-radius: 8px; padding: 2px 12px; }  /* 조건 젤리: 덜 둥근 모서리 */
.t { pointer-events: none; }
.q { color: rgba(255,255,255,.9); font-family: var(--code); font-weight: 800; margin: 0 -3px; pointer-events: none; }
.sel { outline: 3px dashed #FFB800; outline-offset: 5px; }
.in { border: 0; border-radius: 999px; background: #fff; color: var(--ink); font: inherit; font-weight: 700; font-size: 14px;
      padding: 2px 6px; text-align: center; min-width: 1.6em; outline: none; }
.in:focus { box-shadow: 0 0 0 2px var(--ink); }
.pick { border: 0; border-radius: 999px; background: rgba(255,255,255,.95); color: var(--ink); font: inherit; font-weight: 700; font-size: 14px; padding: 2px 4px; }
.hole { display: inline-block; width: 46px; height: 24px; background: rgba(0,0,0,.18);
        clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 10px 100%, 0 50%); }
.slot-hot { outline: 3px solid #FFD400; outline-offset: 1px; background: #FFF6B8 !important; }

/* 글자 블록 (입): 낱말 첫 글자 줄기가 등뼈·아래턱 (letters.js 가 그림) */
.jaw { position: relative; width: max-content; padding-right: 30px; margin: 2px 0; --c: transparent; }
.jaw > svg.art { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; z-index: 0; }
.jaw > .head, .jaw > .inside, .jaw > .foot { position: relative; z-index: 1; }
.jaw > .head { display: flex; align-items: center; gap: 5px; }
.jaw > .head > .wsp { flex: none; }
.jaw > .head.mid > .wsp { margin-left: var(--spine); }
.jaw > .head > .t { color: var(--ink); font-weight: 800; font-size: 15px; margin-top: 8px; }
.jaw > .head > .in, .jaw > .head > .pick, .jaw > .head > .hole, .jaw > .head > .rep { margin-top: 8px; }
.jaw > .head > .in { border: 2.5px solid var(--ink); }
.jaw > .head > .hole { background: #E9E1D7; }
.jaw > .head .colon { margin: 6px 0 0 -10px; display: inline-flex; }
.jaw > .inside { padding: 0 0 2px calc(var(--spine) + 10px); min-height: 40px; }
.jaw > .foot { height: 30px; }
.sticker { display: block; overflow: visible; }

/* 끌기 */
.ghost { position: fixed; z-index: 50; pointer-events: none; opacity: .9; filter: drop-shadow(0 8px 12px rgba(0,0,0,.25)); }
.marker { position: fixed; z-index: 49; width: 120px; height: 6px; border-radius: 3px; background: #FFD400; border: 1.5px solid var(--ink); pointer-events: none; display: none; }

/* 꾸러미 설명 */
.pal-help { font-size: 13px; color: var(--muted); line-height: 1.55; margin: 0 0 12px; background: #EEF3FF; border-radius: 10px; padding: 8px 10px; }
.pal-sub { font-weight: 800; font-size: 14px; margin: 18px 0 8px; padding-top: 10px; border-top: 1.5px dashed var(--line); }

/* 우클릭 메뉴 */
.ctxmenu { position: fixed; z-index: 80; min-width: 190px; background: #fff; border: 2px solid var(--ink); border-radius: 14px;
           padding: 6px; box-shadow: 0 10px 28px rgba(43,33,28,.22); display: flex; flex-direction: column; }
.ctxmenu button { border: 0; background: none; text-align: left; padding: 8px 12px; border-radius: 9px; font-size: 14px; color: var(--ink); }
.ctxmenu button:hover:not(:disabled) { background: #F4EDE4; }
.ctxmenu button:disabled { color: #B9B0A8; cursor: default; }
.ctxmenu button.danger { color: #C2412D; }
.ctxmenu hr { border: 0; border-top: 1.5px solid var(--line); margin: 4px 6px; }

/* 꾹 누르기: 손가락 둘레 원이 차오른다 */
.pressring { position: fixed; z-index: 90; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; pointer-events: none;
             background: conic-gradient(#12B8A0 calc(var(--p, 0) * 1%), rgba(18,184,160,.15) 0);
             -webkit-mask: radial-gradient(circle, transparent 15px, #000 16px); mask: radial-gradient(circle, transparent 15px, #000 16px);
             animation: pressfill .65s linear forwards; }
@property --p { syntax: '<number>'; inherits: false; initial-value: 0; }
@keyframes pressfill { from { --p: 0; } to { --p: 100; } }

/* 굳은 젤리: 반투명해지고 파이썬 코드가 비친다 */
.script > .list { transition: opacity .45s, filter .45s; }
.script.frozen > .list { opacity: .25; filter: saturate(.3) blur(.3px); }
.script.frozen { cursor: pointer; }
.codeghost { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.codeghost .cl { position: absolute; left: 0; white-space: pre; font: 600 14px/22px Consolas, 'D2Coding', 'Cascadia Mono', 'Pretendard Variable', monospace;
                 color: #1D2A5A; background: rgba(255,255,255,.72); border-radius: 6px; padding: 0 8px;
                 box-shadow: 0 1px 0 rgba(29,42,90,.08); animation: rise .45s ease-out both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: .95; transform: none; } }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px;
         border-radius: 12px; font-size: 15px; z-index: 60; max-width: min(90vw, 640px); white-space: pre-line; }
.toast.err { background: #C2412D; }

@media (max-width: 1100px) {
  .app { grid-template-columns: 1fr; overflow: auto; }
  body { overflow: auto; }
  .left { border-right: 0; }
  .right { min-height: 640px; grid-template-columns: 64px 240px 1fr; }
}
