:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #5f6675;
  --line: #e2e5ee;
  --accent: #2f6fed;
  --accent-dark: #1f55c4;
  --accent-soft: #e8f0ff;
  --ok: #1a8f5a;
  --warn-soft: #fff5e0;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic UI", system-ui, sans-serif;
  line-height: 1.6;
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 16px 48px;
  transition: max-width .2s;
}

/* ChatGPT を右半分に開いた後は、画面の左半分に収める */
body.split main {
  margin: 0;
  max-width: 50vw;
  min-width: 320px;
}

h1 { font-size: 1.5rem; margin: 0 0 4px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-top: 16px;
}

.scene { color: var(--muted); margin: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  background: var(--accent-soft);
  color: var(--accent-dark);
}
.btn:hover { filter: brightness(.96); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.big { width: 100%; font-size: 1.25rem; padding: 16px 20px; }
.btn.small { padding: 4px 12px; font-size: .9rem; font-weight: 500; }

.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.steps { margin: 0; padding-left: 1.4em; }
.steps li { margin: 6px 0; }
.steps li.done { color: var(--muted); text-decoration: line-through; }

.notice {
  background: var(--warn-soft);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 10px;
  font-size: .95rem;
}
.hidden { display: none !important; }

.phrases { list-style: none; margin: 0; padding: 0; }
.phrases li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px dashed var(--line);
}
.phrases li:first-child { border-top: 0; }
.phrases .en { font-weight: 700; font-size: 1.08rem; }
.phrases .ja { color: var(--muted); font-size: .9rem; }
body.hide-ja .phrases .ja { visibility: hidden; }
.say {
  flex: none;
  border: 0;
  background: var(--accent-soft);
  border-radius: 50%;
  width: 34px; height: 34px;
  cursor: pointer;
  font-size: 1rem;
}

.target { border: 2px solid var(--accent); }

