/* Class-based styles for the rokuonyouyaku frontend. No CSS framework. */

:root {
  font-family: -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  line-height: 1.6;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --bg: #f5f5f7;
  --card-bg: #ffffff;
  --border: #e2e2e7;
  --text: #1d1d1f;
  --muted: #6b7280;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #2563eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

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

h1 {
  font-size: 1.5rem;
  margin: 0 0 20px;
}

.site-title {
  color: inherit;
  text-decoration: none;
}

.site-title:hover {
  color: var(--accent);
}

h2 {
  font-size: 1.2rem;
  margin: 0 0 16px;
}

h3 {
  font-size: 1.05rem;
  margin: 0 0 12px;
}

h4 {
  font-size: 0.95rem;
  margin: 16px 0 8px;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---- Cards ---- */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* ---- Form fields ---- */
.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
}

input[type="file"],
input[type="password"],
textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
}

textarea {
  resize: vertical;
}

input[type="password"]:focus,
textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 400;
  cursor: pointer;
}

.answer-inputs {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 8px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-dark);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
  padding: 6px 12px;
  font-size: 0.85rem;
}

.btn-ghost:hover:not(:disabled) {
  background: #f1f1f4;
}

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-neutral {
  background: #e5e7eb;
  color: #374151;
}

.badge-info {
  background: #dbeafe;
  color: #1e40af;
}

.badge-success {
  background: #dcfce7;
  color: #166534;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

/* ---- Error text ---- */
.error-text {
  color: var(--danger);
  font-size: 0.9rem;
  margin: 8px 0;
}

/* ---- Progress bar ---- */
.upload-progress {
  margin: 12px 0;
}

.progress-label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.progress-bar {
  width: 100%;
  height: 10px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.2s ease;
}

/* ---- Job list ---- */
.job-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.job-row {
  border-bottom: 1px solid var(--border);
}

.job-row:last-child {
  border-bottom: none;
}

.job-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  text-decoration: none;
  color: var(--text);
}

.job-link:hover {
  background: #f7f7fa;
}

.job-filename {
  flex: 1;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-date {
  font-size: 0.82rem;
}

/* ---- Job detail ---- */
.back-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}

.back-link:hover {
  text-decoration: underline;
}

.job-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.job-header h2 {
  margin: 0;
  flex: 1;
  word-break: break-all;
}

/* ---- Step indicator ---- */
.steps {
  list-style: none;
  display: flex;
  margin: 0;
  padding: 0;
  gap: 4px;
}

.step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}

.step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 7px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.step-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--border);
  z-index: 1;
}

.step-done .step-dot {
  background: var(--success);
}

.step-done:not(:last-child)::after {
  background: var(--success);
}

.step-active .step-dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
}

.step-active .step-label {
  color: var(--accent);
  font-weight: 600;
}

.step-failed .step-dot {
  background: var(--danger);
}

.step-failed .step-label {
  color: var(--danger);
  font-weight: 600;
}

/* ---- Transcript ---- */
.transcript-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.transcript-header h3 {
  margin: 0;
}

.transcript-actions {
  display: flex;
  gap: 8px;
}

.transcript-text {
  margin-top: 12px;
  padding: 14px;
  background: #f7f7fa;
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 420px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 0.9rem;
}

/* ---- Answers ---- */
.answers h3 {
  margin-bottom: 12px;
}

.answer-notes {
  margin-bottom: 16px;
}

.answer-card {
  margin-bottom: 16px;
}

.answer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.question-number {
  font-weight: 700;
  font-size: 1rem;
}

.format-tag {
  font-size: 0.8rem;
  background: #eef2ff;
  color: #3730a3;
  padding: 2px 8px;
  border-radius: 6px;
}

.question-summary {
  margin: 0 0 12px;
  color: var(--text);
}

.selected-answer {
  display: flex;
  align-items: baseline;
  gap: 12px;
  background: #f0f7ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 12px;
}

.selected-label {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}

.selected-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent-dark);
}

/* ---- Per-statement judgements ---- */
.statements ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.statement {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.statement:first-child {
  border-top: none;
}

.stmt-mark {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
}

.stmt-correct {
  background: var(--success);
}

.stmt-wrong {
  background: var(--danger);
}

.statement-body {
  flex: 1;
}

.statement-text {
  margin: 0 0 4px;
  font-size: 0.92rem;
}

.statement-reason {
  margin: 0;
}

/* ---- Rationale & sources ---- */
.rationale-text {
  margin: 0;
  white-space: pre-wrap;
  font-size: 0.92rem;
}

.sources ul {
  margin: 0;
  padding-left: 18px;
}

.sources a {
  color: var(--accent);
  word-break: break-all;
  font-size: 0.88rem;
}

.failure-card {
  border-color: #fecaca;
}

/* ---- Login ---- */
.login-card {
  max-width: 420px;
  margin: 40px auto;
}
