/* Phase 04-1: 更新履歴ウィンドウ（コマンドプロンプト風）
 * 画像は assets/images/update-window/ を 1:1（等倍）で使用する。
 * 取得・描画ロジックは updates.js / data-updates をそのまま利用する。 */
.cmdwin {
  --bw: 384px;   /* 黒い本文領域の幅（8pxの倍数＝半角48桁） */
  --bh: 144px;   /* 同 高さ（16px行×9行 / 18px行×8行 のどちらも割り切れる） */
  --lh: 16px;    /* 行高。--lg 指定時は 18px */
  position: relative;
  box-sizing: content-box;
  width: calc(6px + var(--bw) + 17px + 6px);
  height: calc(31px + var(--bh) + 17px + 5px);
  display: grid;
  grid-template-columns: 6px var(--bw) 17px 6px;
  grid-template-rows: 31px var(--bh) 17px 5px;
  image-rendering: pixelated;
  font-size: 0;
}
.cmdwin * { box-sizing: border-box; }

/* --- タイトルバー --- */
.cmdwin__title {
  grid-column: 1 / 5;
  position: relative;
  display: flex;
  height: 31px;
}
.cmdwin__title-l { flex: 0 0 44px; background: url(../images/update-window/title-bar-left.png) no-repeat; }
.cmdwin__title-f { flex: 1 1 auto; background: url(../images/update-window/title-bar-fill.png) 0 0 / 100% 31px no-repeat; image-rendering: auto; }
.cmdwin__title-r { flex: 0 0 57px; background: url(../images/update-window/title-bar-right.png) no-repeat; }
.cmdwin__caption {
  position: absolute;
  left: 30px;
  top: 3px;
  margin: 0;
  line-height: 25px;
  font: bold 12px/25px Tahoma, "MS UI Gothic", "Meiryo UI", sans-serif;
  color: #fff;
  white-space: nowrap;
}

/* --- 枠 --- */
.cmdwin__fl { grid-column: 1; grid-row: 2 / 4; background: url(../images/update-window/frame-left.png) repeat-y; }
.cmdwin__fr { grid-column: 4; grid-row: 2 / 4; background: url(../images/update-window/frame-right.png) repeat-y; }
.cmdwin__bl { grid-column: 1; grid-row: 4; background: url(../images/update-window/frame-bottom-left.png) no-repeat; }
.cmdwin__bm { grid-column: 2 / 4; grid-row: 4; background: url(../images/update-window/frame-bottom.png) repeat-x; }
.cmdwin__br { grid-column: 4; grid-row: 4; background: url(../images/update-window/frame-bottom-right.png) no-repeat; }

/* --- 本文（実スクロール領域。data-updates 要素そのもの） --- */
.cmdwin .update-history {
  grid-column: 2; grid-row: 2;
  width: var(--bw);
  height: var(--bh);
  margin: 0;
  padding: 0 2px;
  overflow-x: hidden;
  overflow-y: scroll;
  border: 0;
  background: #000;
  color: #fff;
  font-family: "Terminal", "MS Gothic", "ＭＳ ゴシック", monospace;
  font-size: 14px;
  line-height: 16px;
  letter-spacing: 0;
  font-kerning: none;
  font-variant-ligatures: none;
  scrollbar-width: none;           /* ネイティブバーは出さない */
  -ms-overflow-style: none;
  outline: 0;
}
.cmdwin .update-history::-webkit-scrollbar { display: none; width: 0; height: 0; }
.cmdwin .update-history:focus-visible { outline: 1px dotted #fff; outline-offset: -3px; }
.cmdwin .update-entry + .update-entry { margin-top: var(--lh); padding-top: 0; border-top: 0; }
.cmdwin .update-entry__date { display: block; color: #c0c0c0; font-weight: normal; }
.cmdwin .update-entry__text { margin: 0; white-space: pre-wrap; word-break: break-all; overflow-wrap: anywhere; }
.cmdwin .updates-message { margin: 0; }
.cmdwin .updates-message--error { color: #ff8080; }
.cmdwin .update-history a:link, .cmdwin .update-history a:visited { color: #80d0ff; text-decoration: underline; }
.cmdwin .update-history a:hover { color: #ffff80; }

/* --- 縦スクロールバー（画像。実スクロールと同期） --- */
.cmdwin__vbar { grid-column: 3; grid-row: 2; display: flex; flex-direction: column; width: 17px; height: var(--bh); user-select: none; touch-action: none; }
.cmdwin__vup   { flex: 0 0 17px; background: url(../images/update-window/vertical-scroll-up.png) no-repeat; }
.cmdwin__vdown { flex: 0 0 17px; background: url(../images/update-window/vertical-scroll-down.png) no-repeat; }
.cmdwin__vtrack { position: relative; flex: 1 1 auto; background: url(../images/update-window/vertical-scroll-track.png) 0 0 repeat; }
.cmdwin__vthumb {
  position: absolute; left: 0; top: 0; width: 17px; height: 8px;
  border-style: solid; border-width: 2px; border-color: transparent;
  border-image: url(../images/update-window/vertical-scroll-thumb.png) 2 fill / 2px stretch;
}
.cmdwin__vthumb[hidden] { display: none; }

/* --- 横スクロールバー（見た目のみ。装飾） --- */
.cmdwin__hbar { grid-column: 2; grid-row: 3; display: flex; height: 17px; }
.cmdwin__hleft  { flex: 0 0 17px; background: url(../images/update-window/horizontal-scroll-left.png) no-repeat; }
.cmdwin__hright { flex: 0 0 17px; background: url(../images/update-window/horizontal-scroll-right.png) no-repeat; }
.cmdwin__htrack { position: relative; flex: 1 1 auto; background: url(../images/update-window/horizontal-scroll-track.png) -1px 0 repeat; }
.cmdwin__hthumb { position: absolute; left: 0; top: 0; width: 101px; height: 17px; background: url(../images/update-window/horizontal-scroll-thumb.png) no-repeat; }
.cmdwin__corner { grid-column: 3; grid-row: 3; background: url(../images/update-window/scroll-corner.png) no-repeat; }

.cmdwin--lg { --lh: 18px; }
.cmdwin--lg .update-history { font-size: 16px; line-height: 18px; }

.cmdwin-more { margin: 4px 0 0; font-size: 12px; line-height: 1.45; }
