/* ThinkBook 共通スタイル — スマホファースト（375px基準）・ライト基調・簿記ティール #0f766e
   ▼方針: 白〜極淡グレー背景 × 簿記ティール。知的・信頼感・清潔感。
           itpass-dojo（シンクパス）のapp.cssを雛形に、ブランド色のみ簿記ティールへ再定義。
           コントラストは白背景でAA以上を死守。
   ▼簿記5要素カラー（仕訳ドリル・精算表等で使用。既存 boki-style.css と統一）
     資産#2563eb・負債#e11d48・純資産#7c3aed・収益#16a34a・費用#ea580c */
:root {
  /* ---- 背景（白〜極淡ブルーグレー） ---- */
  --bg:    #f5f8fc;   /* ページ地。極淡ブルーグレー */
  --bg2:   #eef4fb;   /* 一段沈めた面（メーター溝・解説の地・入力の地） */
  --card:  #ffffff;   /* カード面 */
  --card2: #f3f7fd;   /* カード内の副面（選択肢・サブカード・タイル副面） */

  /* ---- 境界・テキスト ---- */
  --line:  #e3e9f2;   /* 繊細な境界線 */
  --text:  #16263d;   /* 濃紺。本文（白背景で十分なコントラスト） */
  --muted: #5a6b84;   /* ミュート。#fff上で約5.6:1（AA合格） */

  /* ---- ブランド ティールファミリー ---- */
  --brand:      #0f766e;  /* primary（簿記ティール） */
  --brand-deep: #115e59;  /* 濃。ホバー/押下/キーバッジ */
  --brand-soft: #e6f5f3;  /* 淡。淡い面・選択肢ハイライト地 */
  --brand-tint: #c9e9e4;  /* 中淡。枠・アクセント地 */

  /* ---- 簿記5要素カラー（boki-style.cssと統一・アイコンやタグの色分けに使用） ---- */
  --boki-asset:   #2563eb;  /* 資産 */
  --boki-liab:    #e11d48;  /* 負債 */
  --boki-equity:  #7c3aed;  /* 純資産 */
  --boki-revenue: #16a34a;  /* 収益 */
  --boki-expense: #ea580c;  /* 費用 */

  /* ---- 状態色（白背景でAA） ---- */
  --ok:    #1f8a5b;   /* 正解。アクセシブルな緑（#fff上 約4.7:1） */
  --ok-bg: #e7f5ee;   /* 正解の淡い面 */
  --ng:    #c2382f;   /* 不正解。落ち着いた赤（#fff上 約5.6:1） */
  --ng-bg: #fbecea;   /* 不正解の淡い面 */
  --warn:  #b9791a;   /* 注意。琥珀（#fff上 約4.5:1） */
  --gold:  #b8860b;   /* 達成バッジの文字色（ゴールド系・テキストで読める濃度） */
  --gold-line: #e0b84a; /* バッジ枠・装飾用の明るいゴールド */
  --gold-bg: #fdf6e3; /* 達成の淡い面 */

  /* ---- 形・影 ---- */
  --radius: 16px;
  --radius-sm: 12px;
  --shadow:    0 4px 18px rgba(16,38,61,.06), 0 1px 3px rgba(16,38,61,.05);
  --shadow-lg: 0 10px 32px rgba(16,38,61,.12);

  /* ---- 背景の幾何パターン（生徒ポータルの“融合背景”を踏襲） ----
     寂しい無地を避け、ブランド青の極薄テクスチャで奥行きを出す。
     ・glow … 画面上部のやわらかな青みスポット（非反復）
     ・stripe … 45°の極薄ストライプ（反復・全面）
     ・dot … 濃色パネルに重ねる白ドット（.mission等のヒーロー面用） */
  --bg-glow:   radial-gradient(1100px 560px at 50% -12%, rgba(15,118,110,.10) 0%, rgba(15,118,110,0) 62%);
  --bg-stripe: repeating-linear-gradient(45deg,
                 rgba(15,118,110,.035) 0px, rgba(15,118,110,.035) 1px,
                 transparent 1px, transparent 22px);
  --dot-pattern: radial-gradient(circle, rgba(255,255,255,.08) 1px, transparent 1px);

  /* ---- リキッドグラス（すりガラス枠） ----
     半透明の面＋背景ぼかしで、下のテクスチャがうっすら透ける質感。
     ・glass-bg … 面の地（やや透ける白）／strong … 文字が多い面用の濃いめ
     ・glass-blur … backdrop-filter（ぼかし＋彩度上げでガラスらしく）
     ・glass-edge … 枠＋上端ハイライト＋淡い縁取り＋浮き影 を1セットに */
  --glass-bg:        rgba(255,255,255,.60);
  --glass-bg-strong: rgba(255,255,255,.74);
  --glass-border:    rgba(255,255,255,.55);
  --glass-blur:      blur(14px) saturate(150%);
  --glass-edge: inset 0 1px 0 rgba(255,255,255,.75),
                inset 0 -1px 0 rgba(16,38,61,.05),
                0 6px 22px rgba(16,38,61,.08),
                0 1px 3px rgba(16,38,61,.05);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; color: var(--text);
  font-family: "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif; font-size: 16px; line-height: 1.65;
  -webkit-font-smoothing: antialiased; }
