/* ─────────────────────────────────────────────────────────────
   廢土旗幟 — 旗幟圖庫（banner.mcfallout.net）
   版型照 season.mcfallout.net：深色頂欄＋金色像素字招牌、淺色紙面板分步驟、
   土色編號徽章、選中用金色、白底卡片、頁尾廢土品牌圖。CSS 變數跟 season 同一組。
   規則：
   • 所有圖都是遊戲原始貼圖，整數倍、pixelated；旗幟是 canvas 即時畫的（見 app.js）。
   • 面板／按鈕用 Minecraft 的立體邊：亮邊左上、暗邊右下；不用圓角、不用模糊陰影。
   ───────────────────────────────────────────────────────────── */
@font-face { font-family: 'minecraftfont'; src: url('assets/fonts/minecraftfont.woff') format('woff'); font-display: swap; }
:root {
  --blue: #3b82c4; --green: #5b8731; --green-l: #7cb342; --gold: #d9a334; --red: #c8434b;
  --soil: #6b4f3a; --purple: #8b5fbf;
  --panel: #c6c6c6; --panel-d: #8b8b8b; --panel-hi: #ffffff; --panel-lo: #555555;
  --slot: #8b8b8b; --slot-hi: #ffffff; --slot-lo: #373737;
  --ink: #2b2b2b; --ink2: #555; --ink3: #7a7a7a; --paper: #ECECEC; --dark: #1d1d1d;
  --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: #1a1a1a;
  background-image: url('assets/img/grass_side.png'), url('assets/img/dirt.png'), url('assets/img/stone.png');
  background-size: 48px 48px; background-position: left top, left 48px, left 96px;
  background-repeat: repeat-x, repeat-x, repeat;
}
img, canvas, .tex { 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); transition: filter .1s; 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.gold.on { background: var(--gold); text-shadow: 1px 1px 0 #6b4f10; }
.mc-btn.big { padding: 11px 20px; font-size: 15px; }
.mc-btn.sm { padding: 4px 9px; font-size: 12px; }

/* ── 頂欄 ── */
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: 14px; height: 28px; 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 { flex: 1; }
#btn-fold { display: none; }   /* 只有單欄的時候才需要收合 */

#visbar { display: flex; gap: 10px; align-items: flex-start; padding: 9px 20px; background: rgba(28,28,28,.62);
  color: #f0e2b8; font-size: 12.5px; line-height: 1.7; text-shadow: 1px 1px 0 #000; }
#visbar img { width: 24px; height: 24px; flex: none; margin-top: 2px; }
#visbar b { color: #ffd76e; }

.wrap { max-width: 1400px; margin: 0 auto; padding: 16px 14px 60px; }
.layout { display: grid; grid-template-columns: minmax(0,1fr) 380px; gap: 16px; align-items: start; }

/* 「這一面」這欄的內容比一個畫面還長（底色＋疊層＋材料＋三個指令框）。
   sticky 元素只要比視窗高，瀏覽器就不會黏住；而且沒有自己的捲動區的話，
   滑鼠滾在這一欄上捲的是整頁——所以限高＋內部 overflow-y。
   ⚠ 這裡**不要** overscroll-behavior:contain：擋住傳導的話，面板捲到底就整個停住，
   玩家會以為畫面壞掉滑不動、也永遠看不到頁尾。捲到底就讓它接著帶整頁往下，
   露出頁尾跟背景，人才知道真的到底了。 */
.pick-col { position: sticky; top: 12px; max-height: calc(100vh - 24px); display: flex; flex-direction: column; }
/* ⚠ 黏住的面板一定要**不透明**：其他面板用的是 rgba(...,.96)，底下的內容捲過去時會整片透出來，
   在手機上（面板黏在最上面、旗幟牆從底下經過）糊成一團完全讀不了。09-07 實機截圖抓到。 */
.pick-col > .step { display: flex; flex-direction: column; min-height: 0; max-height: 100%; margin-bottom: 0;
  background: var(--paper); }
.pick-col > .step > .hd { flex: none; }
.pick-col > .step > .bd { overflow-y: auto; min-height: 0; }
/* 捲軸也做成麥塊的樣子，不要瀏覽器預設那條 */
.pick-col > .step > .bd::-webkit-scrollbar { width: 10px; }
.pick-col > .step > .bd::-webkit-scrollbar-track { background: #d8d8d8; }
.pick-col > .step > .bd::-webkit-scrollbar-thumb { background: var(--panel-d); border: 2px solid #d8d8d8; }
.pick-col > .step > .bd::-webkit-scrollbar-thumb:hover { background: #6f6f6f; }
/* 手機沒有常駐捲軸，內容又一定會被切在一半——底下補一條實心提示（⛔ 不用漸層，像素風不做模糊）。
   有東西可以捲的時候才由 app.js 掛上 .can-scroll，捲到底會自己收掉。 */
.pick-col > .step { position: relative; }
@media (min-width: 1001px) {
  .pick-col.can-scroll > .step::after { display: none; }
  .pick-col.can-scroll > .step > .bd { padding-bottom: 14px; }
}
.pick-col.can-scroll > .step::after {
  content: '⌄ 往下捲還可以改顏色'; position: absolute; left: 3px; right: 3px; bottom: 3px;
  background: var(--panel); color: var(--ink2); font-size: 11px; text-align: center; padding: 2px 0;
  border-top: 2px dashed #b3b3b3; pointer-events: none; font-family: var(--sans);
}
.pick-col.can-scroll > .step > .bd { padding-bottom: 26px; }

/* ── 面板 ── */
.step { 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; flex-wrap: wrap; }
.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 .hd-t { min-width: 0; flex: 1 1 auto; }
.step > .hd .hd-t .t { display: block; line-height: 1.35; word-break: break-word; }
.step > .hd .hd-t .t small { font-weight: 400; font-size: 12px; color: var(--ink2); }
.step > .hd .cls { margin-top: 3px; }
.step > .hd .v { margin-left: auto; font-size: 12.5px; color: var(--ink2); }
.step > .bd { padding: 14px 15px; }
.hint { color: var(--ink2); font-size: 12.5px; margin: 0 0 10px; line-height: 1.75; }
.hint.warn { color: #8a5a12; }
.label { font-family: var(--pixel); font-size: 14px; color: var(--ink); margin: 14px 0 6px; }
.label:first-child { margin-top: 0; }

/* ── 篩選鈕 ── */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 3px solid var(--dark);
  padding: 5px 9px; cursor: pointer; font: inherit; font-size: 13px; color: var(--ink); }
.chip-btn:hover { background: #fff8e6; }
.chip-btn[aria-pressed="true"] { background: var(--gold); color: #fff; text-shadow: 1px 1px 0 #6b4f10; }
.chip-btn img { width: 18px; height: 18px; flex: none; background: var(--slot);
  box-shadow: 0 0 0 1px var(--slot), 1px 1px 0 1px var(--slot-hi), -1px -1px 0 1px var(--slot-lo); margin: 0 2px; }
.chip-btn canvas { width: 11px; height: 22px; flex: none; display: block; }
.chip-btn .n { font-family: var(--pixel); font-size: 11px; opacity: .75; }
.chip-btn[aria-pressed="true"] .n { opacity: .9; }

.searchrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.searchrow input[type="search"] { flex: 1 1 220px; min-width: 0; font-family: var(--sans); font-size: 14px;
  background: #000; color: #e0e0e0; border: 3px solid var(--dark); padding: 8px 10px; }
.searchrow input::placeholder { color: #6f6f6f; }

/* ── 旗幟牆 ── */
.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px,1fr)); gap: 7px; }
.bn { background: #fff; border: 3px solid var(--dark); padding: 6px 4px 5px; cursor: pointer; font: inherit;
  color: var(--ink); display: flex; flex-direction: column; align-items: center; gap: 3px; }
.bn:hover { background: #fff8e6; }
.bn[aria-pressed="true"] { background: var(--gold); }
.bn canvas { width: 44px; height: 88px; display: block; background: var(--slot);
  box-shadow: 0 0 0 2px var(--slot), 2px 2px 0 2px var(--slot-hi), -2px -2px 0 2px var(--slot-lo); margin: 2px 0 4px; }
.bn .t { font-size: 11px; line-height: 1.3; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bn .m { font-family: var(--pixel); font-size: 10px; color: var(--ink3); }
.bn[aria-pressed="true"] .m { color: #6b4f10; }
.wall-more { display: block; margin: 12px auto 0; }
.empty { text-align: center; color: var(--ink2); padding: 26px 10px; font-size: 13px; }

/* ── 右欄：選中的那一面 ── */
/* 旗幟大圖，右手邊直接就是改色的工具——改哪一層、看哪一層，眼睛不用來回跑 */
.big-row { display: flex; gap: 12px; align-items: flex-start; }
.big-row .edit { min-width: 0; flex: 1 1 auto; }
.big-row .edit .edit-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.big-row .edit .hint { margin-top: 8px; font-size: 12px; }

/* 材料清單底下那一句「這是一個 N 層旗幟」 */
.mat-sum { margin: 8px 0 0; font-size: 12.5px; color: var(--ink2); }
.mat-sum b { color: var(--ink); font-family: var(--pixel); font-size: 14px; }

/* 自訂顏色的視窗：左邊看預覽，右邊點色塊 */
.color-edit { display: flex; gap: 16px; align-items: flex-start; margin-top: 10px; }
#bigModal { width: 110px; height: 220px; flex: none; background: var(--slot);
  box-shadow: 0 0 0 3px var(--slot), 3px 3px 0 3px var(--slot-hi), -3px -3px 0 3px var(--slot-lo); }
.color-cols { min-width: 0; flex: 1 1 auto; }
.color-cols .label { margin: 0 0 4px; }
.color-cols .label + .hint { margin-bottom: 6px; }
.color-cols .sws.base .sw { width: 24px; height: 24px; }
.color-cols .layers .sw { width: 20px; height: 20px; }
.color-cols .layers .nm { font-size: 12.5px; }
.modal-btns { display: flex; gap: 8px; margin-top: 14px; }
.modal-btns .mc-btn { flex: 1; }
@media (max-width: 560px) {
  .color-edit { flex-direction: column; align-items: center; }
  #bigModal { width: 84px; height: 168px; }
  .color-cols { width: 100%; }
}
#big { width: 96px; height: 192px; flex: none; background: var(--slot);
  box-shadow: 0 0 0 3px var(--slot), 3px 3px 0 3px var(--slot-hi), -3px -3px 0 3px var(--slot-lo); }
.cls { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 11px; background: #ddd; border: 2px solid var(--dark); padding: 1px 6px; }
.tag.j { background: #e6dcc4; }
.tag.y { background: #d5e2ea; }
.tag.e { background: #e2d5ea; }

/* 掛起來長怎樣：場景引擎照搬 season.mcfallout.net，村子中間那間房子的牆上掛著你選的旗 */
.scene-wrap { margin-top: 12px; }
.scene { position: relative; width: 100%; aspect-ratio: 3/2; overflow: hidden;
  background: #79a6ff; isolation: isolate; border: 3px solid var(--dark);
  box-shadow: inset 2px 2px 0 var(--slot-lo), inset -2px -2px 0 var(--slot-hi); }
.scene > * { position: absolute; inset: 0; pointer-events: none; }
.scene img, .scene .l-ground, .scene .l-trees, .scene .l-hills { image-rendering: pixelated; }
.tint-mul { mix-blend-mode: multiply; }
.l-sun img { position: absolute; transform: translate(-50%,-50%); }
.l-clouds { image-rendering: pixelated; }
.l-clouds .band { position: absolute; left: -20%; right: -20%; background-repeat: repeat-x;
  animation: bn-clouds 90s linear infinite; }
@keyframes bn-clouds { to { background-position-x: 256px; } }
/* 場景底下的說明：跟站上其他 .hint 同一個字級與顏色，⛔ 不要用 season 那邊深色背景的版本 */
.scene-note { margin: 8px 0 0; font-family: var(--sans); font-size: 12.5px; font-weight: 400;
  color: var(--ink2); line-height: 1.75; text-align: left; text-shadow: none; }
.scene-note a { color: #2f6b2f; font-weight: 700; white-space: nowrap; text-decoration: underline; cursor: pointer; }
.scene-note #themeName { font-family: var(--pixel); font-size: 14px; color: var(--ink); letter-spacing: .5px; }
.scene-note #themeBlurb { color: var(--ink2); }

.layers { list-style: none; margin: 0; padding: 0; }
.layers li { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-top: 1px dashed #c2c2c2; flex-wrap: wrap; }
.layers li:first-child { border-top: 0; }
.layers .no { font-family: var(--pixel); font-size: 12px; color: var(--ink3); width: 14px; flex: none; }
.layers .nm { font-size: 12px; flex: 1 1 100%; min-width: 0; }
.sws { display: flex; flex-wrap: wrap; gap: 3px; }
/* ⚠ flex:none 會讓這排色票不縮也不換行，16 顆直接衝出面板右邊（截圖抓到）。
   讓它自己佔一整行、寬度跟著容器，才會乖乖換行。 */
.layers .sws { gap: 2px; flex: 1 1 100%; min-width: 0; }
.sw { width: 14px; height: 14px; border: 2px solid var(--dark); cursor: pointer; padding: 0; display: block; }
.sw[aria-pressed="true"] { box-shadow: inset 0 0 0 2px #fff, 0 0 0 2px var(--green); }
#btn-restore { margin-bottom: 4px; }
.sws.base { gap: 3px; margin-bottom: 2px; }
.sws.base .sw { width: 18px; height: 18px; }

.mat { list-style: none; margin: 0; padding: 0; }
.mat li { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-top: 1px dashed #c2c2c2;
  font-size: 13px; flex-wrap: wrap; }
.mat li > span:not(.q):not(.note) { white-space: nowrap; }   /* 「旗幟圖案」不要被擠成兩行 */
.mat li:first-child { border-top: 0; }
.mat img { width: 22px; height: 22px; flex: none; background: var(--slot);
  box-shadow: 0 0 0 1px var(--slot), 1px 1px 0 1px var(--slot-hi), -1px -1px 0 1px var(--slot-lo); }
.mat .q { font-family: var(--pixel); font-size: 13px; flex: none; }
.mat .note { color: var(--ink2); font-size: 11.5px; flex: 1 1 100%; padding-left: 30px; margin-top: -2px; }

.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: break-word; word-break: break-all;
  line-height: 1.6; margin-bottom: 8px; word-spacing: 5px; }
.cmdbox code.sm { font-size: 11px; word-spacing: 2px; }
.cmdbox .btns { display: flex; gap: 8px; }
.cmdbox .btns .mc-btn { flex: 1; }
.cmdbox .note { font-size: 11.5px; 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%; max-height: 86vh; overflow: auto;
  padding: 18px 20px 16px; box-shadow: inset -3px -3px 0 rgba(0,0,0,.16), inset 3px 3px 0 rgba(255,255,255,.5);
  color: var(--ink); font-size: 13.5px; line-height: 1.8; }
.modal h2 { font-family: var(--pixel); font-size: 18px; margin: 0 0 8px; }
.modal h3 { font-family: var(--pixel); font-size: 14px; margin: 14px 0 4px; }
.modal ol, .modal ul { padding-left: 22px; margin: 6px 0 10px; }
.modal code { font-family: var(--pixel); background: #000; color: #55ff55; padding: 2px 6px; word-spacing: 4px; }
.modal .close { margin-top: 10px; }

footer { padding: 18px 20px 44px; text-align: center; }
footer .brand { display: inline-block; margin: 0 0 10px; opacity: .72; transition: opacity .15s; }
footer .brand:hover { opacity: 1; }
footer .brand img { height: 34px; width: auto; display: block; image-rendering: auto; }
footer .fnav { margin-bottom: 5px; }
footer a { color: #9fb4c7; font-size: 11.5px; text-decoration: underline; cursor: pointer; margin: 0 8px; }
footer .fnote { color: #6f7d88; font-size: 10.5px; line-height: 1.9; margin-top: 9px; }

/* ── 視窗小一點：右欄窄一格 ── */
@media (max-width: 1240px) {
  .layout { grid-template-columns: minmax(0,1fr) 330px; }
  #big { width: 84px; height: 168px; }
}

/* ── 直式（平板、手機）：單欄。選中的那一面移到最上面並黏住，
      往下捲旗幟牆的時候還看得到自己挑的是哪一面（同 season 的做法）。 ── */
@media (max-width: 1000px) {
  .wrap { padding: 12px 10px 40px; }
  .layout { grid-template-columns: 1fr; gap: 12px; }
  /* 黏在最上面，但只佔一部分畫面——底下的旗幟牆才是主角。看不夠就在面板裡自己捲，
     不想看就按「收起來」。 */
  .pick-col { order: -1; top: 0; z-index: 30; max-height: 42vh; }
  .pick-col.folded { max-height: none; }
  .pick-col.folded.can-scroll > .step::after { display: none; }
  .pick-col.folded > .step > .bd { display: none; }
  #btn-fold { display: block; margin-left: 8px; }
  .pick-col > .step { box-shadow: inset -3px -3px 0 rgba(0,0,0,.16), inset 3px 3px 0 rgba(255,255,255,.5), 0 6px 0 rgba(0,0,0,.35); }
  .big-row { gap: 12px; }
  #big { width: 72px; height: 144px; }
  .big-t h2 { font-size: 15px; }
  header { padding: 10px 12px; gap: 10px; }
  header .sub { display: none; }
  header .logo { font-size: 17px; padding: 6px 11px; }
  #visbar { padding: 8px 12px; font-size: 12px; }
}

/* ── 手機直立 ── */
@media (max-width: 640px) {
  .wall { grid-template-columns: repeat(auto-fill, minmax(74px,1fr)); gap: 6px; }
  .bn canvas { width: 40px; height: 80px; }
  .bn .t { font-size: 10.5px; }
  .step > .hd { padding: 9px 11px; gap: 8px; }
  .step > .hd .t { font-size: 14px; }
  .step > .hd .v { font-size: 11.5px; }
  .step > .bd { padding: 11px 11px; }
  .chip-btn { font-size: 12px; padding: 4px 7px; }
  .chip-btn .n { font-size: 10px; }
  .label { font-size: 13px; }
  .hint { font-size: 12px; }
  .cmdbox code { font-size: 12px; }
  .cmdbox code.sm { font-size: 10.5px; }
  .cmdbox .btns { flex-wrap: wrap; }
  .cmdbox .btns .mc-btn { flex: 1 1 46%; }
  .sws.base .sw { width: 26px; height: 26px; }        /* 手指點得到 */
  .layers .sw { width: 20px; height: 20px; }
  .layers .nm { flex-basis: 100%; }
  .pick-col { max-height: 46vh; }
  footer a { display: inline-block; margin: 2px 6px; }
}

/* ── 很窄（小手機） ── */
@media (max-width: 400px) {
  .wall { grid-template-columns: repeat(auto-fill, minmax(66px,1fr)); }
  .bn canvas { width: 36px; height: 72px; }
  header h1 .en { display: none; }
  .big-row { flex-direction: column; align-items: center; text-align: center; }
  .big-t { text-align: center; }
  .big-t .cls { justify-content: center; }
}

/* ── 橫躺的手機：畫面很矮，別讓黏住的面板吃掉整個畫面 ── */
@media (max-width: 1000px) and (orientation: landscape) and (max-height: 560px) {
  .pick-col { max-height: 50vh; }
}

/* 手指捲動也不要把捲動傳導到整頁 */
@media (hover: none) {
  .pick-col > .step > .bd { -webkit-overflow-scrolling: touch; }
}
