@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Noto+Sans+JP:wght@400;500;700&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a0a1a;
  --panel: rgba(20, 20, 40, 0.6);
  --panel-border: rgba(255, 255, 255, 0.08);
  --primary: #6366f1;
  --primary-light: #818cf8;
  --accent: #ec4899;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --text: #e5e7eb;
  --text-dim: #9ca3af;
  --text-muted: #6b7280;
}

body {
  font-family: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Hiragino Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* === Background === */
.bg-gradient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 20% 80%, rgba(99, 102, 241, 0.15) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 20%, rgba(236, 72, 153, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 50% 50%, rgba(14, 165, 233, 0.08) 0%, transparent 60%);
  will-change: auto;
}
@media (prefers-reduced-motion: no-preference) {
  .bg-gradient { animation: bgShift 20s ease-in-out infinite alternate; }
}
@keyframes bgShift {
  0% { transform: scale(1) rotate(0deg); }
  100% { transform: scale(1.1) rotate(3deg); }
}

.floating-orbs { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.2;
}
@media (prefers-reduced-motion: no-preference) {
  .orb { animation: float 30s ease-in-out infinite; will-change: transform; }
}
.orb:nth-child(1) { width: 300px; height: 300px; background: #6366f1; top: -100px; left: -50px; }
.orb:nth-child(2) { width: 400px; height: 400px; background: #ec4899; top: 50%; right: -100px; animation-delay: -5s; }
.orb:nth-child(3) { width: 250px; height: 250px; background: #0ea5e9; bottom: -50px; left: 50%; animation-delay: -10s; }
@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(50px, -30px); }
  66% { transform: translate(-30px, 50px); }
}

/* === Layout === */
.header, .student-bar, .tabs, .content, .footer { position: relative; z-index: 1; }

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2.5rem;
  background: rgba(10, 10, 26, 0.7);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--panel-border);
}
.logo { display: flex; align-items: center; gap: 1rem; }
.logo-icon { font-size: 2.5rem; }
.logo h1 {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #818cf8, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.tagline { font-size: 0.75rem; color: var(--text-dim); font-weight: 500; }

.header-actions { display: flex; align-items: center; gap: 1rem; }
.mode-badge {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary-light);
  border: 1px solid rgba(99, 102, 241, 0.3);
}
.cost-meter {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.25);
  font-family: 'Inter', monospace;
}
.cost-meter.warn { background: rgba(245, 158, 11, 0.1); color: var(--warning); border-color: rgba(245, 158, 11, 0.25); }
.cost-meter.danger { background: rgba(239, 68, 68, 0.1); color: var(--error); border-color: rgba(239, 68, 68, 0.25); }

/* Parent view (read-only) */
body.parent-view .tabs .tab[data-tab="mentor"],
body.parent-view .tabs .tab[data-tab="essay"],
body.parent-view .tabs .tab[data-tab="diagnostic"] { display: none; }
body.parent-view .student-bar button,
body.parent-view #addStudentBtn,
body.parent-view #importStudentsBtn,
body.parent-view #exportDataBtn,
body.parent-view #openSettings,
body.parent-view #studentSelect { display: none; }
body.parent-view .student-bar label::after { content: "（保護者様専用）"; color: var(--accent); font-weight: 700; margin-left: 0.5rem; }
body.parent-view #currentStudentName { color: var(--text); font-weight: 700; padding: 0.4rem 0.8rem; background: rgba(255,255,255,0.06); border-radius: 8px; font-size: 0.9rem; }

/* Printable */
@media print {
  body { background: white !important; color: #111 !important; }
  .bg-gradient, .floating-orbs, .header, .student-bar, .tabs, .footer,
  .btn-primary, .btn-secondary, .btn-icon, .btn-icon-small,
  .kpi-cards, .charts-row, .summary-header button { display: none !important; }
  .tab-content { display: block !important; }
  .tab-content:not(#tab-parent) { display: none !important; }
  .result-box { background: white !important; color: #111 !important; border: 1px solid #ccc !important; max-height: none !important; }
  .panel-header h2 { color: #111 !important; }
  .parent-summary-box { background: white !important; border: 1px solid #ccc !important; }
}
.mode-badge.demo { background: rgba(245, 158, 11, 0.15); color: var(--warning); border-color: rgba(245, 158, 11, 0.3); }
.mode-badge.live { background: rgba(16, 185, 129, 0.15); color: var(--success); border-color: rgba(16, 185, 129, 0.3); }

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text);
  width: 40px; height: 40px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s;
}
.btn-icon:hover { background: rgba(255, 255, 255, 0.1); transform: translateY(-1px); }

/* ラベル付きナビゲーションピル（textbook-generator header等で使用） */
.btn-nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 40px;
  padding: 0 0.9rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text);
  border-radius: 10px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.2s;
}
.btn-nav-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
  border-color: rgba(129, 140, 248, 0.4);
}
.btn-nav-pill .bnp-icon { font-size: 1rem; line-height: 1; }
.btn-nav-pill .bnp-label { line-height: 1; }

/* ==========================================================================
   管理ナビゲーションバー（ラベル付きアイコン）
   ========================================================================== */
.nav-status-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding-right: 0.75rem;
  border-right: 1px solid var(--panel-border);
}

.nav-bar-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.nav-bar-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.08em;
  padding-left: 0.2rem;
}
.nav-bar-icons {
  display: flex;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 0.4rem 0.5rem;
}

.btn-icon-labeled {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.4rem 0.5rem;
  min-width: 56px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-icon-labeled:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.25);
  transform: translateY(-1px);
}
.btn-icon-labeled .icon {
  font-size: 1.25rem;
  line-height: 1;
}
.btn-icon-labeled .label {
  font-size: 0.65rem;
  color: var(--text-dim);
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.btn-icon-labeled:hover .label { color: var(--text); }

/* 保護者モードでは管理メニュー全体を隠す（設計思想: 顧客には見せない） */
body.parent-view .nav-bar-wrapper,
body.parent-view .nav-status-group { display: none; }

@media (max-width: 1024px) {
  .nav-bar-label { display: none; }
  .btn-icon-labeled { min-width: 48px; padding: 0.3rem; }
  .btn-icon-labeled .label { font-size: 0.6rem; }
}

.btn-icon-small {
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary-light);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s;
}
.btn-icon-small:hover { background: rgba(99, 102, 241, 0.25); }

/* === Student Bar === */
.student-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 2.5rem;
  background: rgba(20, 20, 40, 0.4);
  border-bottom: 1px solid var(--panel-border);
}
.student-bar label { font-weight: 600; color: var(--text-dim); font-size: 0.85rem; }
.student-info { margin-left: auto; display: flex; gap: 1rem; font-size: 0.85rem; color: var(--text-dim); }
.student-info span { padding: 0.3rem 0.7rem; background: rgba(255,255,255,0.05); border-radius: 6px; }

/* === Tabs === */
.tabs {
  display: flex;
  gap: 0.25rem;
  padding: 1rem 2.5rem 0;
  overflow-x: auto;
  scrollbar-width: thin;
}
.tab {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 0.85rem 1.5rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 10px 10px 0 0;
  transition: all 0.2s;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.03); }
.tab.active {
  color: var(--primary-light);
  background: var(--panel);
  border-bottom-color: var(--primary);
}

/* === Content === */
.content {
  padding: 2rem 2.5rem;
  min-height: 60vh;
}
.tab-content { display: none; animation: fadeIn 0.3s; }
.tab-content.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-header { margin-bottom: 1.5rem; }
.panel-header h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.3rem; }
.panel-header p { color: var(--text-dim); font-size: 0.9rem; }

/* === Forms === */
select, input[type="text"], input[type="number"], input[type="password"], input[type="date"], textarea {
  width: 100%;
  padding: 0.7rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  transition: all 0.2s;
  resize: vertical;
}
select:focus, input:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
}

.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* === Buttons === */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border: none;
  padding: 0.8rem 1.8rem;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary.btn-small { padding: 0.5rem 1rem; font-size: 0.8rem; }

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border: 1px solid var(--panel-border);
  padding: 0.8rem 1.8rem;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.1); }
.btn-secondary.btn-small { padding: 0.4rem 0.9rem; font-size: 0.8rem; }

