/* コマンド道場
   配置: 上に見出しと記録、その下にタブ。ミッション画面は左に「場面とゴール」、右に「ターミナルと文の分解」。
   色: インディゴ(コマンド) / 琥珀(オプション) / 青緑(引数) の3役を、全画面で同じ意味に固定する。 */
:root {
  --bg: #edf0f4;
  --surface: #ffffff;
  --surface-2: #f5f7fa;
  --ink: #1a2130;
  --muted: #586174;
  --line: #d3d9e3;
  --accent: #2b45d6;
  --on-accent: #ffffff;
  --cmd: #2b45d6;
  --cmd-bg: #e4e9ff;
  --opt: #a34504;
  --opt-bg: #fbe8d5;
  --arg: #0b6f64;
  --arg-bg: #d6f1ec;
  --ok: #157a3a;
  --ok-bg: #ddf3e4;
  --err: #b7332a;
  --err-bg: #fbe3e0;

  --t-bg: #0f1522;
  --t-bar: #182033;
  --t-ink: #e3e8f2;
  --t-dim: #8a94aa;
  --t-dir: #8fb0ff;
  --t-prompt: #7fd8b0;
  --t-err: #ff9a91;
  --t-tr: #232e4a;
  --t-tr-ink: #f6e7c1;
  --t-ok: #8ee3a8;

  --font-ui: 'Zen Kaku Gothic New', 'Hiragino Sans', 'Yu Gothic', 'Noto Sans JP', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --font-display: 'Dela Gothic One', 'Zen Kaku Gothic New', 'Hiragino Sans', sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0d121a;
    --surface: #161c27;
    --surface-2: #1c2331;
    --ink: #e6eaf2;
    --muted: #9aa4b8;
    --line: #2a3243;
    --accent: #8197ff;
    --on-accent: #0d121a;
    --cmd: #9db0ff;
    --cmd-bg: #222b52;
    --opt: #f2a768;
    --opt-bg: #3b2a1b;
    --arg: #55d6c3;
    --arg-bg: #153330;
    --ok: #62d68a;
    --ok-bg: #163322;
    --err: #ff8f86;
    --err-bg: #3a1d1b;
    --t-bg: #080c13;
    --t-bar: #121929;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #0d121a;
  --surface: #161c27;
  --surface-2: #1c2331;
  --ink: #e6eaf2;
  --muted: #9aa4b8;
  --line: #2a3243;
  --accent: #8197ff;
  --on-accent: #0d121a;
  --cmd: #9db0ff;
  --cmd-bg: #222b52;
  --opt: #f2a768;
  --opt-bg: #3b2a1b;
  --arg: #55d6c3;
  --arg-bg: #153330;
  --ok: #62d68a;
  --ok-bg: #163322;
  --err: #ff8f86;
  --err-bg: #3a1d1b;
  --t-bg: #080c13;
  --t-bar: #121929;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.75;
  padding-block: 20px 56px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.app {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
h1,
h2,
h3,
p,
ul,
ol {
  margin: 0;
}
button,
input {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- ヘッダー ---------- */
.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px 24px;
  flex-wrap: wrap;
}
.brand {
  min-width: 0;
  flex: 1 1 360px;
}
.brand h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.2;
  letter-spacing: 0.02em;
}
.brand p {
  color: var(--muted);
  font-size: 14px;
  margin-top: 4px;
  text-wrap: balance;
}
.stats {
  display: flex;
  gap: 10px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 14px;
  display: flex;
  align-items: baseline;
  gap: 4px;
  line-height: 1.3;
}
.stat b {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.stat .of {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
}
.stat small {
  font-size: 12px;
  color: var(--muted);
  margin-left: 6px;
}

/* ---------- タブ ---------- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.tab {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 10px 18px 9px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover {
  color: var(--ink);
}
.tab[aria-selected='true'] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}
.badge {
  display: inline-block;
  min-width: 22px;
  padding: 0 6px;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--opt);
  color: var(--surface);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 20px;
  text-align: center;
}

/* ---------- 共通部品 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
}
.eyebrow {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.06em;
}
.lead {
  color: var(--muted);
  font-size: 15px;
  max-width: 62ch;
}
.btn {
  appearance: none;
  background: var(--accent);
  color: var(--on-accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 9px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s;
}
.btn:hover {
  filter: brightness(1.08);
}
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn.ghost:hover {
  background: var(--surface-2);
  filter: none;
}
.btn[disabled] {
  opacity: 0.5;
  cursor: default;
}
.row-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
  line-height: 1.5;
  padding: 1px 8px;
  border-radius: 6px;
  white-space: nowrap;
}
.chip.big {
  font-size: 22px;
  padding: 4px 14px;
  border-radius: 8px;
}
.k-cmd {
  background: var(--cmd-bg);
  color: var(--cmd);
}
.k-opt {
  background: var(--opt-bg);
  color: var(--opt);
}
.k-arg {
  background: var(--arg-bg);
  color: var(--arg);
}
.k-redir {
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
}
.k-bad {
  background: var(--err-bg);
  color: var(--err);
}

/* ---------- ミッション一覧のコマ ---------- */
.pips-row {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
}
.tab-extra .row-actions {
  flex: 0 0 auto;
}
.tab-extra .clear[hidden] {
  display: none;
}
.tab-extra .clear {
  flex: 1 1 0;
  min-width: 0;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 4px 14px;
  padding: 8px 14px;
}
.tab-extra .clear-title {
  font-size: 16px;
}
.tab-extra .clear p:not(.clear-title) {
  font-size: 13px;
  text-align: right;
  flex: 1 1 200px;
}
.tab-extra .clear #mClearText:empty {
  display: none;
}
.tab-extra .clear .btn {
  padding: 6px 14px;
  font-size: 14px;
}
.pips-row .pips {
  flex: 0 0 auto;
  max-width: 55%;
}
.pips {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}
.pips-wrap {
  flex: 1 1 100%;
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pips-row .pips-wrap .pips {
  max-width: none;
}
.part-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
}
.part-tab {
  flex: 0 0 auto;
  white-space: nowrap;
}
.part-tab {
  appearance: none;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: none;
  padding: 6px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: -1px;
}
.part-tab:hover {
  color: var(--ink);
}
.part-tab[aria-selected='true'] {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
  border-bottom: 1px solid var(--surface);
}
.pip {
  appearance: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  color: var(--muted);
}
.pip:hover {
  border-color: var(--accent);
}
.pip.done {
  background: var(--ok-bg);
  border-color: var(--ok);
  color: var(--ok);
}
.pip.current {
  border: 2px solid var(--accent);
  color: var(--ink);
}

/* ---------- ミッション画面 ---------- */
.mission-grid {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.mission {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.mission h2 {
  font-size: 22px;
  line-height: 1.4;
  text-wrap: balance;
}
.scene {
  color: var(--ink);
}
.goal {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 12px 14px;
}
.goal .label {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.08em;
}
.goal p {
  font-weight: 700;
}
.fold {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.fold summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 15px;
}
.fold p {
  margin-top: 8px;
  font-size: 15px;
  color: var(--muted);
}
.clear {
  background: var(--ok-bg);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}
.clear-title {
  font-weight: 700;
  color: var(--ok);
  font-size: 18px;
}
.clear p:not(.clear-title) {
  font-size: 15px;
}

/* ---------- ターミナル ---------- */
.work {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.terminal {
  background: var(--t-bg);
  color: var(--t-ink);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
}
.term-bar {
  background: var(--t-bar);
  color: var(--t-dim);
  font-size: 12px;
  padding: 7px 14px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.term-out {
  padding: 12px 14px 4px;
  min-height: 280px;
  max-height: 440px;
  overflow-y: auto;
}
.line {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.line .dim {
  color: var(--t-dim);
}
.line .dir {
  color: var(--t-dir);
  font-weight: 600;
}
.line.echo .p {
  color: var(--t-prompt);
}
.line.info {
  color: var(--t-dim);
}
.line.err {
  color: var(--t-err);
}
.line.success {
  color: var(--t-ok);
  font-weight: 600;
  margin-top: 6px;
}
.tr {
  background: var(--t-tr);
  color: var(--t-tr-ink);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 4px 0 10px;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.7;
}
.tr .tr-head {
  font-weight: 700;
}
.tr .tr-fix {
  display: block;
  opacity: 0.9;
}
.tr .words {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 4px;
  font-size: 13px;
}
.tr .words span {
  white-space: normal;
}
.tr .words b {
  font-family: var(--font-mono);
  font-weight: 500;
}
.term-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 14px 14px;
}
.prompt {
  color: var(--t-prompt);
  white-space: nowrap;
}
.term-line input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  color: var(--t-ink);
  font-family: inherit;
  font-size: inherit;
  padding: 2px 0;
  caret-color: var(--t-prompt);
}
.term-line input:focus {
  outline: none;
}
.term-line:focus-within {
  box-shadow: inset 0 2px 0 var(--t-prompt);
}

/* ---------- 分解表示 ---------- */
.breakdown {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
}
.mission {
  position: relative;
  max-height: calc(100vh - 24px);
}
.mission-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  max-height: calc(100vh - 24px - 40px);
  overflow-y: auto;
}
.tips {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 20;
}
.tips-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 18px;
  line-height: 1;
  cursor: help;
}
.tips-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: min(460px, 90vw);
  box-shadow: 0 8px 24px rgba(20, 30, 60, 0.18);
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.12s;
}
.tips-pop::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 8px;
}
.tips:hover .tips-pop,
.tips:focus-within .tips-pop {
  visibility: visible;
  opacity: 1;
}
.bd-head h3 {
  font-size: 16px;
}
.legend {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: center;
}
.bd-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bd-row {
  display: grid;
  grid-template-columns: minmax(64px, max-content) minmax(0, 1fr);
  gap: 4px 12px;
  align-items: start;
}
.bd-row .chip {
  justify-self: start;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bd-kind {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.bd-desc {
  font-size: 15px;
  line-height: 1.6;
}
.bd-empty {
  color: var(--muted);
  font-size: 15px;
}

/* ---------- 復習 ---------- */
.review {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.review h2 {
  font-size: 22px;
}
.due-line {
  font-weight: 700;
}
.cards-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}
.cards-list li {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.cards-list .when {
  font-size: 13px;
  color: var(--muted);
}
.cards-list .when.due {
  color: var(--opt);
  font-weight: 700;
}
.cards-list .name {
  font-family: var(--font-mono);
  font-weight: 600;
  overflow-wrap: anywhere;
}
.rv-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.rv-prompt {
  font-family: var(--font-mono);
  color: var(--muted);
}
.rv-form input {
  flex: 1 1 220px;
  min-width: 0;
  background: var(--t-bg);
  color: var(--t-ink);
  font-family: var(--font-mono);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
}
.rv-feedback {
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
}
.rv-feedback.good {
  background: var(--ok-bg);
}
.rv-feedback.bad {
  background: var(--err-bg);
}
.rv-feedback b {
  font-family: var(--font-mono);
}

/* ---------- 辞書 ---------- */
.section-title {
  font-size: 20px;
  margin-top: 6px;
}
.grammar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.grammar h2 {
  font-size: 20px;
}
.sentence {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.sentence-notes {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  font-size: 15px;
}
.dict-grid,
.err-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 12px;
}
.dict-card,
.err-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.dict-name {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.dict-name b {
  font-family: var(--font-mono);
  font-size: 22px;
  color: var(--cmd);
}
.dict-name span {
  font-size: 12px;
  color: var(--muted);
}
.dict-use {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.dict-opts,
.dict-ex {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
}
.dict-ex code,
.dict-opts code,
.err-card code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 5px;
  overflow-wrap: anywhere;
}
.dict-opts code {
  color: var(--opt);
}
.err-card code {
  display: block;
  color: var(--err);
  background: var(--err-bg);
  padding: 6px 10px;
}
.err-card .ja {
  font-weight: 700;
}
.err-card .fix {
  font-size: 14px;
  color: var(--muted);
}

/* ---------- 幅が狭いとき ---------- */
@media (max-width: 860px) {
  .mission-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .term-out {
    min-height: 240px;
    max-height: 360px;
  }
}
@media (max-width: 480px) {
  .card {
    padding: 16px;
  }
  .term-out,
  .term-line {
    padding-left: 12px;
    padding-right: 12px;
  }
  .stat b {
    font-size: 20px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Tips：実行結果の読み方 ---------- */
.read-box {
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.read-box h3 {
  font-size: 15px;
  margin-bottom: 4px;
}
.read-box p {
  font-size: 14px;
  line-height: 1.7;
}
.tips-pop .bd-list {
  max-height: 34vh;
  overflow-y: auto;
}

/* ---------- ミッションカードのアコーディオン ---------- */
.accordion {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fold[open] > summary {
  margin-bottom: 6px;
}
.fold .legend {
  margin: 0 0 8px;
}
.fold .bd-list {
  max-height: 300px;
  overflow-y: auto;
}
.ans-term {
  background: var(--t-bg);
  color: var(--t-ink);
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
}

/* ---------- タブ行の右側：「最初から」と「クリア」の表示 ---------- */
.tabs {
  align-items: center;
  flex-wrap: wrap;
  overflow: visible;
}
.tab-extra {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 420px;
  justify-content: flex-end;
  padding-bottom: 4px;
}
.tab-extra[hidden] {
  display: none;
}
.tab-extra .btn {
  padding: 6px 14px;
  font-size: 14px;
}
.tab-extra .clear {
  flex: 0 1 auto;
}
.tab-extra .clear p:not(.clear-title) {
  font-size: 12px;
  line-height: 1.4;
  flex: 0 1 auto;
  max-width: 440px;
}

/* ---------- 画面の高さに収める（広い画面のみ） ---------- */
@media (min-width: 861px) and (min-height: 600px) {
  body {
    height: 100vh;
    box-sizing: border-box;
    padding-block: 12px;
    overflow: hidden;
  }
  .app {
    height: 100%;
    min-height: 0;
    gap: 10px;
  }
  .brand h1 {
    font-size: 30px;
  }
  .brand p {
    font-size: 13px;
    line-height: 1.5;
  }
  #panel-mission:not([hidden]) {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  #panel-review:not([hidden]),
  #panel-dict:not([hidden]) {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }
  .pips-row {
    flex: 0 0 auto;
    margin-bottom: 8px;
  }
  .mission-grid {
    flex: 1;
    min-height: 0;
    align-items: stretch;
  }
  .mission {
    max-height: none;
    min-height: 0;
    height: 100%;
    overflow: hidden;
  }
  .mission-body {
    flex: 1;
    max-height: none;
    min-height: 0;
  }
  .work {
    min-height: 0;
    height: 100%;
  }
  .terminal {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  .term-out {
    flex: 1;
    min-height: 0;
    max-height: none;
  }
}

/* ---------- 広告枠（ターミナル 2 : 広告 1） ---------- */
.ad-slot {
  position: relative;
  min-height: 110px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.ad-label {
  position: absolute;
  top: 6px;
  left: 10px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.1em;
}
.ad-body {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
}
@media (min-width: 861px) and (min-height: 600px) {
  .terminal {
    flex: 2 1 0;
  }
  .ad-slot {
    flex: 1 1 0;
    min-height: 0;
  }
}

/* ---------- 左右の広告枠 ---------- */
body {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 16px;
}
.app {
  flex: 0 1 1180px;
  min-width: 0;
  margin: 0;
}
.ad-slot.ad-side {
  display: none;
  flex: 1 1 160px;
  max-width: 300px;
  min-width: 0;
  min-height: 600px;
  align-self: stretch;
}
/* 右側だけ：アプリを左に寄せ、その右に広告を置く */
@media (min-width: 1390px) {
  body {
    justify-content: flex-start;
  }
  .ad-slot.ad-side.ad-right {
    display: flex;
  }
}
/* 両側：アプリを中央に置き、左右に広告を置く */
@media (min-width: 1570px) {
  body {
    justify-content: center;
  }
  .ad-slot.ad-side.ad-left {
    display: flex;
  }
}
@media (min-width: 861px) and (min-height: 600px) {
  .ad-slot.ad-side {
    min-height: 0;
  }
}

/* ---------- 道場一覧へ戻るリンク ---------- */
.brand .back {
  display: inline-block;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 2px;
}
.brand .back:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ---------- OS（Windows / Mac / Linux）の切り替え ---------- */
.os-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  margin-right: 12px;
}
.os-switch[hidden] {
  display: none;
}
.os-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  padding: 0 6px 0 10px;
  letter-spacing: 0.08em;
}
.os-btn {
  appearance: none;
  border: 0;
  background: none;
  border-radius: 999px;
  padding: 4px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.os-btn:hover {
  color: var(--ink);
}
.os-btn[aria-pressed='true'] {
  background: var(--accent);
  color: var(--on-accent);
}
.top {
  align-items: center;
}