html { background: var(--bg); }
/* 全画面共通の融合背景：上部グロー＋全面ストライプを極淡に重ねる（生徒ポータル流用） */
body { min-height: 100vh; background-color: var(--bg);
  background-image: var(--bg-glow), var(--bg-stripe);
  background-repeat: no-repeat, repeat; background-position: top center, top left; }
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; }

/* ===== ヘッダー（白・スティッキー・繊細な影） ===== */
header.app { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.66);
  backdrop-filter: blur(16px) saturate(150%); -webkit-backdrop-filter: blur(16px) saturate(150%);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 2px 14px rgba(16,38,61,.06); }
.hd-inner { display: flex; align-items: center; justify-content: space-between;
  max-width: 760px; margin: 0 auto; padding: 11px 16px; gap: 10px; }
.hd-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px;
  color: var(--text); letter-spacing: -.01em; }
.hd-brand .hd-logo { height: 22px; width: auto; display: block; }
.hd-brand .wm { color: var(--text); }
.hd-brand .wm b { color: var(--brand); font-weight: 800; }
.hd-back { background: #fff; border: 1px solid var(--line); color: var(--brand);
  border-radius: 9px; padding: 7px 11px; font-size: 13px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px; }
.hd-back:active { background: var(--brand-soft); }
.hd-right { display: flex; align-items: center; gap: 10px; }
.hd-user { color: var(--muted); font-size: 14px; max-width: 38vw; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.hd-logout { background: #fff; border: 1px solid var(--line); color: var(--muted);
  border-radius: 9px; padding: 7px 11px; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: border-color .15s, color .15s; }
.hd-logout:active { border-color: var(--brand-tint); color: var(--brand-deep); }
.hd-mypage { display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 9px; background: #fff; border: 1px solid var(--line);
  color: var(--muted); font-size: 16px; text-decoration: none; line-height: 1;
  transition: border-color .15s, color .15s; }
.hd-mypage:hover { border-color: var(--brand-tint); color: var(--brand-deep); }
.hd-mypage:active { background: var(--brand-soft); color: var(--brand-deep); }
.hd-help { display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 9px; background: #fff; border: 1px solid var(--line);
  color: var(--muted); font-size: 15px; text-decoration: none; line-height: 1;
  transition: border-color .15s, color .15s; }
.hd-help:hover { border-color: var(--brand-tint); color: var(--brand-deep); }
.hd-help:active { background: var(--brand-soft); color: var(--brand-deep); }

main { max-width: 760px; margin: 0 auto; padding: 16px 16px 90px; }
h1 { color: var(--text); }

/* ===== カード（リキッドグラス枠） ===== */
.card { background: var(--glass-bg); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border); border-radius: var(--radius);
  padding: 18px 16px; margin-bottom: 14px; box-shadow: var(--glass-edge); }
.card h2 { margin: 0 0 10px; font-size: 18px; color: var(--text); letter-spacing: .01em; }
.muted { color: var(--muted); font-size: 14px; }

/* ===== ボタン（44px以上・親指ゾーン） ===== */
.btn { display: block; width: 100%; min-height: 50px; border: none; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand), var(--brand-deep)); color: #fff;
  font-size: 17px; font-weight: 700; cursor: pointer; letter-spacing: .02em;
  box-shadow: 0 4px 12px rgba(15,118,110,.22);
  transition: transform .07s ease, box-shadow .2s, opacity .2s, background .2s; }