/* === Tutor === */
.tutor-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  height: calc(100vh - 320px);
  min-height: 500px;
}
.tutor-sidebar {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.subject-selector label { font-size: 0.8rem; color: var(--text-dim); display: block; margin-bottom: 0.4rem; }
.session-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.stat {
  background: rgba(99, 102, 241, 0.08);
  padding: 0.75rem;
  border-radius: 10px;
  text-align: center;
  border: 1px solid rgba(99, 102, 241, 0.15);
}
.stat-label { display: block; font-size: 0.7rem; color: var(--text-dim); margin-bottom: 0.2rem; }
.stat-value { font-size: 1.4rem; font-weight: 700; color: var(--primary-light); }

.chat-container {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.message { display: flex; gap: 0.75rem; align-items: flex-start; }
.message.user-msg { flex-direction: row-reverse; }
.msg-avatar {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.user-msg .msg-avatar { background: rgba(236, 72, 153, 0.15); }
.msg-body {
  background: rgba(255, 255, 255, 0.04);
  padding: 0.9rem 1.1rem;
  border-radius: 12px;
  max-width: 75%;
  line-height: 1.6;
  font-size: 0.92rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
  white-space: pre-wrap;
  word-break: break-word;
}
.user-msg .msg-body {
  background: rgba(236, 72, 153, 0.08);
  border-color: rgba(236, 72, 153, 0.2);
}
.ai-msg .msg-body { background: rgba(99, 102, 241, 0.08); border-color: rgba(99, 102, 241, 0.2); }
.msg-body.thinking { color: var(--text-dim); font-style: italic; }

.chat-input-area {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  border-top: 1px solid var(--panel-border);
  background: rgba(0, 0, 0, 0.2);
  align-items: flex-end;
}
.chat-input-area textarea { flex: 1; resize: none; }

.btn-attach {
  width: 44px;
  height: 44px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: var(--primary-light);
  border-radius: 10px;
  font-size: 1.3rem;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.btn-attach:hover {
  background: rgba(99, 102, 241, 0.2);
  transform: translateY(-1px);
}
.btn-attach.has-file {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border-color: transparent;
  animation: pulse-attach 1.5s infinite;
}
@keyframes pulse-attach {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.5); }
  50% { box-shadow: 0 0 0 8px rgba(99, 102, 241, 0); }
}

.chat-attach-preview {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  margin: 0 1rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(236, 72, 153, 0.06));
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 10px;
  position: relative;
}
.chat-attach-preview img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  flex-shrink: 0;
}
.attach-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}
.attach-info span:first-child {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attach-hint {
  font-size: 0.78rem;
  color: var(--primary-light);
}
.attach-remove {
  width: 32px;
  height: 32px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--error);
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 900;
  flex-shrink: 0;
  transition: all 0.2s;
}
.attach-remove:hover {
  background: rgba(239, 68, 68, 0.25);
  transform: scale(1.05);
}

/* 複数画像添付のサムネイル (2026-06-02 最大5枚対応) */
.attach-thumbs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}
.attach-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}
.attach-thumb img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
}
.attach-thumb .attach-thumb-pdf {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #dc2626;
  color: #fff;
  font-weight: 800;
  font-size: 0.7rem;
  border-radius: 8px;
}
.attach-thumb-x {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 900;
  line-height: 1;
  padding: 0;
}

/* チャット回答が maxTokens で途切れた時の「続き」ボタン (2026-06-02) */
.chat-continue-btn {
  display: inline-block;
  margin-top: 0.6rem;
  padding: 0.4rem 0.9rem;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: var(--primary-light);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.chat-continue-btn:hover { background: rgba(99, 102, 241, 0.25); }
.chat-continue-btn:disabled { opacity: 0.6; cursor: default; }

/* メッセージ内の画像表示 */
.message .msg-body img {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  margin-top: 0.5rem;
  border: 1px solid var(--panel-border);
}

/* Speaking practice */
.speaking-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
}
.speaking-sidebar, .speaking-main {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 1.5rem;
}
.speaking-controls { margin-top: 1.5rem; }
.speaking-controls .btn-primary.recording {
  background: linear-gradient(135deg, var(--error), var(--accent));
  animation: pulse-rec 1.5s infinite;
}
@keyframes pulse-rec {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}
.speaking-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--panel-border);
}
.stat-ring {
  text-align: center;
  padding: 0.75rem 0.4rem;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 10px;
}
.ring-label { font-size: 0.7rem; color: var(--text-dim); margin-bottom: 0.3rem; }
.ring-value {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.speaking-session { display: flex; flex-direction: column; gap: 1.25rem; min-height: 500px; }
.ai-prompt-box {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(99, 102, 241, 0.05));
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
}
.ai-prompt-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary-light);
  margin-bottom: 0.5rem;
}
.ai-prompt-text { font-size: 1.05rem; line-height: 1.7; }
.transcript-area {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  min-height: 120px;
}
.transcript-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}
.transcript-box {
  font-size: 1rem;
  line-height: 1.8;
  min-height: 60px;
}
.transcript-placeholder { color: var(--text-muted); font-style: italic; }
.transcript-interim { color: var(--text-dim); font-style: italic; }

.feedback-area {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
}
.feedback-area h3 { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; }
.feedback-content { line-height: 1.8; font-size: 0.92rem; }
.feedback-content h4 { margin: 1rem 0 0.3rem; color: var(--primary-light); font-size: 0.95rem; }
.feedback-content strong { color: var(--accent); }
.feedback-content .highlight-correct { background: rgba(16, 185, 129, 0.15); padding: 0 0.3rem; border-radius: 4px; }
.feedback-content .highlight-wrong { background: rgba(239, 68, 68, 0.15); padding: 0 0.3rem; border-radius: 4px; text-decoration: line-through; }

@media (max-width: 1024px) {
  .speaking-layout { grid-template-columns: 1fr; }
}

/* Moshi image upload */
.moshi-upload {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.08), rgba(99, 102, 241, 0.05));
  border: 1px dashed rgba(236, 72, 153, 0.3);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.25rem;
}
.moshi-header {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text);
}
.badge-new {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  margin-left: 0.4rem;
  letter-spacing: 0.03em;
}
.moshi-hint {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
}
#moshiStatus {
  margin-top: 0.75rem;
  padding: 0.7rem;
  border-radius: 8px;
  font-size: 0.85rem;
}
#moshiStatus.loading { background: rgba(99, 102, 241, 0.1); color: var(--primary-light); }
#moshiStatus.success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
#moshiStatus.error { background: rgba(239, 68, 68, 0.1); color: var(--error); }
#moshiPreview {
  max-width: 100%;
  max-height: 200px;
  border-radius: 8px;
  margin-top: 0.5rem;
  border: 1px solid var(--panel-border);
}

/* Quick-fill bar */
.quick-fill-bar {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(99, 102, 241, 0.05));
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
}
.qf-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--success);
  margin-bottom: 0.6rem;
}
.qf-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.4rem;
}
.qf-btn {
  padding: 0.5rem 0.7rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: var(--success);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.qf-btn:hover {
  background: rgba(16, 185, 129, 0.2);
  transform: translateY(-1px);
}
.qf-status {
  margin-top: 0.6rem;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  font-size: 0.82rem;
  line-height: 1.6;
}
.qf-status.loading { background: rgba(99, 102, 241, 0.1); color: var(--primary-light); }
.qf-status.success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.qf-status.error { background: rgba(239, 68, 68, 0.1); color: var(--error); }

.field-hint-small {
  margin-top: 0.3rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.weakness-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
}
.weakness-chip {
  padding: 0.35rem 0.8rem;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: var(--primary-light);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.weakness-chip:hover {
  background: rgba(99, 102, 241, 0.2);
  transform: translateY(-1px);
}
.weakness-chip.selected {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border-color: transparent;
}

/* 問題生成のレイアウト選択 */
.prob-layout-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}
.prob-layout-opt { cursor: pointer; display: block; }
.prob-layout-opt input { display: none; }
.prob-layout-card {
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid var(--panel-border);
  border-radius: 10px;
  text-align: center;
  transition: all 0.2s;
}
.prob-layout-opt:hover .prob-layout-card { border-color: rgba(99, 102, 241, 0.3); }
.prob-layout-opt input:checked + .prob-layout-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(236, 72, 153, 0.05));
  border-color: var(--primary);
}
.pl-emoji { font-size: 1.5rem; margin-bottom: 0.2rem; }
.pl-title { font-weight: 700; font-size: 0.85rem; margin-bottom: 0.2rem; }
.pl-desc { font-size: 0.7rem; color: var(--text-dim); line-height: 1.5; }
.pl-desc strong { color: var(--accent); }

