/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --purple: #6B5CE7;
  --purple-light: #8B7CF8;
  --purple-dark: #4A3DB5;
  --mint: #4CD9C0;
  --bg: #F8F7FF;
  --card-bg: #FFFFFF;
  --text: #2D2B4E;
  --text-sub: #7B79A8;
  --border: #E8E6FF;
  --required: #6B5CE7;
  --random: #4CD9C0;
  --danger: #FF6B8A;
  --success: #4CD9C0;
  --shadow: 0 4px 20px rgba(107, 92, 231, 0.12);
  --radius: 16px;
  --radius-sm: 8px;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Yu Gothic', 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ── Screen System ────────────────────────────────────────────────────────── */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; }

/* ── Header ──────────────────────────────────────────────────────────────── */
.app-header {
  background: linear-gradient(135deg, var(--purple) 0%, var(--purple-light) 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(107, 92, 231, 0.3);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header h1 { font-size: 1.1rem; font-weight: 700; letter-spacing: 0.02em; }
.header-sub { font-size: 0.75rem; opacity: 0.8; margin-top: 2px; }
.btn-icon { background: rgba(255,255,255,0.2); border: none; color: white;
  padding: 8px 12px; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 0.85rem; transition: background 0.2s; }
.btn-icon:hover { background: rgba(255,255,255,0.3); }

/* ── Home Screen ─────────────────────────────────────────────────────────── */
.home-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  gap: 32px;
}

.home-hero {
  text-align: center;
}

.hero-title {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--purple), var(--mint));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.hero-sub {
  color: var(--text-sub);
  font-size: 0.95rem;
  max-width: 320px;
}

.last-session {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-sub);
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}

.mode-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 400px;
}

.mode-card {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: var(--shadow);
  text-align: left;
}

.mode-card:hover { transform: translateY(-3px); box-shadow: 0 8px 30px rgba(107, 92, 231, 0.2); }
.mode-card:active { transform: translateY(0); }

.mode-card.record { border-color: var(--purple); }
.mode-card.play   { border-color: var(--mint); }

.mode-icon { font-size: 2rem; margin-bottom: 12px; }
.mode-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 6px; }
.mode-card.record .mode-title { color: var(--purple); }
.mode-card.play .mode-title { color: var(--mint); }
.mode-desc { font-size: 0.875rem; color: var(--text-sub); }

.btn-history {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-sub);
  padding: 10px 24px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s;
}
.btn-history:hover { border-color: var(--purple); color: var(--purple); }

/* ── Record Screen ───────────────────────────────────────────────────────── */
.record-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  overflow: hidden;
}

.record-progress {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  grid-column: 1 / -1;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--mint));
  border-radius: 3px;
  transition: width 0.4s ease;
}

.progress-text { font-size: 0.875rem; color: var(--text-sub); white-space: nowrap; }

/* Question panel */
.question-panel {
  padding: 32px 28px;
  background: #FAF9FF;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.badges { display: flex; gap: 8px; }

.badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
}

.badge-section {
  background: rgba(107, 92, 231, 0.1);
  color: var(--purple);
}

.badge-required {
  background: rgba(107, 92, 231, 0.15);
  color: var(--purple);
}

.badge-random {
  background: rgba(76, 217, 192, 0.15);
  color: #2BA898;
}

.question-text {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.5;
  color: var(--text);
}

.question-text-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.question-text-row .question-text {
  flex: 1;
}

.btn-speak {
  flex-shrink: 0;
  background: rgba(107, 92, 231, 0.1);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
}

.btn-speak:hover { background: rgba(107, 92, 231, 0.2); }
.btn-speak.speaking {
  background: var(--purple);
  border-color: var(--purple);
  animation: pulseShadow 1.2s infinite;
}