details.card > summary { cursor: pointer; font-weight: 700; }
details.card[open] > summary { margin-bottom: 8px; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.footer { margin-top: 24px; font-size: .85rem; color: var(--muted); }
.footer a { color: var(--muted); }

/* 先生用ページ */
label { display: block; font-weight: 700; margin: 12px 0 4px; }
label .hint { font-weight: 400; color: var(--muted); font-size: .85rem; }
input[type=text], input[type=url], input[type=number], input[type=date], input[type=password], select, textarea {
  width: 100%;
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}
textarea { resize: vertical; }
textarea.mono { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }
.presets { display: flex; gap: 6px; flex-wrap: wrap; }
.ok { color: var(--ok); font-weight: 700; }
.label-sm { font-weight: 700; font-size: .9rem; margin-bottom: 6px; }
.hint { font-weight: 400; color: var(--muted); font-size: .85rem; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-weight: 500;
}
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
label.chip, label.check { margin: 0; font-weight: 400; }
label.check { display: flex; align-items: center; gap: 6px; padding-top: 8px; }

input[type=range] { width: 100%; accent-color: var(--accent); }

.phrase-row { display: grid; grid-template-columns: 1.2fr 1fr auto auto; gap: 6px; margin-bottom: 6px; align-items: center; }
.phrase-row .del {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  width: 30px; height: 30px; border-radius: 50%; font-size: 1rem;
}
.phrase-row .del:hover { background: #fdecec; color: #c0392b; }
@media (max-width: 560px) { .phrase-row { grid-template-columns: 1fr auto auto; } .phrase-row .pja { grid-column: 1 / 2; } }

details.advanced { margin-top: 14px; }
details.advanced > summary { cursor: pointer; color: var(--muted); font-weight: 700; }

.btn:disabled { opacity: .5; cursor: not-allowed; }

.history { list-style: none; margin: 0; padding: 0; max-height: 240px; overflow: auto; }
.history li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px dashed var(--line); }
.history li:first-child { border-top: 0; }
.history .hdate { color: var(--muted); font-size: .85rem; width: 6.5em; flex: none; }
.history .htitle { flex: 1; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 8px 16px; border-radius: 999px;
}
.pw { display: flex; gap: 6px; align-items: center; }
.pw input { flex: 1; }
.pw .btn { flex: none; }

/* デモ画面・使い方ガイド */
.demo-banner { background: #eef4ff; border: 1px dashed var(--accent); }
.tour-layer { position: fixed; inset: 0; z-index: 1002; pointer-events: none; }
.tour-dim { position: fixed; inset: 0; background: rgba(15, 20, 35, .55); pointer-events: auto; }
.tour-focus {
  position: relative;
  z-index: 1001;
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 0 0 8px var(--card), 0 0 0 11px var(--accent), 0 0 0 9999px rgba(15, 20, 35, .55);
  transition: box-shadow .2s;
}
.tour-bubble {
  position: fixed;
  z-index: 1002;
  pointer-events: auto;
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 18px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  transition: top .2s, left .2s;
}
.tour-count { font-size: .8rem; color: var(--muted); }
.tour-title { margin: 2px 0 8px; font-size: 1.1rem; }
.tour-text { font-size: .95rem; }
.tour-nav { display: flex; gap: 6px; align-items: center; margin-top: 14px; }

/* 生徒用：準備とボタンの説明 */
details.prep > summary { cursor: pointer; font-weight: 700; font-size: 1.1rem; }
details.prep[open] > summary { margin-bottom: 8px; }
.ico { width: 28px; height: 28px; flex: none; color: var(--text); }
.btn-guide { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .btn-guide { grid-template-columns: 1fr; } }
.btn-guide > div { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; }
.btn-guide .ng { background: #fdecec; }
.btn-guide .ok-box { background: #e6f6ee; }
.rules { list-style: none; margin: 0; padding: 0; }
.rules li { display: flex; gap: 10px; align-items: center; padding: 6px 0; }
.rules .ico { width: 24px; height: 24px; }
.notice.opened { background: #e6f6ee; }

/* ===== 生徒用ページ（コンパクト版） ===== */
body.student main { padding-top: 14px; }
.lesson-head h1 { font-size: 1.3rem; margin: 0; }
.lesson-head .scene { font-size: .92rem; }
body.student .card { margin-top: 10px; padding: 14px 16px; }
body.student .notice { margin-top: 8px; }

.flow { margin: 12px 0 0; padding-left: 1.4em; font-size: .95rem; }
.flow li { margin: 3px 0; }
.ico.inline { width: 20px; height: 20px; vertical-align: -5px; margin: 0 2px; }

details.prep { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; font-size: .92rem; }
details.prep > summary { cursor: pointer; font-weight: 700; }
details.prep ul { margin: 6px 0 4px; padding-left: 1.2em; }
details.prep li { margin: 3px 0; }
details.prep .check { padding-top: 4px; }

.talkbar {
  display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center;
  margin-top: 10px; padding: 8px 12px;
  background: #fff8e6; border: 1px solid #f3dfa8; border-radius: 10px;
  font-size: .9rem;
}
.talkbar span { display: inline-flex; align-items: center; gap: 4px; }
.talkbar .ico { width: 20px; height: 20px; }

.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.tabs button {
  border: 1px solid var(--line); background: #fff; color: var(--text);
  border-radius: 999px; padding: 4px 10px; font: inherit; font-size: .85rem; cursor: pointer;
}
.tabs button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }

.phrases.compact li { padding: 6px 0; gap: 8px; align-items: center; }
.phrases.compact .en { font-size: 1.02rem; line-height: 1.35; }
.phrases.compact .ja { font-size: .82rem; line-height: 1.3; }
.phrases.compact .say { width: 30px; height: 30px; font-size: .9rem; }
.phrase-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }

body.student .footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 12px; }

/* 左のウィンドウ（会話中）：始めるための部分は出さず、ルールを上に固定 */
/* ChatGPT を開いた後は、ボタンと準備だけ消して「やりかた」は残す */
body.panel.started #start, body.panel.started #prepCard, body.panel #opened { display: none; }
body.panel.started .flow { margin-top: 0; }
.flow li.done { color: var(--muted); text-decoration: line-through; }
body.panel .lesson-head .scene { display: none; }
body.panel .talkbar { position: sticky; top: 0; z-index: 5; }