/* 生成された問題のブロック表示 */
.problem-block {
  background: rgba(99, 102, 241, 0.05);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-left: 4px solid var(--primary);
  border-radius: 0 10px 10px 0;
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
}
.problem-block-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.problem-block-num {
  display: inline-block;
  padding: 0.25rem 0.8rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 800;
}
.problem-source-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.7rem;
  background: rgba(236, 72, 153, 0.12);
  border: 1px solid rgba(236, 72, 153, 0.35);
  color: var(--accent);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.problem-block-body {
  font-size: 0.95rem;
  line-height: 2;
}

.answer-block-v2 {
  background: rgba(236, 72, 153, 0.05);
  border: 1px solid rgba(236, 72, 153, 0.2);
  border-left: 4px solid var(--accent);
  border-radius: 0 10px 10px 0;
  padding: 1rem 1.5rem;
  margin: 0.75rem 0;
}
.answer-block-v2 .ab-label {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}
.answer-block-v2 .ab-content {
  font-size: 0.92rem;
  line-height: 2;
}
.answer-block-v2 .ab-content strong { color: var(--accent); }

.answers-section-header {
  margin: 2.5rem 0 1.5rem;
  padding: 1.5rem 2rem;
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.12), rgba(99, 102, 241, 0.05));
  border: 2px solid rgba(236, 72, 153, 0.3);
  border-radius: 14px;
  text-align: center;
  page-break-before: always;
}
.answers-section-header h2 {
  color: var(--accent) !important;
  font-size: 1.5rem !important;
  border: none !important;
  background: none !important;
}

.reveal-problem-btn {
  margin-top: 1rem;
  padding: 0.55rem 1.1rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(236, 72, 153, 0.08));
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: var(--primary-light);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.reveal-problem-btn:hover { background: rgba(99, 102, 241, 0.25); }
.reveal-hidden { display: none; }
.reveal-hidden.show { display: block; }

/* 🎯 4択ボタン (塾長指示 2026-04-30: 4 択問題はクリック可能ボタン化) */
.problem-choices {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 1rem 0 0.5rem;
}
.problem-choice-btn {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.18s;
  text-align: left;
  width: 100%;
}
.problem-choice-btn:hover:not(:disabled) {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.5);
  transform: translateX(2px);
}
.problem-choice-btn:disabled {
  cursor: default;
  opacity: 0.85;
}
.problem-choice-btn .choice-letter {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.18);
  color: var(--primary-light);
  font-weight: 900;
  font-size: 1rem;
}
.problem-choice-btn .choice-text {
  flex: 1;
  line-height: 1.55;
}
/* 正解クリック時 (緑 + ✓) */
.problem-choice-btn.correct {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.6);
}
.problem-choice-btn.correct .choice-letter {
  background: rgba(34, 197, 94, 0.4);
  color: #d1fae5;
}
/* 不正解クリック時 (赤) */
.problem-choice-btn.incorrect {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.6);
}
.problem-choice-btn.incorrect .choice-letter {
  background: rgba(239, 68, 68, 0.4);
  color: #fee2e2;
}
/* 不正解時に正解の位置を強調 (緑枠線) */
.problem-choice-btn.correct-answer:not(.correct) {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.5);
  border-style: dashed;
}
.problem-feedback {
  margin: 0.6rem 0 0.3rem;
}
.pf-mark {
  display: inline-block;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  font-weight: 800;
  font-size: 0.92rem;
}
.pf-correct { background: rgba(34, 197, 94, 0.15); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.4); }
.pf-incorrect { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.4); }
.pf-skip { background: rgba(251, 191, 36, 0.12); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.3); }

/* 📊 正解率バッジ */
.problem-stats-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid;
}
.problem-stats-fresh { background: rgba(255,255,255,0.05); color: var(--text-dim); border-color: rgba(255,255,255,0.12); }
.problem-stats-good  { background: rgba(34, 197, 94, 0.12); color: #4ade80; border-color: rgba(34, 197, 94, 0.4); }
.problem-stats-mid   { background: rgba(251, 191, 36, 0.12); color: #fbbf24; border-color: rgba(251, 191, 36, 0.4); }
.problem-stats-weak  { background: rgba(239, 68, 68, 0.12); color: #f87171; border-color: rgba(239, 68, 68, 0.4); }

/* Problems layout */
.problems-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 1.5rem;
}
.problems-form, .problems-output {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 1.5rem;
}
.problems-form h3, .problems-output h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
}
.problems-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
@media (max-width: 1024px) {
  .problems-layout { grid-template-columns: 1fr; }
}

/* mypage: アクションボタン強調版（新機能紹介） */
.action-btn-highlight {
  border-color: rgba(236, 72, 153, 0.45) !important;
  background: linear-gradient(135deg, rgba(129, 140, 248, 0.10), rgba(236, 72, 153, 0.08)) !important;
}
.action-btn-highlight:hover {
  border-color: rgba(236, 72, 153, 0.75) !important;
  box-shadow: 0 6px 20px rgba(236, 72, 153, 0.25) !important;
}
.action-badge-new {
  display: inline-block;
  background: linear-gradient(135deg, #f59e0b, #ec4899);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  margin-left: 0.3rem;
  letter-spacing: 0.05em;
  vertical-align: middle;
}

/* 生徒向けテキスト教材生成CTA（問題作成タブ内） */
.student-textbook-cta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 0 1.25rem 0;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, rgba(129, 140, 248, 0.12), rgba(236, 72, 153, 0.10));
  border: 1px solid rgba(129, 140, 248, 0.35);
  border-radius: 14px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.student-textbook-cta:hover {
  transform: translateY(-2px);
  border-color: rgba(236, 72, 153, 0.55);
  box-shadow: 0 8px 24px rgba(129, 140, 248, 0.20);
}
.student-textbook-cta .stc-icon {
  font-size: 2rem;
  line-height: 1;
}
.student-textbook-cta .stc-body { flex: 1; }
.student-textbook-cta .stc-title {
  font-weight: 700;
  font-size: 1.05rem;
  background: linear-gradient(135deg, #818cf8, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.25rem;
}
.student-textbook-cta .stc-desc {
  font-size: 0.85rem;
  color: var(--text-dim);
}
.student-textbook-cta .stc-arrow {
  font-size: 1.5rem;
  color: #ec4899;
  font-weight: 700;
}

/* 模試登録後のメール提案モーダル */
.mep-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.mep-card {
  background: var(--panel-bg);
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: 16px;
  max-width: 540px;
  width: 100%;
  padding: 2rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.25s;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.mep-success {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 1rem;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 10px;
}
.mep-success-icon { font-size: 1.8rem; }
.mep-success-text strong { display: block; font-size: 0.95rem; }
.mep-success-sub { color: var(--text-dim); font-size: 0.82rem; margin-top: 0.2rem; }
.mep-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 1.25rem 0;
}
.mep-title {
  font-size: 1.15rem;
  margin: 0 0 0.5rem;
  background: linear-gradient(135deg, #10b981, #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.mep-desc { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 1rem; }
.mep-preview {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 0.9rem;
  margin-bottom: 1rem;
}
.mep-preview-row {
  font-size: 0.88rem;
  padding: 0.25rem 0;
  word-break: break-word;
}
.mep-label {
  color: var(--text-dim);
  margin-right: 0.4rem;
  display: inline-block;
  min-width: 4em;
}
.mep-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}
.mep-actions button { padding: 0.75rem 1rem; }
.mep-btn-send { font-weight: 700; }
.mep-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  text-align: center;
}

/* メールタブ */
.email-layout {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 1.25rem;
}
@media (max-width: 1024px) { .email-layout { grid-template-columns: 1fr; } }
.email-students-panel, .email-compose-panel, .email-log-panel {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 1.25rem;
}
.email-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.email-panel-header h3 { margin: 0; font-size: 1.05rem; }

.email-students-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 60vh;
  overflow-y: auto;
}
.email-student-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0.9rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  gap: 0.5rem;
}
.esi-info { flex: 1; min-width: 0; }
.esi-name {
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.esi-grade {
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 400;
}
.esi-email { font-size: 0.82rem; margin-top: 0.2rem; }
.esi-email-addr { color: var(--text-dim); word-break: break-all; }
.esi-email-missing { color: #fca5a5; }

.esi-actions {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}
.esi-actions .btn-small {
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  min-width: auto;
}
.esi-actions .btn-small:hover { background: rgba(255, 255, 255, 0.1); }
.email-select-btn {
  background: rgba(16, 185, 129, 0.15) !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
  color: #10b981 !important;
}

.email-compose-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.email-compose-actions button { flex: 1; min-width: 120px; }

.email-log-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 40vh;
  overflow-y: auto;
}
.email-log-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.9rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
}
.eli-subject { font-weight: 600; font-size: 0.88rem; }
.eli-meta { color: var(--text-dim); font-size: 0.78rem; margin-top: 0.15rem; }
.eli-date { color: var(--text-muted); font-size: 0.75rem; white-space: nowrap; }