.hint-box {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.hint-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hint-text {
  font-size: 1.15rem;
  color: var(--text);
  line-height: 1.8;
  font-weight: 500;
}

/* Question browse nav */
.question-browse-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.btn-browse {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-sub);
  font-size: 0.8rem;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-browse:hover:not(:disabled) { border-color: var(--purple); color: var(--purple); }
.btn-browse:disabled { opacity: 0.3; cursor: not-allowed; }

.browse-count {
  font-size: 0.8rem;
  color: var(--text-sub);
  min-width: 40px;
  text-align: center;
}

/* Recording panel */
.recording-panel {
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  overflow-y: auto;
}

.record-btn {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.25s;
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  color: white;
  box-shadow: 0 8px 32px rgba(107, 92, 231, 0.4);
}

.record-btn:hover { transform: scale(1.05); }
.record-btn:active { transform: scale(0.98); }

.record-btn.recording {
  background: linear-gradient(135deg, #FF6B8A, #FF8FA3);
  box-shadow: 0 8px 32px rgba(255, 107, 138, 0.4);
  animation: pulseShadow 1.5s infinite;
}

.record-btn.recorded {
  background: linear-gradient(135deg, var(--mint), #3BC4AC);
  box-shadow: 0 8px 32px rgba(76, 217, 192, 0.4);
}

@keyframes pulseShadow {
  0%, 100% { box-shadow: 0 8px 32px rgba(255, 107, 138, 0.4); }
  50% { box-shadow: 0 8px 48px rgba(255, 107, 138, 0.7); }
}

.record-icon {
  width: 32px;
  height: 32px;
  background: white;
  border-radius: 50%;
}

.record-icon.check { background: none; font-size: 2rem; }

.record-timer {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--danger);
  min-height: 28px;
}

/* Waveform */
.waveform {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 48px;
}

.wave-bar {
  width: 5px;
  background: var(--danger);
  border-radius: 3px;
  animation: wave 0.8s infinite ease-in-out;
}

.wave-bar:nth-child(1) { animation-delay: 0s; }
.wave-bar:nth-child(2) { animation-delay: 0.1s; }
.wave-bar:nth-child(3) { animation-delay: 0.2s; }
.wave-bar:nth-child(4) { animation-delay: 0.3s; }
.wave-bar:nth-child(5) { animation-delay: 0.4s; }
.wave-bar:nth-child(6) { animation-delay: 0.3s; }
.wave-bar:nth-child(7) { animation-delay: 0.2s; }
.wave-bar:nth-child(8) { animation-delay: 0.1s; }
.wave-bar:nth-child(9) { animation-delay: 0s; }

@keyframes wave {
  0%, 100% { height: 8px; }
  50% { height: 40px; }
}

/* Playback controls */
.playback-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

.btn-play-rec, .btn-delete-rec {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-play-rec {
  background: var(--purple);
  color: white;
}
.btn-play-rec:hover { background: var(--purple-dark); }

.btn-delete-rec {
  background: rgba(255, 107, 138, 0.1);
  color: var(--danger);
  border: 1px solid rgba(255, 107, 138, 0.3);
}
.btn-delete-rec:hover { background: rgba(255, 107, 138, 0.2); }

/* Record navigation */
.record-nav {
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  grid-column: 1 / -1;
}

.btn-nav {
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-nav.prev {
  background: var(--bg);
  color: var(--text-sub);
  border: 1px solid var(--border);
}
.btn-nav.prev:hover { border-color: var(--purple); color: var(--purple); }

.btn-nav.next {
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  color: white;
  box-shadow: 0 4px 16px rgba(107, 92, 231, 0.3);
}
.btn-nav.next:hover { box-shadow: 0 6px 20px rgba(107, 92, 231, 0.45); }
.btn-nav.next:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-nav.home {
  background: var(--bg);
  color: var(--text-sub);
  border: 1px solid var(--border);
  font-size: 0.85rem;
}
.btn-nav.home:hover { border-color: var(--danger); color: var(--danger); }

/* ── Complete Screen ──────────────────────────────────────────────────────── */
.complete-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  gap: 28px;
  text-align: center;
}

.complete-icon { font-size: 5rem; }
.complete-title { font-size: 2rem; font-weight: 800; color: var(--purple); }
.complete-date { color: var(--text-sub); font-size: 0.9rem; }
.complete-count {
  background: linear-gradient(135deg, rgba(107, 92, 231, 0.1), rgba(76, 217, 192, 0.1));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 32px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--purple);
}

.complete-actions { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 300px; }

.btn-primary {
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  color: white;
  border: none;
  padding: 16px 32px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(107, 92, 231, 0.3);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(107, 92, 231, 0.4); }

.btn-secondary {
  background: white;
  color: var(--purple);
  border: 2px solid var(--purple);
  padding: 14px 32px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { background: rgba(107, 92, 231, 0.05); }

/* ── Playback Screen ─────────────────────────────────────────────────────── */
.play-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 20px;
  gap: 24px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.play-progress {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
}

.play-section-badge {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--purple);
  background: rgba(107, 92, 231, 0.1);
  padding: 4px 14px;
  border-radius: 999px;
  align-self: flex-start;
}

.play-question {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
  color: var(--text);
  flex: 1;
}

.play-date {
  font-size: 0.8rem;
  color: var(--text-sub);
}

.play-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px 32px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  width: 100%;
  justify-content: center;
}

.btn-play-ctrl {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  color: var(--text-sub);
  padding: 8px;
  border-radius: 50%;
  transition: all 0.2s;
  line-height: 1;
}
.btn-play-ctrl:hover:not(:disabled) { color: var(--purple); background: rgba(107, 92, 231, 0.1); }
.btn-play-ctrl:disabled { opacity: 0.3; cursor: not-allowed; }

.btn-play-main {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(107, 92, 231, 0.4);
  transition: all 0.2s;
}
.btn-play-main:hover { transform: scale(1.08); }

.btn-speed {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-speed:hover { border-color: var(--purple); color: var(--purple); }

/* ── History Screen ──────────────────────────────────────────────────────── */
.history-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
}

.history-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.history-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.streak-badge {
  font-size: 0.8rem;
  background: linear-gradient(135deg, var(--purple), var(--mint));
  color: white;
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 700;
}

/* Calendar */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-header {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-sub);
  padding: 4px 0;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  border-radius: 50%;
  cursor: default;
  transition: all 0.15s;
}

