:root {
  --bg: #0f1724;
  --card: #0b1220;
  --accent: #06b6d4;
  --muted: #94a3b8;
  --glass: rgba(255, 255, 255, 0.03);
}

/* 基本リセット */
* {
  box-sizing: border-box;
}
body {
  font-family: Inter, system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
  background: linear-gradient(135deg, #021124 0%, #052431 100%);
  color: #e6eef6;
  padding: 28px;
  margin: 0;
}

/* コンテナ */
.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 12px;
}
h1 {
  font-size: 1.6rem;
  margin: 0 0 18px;
}

/* カード、レイアウト */
.card {
  background: var(--card);
  padding: 18px;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(2, 6, 23, 0.6);
}

/* 2カラムレイアウト（PC） */
.grid {
  display: grid;
  grid-template-columns: 1fr 320px; /* 右カラム固定幅 */
  gap: 16px;
  align-items: start;
}

/* フォーム群 */
.controls {
  display: grid;
  gap: 12px;
}
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap; /* 小画面で折り返すため */
}
label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap; /* 一般ラベルは折り返し許可 */
}
.section-title {
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 6px;
}

/* =========================
   記号選択エリア（主要部分）
   - 列数は auto-fit / minmax で自動
   - ラベル内は折り返し禁止（チェックボックスと記号を横並び）
   ========================= */
.symbols {
  display: grid;
  /* 各セルの最小幅を確保しつつ、画面幅に応じて自動で列数を決定 */
  grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
  gap: 6px;
  /* 縦スクロールを無くす（コンテンツ高さに合わせて拡張） */
  max-height: none;
  overflow: visible;
  /* 行高さを中身に合わせて余白を最小化 */
  grid-auto-rows: min-content;
  padding: 8px;
  background: var(--glass);
  border-radius: 8px;
}

/* 記号ラベル内はチェックと記号を横並びに保持 */
.symbols label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px;
  border-radius: 6px;
  white-space: nowrap; /* 折り返し禁止 */
  flex-wrap: nowrap;   /* flexの折り返し禁止 */
  min-width: 0;
}

/* チェックボックス表示安定化 */
.symbols input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 0;
}

/* 記号テキストを1行で */
.symbols span {
  display: inline-block;
  line-height: 1;
  padding: 0 2px;
}

/* フォームの補助グループ */
.radio-group,
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* 入力系 */
input[type="text"],
input[type="number"],
.output {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 8px;
  border-radius: 8px;
  color: inherit;
}
input[type="number"] {
  width: 100px;
}

/* アクションボタン列は折り返し対応 */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

/* ボタン */
button {
  background: linear-gradient(180deg, var(--accent), #0aa3b0);
  border: none;
  padding: 8px 12px;
  border-radius: 8px;
  color: #07202a;
  font-weight: 700;
  cursor: pointer;
}
button.ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

/* 出力エリア */
.output {
  min-height: 220px;
  padding: 12px;
  white-space: pre-wrap;
  overflow: auto;
}

/* パスワード行 */
.pw-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.01), transparent);
}
.pw-text {
  font-family: monospace;
  font-size: 0.95rem;
  word-break: break-all;
}
/* パスワード行のコピー/ボタンが折り返さないように */
.pw-row button {
  white-space: nowrap; /* テキストを折り返さない */
  flex: 0 0 auto;      /* 横幅を最小限に固定 */
  padding: 6px 10px;   /* 適度な余白 */
  cursor: pointer;
}

.small {
  font-size: 0.9rem;
  color: var(--muted);
}

/* =========================
   レスポンシブ調整
   - 880px 以下で1カラム化（右カラムが下に回る）
   - body padding を減らす
   - 480px 以下で記号セルの最小幅を縮小
   ========================= */
@media (max-width: 880px) {
  .grid {
    grid-template-columns: 1fr;
  }
  body {
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .symbols {
    grid-template-columns: repeat(auto-fit, minmax(48px, 1fr));
    grid-auto-rows: min-content;
    max-height: none;
    overflow: visible;
  }
}