/* プランインジケーター */
.plan-indicator-bar {
  display: inline-flex;
  align-items: center;
  margin-left: 0.75rem;
  padding: 0.25rem 0.6rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
}

/* 家族ダッシュボード */
.family-empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  max-width: 600px;
  margin: 2rem auto;
}
.family-empty-icon { font-size: 4rem; margin-bottom: 1rem; }
.family-empty-state h3 { font-size: 1.4rem; margin: 1rem 0; }
.family-pricing-card {
  background: rgba(236, 72, 153, 0.08);
  border: 1px solid rgba(236, 72, 153, 0.3);
  border-radius: 14px;
  padding: 1.5rem;
  margin: 1.5rem 0;
}
.family-price-old {
  color: var(--text-muted);
  text-decoration: line-through;
  font-size: 1rem;
}
.family-price-new {
  font-size: 2rem;
  font-weight: 900;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0.5rem 0;
}
.family-price-save {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  display: inline-block;
  font-weight: 700;
}

.family-overview-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 900px) {
  .family-overview-stats { grid-template-columns: repeat(2, 1fr); }
}
.fos-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 1rem;
}
.fos-label {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
}
.fos-value {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.family-students-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}
@media (max-width: 900px) {
  .family-students-grid { grid-template-columns: 1fr; }
}
.family-student-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 1.25rem;
  transition: all 0.2s;
}
.family-student-card.active {
  border-color: rgba(236, 72, 153, 0.5);
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.08), rgba(139, 92, 246, 0.06));
}
.fsc-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  position: relative;
}
.fsc-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 900;
  color: #fff;
}
.fsc-name { font-weight: 700; font-size: 1.1rem; }
.fsc-grade { color: var(--text-dim); font-size: 0.85rem; }
.fsc-active-badge {
  position: absolute;
  right: 0;
  top: 0;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  padding: 0.2rem 0.5rem;
  border-radius: 8px;
  font-size: 0.7rem;
  font-weight: 700;
}
.fsc-stats {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.fsc-stat-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
}
.fsc-stat-label { color: var(--text-dim); }
.fsc-stat-value { font-weight: 600; }

.fsc-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.fsc-actions .btn-small {
  flex: 1;
  padding: 0.5rem 0.7rem;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  min-width: 100px;
}
.fsc-actions .btn-small:hover { background: rgba(255, 255, 255, 0.1); }
.fsc-actions .btn-small.btn-disabled { opacity: 0.5; cursor: default; }
.fsc-actions .btn-small.btn-delete {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

.family-add-slot, .family-full-slot {
  background: rgba(255, 255, 255, 0.02);
  border: 2px dashed var(--panel-border);
  border-radius: 14px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-dim);
  font-size: 0.95rem;
}
.family-add-slot:hover {
  border-color: rgba(236, 72, 153, 0.5);
  background: rgba(236, 72, 153, 0.05);
  color: var(--text);
}
.fas-icon { font-size: 2.5rem; }
.fas-text { text-align: center; }
.fas-text small { color: var(--text-muted); font-size: 0.8rem; }

.family-actions-row {
  display: flex;
  gap: 0.75rem;
  margin-top: 2rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* 模試履歴ストック */
.moshi-layout {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 1.25rem;
}
@media (max-width: 1024px) {
  .moshi-layout { grid-template-columns: 1fr; }
}
.moshi-form-panel, .moshi-list-panel {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 1.25rem;
}
.moshi-form-panel h3, .moshi-list-panel h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.05rem;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.moshi-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.moshi-count-badge {
  display: inline-block;
  background: linear-gradient(135deg, #10b981, #3b82f6);
  color: #fff;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  margin-left: 0.5rem;
  font-weight: 700;
}
.moshi-filters select {
  padding: 0.4rem 0.6rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text);
  border-radius: 8px;
  font-size: 0.85rem;
}
.moshi-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 70vh;
  overflow-y: auto;
}
.moshi-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 12px;
  padding: 1rem;
  transition: transform 0.15s, border-color 0.15s;
}
.moshi-card:hover {
  border-color: rgba(16, 185, 129, 0.45);
  transform: translateY(-1px);
}
.moshi-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.moshi-card-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}
.moshi-card-date {
  font-size: 0.8rem;
  color: var(--text-dim);
}
.moshi-card-body > div {
  margin-bottom: 0.3rem;
  font-size: 0.88rem;
}
.moshi-deviation strong {
  background: linear-gradient(135deg, #3b82f6, #10b981);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 1.1em;
}
.moshi-meta {
  color: var(--text-dim);
}
.moshi-weakness {
  color: #fca5a5;
  font-size: 0.85rem;
}
.moshi-scores {
  color: var(--text-dim);
  font-size: 0.82rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.moshi-card-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}
.moshi-card-actions .btn-small {
  flex: 1;
  min-width: 90px;
  padding: 0.45rem 0.6rem;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.moshi-card-actions .btn-small:hover { background: rgba(255, 255, 255, 0.1); }
.moshi-card-actions .btn-gen-problems {
  background: rgba(129, 140, 248, 0.12);
  border-color: rgba(129, 140, 248, 0.35);
  color: #a5b4fc;
}
.moshi-card-actions .btn-delete-moshi {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

/* 詳細モーダル */
.moshi-detail {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.moshi-detail-inner {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  position: relative;
}
.moshi-detail-close {
  position: sticky;
  top: 0;
  float: right;
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
}
.moshi-detail-meta {
  color: var(--text-dim);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}
.moshi-scores-detail, .moshi-ai-analysis {
  background: rgba(0, 0, 0, 0.3);
  padding: 1rem;
  border-radius: 8px;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.7;
}

/* 問題生成ボタン行: 生成 + リセット */
.gen-btn-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.gen-btn-row .btn-primary { flex: 1; min-width: 200px; }
.btn-reset {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn-reset:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.35);
}
.btn-reset:active { transform: translateY(1px); }

/* === Two-column layouts === */
/* 英作文添削の画像添付 */
.label-with-attach {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}
.label-with-attach label {
  margin-bottom: 0;
}
.btn-attach-small {
  padding: 0.3rem 0.7rem;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: var(--primary-light);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-attach-small:hover {
  background: rgba(99, 102, 241, 0.2);
  transform: translateY(-1px);
}
.btn-attach-small.has-file {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border-color: transparent;
}

.essay-attach-preview {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.75rem 1rem;
  margin-top: 0.5rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(236, 72, 153, 0.05));
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 10px;
}
.essay-attach-preview img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  flex-shrink: 0;
}
.eap-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}
.eap-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.eap-hint {
  font-size: 0.75rem;
  color: var(--primary-light);
}
.eap-remove {
  width: 28px;
  height: 28px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--error);
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 900;
  flex-shrink: 0;
}
.eap-remove:hover { background: rgba(239, 68, 68, 0.25); }

.diagnostic-layout, .curriculum-layout, .essay-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
.diagnostic-input, .diagnostic-output,
.curriculum-form, .curriculum-output,
.essay-input, .essay-output,
.mentor-schedule, .mentor-prep {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 1.5rem;
}
.diagnostic-input h3, .diagnostic-output h3,
.curriculum-form h3, .curriculum-output h3,
.essay-input h3, .essay-output h3,
.mentor-schedule h3, .mentor-prep h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text);
}