.btn:hover { box-shadow: 0 6px 16px rgba(15,118,110,.28); }
.btn:active { transform: scale(.98); box-shadow: 0 2px 8px rgba(15,118,110,.20); }
.btn:disabled { opacity: .5; box-shadow: none; cursor: default; }
.btn.ghost { background: var(--glass-bg-strong); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1.5px solid var(--brand-tint); color: var(--brand-deep);
  box-shadow: var(--glass-edge); }
.btn.ghost:hover { border-color: var(--brand); }
.btn.ghost:active { background: var(--brand-soft); }
.btn.small { min-height: 44px; font-size: 15px; }
/* 送信中ローディング（任意で .btn.loading を付与） */
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after { content: ''; position: absolute; top: 50%; left: 50%;
  width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.45); border-top-color: #fff;
  animation: tp-spin .7s linear infinite; }
@keyframes tp-spin { to { transform: rotate(360deg); } }

/* ===== 選択肢（クイズ共通） ===== */
.choice-btn { display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left;
  background: #fff; border: 2px solid var(--line); border-radius: var(--radius-sm);
  padding: 13px 14px; margin-bottom: 10px; min-height: 50px; color: var(--text);
  font-size: 16px; cursor: pointer; box-shadow: 0 1px 3px rgba(16,38,61,.04);
  transition: border-color .15s, background .15s, box-shadow .15s, transform .07s; }
.choice-btn:hover { border-color: var(--brand-tint); }
.choice-btn:active { transform: scale(.99); }
.choice-btn .key { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff;
  font-weight: 800; font-size: 14px; }
.choice-btn.correct { border-color: var(--ok); background: var(--ok-bg); box-shadow: 0 2px 8px rgba(31,138,91,.14); }
.choice-btn.correct .key { background: var(--ok); }
.choice-btn.wrong { border-color: var(--ng); background: var(--ng-bg); }
.choice-btn.wrong .key { background: var(--ng); }
.choice-btn:disabled { cursor: default; }

/* ===== 正誤バナー ===== */
.verdict { border-radius: var(--radius-sm); padding: 14px; margin: 12px 0; font-weight: 700; font-size: 17px; }
.verdict.ok { background: var(--ok-bg); color: var(--ok); border: 1.5px solid var(--ok); }
.verdict.ng { background: var(--ng-bg); color: var(--ng); border: 1.5px solid var(--ng); }
.explain { background: var(--bg2); border-left: 4px solid var(--brand); border-radius: 10px;
  padding: 12px 14px; font-size: 15px; margin-top: 8px; color: var(--text); }
.explain b, .explain strong { color: var(--brand-deep); }

/* ===== 進捗メーター ===== */
.meter { background: var(--bg2); border-radius: 999px; height: 14px; overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(16,38,61,.06); }
.meter > i { display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), #2dd4bf); transition: width .5s ease; }
.meter-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px;
  font-size: 14px; color: var(--text); }

/* ===== バッジ ===== */
.badge { display: inline-flex; align-items: center; gap: 6px; background: #fff;
  border: 1px solid var(--line); color: var(--muted); border-radius: 999px;
  padding: 6px 12px; font-size: 13px; margin: 3px 4px 3px 0; }
.badge.earned { border-color: var(--gold-line); color: var(--gold); background: var(--gold-bg); font-weight: 700; }

/* ===== コンボ・スコア表示 ===== */
.combo { font-size: 28px; font-weight: 900; color: var(--gold); text-align: center; }
.bigscore { font-size: 42px; font-weight: 900; text-align: center; margin: 6px 0; color: var(--brand-deep); }

/* ===== メニュータイル（ホーム） ===== */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { background: var(--glass-bg); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border); border-radius: var(--radius);
  padding: 16px 14px; color: var(--text); box-shadow: var(--glass-edge);
  transition: transform .07s ease, box-shadow .2s, border-color .2s; }
