:root {
  --bg: #0f0f0f;
  --panel: #1b1b1b;
  --panel2: #111;
  --bd: #333;
  --text: #eee;
  --sub: #bbb;
  --ok: #cfc;
  --ng: #f99;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

h1 {
  font-size: 18px;
  margin: 0 0 12px;
}

h2 {
  font-size: 16px;
  margin: 0 0 10px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--bd);
  border-radius: 14px;
  padding: 14px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media(max-width:980px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

.row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 10px;
  margin: 8px 0;
  align-items: center;
}

@media(max-width:520px) {
  .row {
    grid-template-columns: 1fr;
  }
}

label {
  color: var(--sub);
  font-size: 13px;
}

input,
textarea {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--bd);
  background: var(--panel2);
  color: var(--text);
}

textarea {
  min-height: 240px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  white-space: pre;
}

.btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

button {
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid #444;
  background: #151515;
  color: var(--text);
  cursor: pointer;
}

button.primary {
  border-color: #2a7;
  background: #123;
}

#qrBox {
  background: #fff;
  border-radius: 14px;
  padding: 14px;
  
  /* 固定幅をやめて、親要素に合わせる */
  width: 100%;
  
  /* ただしPCなどで巨大になりすぎないよう制限 */
  max-width: 400px;
  
  /* 正方形を保つ（モダンブラウザ対応） */
  aspect-ratio: 1 / 1;
  
  /* 中央寄せ */
  margin: 0 auto;
  
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box; /* paddingを含めたサイズ計算にする */
}

/* 生成されたQR画像が枠からはみ出さないようにする */
#qrBox img {
  max-width: 100%;
  height: auto;
  /* 画像がボケないようにドット感を維持（お好みで） */
  image-rendering: pixelated; 
}

.status {
  font-size: 12px;
  color: var(--ok);
}

.status.err {
  color: var(--ng);
}