.result-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 1.25rem;
  min-height: 200px;
  max-height: 600px;
  overflow-y: auto;
  line-height: 1.7;
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.result-box .placeholder { color: var(--text-muted); font-style: italic; }
.result-box h1, .result-box h2, .result-box h3, .result-box h4 {
  margin: 0.8rem 0 0.4rem;
  color: var(--primary-light);
}
.result-box h1 { font-size: 1.15rem; }
.result-box h2 { font-size: 1.05rem; }
.result-box h3 { font-size: 0.95rem; }
.result-box strong { color: var(--accent); font-weight: 700; }
.result-box ul, .result-box ol { margin: 0.4rem 0 0.4rem 1.5rem; }
.result-box li { margin-bottom: 0.3rem; }
.result-box code {
  background: rgba(0,0,0,0.4);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85em;
  color: #fbbf24;
}

/* === Parent Report === */
.parent-layout { display: flex; flex-direction: column; gap: 1.5rem; }
.kpi-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.kpi-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 1.25rem;
}
.kpi-label { font-size: 0.8rem; color: var(--text-dim); margin-bottom: 0.5rem; }
.kpi-value {
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.3rem;
}
.kpi-trend { font-size: 0.75rem; color: var(--text-muted); }
.kpi-trend.up { color: var(--success); }
.kpi-trend.down { color: var(--error); }

.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.chart-container {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 1.5rem;
  height: 320px;
}
.chart-container h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 1rem; }

.parent-summary-box {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 1.5rem;
}
.summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.summary-header h3 { font-size: 1rem; font-weight: 700; }

/* === Mentor === */
.mentor-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.schedule-list { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1rem; }
.schedule-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.schedule-time {
  font-weight: 700;
  color: var(--primary-light);
  font-size: 0.9rem;
}
.schedule-student { font-size: 0.9rem; }
.schedule-meta { font-size: 0.75rem; color: var(--text-dim); }

/* === Modal === */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(8px);
}
.modal.show { display: flex; }
.modal-content {
  background: linear-gradient(135deg, rgba(30, 30, 60, 0.95), rgba(20, 20, 40, 0.95));
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 2.5rem;
  max-width: 480px;
  width: 90%;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.modal-content h2 { font-size: 1.4rem; font-weight: 700; }
.modal-desc { color: var(--text-dim); font-size: 0.9rem; line-height: 1.6; }
.modal-hint { font-size: 0.75rem; color: var(--text-muted); }
.modal-hint a { color: var(--primary-light); text-decoration: none; }
.modal-hint a:hover { text-decoration: underline; }

/* 🎓 学年・志望校 設定モーダル (塾長指示 2026-05-26) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(8px);
  padding: 1rem;
}
.modal-overlay .modal-content {
  background: linear-gradient(135deg, rgba(30, 30, 60, 0.97), rgba(20, 20, 40, 0.97));
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 0;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}
.modal-overlay .modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.10);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-overlay .modal-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}
.modal-overlay .modal-close {
  background: rgba(255,255,255,0.08);
  border: none;
  color: #cbd5e1;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.modal-overlay .modal-close:hover { background: rgba(255,255,255,0.18); }
.modal-overlay .modal-body { overflow-y: auto; flex: 1; }

.info-edit-btn {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.40);
  color: #c7d2fe;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  margin-right: 0.4rem;
  min-height: 36px;
  white-space: nowrap;
}
.info-edit-btn:hover {
  background: rgba(99, 102, 241, 0.28);
  border-color: rgba(99, 102, 241, 0.65);
  color: #fff;
}
.info-edit-btn.is-unset {
  background: rgba(248, 113, 113, 0.15);
  border-color: rgba(248, 113, 113, 0.45);
  color: #fca5a5;
}
.info-edit-btn.is-unset:hover {
  background: rgba(248, 113, 113, 0.28);
  color: #fff;
}

.grade-preset-btn, .goal-preset-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  color: #e4e4e7;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
  text-align: center;
  min-height: 40px;
}
.grade-preset-btn:hover, .goal-preset-btn:hover {
  background: rgba(99, 102, 241, 0.22);
  border-color: rgba(99, 102, 241, 0.55);
  color: #fff;
}
.grade-preset-btn.is-selected, .goal-preset-btn.is-selected {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  border-color: #6366f1;
  color: #fff;
  font-weight: 700;
}

/* === Footer === */
.footer {
  text-align: center;
  padding: 2rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--panel-border);
  margin-top: 3rem;
}