.tile:hover { box-shadow: var(--shadow-lg); border-color: var(--brand-tint); }
.tile .ic { font-size: 28px; }
.tile .nm { font-weight: 800; margin-top: 6px; font-size: 15px; color: var(--text); }
.tile .st { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ===== ミッションカード（生徒ポータルのヒーロー帯に合わせ、ドット幾何＋装飾サークルで質感を出す） ===== */
.mission { position: relative; overflow: hidden; border: none; color: #fff;
  background-image: var(--dot-pattern), linear-gradient(135deg, #0f766e, #115e59);
  background-size: 16px 16px, auto;
  box-shadow: 0 8px 24px rgba(17,94,89,.28); }
.mission::before { content: ''; position: absolute; width: 200px; height: 200px;
  border: 40px solid rgba(255,255,255,.06); border-radius: 50%;
  top: -78px; right: -64px; pointer-events: none; }
.mission > * { position: relative; z-index: 1; }
.mission h2 { color: #fff; }
.mission .muted { color: rgba(255,255,255,.82); }
.mission .tag { display: inline-block; background: rgba(255,255,255,.20); color: #fff; font-size: 12px;
  font-weight: 700; border-radius: 7px; padding: 3px 11px; margin-bottom: 8px;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }

/* ===== レベルタブ ===== */
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tabs button { flex: 1; min-height: 44px; border-radius: var(--radius-sm); border: 1px solid var(--glass-border);
  background: var(--glass-bg); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-edge);
  color: var(--muted); font-size: 14px; font-weight: 700; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s; }
.tabs button:hover { border-color: var(--brand-tint); }
.tabs button.active { background: var(--brand); border-color: var(--brand); color: #fff;
  box-shadow: 0 3px 10px rgba(15,118,110,.22); }
.tabs button small { font-weight: 600; opacity: .9; }

/* ===== 入力 ===== */
input[type=text], input[type=email], input[type=password], input[type=number], textarea, select {
  width: 100%; background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  color: var(--text); font-size: 16px; padding: 13px 14px; transition: border-color .15s, box-shadow .15s; }
input[type=text]:focus, input[type=email]:focus, input[type=password]:focus,
input[type=number]:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input::placeholder, textarea::placeholder { color: #97a6bd; }
textarea { resize: vertical; min-height: 90px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 5px; font-weight: 600; }

/* ===== スライダー（損益分岐点） ===== */
input[type=range] { width: 100%; accent-color: var(--brand); height: 34px; }

/* ===== ドラッグ/タップ分類（SWOT） ===== */
.quad { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quad .zone { min-height: 86px; border: 2px dashed var(--line); border-radius: var(--radius-sm);
  padding: 8px; font-size: 13px; background: var(--bg2); color: var(--text);
  transition: border-color .15s, background .15s; }
.quad .zone.hot { border-color: var(--brand); background: var(--brand-soft); }
.quad .zone.good { border-color: var(--ok); background: var(--ok-bg); }
.sortcard { background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px; font-size: 15px; font-weight: 600; text-align: center; color: var(--text);
  box-shadow: 0 1px 3px rgba(16,38,61,.05); }
.sortcard.active { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }

/* ===== テーブル（先生用） ===== */
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th, table.t td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; color: var(--text); }
table.t th { color: var(--muted); font-weight: 600; font-size: 12px; }

/* ===== グラフ用キャンバス枠 ===== */
.chartbox { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; }

/* ===== トースト ===== */
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); border: none; color: #fff;
  padding: 12px 20px; border-radius: var(--radius-sm); font-size: 15px; opacity: 0; pointer-events: none;
  transition: opacity .3s, transform .3s; z-index: 99; max-width: 90vw;
  box-shadow: 0 8px 28px rgba(16,38,61,.25); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* ===== 全画面ローディング（common.js の showLoading/hideLoading 用） ===== */
.loading-overlay { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  background: rgba(245,248,252,.72); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none; transition: opacity .2s; }
.loading-overlay.show { opacity: 1; pointer-events: auto; }
.loading-overlay .spinner { width: 40px; height: 40px; border-radius: 50%;
  border: 3.5px solid var(--brand-tint); border-top-color: var(--brand);
  animation: tp-spin .7s linear infinite; }
.loading-overlay .msg { color: var(--brand-deep); font-size: 14px; font-weight: 700; }

/* ===== 出現フェード（控えめ） ===== */
@keyframes tp-fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.card, .choice-btn { animation: tp-fade-in .28s ease both; }
@media (prefers-reduced-motion: reduce) {
  .card, .choice-btn, .meter > i, .btn, .tile { animation: none; transition: none; }
  .loading-overlay .spinner, .btn.loading::after { animation: none; }
}

/* 透明効果を抑える設定の端末では、すりガラスを不透明に戻して可読性を確保 */
@media (prefers-reduced-transparency: reduce) {
  .card, .tile, .tabs button, details.growgroup, .app-t { background: var(--card); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .btn.ghost { background: #fff; }
  header.app { background: rgba(255,255,255,.96); }
}

@media (min-width: 700px) { .tiles { grid-template-columns: repeat(3, 1fr); } }

/* 表示制御ユーティリティ（teacher.html等が使用） */
.hidden { display: none !important; }
