/* ─────────────────────────────────────────────────────────────
   廢土書房（book.mcfallout.net）— 版型照 season.mcfallout.net（muse 版型）：
   深色頂欄＋金色像素字招牌、淺色紙面板、Minecraft 立體邊按鈕；
   背景換成「無影雪原」：雪地方塊、濃霧、飄雪。
   ───────────────────────────────────────────────────────────── */
@font-face { font-family: 'minecraftfont'; src: url('assets/fonts/minecraftfont.woff') format('woff'); font-display: swap; }
:root {
  --green: #5b8731; --gold: #d9a334; --red: #c8434b; --soil: #6b4f3a;
  --panel: #c6c6c6; --ink: #2b2b2b; --ink2: #555; --paper: #ECECEC; --dark: #1d1d1d;
  --page: #FFFAEE;
  --pixel: 'minecraftfont', 'Courier New', monospace;
  --sans: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100%; font-family: var(--sans); color: var(--ink); font-size: 14px; line-height: 1.7;
  background-color: #c9d1da;
  background-image:
    linear-gradient(to bottom, rgba(222,228,235,.92) 0, rgba(214,221,229,.80) 260px, rgba(205,213,222,.55) 620px, rgba(190,198,208,.35) 100%),
    url('assets/img/grass_block_snow.png'), url('assets/img/dirt.png'), url('assets/img/stone.png');
  background-size: auto, 48px 48px, 48px 48px, 48px 48px;
  background-position: 0 0, left top, left 48px, left 96px;
  background-repeat: no-repeat, repeat-x, repeat-x, repeat;
  background-attachment: fixed, scroll, scroll, scroll;
}
#snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; image-rendering: pixelated; }
header, .wrap, footer, #banner { position: relative; z-index: 1; }
img, canvas { image-rendering: pixelated; }
.num { font-family: var(--pixel); font-variant-numeric: tabular-nums; letter-spacing: .5px; }

/* ── 按鈕 ── */
.mc-btn { background: var(--panel); border: 3px solid var(--dark);
  box-shadow: inset -3px -3px 0 rgba(0,0,0,.30), inset 3px 3px 0 rgba(255,255,255,.55);
  cursor: pointer; color: var(--ink); font-family: var(--pixel); padding: 7px 12px; font-size: 13px; }