/* ========================================================================== */
/* 📊 セッション結果モーダル (塾長指示 2026-05-01)                              */
/* ========================================================================== */
.session-result-modal .srm-content {
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.75rem 2rem;
}
.srm-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--panel-border);
}
.srm-close {
  background: transparent; border: 0; color: var(--text-dim);
  font-size: 1.4rem; cursor: pointer; padding: 0.25rem 0.55rem;
  border-radius: 8px; transition: background 0.15s;
}
.srm-close:hover { background: rgba(255,255,255,0.08); color: #fff; }
.srm-body { display: flex; flex-direction: column; gap: 1.1rem; }
.srm-hero {
  text-align: center;
  padding: 1.25rem 1rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
}
.srm-pct {
  font-size: 3.2rem; font-weight: 800; line-height: 1;
  background-clip: text; -webkit-background-clip: text;
  -webkit-text-fill-color: transparent; background-image: linear-gradient(135deg, #818cf8, #ec4899);
}
.srm-pct-good { background-image: linear-gradient(135deg, #34d399, #10b981); -webkit-background-clip: text; }
.srm-pct-mid  { background-image: linear-gradient(135deg, #fbbf24, #f59e0b); -webkit-background-clip: text; }
.srm-pct-weak { background-image: linear-gradient(135deg, #f87171, #ef4444); -webkit-background-clip: text; }
.srm-fraction { font-size: 1.05rem; font-weight: 700; margin-top: 0.4rem; color: #e2e8f0; }
.srm-meta { font-size: 0.85rem; color: var(--text-dim); margin-top: 0.3rem; }
.srm-h3 {
  font-size: 1.05rem; font-weight: 700; color: #e2e8f0;
  margin: 0.4rem 0 0.5rem;
}
.srm-topic-table { display: flex; flex-direction: column; gap: 0.45rem; }
.srm-row {
  display: grid; grid-template-columns: 130px 1fr 100px;
  align-items: center; gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  font-size: 0.85rem;
}
.srm-row-topic { font-weight: 600; color: #e2e8f0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srm-row-bar {
  position: relative; height: 8px;
  background: rgba(255,255,255,0.06); border-radius: 999px; overflow: hidden;
}
.srm-row-bar-fill { position: absolute; left: 0; top: 0; height: 100%; border-radius: 999px; transition: width 0.5s; }
.srm-row-pct { font-weight: 700; text-align: right; font-size: 0.82rem; }
.srm-row-weak { border-color: rgba(239,68,68,0.45); }
.srm-row-weak .srm-row-bar-fill { background: linear-gradient(90deg, #f87171, #ef4444); }
.srm-row-weak .srm-row-topic, .srm-row-weak .srm-row-pct { color: #fca5a5; }
.srm-row-mid .srm-row-bar-fill { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.srm-row-mid .srm-row-pct { color: #fbbf24; }
.srm-row-strong { border-color: rgba(34,197,94,0.4); }
.srm-row-strong .srm-row-bar-fill { background: linear-gradient(90deg, #34d399, #10b981); }
.srm-row-strong .srm-row-topic, .srm-row-strong .srm-row-pct { color: #4ade80; }
.srm-block {
  border-radius: 10px; padding: 0.85rem 1rem; border: 1px solid;
}
.srm-block-head { font-weight: 700; font-size: 0.92rem; margin-bottom: 0.45rem; }
.srm-block-body { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.srm-block-weak { background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.4); }
.srm-block-weak .srm-block-head { color: #fca5a5; }
.srm-block-strong { background: rgba(34,197,94,0.08); border-color: rgba(34,197,94,0.4); }
.srm-block-strong .srm-block-head { color: #4ade80; }
.srm-tag {
  display: inline-block; padding: 0.22rem 0.6rem; border-radius: 999px;
  font-size: 0.78rem; font-weight: 700; border: 1px solid;
}
.srm-tag-weak { color: #fca5a5; background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.4); }
.srm-tag-strong { color: #4ade80; background: rgba(34,197,94,0.12); border-color: rgba(34,197,94,0.4); }
.srm-cta {
  background: linear-gradient(135deg, rgba(99,102,241,0.12), rgba(236,72,153,0.10));
  border: 1px solid rgba(129,140,248,0.4);
  border-radius: 12px; padding: 1rem; text-align: center;
}
.srm-cta-good {
  background: linear-gradient(135deg, rgba(34,197,94,0.10), rgba(16,185,129,0.10));
  border-color: rgba(34,197,94,0.4);
}
.srm-cta-text { font-size: 0.92rem; margin: 0 0 0.7rem; color: #e2e8f0; }
.srm-cta-btn {
  display: inline-block; padding: 0.7rem 1.4rem; border-radius: 999px;
  background: linear-gradient(135deg, #6366f1, #ec4899); color: #fff;
  font-weight: 700; text-decoration: none; font-size: 0.9rem;
  transition: transform 0.15s;
}
.srm-cta-btn:hover { transform: translateY(-1px); text-decoration: none; }
.srm-details {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--panel-border);
  border-radius: 10px; padding: 0.6rem 0.85rem;
  font-size: 0.85rem;
}
.srm-details summary {
  cursor: pointer; font-weight: 700; color: var(--text-dim);
  user-select: none; padding: 0.2rem 0;
}
.srm-details summary:hover { color: #e2e8f0; }
.srm-detail-table {
  width: 100%; margin-top: 0.6rem; border-collapse: collapse;
  font-size: 0.82rem;
}
.srm-detail-table th, .srm-detail-table td {
  padding: 0.4rem 0.55rem; text-align: left;
  border-bottom: 1px solid var(--panel-border);
}
.srm-detail-table th { color: var(--text-dim); font-weight: 700; }
.srm-mark-ok { color: #4ade80; font-weight: 700; }
.srm-mark-ng { color: #f87171; font-weight: 700; }
.srm-footer {
  display: flex; justify-content: flex-end; gap: 0.5rem;
  margin-top: 1rem; padding-top: 0.85rem;
  border-top: 1px solid var(--panel-border);
}

/* === モバイル対応: セッション結果モーダル (塾長指示 2026-05-01) === */
@media (max-width: 600px) {
  .session-result-modal .srm-content {
    max-width: 95%;
    padding: 1.25rem 1rem;
    max-height: 92vh;
  }
  .srm-pct { font-size: 2.5rem; }
  .srm-row {
    grid-template-columns: 100px 1fr 80px;
    gap: 0.45rem;
    font-size: 0.78rem;
  }
  .srm-row-pct { font-size: 0.74rem; }
  .srm-cta-btn { padding: 0.6rem 1.1rem; font-size: 0.85rem; }
  .srm-detail-table { font-size: 0.76rem; }
  .srm-detail-table th, .srm-detail-table td { padding: 0.3rem 0.4rem; }
}

/* === Responsive === */
@media (max-width: 1024px) {
  .tutor-layout, .diagnostic-layout, .curriculum-layout, .essay-layout, .mentor-layout {
    grid-template-columns: 1fr;
  }
  .kpi-cards { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
  /* 🎯 2026-05-18 塾長指示: スマホ/タブレットで会話欄を最大化
     sidebar (累計/クリア) を横一列コンパクトに → chat が画面の大半を占める */
  .tutor-layout {
    grid-template-rows: auto 1fr;
    height: calc(100vh - 240px);
    min-height: 520px;
  }
  .tutor-sidebar {
    flex-direction: row;
    align-items: center;
    padding: 0.6rem 0.75rem;
    gap: 0.5rem;
  }
  .tutor-sidebar .session-stats {
    flex: 1;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }
  .tutor-sidebar .stat { padding: 0.4rem 0.5rem; }
  .tutor-sidebar .stat-label { font-size: 0.65rem; margin-bottom: 0.1rem; }
  .tutor-sidebar .stat-value { font-size: 1.05rem; }
  .tutor-sidebar #clearChat { white-space: nowrap; flex-shrink: 0; }
  .chat-messages .msg-body { max-width: 86%; }
}
@media (max-width: 640px) {
  .header, .student-bar, .content, .tabs { padding-left: 1rem; padding-right: 1rem; }
  .form-row { grid-template-columns: 1fr; }
  .kpi-cards { grid-template-columns: 1fr; }
  /* 🎯 スマホ縦持ち時: 余白を切り詰めて chat-messages に最大限を割り当て */
  .tutor-layout { height: calc(100vh - 200px); min-height: 480px; gap: 0.75rem; }
  .chat-messages { padding: 1rem 0.75rem; gap: 0.75rem; }
  .chat-messages .msg-body { max-width: 90%; padding: 0.7rem 0.85rem; font-size: 0.88rem; }
  .chat-messages .msg-avatar { width: 32px; height: 32px; font-size: 1.05rem; }
  .chat-input-area { padding: 0.6rem; gap: 0.4rem; }
  .chat-input-area textarea { font-size: 0.92rem; min-height: 44px; }
  .btn-attach { width: 38px; height: 38px; font-size: 1rem; }
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
::-webkit-scrollbar-thumb { background: rgba(99, 102, 241, 0.3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(99, 102, 241, 0.5); }

/* === 学習計画・管理タブ (Study Plan) === */
.sp-toolbar { display:flex; gap:0.5rem; align-items:center; flex-wrap:wrap; margin-bottom:1rem; padding:0.75rem; background:rgba(99,102,241,0.05); border:1px solid rgba(99,102,241,0.15); border-radius:10px; }
.sp-week-label { font-weight:700; color:var(--text); padding:0 0.5rem; }
.sp-grid { display:grid; grid-template-columns: 300px 1fr; gap:1rem; }
@media (max-width: 900px) { .sp-grid { grid-template-columns: 1fr; } }
.sp-side { display:flex; flex-direction:column; gap:0.75rem; }
.sp-progress-card, .sp-today-card, .sp-add-card { background:rgba(17,24,39,0.6); border:1px solid rgba(99,102,241,0.2); border-radius:10px; padding:0.9rem; }
.sp-progress-card h3, .sp-today-card h3, .sp-add-card h3 { margin:0 0 0.5rem; font-size:0.95rem; color:var(--primary-light); }
.sp-progress-bar { height:10px; background:rgba(0,0,0,0.4); border-radius:5px; overflow:hidden; margin:0.5rem 0; }
.sp-progress-fill { height:100%; background:linear-gradient(90deg,#10b981,#34d399); transition:width 0.4s; }
.sp-progress-stats { display:flex; gap:0.75rem; flex-wrap:wrap; font-size:0.85rem; }
.sp-progress-stats .stat { background:rgba(0,0,0,0.3); padding:0.25rem 0.6rem; border-radius:6px; }
.sp-progress-stats .stat.warn { background:rgba(245,158,11,0.2); color:#fbbf24; }
.sp-progress-stats .stat.danger { background:rgba(239,68,68,0.2); color:#f87171; }
.sp-progress-stats .stat.ok { background:rgba(16,185,129,0.2); color:#34d399; }

.sp-today-list { display:flex; flex-direction:column; gap:0.4rem; font-size:0.9rem; }
/* 🛡️ 2026-05-19 fix (塾長指示「日にちの枠を広げて」): iPhone Safari で input 圧縮を解消
 * 戦略: PC でも mobile でも 2 列 grid に統一 → サイドバー 300px 内に確実収容
 * iOS Safari auto-zoom 防止のため font-size: 16px (1rem) 固定 */
.sp-add-form {
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:0.55rem;
  align-items:stretch;
}
.sp-add-form input,
.sp-add-form select {
  min-width:0;
  padding:0.55rem 0.7rem;
  background:rgba(0,0,0,0.3);
  border:1px solid rgba(99,102,241,0.3);
  border-radius:6px;
  color:var(--text);
  font-size:1rem;            /* 16px: iOS Safari auto-zoom 防止 (audit fix 軽微) */
  min-height:44px;           /* Apple HIG タップターゲット */
  box-sizing:border-box;
  grid-column: span 1;
}
/* text input (material/title) は 2 列分使って full-width 表示 */
.sp-add-form input[type="text"] {
  grid-column: span 2;
}
/* number input の inline max-width:6rem が grid セル幅を破壊するので override (audit fix 重大) */
.sp-add-form input[type="number"] {
  max-width:none !important;
  grid-column: span 1;
}
.sp-add-form button {
  min-width:0;
  min-height:48px;           /* mobile 用に少し大きめ */
  padding:0.55rem 1rem;
  font-size:1rem;
  grid-column: span 1;
}

.sp-week-grid { display:grid; grid-template-columns: repeat(7, 1fr); gap:0.5rem; }
@media (max-width: 1200px) { .sp-week-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 700px)  { .sp-week-grid { grid-template-columns: repeat(2, 1fr); } }

.sp-day { background:rgba(17,24,39,0.6); border:1px solid rgba(99,102,241,0.2); border-radius:10px; padding:0.5rem; min-height:160px; }
.sp-day.today { border-color:rgba(251,191,36,0.6); background:rgba(251,191,36,0.06); box-shadow:0 0 0 1px rgba(251,191,36,0.3); }
.sp-day.weekend { background:rgba(139,92,246,0.05); }
.sp-day-header { display:flex; justify-content:space-between; align-items:baseline; margin-bottom:0.4rem; padding-bottom:0.3rem; border-bottom:1px solid rgba(99,102,241,0.15); }
.sp-day-name { font-weight:700; font-size:0.85rem; color:var(--text); }
.sp-day-count { font-size:0.75rem; color:var(--text-muted); }
.sp-day.today .sp-day-name { color:#fbbf24; }
.sp-day-body { display:flex; flex-direction:column; gap:0.3rem; }

.sp-task { display:flex; align-items:flex-start; gap:0.4rem; padding:0.4rem 0.5rem; background:rgba(0,0,0,0.3); border-radius:6px; font-size:0.8rem; border-left:3px solid transparent; cursor:pointer; transition:background 0.15s; }
.sp-task:hover { background:rgba(99,102,241,0.15); }
.sp-task.completed { opacity:0.55; border-left-color:#10b981; }
.sp-task.completed .sp-task-title { text-decoration:line-through; }
.sp-task.overdue:not(.completed) { border-left-color:#ef4444; background:rgba(239,68,68,0.07); }
.sp-task input[type="checkbox"] { margin-top:0.15rem; cursor:pointer; accent-color:#10b981; }
.sp-task-meta { flex:1; min-width:0; }
.sp-task-title { color:var(--text); line-height:1.3; word-break:break-word; }
.sp-task-sub { font-size:0.7rem; color:var(--text-muted); margin-top:0.1rem; }
.sp-task-subject { display:inline-block; padding:0 0.3rem; border-radius:3px; font-size:0.65rem; font-weight:700; margin-right:0.25rem; }
.sp-subject-英語 { background:rgba(16,185,129,0.25); color:#34d399; }
.sp-subject-数学 { background:rgba(99,102,241,0.25); color:#a5b4fc; }
.sp-subject-国語 { background:rgba(236,72,153,0.25); color:#f9a8d4; }
.sp-subject-理科 { background:rgba(14,165,233,0.25); color:#7dd3fc; }
.sp-subject-社会 { background:rgba(234,179,8,0.25); color:#fde047; }
.sp-subject-その他 { background:rgba(148,163,184,0.25); color:#cbd5e1; }
.sp-task-del { background:none; border:none; color:var(--text-muted); cursor:pointer; padding:0 0.2rem; font-size:0.75rem; opacity:0; transition:opacity 0.15s; }
.sp-task:hover .sp-task-del { opacity:1; }
.sp-task-del:hover { color:#ef4444; }

/* 🎯 学習時間自動計測 タイマー UI (塾長指示 2026-05-18) */
.sp-task.running { border-left-color:#fbbf24 !important; background:rgba(251,191,36,0.12) !important; }
.sp-timer-btn {
  background:rgba(99,102,241,0.20); border:1px solid rgba(99,102,241,0.40);
  color:#a5b4fc; cursor:pointer; padding:0.18rem 0.45rem;
  font-size:0.75rem; font-weight:700; border-radius:6px;
  margin-left:0.2rem; flex-shrink:0;
  white-space:nowrap; transition:all 0.15s;
}
.sp-timer-btn:hover { transform:scale(1.05); }
.sp-timer-start { background:rgba(34,197,94,0.18); border-color:rgba(34,197,94,0.40); color:#86efac; }
.sp-timer-start:hover { background:rgba(34,197,94,0.30); }
.sp-timer-resume { background:rgba(251,191,36,0.18); border-color:rgba(251,191,36,0.40); color:#fde68a; }
.sp-timer-resume:hover { background:rgba(251,191,36,0.30); }
.sp-timer-stop { background:rgba(239,68,68,0.18); border-color:rgba(239,68,68,0.40); color:#fca5a5; font-family:'SF Mono','Monaco',monospace; min-width:60px; }
.sp-timer-stop:hover { background:rgba(239,68,68,0.30); }
/* 🍅 Pomodoro モード時のタイマー表示 (集中フェーズ・カウントダウン色) */
.sp-timer-pomodoro { background:rgba(244,114,182,0.18); border-color:rgba(244,114,182,0.40); color:#f9a8d4; min-width:75px; position:relative; }
.sp-timer-pomodoro:hover { background:rgba(244,114,182,0.30); }
.sp-pomo-cycle { font-size:0.55em; background:#ec4899; color:white; border-radius:50%; padding:0.05em 0.35em; margin-left:0.2em; font-family:system-ui; }

/* 🎴 Flashcard モーダル (塾長指示 2026-05-18 Tier 2) */
.sp-flashcard-modal { position:fixed; top:0; left:0; right:0; bottom:0; z-index:1000; display:flex; align-items:center; justify-content:center; padding:1rem; box-sizing:border-box; }
.sp-flashcard-overlay { position:absolute; top:0; left:0; right:0; bottom:0; background:rgba(0,0,0,0.7); backdrop-filter:blur(4px); }
.sp-flashcard-panel { position:relative; background:#1e293b; border:1px solid rgba(99,102,241,0.30); border-radius:14px; padding:1.2rem; max-width:540px; width:100%; max-height:90vh; overflow-y:auto; box-shadow:0 12px 40px rgba(0,0,0,0.5); }
.sp-flashcard-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:1rem; padding-bottom:0.7rem; border-bottom:1px solid rgba(255,255,255,0.08); }
.sp-flashcard-header h3 { margin:0; font-size:1.05rem; color:#a5b4fc; }
.sp-flashcard-card { transition:transform 0.18s, border-color 0.2s; }
.sp-flashcard-card:hover { transform:scale(1.01); }
.sp-flashcard-card:active { transform:scale(0.99); }
@media (max-width: 640px) {
  .sp-flashcard-panel { padding:1rem; max-height:95vh; }
}
.sp-actual { font-weight:700; }
.sp-actual-ok { color:#86efac; }
.sp-actual-warn { color:#fbbf24; }
.sp-actual-danger { color:#f87171; }
@keyframes pulse {
  0%, 100% { opacity:1; }
  50% { opacity:0.5; }
}

.sp-today-list .sp-task { background:rgba(251,191,36,0.08); }
.sp-today-list .sp-task.completed { background:rgba(16,185,129,0.08); }

/* ==========================================================================
   Before/After 成果ダッシュボード (Progress Dashboard)
   ========================================================================== */
.progress-dashboard {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(59, 130, 246, 0.05));
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 16px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
}
.pd-header { margin-bottom: 1rem; }
.pd-header h3 {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0 0 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.pd-badge-new {
  padding: 0.15rem 0.5rem;
  background: linear-gradient(135deg, #ec4899, #f43f5e);
  color: white;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.05em;
}
.pd-sub {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin: 0;
  line-height: 1.7;
}
.pd-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
}
.pd-empty p { line-height: 1.8; margin: 0.25rem 0; }
.pd-empty strong { color: var(--text); }

.pd-cards {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: stretch;
  margin-bottom: 1.25rem;
}
@media (max-width: 768px) {
  .pd-cards { grid-template-columns: 1fr; }
}
.pd-card {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  text-align: center;
}
.pd-card-before { border-left: 4px solid #3b82f6; }
.pd-card-after { border-left: 4px solid #10b981; }
.pd-card-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
  letter-spacing: 0.05em;
}
.pd-card-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.2rem;
  line-height: 1.4;
}
.pd-card-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}
.pd-card-value {
  font-size: 2.3rem;
  font-weight: 900;
  line-height: 1;
  color: var(--text);
}
.pd-card-before .pd-card-value { color: #60a5fa; }
.pd-card-after .pd-card-value { color: #34d399; }
.pd-card-unit {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 600;
  margin-left: 0.4rem;
  display: inline-block;
  vertical-align: top;
  padding-top: 0.5rem;
}
.pd-arrow-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 0 0.8rem;
  min-width: 140px;
}
.pd-delta-big {
  font-size: 2.8rem;
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(135deg, #10b981, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.pd-delta-big.negative {
  background: linear-gradient(135deg, #f43f5e, #fb7185);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.pd-delta-big.neutral {
  background: linear-gradient(135deg, #9ca3af, #d1d5db);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.pd-delta-unit {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-top: 0.3rem;
}
.pd-period {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  line-height: 1.5;
  text-align: center;
}

.pd-chart-wrap {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 1rem;
  height: 280px;
  position: relative;
  margin-bottom: 1rem;
}

.pd-subjects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.pd-subject-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
}
.pd-subject-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.35rem;
}
.pd-subject-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
}
.pd-subject-before { color: #60a5fa; font-weight: 700; }
.pd-subject-after { color: #34d399; font-weight: 700; }
.pd-subject-arrow { color: var(--text-muted); font-size: 0.75rem; }
.pd-subject-delta {
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  margin-top: 0.3rem;
  display: inline-block;
}
.pd-subject-delta.up { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.pd-subject-delta.down { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
.pd-subject-delta.flat { background: rgba(156, 163, 175, 0.15); color: #9ca3af; }

.pd-share {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-top: 0.8rem;
  border-top: 1px dashed var(--panel-border);
}
.pd-share-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-left: auto;
}
@media (max-width: 768px) {
  .pd-share-hint { margin-left: 0; width: 100%; }
}

/* LP成果統計セクション */
.lp-proof-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  max-width: 1100px;
  margin: 1.5rem auto 0;
}
.lp-proof-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  text-align: center;
  backdrop-filter: blur(10px);
}
.lp-proof-num {
  font-size: 2.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, #10b981, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
  margin-bottom: 0.4rem;
}
.lp-proof-label {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
  line-height: 1.6;
}
.lp-proof-note {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 0.3rem;
}

/* ==========================================================================
   週次自動レポート配信パネル (Weekly Cron Panel)
   ========================================================================== */
.weekly-cron-panel {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(59, 130, 246, 0.06));
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  margin-top: 1.5rem;
}
.wcp-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}
.wcp-header h3 {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0 0 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.wcp-desc { font-size: 0.82rem; color: var(--text-dim); margin: 0; line-height: 1.6; }
.wcp-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.35rem 0.7rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 999px;
  white-space: nowrap;
}
.wcp-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #9ca3af;
}
.wcp-dot.on { background: #10b981; box-shadow: 0 0 10px rgba(16, 185, 129, 0.6); }
.wcp-dot.off { background: #ef4444; }

.wcp-preview-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.75rem;
}
.wcp-preview-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}
.wcp-preview-text {
  margin: 0;
  font-family: 'Inter', monospace;
  font-size: 0.82rem;
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.7;
  min-height: 80px;
}
.wcp-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.wcp-setup {
  margin-top: 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}
.wcp-setup summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-dim);
}
.wcp-setup summary:hover { color: var(--text); }
.wcp-setup-steps {
  margin: 0.75rem 0 0 1.25rem;
  padding: 0;
  font-size: 0.8rem;
  line-height: 1.8;
  color: var(--text-dim);
}
.wcp-setup-steps code {
  background: rgba(0, 0, 0, 0.4);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  color: #fbbf24;
  font-size: 0.88em;
}

/* ==========================================================================
   過去問類題モード (Past Exam Mode)
   ========================================================================== */
.past-exam-group {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(236, 72, 153, 0.04));
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-top: 0.75rem;
}
.past-exam-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  flex-wrap: wrap;
  margin-bottom: 0 !important;
}
.past-exam-toggle input[type="checkbox"] {
  width: 1.1em;
  height: 1.1em;
  accent-color: #fbbf24;
  cursor: pointer;
  flex-shrink: 0;
}
.past-exam-toggle strong { color: #fbbf24; }
.past-exam-hint {
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 500;
  width: 100%;
  margin-left: 1.9em;
  margin-top: 0.25rem;
}
.past-exam-panel {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed rgba(251, 191, 36, 0.25);
}
.past-exam-preview {
  margin-top: 0.75rem;
  padding: 0.85rem 1rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-left: 3px solid #fbbf24;
  border-radius: 0 8px 8px 0;
  font-size: 0.8rem;
  line-height: 1.7;
  color: var(--text);
}
.past-exam-preview-title {
  font-weight: 700;
  color: #fbbf24;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
}
.past-exam-preview-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.past-exam-preview-list li {
  padding: 0.2rem 0;
  border-bottom: 1px dotted rgba(255, 255, 255, 0.08);
}
.past-exam-preview-list li:last-child { border-bottom: none; }
.past-exam-preview-list strong { color: #fde68a; }
.past-exam-preview-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
}

.quality-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.9rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}
.quality-toggle input { accent-color: #fbbf24; width: 1em; height: 1em; }
.quality-toggle strong { color: #fbbf24; }
.quality-toggle-hint { color: var(--text-dim); font-size: 0.76rem; font-weight: 500; width: 100%; margin-left: 1.5em; }

.gen-progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.75rem;
}
.gen-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  width: 0%;
  transition: width 0.3s ease;
}
.gen-batch-badges {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}
.gen-batch-badge {
  padding: 0.3rem 0.7rem;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary-light);
  transition: all 0.2s;
}
.gen-batch-badge.done {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.1));
  border-color: rgba(16, 185, 129, 0.35);
  color: #34d399;
}
.gen-batch-badge.loading {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(236, 72, 153, 0.05));
  border-color: rgba(251, 191, 36, 0.35);
  color: #fbbf24;
  animation: pulse-badge 1.2s ease-in-out infinite;
}
@keyframes pulse-badge {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* =================================================================
   Mobile responsive fix for header, student-bar, nav
   Fixes: Japanese text character-stacking on narrow screens
   ================================================================= */
@media (max-width: 768px) {
  /* Header: stack vertically on mobile so .logo isn't squeezed */
  .header {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem;
    gap: 0.75rem;
  }
  .logo { width: 100%; min-width: 0; }
  .logo > div { min-width: 0; flex: 1; }
  .logo h1 { font-size: 1.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tagline { font-size: 0.68rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .logo-icon { font-size: 2rem; flex-shrink: 0; }

  .header-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .nav-status-group { flex-shrink: 0; }
  .nav-bar-wrapper { width: 100%; }
  .nav-bar-icons {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.35rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .btn-icon-labeled { flex-shrink: 0; }
  .btn-icon-labeled .label { white-space: nowrap; }

  /* Student bar: wrap so buttons aren't squeezed into 1-char-wide boxes */
  .student-bar {
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    gap: 0.5rem;
  }
  .student-bar label { white-space: nowrap; }
  #studentSelect { flex: 1 1 auto; min-width: 120px; max-width: 100%; }
  .btn-icon-small { white-space: nowrap; flex-shrink: 0; }
  .student-info { margin-left: 0; width: 100%; flex-wrap: wrap; }

  /* Tabs scroll horizontally, don't squeeze */
  .tabs { padding: 0.75rem 1rem 0; }
  .tab { white-space: nowrap; flex-shrink: 0; padding: 0.7rem 1rem; font-size: 0.85rem; }

  /* Content padding tighter on mobile */
  .content { padding: 1rem; }

  /* Plan indicator badge nowrap */
  .plan-indicator-bar { white-space: nowrap; flex-shrink: 0; }
}

/* Even tighter for small phones */
@media (max-width: 400px) {
  .logo h1 { font-size: 1rem; }
  .tagline { font-size: 0.62rem; }
  .btn-icon-labeled { min-width: 42px; padding: 0.25rem; }
  .btn-icon-labeled .label { font-size: 0.55rem; }
}
