/* ============================================================
   GLYPHALT-16 — style.css

   共通部分は /theme.css と /alt.css が持っている。
   このツールは左右タブ型：左に設定パネル、右にパレット・グリフの一覧を
   キャンバスの上に被せて開閉する。
   骨組み（.workspace / .side-panel / 縦タブ / 900px 以下の扱い）は alt.css。
   ここに書くのは、パネルの幅と2列化、パレット・グリフの選択盤だけ。
   ============================================================ */


/* 設定項目のキャプションは本文フォント。alt.css が .ctrl-label /
   .check-row / .drop-label を面倒みるので、残りをここで揃える */
.size-field label, .pal-hint, .glyph-info,
.download-scale, .quad-toggle {
  font-family: var(--font-body);
}

/* ── パネル ──
   左は設定。2列に並べる */
.side-panel-left {
  width: min(640px, 100%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-content: start;
  gap: 14px 20px;
}
.panel-col { gap: 14px; }

/* 右はパレット・グリフの一覧 */
.side-panel-right {
  width: min(360px, 100%);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.side-panel-right .section-title { margin-bottom: 0; }

.catalog-body { display: flex; flex-direction: column; gap: 14px; }
.catalog-card { display: flex; flex-direction: column; gap: 5px; }
.catalog-card-label { font-size: 12px; line-height: 16px; color: var(--sub); letter-spacing: 1px; }

.catalog-swatch-strip { display: flex; gap: 3px; }
.catalog-swatch {
  flex: 1 1 0;
  min-width: 0;
  aspect-ratio: 1;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 2px;
}

.catalog-glyph-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.catalog-glyph-grid canvas {
  display: block; width: 100%; aspect-ratio: 1;
  image-rendering: pixelated;
  background: var(--canvas-bg);
  border: 1px solid var(--border);
}
.catalog-more { font-size: 12px; line-height: 16px; color: var(--sub); letter-spacing: 1px; }

/* 単独で置く数値入力（サイズ指定など）。
   alt.css が見ているのは .ctrl-inputs の中だけなので、ここで揃える */
input[type=number] {
  background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 4px 6px;
  font-family: var(--font-body); font-size: 12px; line-height: 16px; color: var(--text); outline: none;
}
input[type=number]:focus { border-color: var(--accent); }

.size-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.size-field { display: flex; flex-direction: column; gap: 3px; }
.size-field label { font-size: 12px; line-height: 16px; color: var(--sub); letter-spacing: 1px; }
.size-field input[type=number] { width: 100%; }

/* ── パレット選択盤 ── */
.palette-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; }
.pal-swatch {
  aspect-ratio: 1;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 2px; cursor: pointer; position: relative;
  transition: transform 0.1s;
}
.pal-swatch:hover { transform: scale(1.15); z-index: 1; }
.pal-swatch.off { opacity: 0.25; }
.pal-swatch::after {
  content: '✓'; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; line-height: 16px; color: white; text-shadow: 0 0 2px black;
}
.pal-swatch.off::after { display: none; }
.pal-hint { font-size: 12px; line-height: 16px; color: var(--sub); letter-spacing: 1px; }

/* ── グリフ選択盤 ── */
.glyph-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  overflow: hidden;
}
.glyph-cell {
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 1px;
  cursor: pointer;
  background: var(--canvas-bg);
  overflow: hidden;
  position: relative;
  transition: outline 0.1s;
}
.glyph-cell:hover { outline: 2px solid var(--accent); z-index: 1; }
.glyph-cell canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.glyph-cell.off { opacity: 0.2; }
.glyph-cell.off::after {
  content: ''; position: absolute; inset: 0;
  background: rgba(180,0,0,0.35);
}
.glyph-btn-row { display: flex; gap: 6px; }
.glyph-info { font-size: 12px; line-height: 16px; color: var(--sub); letter-spacing: 1px; }

/* 字面は theme.css の .status-line。状態の色だけ足す */
.status-line.ok  { color: var(--accent); border-color: var(--accent); }
.status-line.err { color: var(--danger); border-color: var(--danger); }

/* ── ボタンの派生 ──
   基本形は theme.css、サイドバー内での詰め方は alt.css */
.btn.stop { background: var(--danger); border-color: var(--danger2); }
.btn.stop:hover { background: var(--danger2); }
.btn.sm { padding: 4px 6px; font-size: 12px; line-height: 16px; letter-spacing: 1px; }

.download-scale { display: flex; flex-wrap: wrap; gap: 5px 8px; align-items: center; font-size: 12px; line-height: 16px; color: var(--sub); letter-spacing: 1px; }
.download-scale > span { width: 100%; color: var(--sub); }
.download-scale label { cursor: pointer; }
.download-scale input { accent-color: var(--accent); vertical-align: middle; }

.quad-toggle { display: flex; flex-wrap: wrap; gap: 5px 10px; align-items: center; font-size: 12px; line-height: 16px; color: var(--sub); letter-spacing: 1px; }
.quad-toggle label { cursor: pointer; }
.quad-toggle input { accent-color: var(--accent); vertical-align: middle; }

/* ── 出力エリア ── 余白と伸び方は alt.css の .workspace > .work-area */
.work-area { gap: 12px; }
.canvas-container { background: var(--canvas-bg); border: 1px solid var(--border); }

/* ドット絵が滲まないよう、CSSでは縮小せずネイティブ解像度のまま描画する。
   ビューポートより大きい場合は .work-area の overflow:auto でスクロールさせる */
#outputCanvas { display: block; image-rendering: pixelated; }

/* 待機画面は alt.css の .alt-placeholder。大きさと色だけこのツールのものに */
#placeholder { width: 520px; height: 220px; gap: 10px; }
.placeholder-art { color: #00ff00; }
.placeholder-msg { color: #00ff00; }

.info-bar { gap: 12px; justify-content: center; }
.tweet-btn { width: min(320px, 100%); margin-top: 2px; }

/* 狭い画面では設定パネルを1列にする（全幅化は alt.css の 560px 以下） */
@media (max-width: 560px) {
  .side-panel-left { grid-template-columns: 1fr; }
}
