:root {
  --bg: #0f1115;
  --panel: #171a21;
  --ink: #e6e8ec;
  --muted: #9aa3b0;
  --accent: #5b9dff;
  --ok: #3fb950;
  --err: #f85149;
  --border: #2a2f3a;
}
* { box-sizing: border-box; }
html { font-size: 13.5px; } /* scales the whole rem-based UI down */
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
}
header, footer { padding: 1.5rem; text-align: center; position: relative; }

.lang-switch {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: .25rem;
}
.lang-switch button {
  background: #222836;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .25rem .5rem;
  font-size: .75rem;
  font-weight: 600;
}
.lang-switch button.active {
  background: var(--accent);
  color: #0b1020;
  border-color: var(--accent);
}
header h1 { margin: 0 0 .25rem; font-size: 2rem; }
header p, footer p { color: #9aa3b0; margin: .25rem 0; }
main {
  display: grid;
  grid-template-columns: minmax(200px, 270px) 1fr;
  align-items: start;
  gap: 1rem;
  max-width: min(1120px, 92vw);
  margin: 0 auto;
  padding: 0 1rem 2rem;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}
/* left column stacks 画像 + 設定; right column is 出力 (independent heights) */
.col-left { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.panel.output { min-width: 0; }
.panel h2 { margin-top: 0; font-size: 1.1rem; display: flex; align-items: center; gap: .5rem; }

.drop {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  color: #9aa3b0;
  transition: border-color .15s, background .15s;
}
.drop.over, .drop:hover { border-color: var(--accent); background: #1b2030; }

.bitmap {
  display: block;
  margin: 1rem auto 0;
  max-width: 100%;
  image-rendering: pixelated;
  background: #fff;
  border-radius: 6px;
}

label { display: block; margin: .75rem 0; font-size: .9rem; }
label.checkbox { display: flex; align-items: center; gap: .5rem; }
select, input[type="text"] {
  width: 100%;
  margin-top: .25rem;
  padding: .5rem;
  background: #0f1115;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 6px;
}
input[type="range"] { width: 100%; }
input[type="checkbox"] { width: auto; }

button {
  background: var(--accent);
  color: #0b1020;
  border: 0;
  border-radius: 8px;
  padding: .6rem 1rem;
  font-weight: 600;
  cursor: pointer;
}
button:disabled { opacity: .4; cursor: not-allowed; }
.toolbar { display: flex; gap: .5rem; margin-bottom: .75rem; flex-wrap: wrap; }
.toolbar button { background: #222836; color: var(--ink); border: 1px solid var(--border); }
#generate { width: 100%; margin-top: .5rem; }

.status { min-height: 2.8em; font-size: .85rem; color: #9aa3b0; }
.status.ok { color: var(--ok); }
.status.error { color: var(--err); }

.badge { font-size: .8rem; padding: .15rem .5rem; border-radius: 999px; font-weight: 600; }
.badge.ok { background: rgba(63,185,80,.15); color: var(--ok); }
.badge.error { background: rgba(248,81,73,.15); color: var(--err); }
.badge.pending { background: #222836; color: #9aa3b0; }

.code {
  background: #0b0d12;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  overflow: auto;
  max-height: none;
  font-family: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
  font-size: 10px;
  line-height: 1.25;
  white-space: pre;
  tab-size: 1;
}

@media (max-width: 760px) { main { grid-template-columns: 1fr; } }