.cal-day.today {
  border: 2px solid var(--purple);
  color: var(--purple);
  font-weight: 700;
}

.cal-day.has-session {
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  color: white;
  font-weight: 700;
}

.cal-day.today.has-session {
  border: 2px solid var(--purple-dark);
}

/* Session list */
.session-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.session-card:hover { box-shadow: var(--shadow); }

.session-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
}

.session-date { font-size: 0.875rem; font-weight: 600; flex: 1; }
.session-mode { font-size: 0.8rem; color: var(--text-sub); }

.session-status {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}

.status-complete { background: rgba(76, 217, 192, 0.15); color: #2BA898; }
.status-partial { background: rgba(255, 107, 138, 0.15); color: var(--danger); }

.session-detail {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
  background: #FAF9FF;
}

.detail-time, .detail-count {
  font-size: 0.85rem;
  color: var(--text-sub);
  margin-bottom: 6px;
}

.detail-questions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.detail-q {
  font-size: 0.75rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  color: var(--text-sub);
}

.empty-msg {
  text-align: center;
  color: var(--text-sub);
  padding: 24px;
  font-size: 0.9rem;
}

/* ── Responsive (Mobile) ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .record-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
    overflow-y: auto;
  }

  .record-progress { grid-column: 1; grid-row: 1; }
  .question-panel { grid-column: 1; grid-row: 2; border-right: none; border-bottom: 1px solid var(--border); padding: 20px 16px; }
  .recording-panel { grid-column: 1; grid-row: 3; padding: 24px 16px; }
  .record-nav { grid-column: 1; grid-row: 4; }

  .question-text { font-size: 1.1rem; }
  .record-btn { width: 130px; height: 130px; }
  .hero-title { font-size: 1.6rem; }
  .play-controls { padding: 16px 20px; }
}

/* ── Login Screen ────────────────────────────────────────────────────────── */
.login-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: linear-gradient(135deg, #F0EEFF 0%, #E8E4FF 100%);
}

.login-card {
  background: white;
  border-radius: var(--radius);
  padding: 40px 32px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 8px 40px rgba(107, 92, 231, 0.18);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-logo { font-size: 3rem; }

.login-title {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--purple), var(--mint));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-sub { font-size: 0.875rem; color: var(--text-sub); }

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.login-input {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.2s;
  text-align: left;
  width: 100%;
}
.login-input:focus { outline: none; border-color: var(--purple); }

.login-error {
  font-size: 0.8rem;
  color: var(--danger);
  min-height: 18px;
  text-align: left;
}

.btn-login-sub {
  background: none;
  border: none;
  color: var(--text-sub);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px;
  text-decoration: underline;
  transition: color 0.2s;
}
.btn-login-sub:hover { color: var(--purple); }

/* ── Home bottom actions ─────────────────────────────────────────────────── */
.home-bottom-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ── Question Manager Screen ─────────────────────────────────────────────── */
.qmgr-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
}

.qmgr-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.qmgr-desc {
  font-size: 0.875rem;
  color: var(--text-sub);
}

.btn-qmgr-add {
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.2s;
}
.btn-qmgr-add:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(107,92,231,0.3); }

.qmgr-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.qmgr-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qmgr-num {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-sub);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.qmgr-q-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
}

.qmgr-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.btn-qmgr-edit, .btn-qmgr-delete {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-qmgr-edit {
  background: rgba(107, 92, 231, 0.08);
  color: var(--purple);
  border: 1px solid rgba(107, 92, 231, 0.2);
}
.btn-qmgr-edit:hover { background: rgba(107, 92, 231, 0.15); }

.btn-qmgr-delete {
  background: rgba(255, 107, 138, 0.08);
  color: var(--danger);
  border: 1px solid rgba(255, 107, 138, 0.2);
}
.btn-qmgr-delete:hover { background: rgba(255, 107, 138, 0.15); }

.qmgr-reset-area {
  display: flex;
  justify-content: center;
  padding: 4px 0 16px;
}

.btn-reset-questions {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-sub);
  padding: 8px 20px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
}
.btn-reset-questions:hover { border-color: var(--danger); color: var(--danger); }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(45, 43, 78, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-box {
  background: white;
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(45, 43, 78, 0.3);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-box h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-field label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.modal-field select,
.modal-field textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.2s;
  resize: vertical;
}

.modal-field select:focus,
.modal-field textarea:focus {
  outline: none;
  border-color: var(--purple);
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.btn-modal-cancel {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: white;
  color: var(--text-sub);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s;
}
.btn-modal-cancel:hover { border-color: var(--text-sub); }

.btn-modal-save {
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  border: none;
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  color: white;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s;
}
.btn-modal-save:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(107,92,231,0.3); }

/* ── Disabled hint ───────────────────────────────────────────────────────── */
.disabled-hint {
  opacity: 0.6;
}