.mc-btn:hover { filter: brightness(1.09); }
.mc-btn:active { box-shadow: inset 3px 3px 0 rgba(0,0,0,.30), inset -3px -3px 0 rgba(255,255,255,.4); }
.mc-btn.on, .mc-btn.primary { background: var(--green); color: #fff; text-shadow: 1px 1px 0 #2c4318; }
.mc-btn.big { padding: 11px 20px; font-size: 15px; }
.mc-btn.sm { padding: 4px 9px; font-size: 12px; }
.mc-btn.full { width: 100%; }
.mc-btn:disabled { filter: grayscale(1) brightness(.85); cursor: not-allowed; }

/* ── 頂欄 ── */
header { display: flex; align-items: center; gap: 14px; padding: 12px 20px;
  background: rgba(28,28,28,.88); border-bottom: 4px solid var(--dark); flex-wrap: wrap; }
header .logo { font-family: var(--pixel); font-size: 20px; color: #fff; letter-spacing: 2px;
  background: var(--gold); padding: 7px 14px; text-shadow: 2px 2px 0 #6b4f10;
  border: 3px solid var(--dark); box-shadow: inset -3px -3px 0 rgba(0,0,0,.3), inset 3px 3px 0 rgba(255,255,255,.35);
  display: inline-flex; align-items: center; gap: 8px; }
header .logo img { width: 24px; height: 24px; display: block; }
header h1 { margin: 0; font-size: 16px; font-weight: 700; color: #fff; text-shadow: 1px 1px 0 #000; }
header h1 .en { font-family: var(--pixel); font-size: 12px; color: #c9b98f; margin-left: 8px; font-weight: 400; }
header .sub { color: #c9b98f; font-size: 12px; margin-top: 3px; text-shadow: 1px 1px 0 #000; line-height: 1.5; }
header .spacer, .spacer { flex: 1; }
#banner { padding: 9px 20px; background: rgba(28,28,28,.70); color: #f0e2b8; font-size: 13px; text-shadow: 1px 1px 0 #000; }
#banner b { color: #ffd76e; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 16px 14px 60px; }
.layout { display: grid; grid-template-columns: minmax(0,1fr) 612px; gap: 16px; align-items: start; }
.preview-col { position: sticky; top: 12px; }
@media (max-width: 1180px) { .layout { grid-template-columns: minmax(0,1fr) 420px; } }
@media (max-width: 900px) {
  .layout { display: flex; flex-direction: column; align-items: stretch; }
  .preview-col { position: static; }
  header .sub { display: none; }
}

/* ── 面板 ── */
.step, .panel { background: rgba(236,236,236,.96); border: 3px solid var(--dark); margin-bottom: 14px;
  box-shadow: inset -3px -3px 0 rgba(0,0,0,.16), inset 3px 3px 0 rgba(255,255,255,.5); }
.step > .hd { display: flex; align-items: center; gap: 11px; padding: 11px 15px; border-bottom: 2px dashed #b3b3b3; }
.step > .hd .no { font-family: var(--pixel); background: var(--soil); color: #fff; width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center; border: 2px solid var(--dark); flex: none; font-size: 14px; }
.step > .hd .t { font-weight: 700; font-size: 15px; }
.step > .hd .v { margin-left: auto; font-size: 12.5px; color: var(--ink2); font-family: var(--pixel); }
.step > .bd, .panel > .bd { padding: 14px 15px; }
.panel { padding: 8px 10px 10px; }
.hint { color: var(--ink2); font-size: 12.5px; margin: 8px 0 0; line-height: 1.75; }
.hint.warn { color: #9a3a12; }
.label { font-family: var(--pixel); font-size: 14px; color: var(--ink); margin: 12px 0 6px; }
.panel .label:first-child { margin-top: 0; }

/* ── 工具列（論壇發文那種） ── */
.toolbar { display: flex; flex-wrap: wrap; gap: 6px 10px; padding: 6px; background: #d6d6d6; border: 2px solid #8b8b8b; border-bottom: none; }
.tgroup { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.tb { min-width: 30px; height: 30px; padding: 0 6px; background: #f3f3f3; border: 2px solid var(--dark); cursor: pointer;
  font-size: 15px; font-family: var(--sans); color: var(--ink); display: inline-flex; align-items: center; justify-content: center;
  box-shadow: inset -2px -2px 0 rgba(0,0,0,.18), inset 2px 2px 0 #fff; }
.tb.wide { font-size: 12.5px; padding: 0 9px; }
.tb:hover { background: #fff8e6; }
.tb.active { background: var(--gold); color: #fff; }
.obf-ico { font-family: var(--pixel); background: repeating-linear-gradient(90deg, #555 0 2px, transparent 2px 4px); -webkit-background-clip: text; color: transparent; font-weight: 700; }
.sw { width: 22px; height: 22px; border: 2px solid var(--dark); cursor: pointer; padding: 0; box-shadow: inset -2px -2px 0 rgba(0,0,0,.25), inset 2px 2px 0 rgba(255,255,255,.35); }
.sw:hover { outline: 2px solid var(--gold); }
.sw.on { outline: 3px solid var(--gold); outline-offset: 1px; }
.custom-color { position: relative; gap: 5px; }
.custom-color input { width: 22px; height: 22px; padding: 0; border: 1px solid #333; background: none; cursor: pointer; }
#hexInput { width: 170px; height: 30px; font-family: var(--pixel); font-size: 13px; border: 2px solid var(--dark); padding: 0 6px; }
#hexInput.bad { border-color: var(--red); background: #fff0f0; }

#editor { min-height: 460px; max-height: 70vh; overflow: auto; background: var(--page); border: 2px solid #8b8b8b;
  padding: 14px 16px; font-size: 17px; line-height: 1.75; color: #000; outline: none; white-space: pre-wrap; overflow-wrap: anywhere; }
#editor:focus { border-color: var(--gold); }
#editor:empty::before { content: '在這裡開始寫……選取文字後用上面的按鈕換顏色、加粗、做成可點擊文字。'; color: #9a9080; }
#editor font[face="bbobf"], #editor [data-k="1"] { background: repeating-linear-gradient(135deg, rgba(0,0,0,.08) 0 3px, transparent 3px 6px); }
#editor font[face="bbnone"] { background: none; }
#editor a.bb-link { color: inherit; text-decoration: none; background: rgba(80,0,255,.10); box-shadow: inset 0 -2px 0 rgba(80,0,255,.45); cursor: pointer; }
#editor .bb-pb { display: block; height: 0; border-top: 3px dashed #b39b6b; margin: 16px 0; position: relative; user-select: none; }
#editor .bb-pb::after { content: '分頁'; position: absolute; left: 50%; top: -13px; transform: translateX(-50%);
  background: var(--page); padding: 0 10px; font-family: var(--pixel); font-size: 12px; color: #8a6a2a; }

/* ── 預覽 ── */
.pv-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.seg { display: flex; gap: 6px; }
.bookwrap { display: flex; justify-content: safe center; background: rgba(40,40,40,.85); border: 2px solid var(--dark); padding: 10px 0; overflow: auto; }
#book { display: block; max-width: 100%; height: auto; }
.pv-nav { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.pv-nav .num { font-size: 14px; }
.stats { margin: 10px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: 12.5px; }
.stats dt { color: #3f3f3f; font-family: var(--pixel); font-size: 13px; }
.stats dd { margin: 0; }
.stats .bad { color: #b02a1a; font-weight: 700; }
.warns { margin: 8px 0 0; padding-left: 18px; font-size: 12.5px; color: #9a3a12; line-height: 1.7; }
.warns:empty { display: none; }
.warns li.info { color: #555; list-style: circle; }
#tip { position: fixed; z-index: 300; pointer-events: none; }
#tip canvas { display: block; }

/* ── 指令區 ── */
.cmdbox { margin-top: 10px; }
.cmdbox code { display: block; font-family: var(--pixel); font-size: 13px; background: #000; color: #55ff55; border: 2px solid #6f6f6f;
  padding: 9px 10px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; margin-bottom: 8px; word-spacing: 5px; }
.cmdbox .btns { display: flex; gap: 8px; }
.cmdbox.stale code { opacity: .45; text-decoration: line-through; }
.cmdbox .btns .mc-btn { flex: 1; }
.cmdbox .note { font-size: 12px; color: #4c4c4c; margin: 8px 0 0; line-height: 1.7; }
.cmdbox .note b { color: #8a5a12; }

/* ── 對話框 ── */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.72); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--paper); border: 3px solid var(--dark); max-width: 640px; width: 100%; padding: 18px 20px 16px; max-height: 92vh; overflow: auto;
  box-shadow: inset -3px -3px 0 rgba(0,0,0,.16), inset 3px 3px 0 rgba(255,255,255,.5); }
.modal h2 { font-family: var(--pixel); font-size: 18px; margin: 0 0 8px; }
.modal ol { padding-left: 22px; margin: 6px 0 10px; }
.modal code { font-family: var(--pixel); background: #000; color: #55ff55; padding: 1px 6px; word-spacing: 4px; }
.modal input[type=text], .modal input[type=number], .modal select, .modal textarea { font: inherit; font-size: 14px; border: 2px solid var(--dark); padding: 5px 8px; background: #fff; width: 100%; }
.modal textarea { resize: vertical; }
.modal input:disabled { background: #e2e2e2; color: #555; border-style: dashed; }
.modal .row { display: flex; gap: 6px; align-items: center; }
.modal .row select { width: auto; flex: none; }
.modal .row input { flex: 1; }
.modal .slash { font-family: var(--pixel); font-size: 16px; }
.modal .btns { display: flex; gap: 8px; margin-top: 12px; }
.lk-pane { margin-top: 8px; }
.grid { display: grid; gap: 6px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.opt { display: flex; align-items: center; gap: 9px; background: #fff; border: 3px solid var(--dark); padding: 6px 9px; cursor: pointer; font: inherit; color: var(--ink); text-align: left; }
.opt:hover { background: #fff8e6; }
.opt[aria-pressed="true"] { background: var(--gold); color: #fff; text-shadow: 1px 1px 0 #6b4f10; }
.opt .txt { display: flex; flex-direction: column; min-width: 0; }
.opt .t { font-weight: 700; font-size: 14px; line-height: 1.35; }
.opt .d { font-size: 11.5px; opacity: .85; line-height: 1.45; margin-top: 2px; }
#lkPreview code { font-size: 12px; }

/* 頁尾：跟頂欄同一條深色底（背景是雪景，淺色字直接放上去會看不見） */
footer { padding: 20px 20px 30px; text-align: center; background: rgba(28,28,28,.90); border-top: 4px solid var(--dark); margin-top: 10px; }
footer .brand { display: inline-block; margin: 0 0 10px; }
footer .brand img { height: 40px; width: auto; display: block; image-rendering: auto; }
footer .fnav { margin-bottom: 6px; }
footer .fnav a { color: #ffd76e; font-size: 13px; text-decoration: underline; margin: 0 9px; text-shadow: 1px 1px 0 #000; }
footer .fnav a:hover { color: #fff; }
footer .fnote { color: #c9b98f; font-size: 11.5px; line-height: 1.9; text-shadow: 1px 1px 0 #000; }
