/* boot — 로딩 · 오프닝 · 공지/이벤트/설정 창. 담당: docs/plan-meta.md §12 (js/boot.js 와 한 쌍)
   글자는 Galmuri 격자 크기만: Galmuri9 10/20 · Galmuri11 12/24 · Galmuri14 15/30. 외곽선 20px↑ --pxo, 10–12px --pxo1 */

/* =====================================================================
   1. 로딩 (#boot) — 스크립트보다 먼저 CSS 만으로 뜬다.
      boot.js 가 .bt-js(막대를 JS 가 채움) · .bt-art(스프라이트 틀·채움·신 캔버스)를 붙인다.
   ===================================================================== */
.boot {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: env(safe-area-inset-top, 0px) 16px env(safe-area-inset-bottom, 0px);
  background: #14152b; color: #f5f8fc;
  font: 12px Galmuri11, monospace;
  transition: opacity .3s linear;
  pointer-events: auto;
}
.boot.out { opacity: 0; pointer-events: none; }

/* 바람의 신(그림 전): 둥근 구름 몸 + 눈·볼, 숨쉬기 */
.boot-god { position: relative; width: 128px; height: 96px; margin-bottom: 16px; }
.boot-god::before {
  content: ''; position: absolute; left: 28px; top: 28px; width: 72px; height: 48px;
  background: linear-gradient(#f5f8fc 0 36px, #d3dce8 36px);
  clip-path: polygon(8px 0, calc(100% - 8px) 0, calc(100% - 8px) 4px, calc(100% - 4px) 4px, calc(100% - 4px) 8px, 100% 8px,
    100% calc(100% - 8px), calc(100% - 4px) calc(100% - 8px), calc(100% - 4px) calc(100% - 4px), calc(100% - 8px) calc(100% - 4px),
    calc(100% - 8px) 100%, 8px 100%, 8px calc(100% - 4px), 4px calc(100% - 4px), 4px calc(100% - 8px), 0 calc(100% - 8px),
    0 8px, 4px 8px, 4px 4px, 8px 4px);
  animation: bt-breathe 1.2s steps(1) infinite;
}
.boot-god::after {
  content: ''; position: absolute; left: 48px; top: 44px; width: 4px; height: 8px; background: #14152b;
  box-shadow: 28px 0 0 #14152b, -8px 12px 0 #ff98c8, -4px 12px 0 #ff98c8, 32px 12px 0 #ff98c8, 36px 12px 0 #ff98c8;
  animation: bt-breathe 1.2s steps(1) infinite;
}
.boot-god canvas { display: block; width: 128px; height: 96px; image-rendering: pixelated; image-rendering: crisp-edges; }
.boot.bt-god .boot-god::before, .boot.bt-god .boot-god::after { display: none; }
@keyframes bt-breathe {
  0% { transform: scale(1, 1); }
  25% { transform: scale(1.06, 1.04); }
  50% { transform: scale(1.11, 1.08); }
  75% { transform: scale(1.06, 1.04); }
}

/* 막대(그림 전): 2px 픽셀 테두리 + 흐르는 줄무늬, 가짜 진행 */
.boot-bar {
  width: 240px; height: 16px; padding: 4px;
  background: #1f2342;
  box-shadow: 0 0 0 2px #a5b2c7, 0 0 0 4px #14152b;
}
.boot-bar > i {
  display: block; height: 8px; width: 0;
  background: repeating-linear-gradient(90deg, #f0c040 0 8px, #fff0a6 8px 12px, #f0c040 12px 16px);
  animation: bt-fake 4s cubic-bezier(.2, .7, .3, 1) forwards, bt-flow .5s steps(4) infinite;
}
@keyframes bt-fake { from { width: 4%; } to { width: 78%; } }
@keyframes bt-flow { to { background-position: 16px 0; } }
.boot.bt-js .boot-bar > i { animation: bt-flow .5s steps(4) infinite; transition: width .2s linear; }
/* 스프라이트: 틀 9-slice(내용 상자 = 8px 트랙) + 채움 32×8 타일, 8fps 로 4px씩 오른쪽 */
.boot.bt-art .boot-bar {
  padding: 0; background: none; box-shadow: none; height: auto;
  border-style: solid; border-width: var(--bw-boot-frame);
  border-image-source: var(--ui-boot-frame); border-image-slice: var(--sl-boot-frame) fill; border-image-repeat: stretch;
}
.boot.bt-art .boot-bar > i { background: var(--boot-fill1) 0 0 / 32px 8px repeat-x; animation: bt-flow-art 1s steps(8) infinite; }
@keyframes bt-flow-art { to { background-position: 32px 0; } }

.boot-msg { margin-top: 16px; font: 12px Galmuri11, monospace; color: #f5f8fc; }
.boot-tip {
  position: absolute; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom, 0px) + 48px);
  min-height: 24px; text-align: center; font: 12px Galmuri11, monospace; line-height: 24px; color: #a8f0ff;
  transition: opacity .2s linear;
}
.boot-tip.fade { opacity: 0; }
.boot-tip:empty::before { content: '팁 · 화면을 누르고 있으면 바람의 신이 숨을 불어요'; }

/* =====================================================================
   2. 오프닝 (#opening) — 게임 캔버스 위 전체 화면. 그림은 .op-scene 캔버스(boot.js)
   ===================================================================== */
#opening {
  position: absolute; inset: 0; z-index: 40; overflow: hidden;
  pointer-events: auto; cursor: pointer; background: #2f64a8;
  transition: opacity .25s linear;
}
#opening.out { opacity: 0; pointer-events: none; }
.op-scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.op-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.op-sub {
  position: absolute; left: 0; right: 0; text-align: center;
  font: 30px Galmuri14, Galmuri11, monospace; line-height: 30px; color: #f5f8fc; text-shadow: var(--pxo);
  opacity: 0; transition: opacity .4s linear; pointer-events: none;
}
.op-sub.show { opacity: 1; }
.op-icons { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 8px); right: calc(env(safe-area-inset-right, 0px) + 8px); }
.op-touch {
  /* 화면 아래 18% 줄에 가운데를 맞춘다 */
  position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 18vh);
  transform: translate(-50%, 50%);
  display: flex; align-items: center; gap: 8px; padding: 4px 6px;
  border-style: solid; border-color: #14152b; border-width: var(--bw-touch, 6px);
  border-image-source: var(--ui-touch); border-image-slice: var(--sl-touch, 6) fill; border-image-repeat: stretch;
  font: 20px Galmuri9, Galmuri11, monospace; line-height: 20px; color: #f5f8fc; white-space: nowrap;
  pointer-events: none; opacity: 0; transition: opacity .3s linear;
}
.op-touch.show { opacity: 1; }
.op-touch.bt-noart { background: #1f2342; border-width: 2px; padding: 8px 12px; text-shadow: var(--pxo); }
.op-touch span { animation: bt-blink 2.4s ease-in-out infinite; }   /* 천천히 깜빡 */
.op-touch::before, .op-touch::after {
  content: ''; flex: none; width: var(--w-touch-arrow, 12px); height: var(--h-touch-arrow, 14px);
  background: var(--ui-touch-arrow) 0 0 / calc(var(--w-touch-arrow, 12px) * var(--n-touch-arrow, 1)) 100% no-repeat;
  animation: bt-arrow 1s steps(var(--n-touch-arrow, 1)) infinite;
}
.op-touch::after { transform: scaleX(-1); }
.op-touch.bt-noart::before, .op-touch.bt-noart::after { display: none; }
@keyframes bt-blink { 50% { opacity: .35; } }
@keyframes bt-arrow { to { background-position: calc(var(--w-touch-arrow, 12px) * var(--n-touch-arrow, 1) * -1) 0; } }
.op-ver {
  position: absolute; left: calc(env(safe-area-inset-left, 0px) + 8px); bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
  font: 10px Galmuri9, Galmuri11, monospace; line-height: 10px; color: #f5f8fc; text-shadow: var(--pxo1);
  pointer-events: none;
}

/* 공지·이벤트·설정 아이콘 줄 (오프닝 오른쪽 위 · 로비 상단 바에서 Boot.icons() 로 같이 쓴다) */
.bt-icons { display: flex; gap: 2px; pointer-events: auto; }
.bt-ic {
  position: relative; width: 44px; height: 48px; padding: 2px 0 0; border: 0; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font: 10px Galmuri9, Galmuri11, monospace; line-height: 10px; color: #f5f8fc; text-shadow: var(--pxo1);
  appearance: none; pointer-events: auto;
}
.bt-ic:active { transform: translateY(2px); }
.bt-ic .ic { position: relative; display: block; width: 32px; height: 32px; background: var(--ic) 0 0 / 100% 100% no-repeat; }
.bt-ic.k-notice .ic { --ic: var(--ui-ic-notice, linear-gradient(#33395c, #33395c)); }
.bt-ic.k-event .ic { --ic: var(--ui-ic-event, linear-gradient(#33395c, #33395c)); }
.bt-ic.k-settings .ic { --ic: var(--ui-ic-settings, linear-gradient(#33395c, #33395c)); }
.bt-ic .dot {
  position: absolute; top: -2px; right: -2px; width: 12px; height: 12px; display: none;
  background: var(--ui-dot, linear-gradient(#ff5a4a, #ff5a4a)) 0 0 / 100% 100% no-repeat;
}
.bt-ic.has .dot { display: block; }

/* =====================================================================
   3. 공지 · 이벤트 · 설정 창 (#overlay) — .panel/.card 픽셀 UI(style.css) 위에 얹는다
   ===================================================================== */
#overlay { position: absolute; inset: 0; z-index: 60; pointer-events: none; }
#overlay:empty { display: none; }
#overlay .panel.bt-panel { z-index: 60; padding-left: calc(env(safe-area-inset-left, 0px) + 14px); padding-right: calc(env(safe-area-inset-right, 0px) + 14px); }
.bt-card { max-width: 360px; }
.bt-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; margin-bottom: 6px; }
.bt-head h2 { font: var(--t-title); line-height: 24px; text-shadow: var(--pxo); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt-head .btn { flex: none; }
.bt-scroll { max-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 220px); overflow-y: auto; touch-action: pan-y; overscroll-behavior: contain; margin-bottom: 6px; }
.bt-list { display: flex; flex-direction: column; gap: 4px; }
.bt-empty { font: var(--t-body); line-height: 18px; color: #a5b2c7; text-align: center; padding: 16px 4px; }
.bt-empty .btn { margin-top: 10px; }

/* 한 줄(공지 목록 · 설정 항목) */
.bt-row {
  position: relative; display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 2px 6px;
  border-style: solid; border-width: var(--bw-row, 2px); border-color: #33395c;
  border-image-source: var(--ui-row); border-image-slice: var(--sl-row, 2) fill; border-image-repeat: stretch;
  background: none; color: #f5f8fc; text-align: left; font: var(--t-body); line-height: 16px;
  appearance: none; pointer-events: auto;
}
button.bt-row { cursor: pointer; }
button.bt-row:active { transform: translateY(2px); }
.bt-row .bt-txt { flex: 1; min-width: 0; }
.bt-row .bt-date { display: block; font: var(--t-small); line-height: 12px; color: #a5b2c7; }
.bt-row .bt-ttl { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt-row .bt-go { flex: none; color: #a5b2c7; }
.bt-row.unread .bt-ttl { color: #fff0a6; }
.bt-row .dot { flex: none; width: 12px; height: 12px; background: var(--ui-dot, linear-gradient(#ff5a4a, #ff5a4a)) 0 0 / 100% 100% no-repeat; }

/* 공지 본문 */
.bt-read .bt-date { font: var(--t-small); line-height: 12px; color: #a5b2c7; margin-bottom: 6px; }
.bt-read .bt-body { font: var(--t-body); line-height: 18px; white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere; }

/* 이벤트 카드 */
.bt-ev {
  padding: 6px 8px;
  border-style: solid; border-width: var(--bw-row, 2px); border-color: #33395c;
  border-image-source: var(--ui-row); border-image-slice: var(--sl-row, 2) fill; border-image-repeat: stretch;
}
.bt-ev.off { filter: grayscale(.7) brightness(.85); }
.bt-ev h3 { font: 20px Galmuri9, Galmuri11, monospace; line-height: 20px; color: #f0c040; text-shadow: var(--pxo); font-weight: 400; margin-bottom: 4px; }
.bt-ev p { font: var(--t-body); line-height: 18px; word-break: keep-all; }
.bt-ev .bt-until { font: var(--t-small); line-height: 12px; color: #a5b2c7; margin-top: 4px; }
.bt-ev .bt-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.bt-reward { display: flex; align-items: center; gap: 4px; font: var(--t-btn); line-height: 20px; color: #f5f8fc; text-shadow: var(--pxo); }
.bt-reward .gem { width: 24px; height: 24px; background: var(--ui-gem, linear-gradient(#46c8e8, #46c8e8)) 0 0 / 100% 100% no-repeat; }
.bt-reward .ci { width: 16px; height: 16px; }
.bt-ev .btn { min-width: 84px; }

/* 설정 */
.bt-set .bt-lbl { flex: 1; min-width: 0; }
.bt-set .bt-lbl small { display: block; font: var(--t-small); line-height: 12px; color: #a5b2c7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt-set .btn.small { flex: none; min-width: 72px; }
.bt-set .bt-na { flex: none; font: var(--t-small); color: #a5b2c7; }
.bt-tg {
  flex: none; width: 56px; height: 28px; padding: 0; border: 0; cursor: pointer; appearance: none; pointer-events: auto;
  background: var(--ui-toggle-off, linear-gradient(#4f5a7c, #4f5a7c)) 0 0 / 100% 100% no-repeat;
}
.bt-tg.on { background-image: var(--ui-toggle-on, linear-gradient(#7ccf5a, #7ccf5a)); }
.bt-name.name-form { margin: 0; }
.bt-name .row { gap: 6px; }
.bt-name input { flex: 1; min-width: 0; width: 100%; user-select: text; -webkit-user-select: text; pointer-events: auto; }
.bt-credit { font: var(--t-small); line-height: 14px; color: #a5b2c7; text-align: center; margin: 4px 0 6px; }
.bt-warn { font: var(--t-body); line-height: 18px; text-align: center; margin: 8px 0 12px; word-break: keep-all; }
.bt-warn b { color: #ff7e56; font-weight: 400; }
