/* WHAT: デモ用の最小スタイル。WHY: プロトタイプの可読性確保が目的で装飾は最小限。 */
:root {
  --bg: #f5f6f8; --panel: #fff; --line: #e1e4e8;
  --accent: #2d6cdf; --bot: #eceff3; --me: #2d6cdf; --text: #1b1f24;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: -apple-system, "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  background: var(--bg); color: var(--text);
}
header { padding: 20px 24px 0; }
h1 { margin: 0; font-size: 22px; }
.sub { margin: 4px 0 14px; color: #6a737d; font-size: 13px; }
.tabs button {
  border: 1px solid var(--line); background: var(--panel); padding: 8px 18px;
  font-size: 14px; cursor: pointer; border-bottom: none; border-radius: 8px 8px 0 0;
}
.tabs button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
main {
  display: grid; grid-template-columns: 1fr 320px; gap: 16px;
  padding: 0 24px 32px; align-items: start;
}
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 0 8px 8px 8px;
  padding: 18px; min-height: 200px;
}
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.q-label { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.field input, .field select {
  width: 100%; padding: 9px 10px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
.field input:focus, .field select:focus { outline: 2px solid var(--accent); border-color: var(--accent); }

/* ラジオ/チェックボックスの選択肢 */
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice {
  display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 400;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer;
}
.choice:hover { background: #fafbfc; }
.choice input { width: auto; margin: 0; }
.choice input:disabled { cursor: not-allowed; }
.choice:has(input:disabled) { opacity: 0.45; cursor: not-allowed; }
.hint { font-size: 12px; color: #b34a00; }
.other-text { margin-top: 4px; }
.confirm {
  align-self: flex-start; margin-top: 6px; padding: 8px 22px; font-size: 14px;
  background: var(--accent); color: #fff; border: none; border-radius: 6px; cursor: pointer;
}
.confirm:disabled { background: #b9c2cf; cursor: not-allowed; }

/* chatモード */
.chat-log { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.bubble { max-width: 78%; padding: 9px 13px; border-radius: 14px; font-size: 14px; line-height: 1.5; }
.bubble.bot { background: var(--bot); align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.me { background: var(--me); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.chat-input { margin-top: 10px; }

.tablink {
  display: inline-block; padding: 8px 18px; margin-left: 4px; font-size: 14px;
  text-decoration: none; color: var(--accent); border: 1px solid var(--line);
  background: var(--panel); border-bottom: none; border-radius: 8px 8px 0 0;
}
.tablink:hover { background: #fafbfc; }

/* 設定画面 */
.settings-main { display: block; padding: 0 24px 32px; }
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; margin-bottom: 14px;
}
.toolbar button, .file-btn {
  padding: 8px 16px; font-size: 14px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--text);
}
.toolbar .primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.toolbar .ghost { color: #6a737d; }
.file-btn { display: inline-block; }
.status { font-size: 13px; margin-left: auto; }
.status.ok { color: #137333; }
.status.err { color: #c5221f; }

.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
table.editor { border-collapse: collapse; width: 100%; font-size: 13px; }
table.editor th, table.editor td { border: 1px solid var(--line); padding: 5px 6px; text-align: left; }
table.editor th { background: #f0f2f5; font-weight: 600; white-space: nowrap; position: sticky; top: 0; }
table.editor input, table.editor select {
  width: 100%; box-sizing: border-box; padding: 5px 6px; font-size: 13px;
  border: 1px solid var(--line); border-radius: 4px; background: #fff;
}
td.ops { white-space: nowrap; }
.op {
  width: 26px; padding: 4px 0; margin: 0 1px; font-size: 13px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 4px; background: #fff;
}
.op.del { color: #c5221f; }

.help { margin-top: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 18px; }
.help h2 { font-size: 14px; margin: 0 0 8px; }
.help ul { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.8; }
.help code { background: #f0f2f5; padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* アクセスゲート */
.gate {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(20, 24, 30, 0.55); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
}
.gate-card {
  background: #fff; border-radius: 12px; padding: 28px 30px; width: 320px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25); text-align: center;
}
.gate-card h2 { margin: 0 0 16px; font-size: 16px; }
.gate-card input {
  width: 100%; box-sizing: border-box; padding: 10px 12px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 6px;
}
.gate-card input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.gate-err { color: #c5221f; font-size: 13px; min-height: 18px; margin: 8px 0; }
.gate-card button {
  width: 100%; padding: 10px; font-size: 15px; cursor: pointer;
  background: var(--accent); color: #fff; border: none; border-radius: 6px;
}

.result-panel h2 { font-size: 13px; margin: 0 0 8px; color: #6a737d; }
#result {
  margin: 0; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px;
  white-space: pre-wrap; word-break: break-all; color: #1b1f24;
}
