/* EIA リスニングテスト 共通スタイル */
:root {
  --bg: #fafafa;
  --fg: #222;
  --accent: #2563eb;
  --accent-light: #dbeafe;
  --border: #e5e5e5;
  --success: #16a34a;
  --error: #dc2626;
  --muted: #6b7280;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

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

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px;
}

h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 24px 0 12px;
}

p {
  margin-bottom: 12px;
}

.subtitle {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 24px;
}

/* ----- ボタン ----- */
button {
  font-family: inherit;
  font-size: 16px;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.05s;
}
button:active { transform: scale(0.98); }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: white;
  padding: 14px 32px;
  border-radius: 8px;
  font-weight: 600;
  width: 100%;
  max-width: 320px;
}

/* ----- 入力 ----- */
input[type="text"] {
  font-family: inherit;
  font-size: 18px;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  width: 100%;
  background: white;
}
input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
}

/* ----- ログイン画面 ----- */
.login-card {
  background: white;
  border-radius: 12px;
  padding: 32px 24px;
  box-shadow: var(--shadow);
  margin-top: 32px;
}
.login-card label {
  display: block;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 8px;
}
.login-card .btn-primary {
  margin-top: 20px;
}

/* ----- テスト画面 ----- */
.test-screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 16px;
}
.progress {
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 16px;
}
.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 24px;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s;
}

.audio-area {
  text-align: center;
  margin: 32px 0;
}
.audio-status {
  font-size: 16px;
  color: var(--muted);
  margin-top: 12px;
}
.blackout {
  height: 200px;
  background: #1a1a1a;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  letter-spacing: 0.05em;
}

/* ----- 4枚イラスト ----- */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}
.option {
  position: relative;
  aspect-ratio: 3 / 2;
  background: white;
  border: 2px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.05s, border-color 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.option:active { transform: scale(0.97); }
.option.selected { border-color: var(--accent); }
.option img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.option-label {
  position: absolute;
  top: 6px;
  left: 8px;
  background: rgba(0,0,0,0.5);
  color: white;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}

.timer-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin: 8px 0;
}
.timer-fill {
  height: 100%;
  background: var(--accent);
  width: 100%;
  transition: width linear;
}

/* ----- ローディング ----- */
.loading {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
}
.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ----- 結果画面 ----- */
.result-summary {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.result-summary .name-date {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 8px;
}
.result-summary .score {
  font-size: 28px;
  font-weight: 700;
  margin: 8px 0;
}
.result-summary .latency {
  font-size: 14px;
  color: var(--muted);
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 14px;
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  font-family: -apple-system, "SF Mono", Menlo, monospace;
  font-size: 14px;
}
.result-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}
.result-row .num {
  display: inline-block;
  min-width: 24px;
  color: var(--muted);
}
.result-row .mark {
  font-size: 16px;
  width: 22px;
}
.result-row.correct .mark { color: var(--success); }
.result-row.wrong .mark { color: var(--error); }
.result-row .ans {
  font-weight: 600;
  min-width: 36px;
}
.result-row .time {
  color: var(--muted);
  font-size: 13px;
}

.screenshot-instruction {
  background: var(--accent-light);
  color: #1e40af;
  padding: 16px;
  border-radius: 12px;
  text-align: center;
  font-weight: 500;
  margin-bottom: 24px;
}

.detail-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.detail-section h2 {
  font-size: 16px;
  color: var(--muted);
  margin-bottom: 16px;
}
.detail-q {
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.detail-q.correct { border-left: 4px solid var(--success); }
.detail-q.wrong { border-left: 4px solid var(--error); }
.detail-q .header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.detail-q .qnum { font-weight: 700; font-size: 14px; color: var(--muted); }
.detail-q .sentence {
  font-size: 16px;
  font-style: italic;
  margin-bottom: 12px;
}
.detail-q .correct-image {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 3 / 2;
  object-fit: contain;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 8px auto;
  display: block;
}
.detail-q .point-label {
  font-size: 14px;
  color: var(--muted);
  margin-top: 8px;
}
.detail-q .point-label strong {
  color: var(--accent);
}
