:root {
  color-scheme: light;
  --bg: linear-gradient(130deg, #0f172a, #1e293b);
  --panel: #ffffffd9;
  --ink: #0f172a;
  --muted: #64748b;
  --border: #cbd5e1;
  --accent: #1d4ed8;
  --good: #16a34a;
  --bad: #dc2626;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--ink);
  font-family: "Noto Sans JP", "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  background: var(--bg);
  padding: 24px 12px;
}

.container {
  width: min(840px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

h1,
h2 {
  margin: 0 0 10px;
  letter-spacing: 0.02em;
}

.card {
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 18px 35px rgba(15, 23, 42, 0.15);
  padding: 16px;
  backdrop-filter: blur(2px);
}

.help {
  color: var(--muted);
  margin: 0 0 12px;
  line-height: 1.5;
}

label {
  font-weight: 700;
  display: block;
  margin: 8px 0 6px;
}

textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  resize: vertical;
  min-height: 140px;
  font: inherit;
  font-family: "Noto Sans JP", "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
}

.row {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 10px 16px;
  color: #fff;
  font-weight: 700;
  background: var(--accent);
  font-size: 1rem;
  cursor: pointer;
}

button.ghost {
  background: #334155;
}

button.good {
  background: var(--good);
}

button.bad {
  background: var(--bad);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.hidden {
  display: none !important;
}

.tapArea {
  border: 2px solid #cbd5e1;
  border-radius: 14px;
  background: #f8fafc;
  padding: 16px;
  min-height: 160px;
  cursor: pointer;
  margin-top: 6px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.tapArea:active {
  transform: scale(0.995);
}

.answer {
  color: var(--good);
  border-top: 1px dashed #94a3b8;
  margin-top: 14px;
  padding-top: 12px;
  font-weight: 700;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-item {
  border: 1px dashed #bfdbfe;
  border-radius: 10px;
  padding: 10px;
  background: #f8fbff;
}

.history-item-main {
  margin: 0;
  font-weight: 700;
}

.history-item-sub {
  margin: 6px 0;
  color: var(--muted);
}

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

.danger {
  background: #b91c1c !important;
}

.error {
  color: #b91c1c;
  margin-top: 10px;
  min-height: 1.2em;
}

#questionText,
#answerText {
  white-space: pre-wrap;
  line-height: 1.7;
  margin: 0;
}

#progressText,
#scoreText,
#resultText,
#tapHint {
  margin-top: 8px;
  margin-bottom: 8px;
}

@media (max-width: 560px) {
  .container {
    gap: 12px;
    padding: 0;
  }

  .card {
    border-radius: 14px;
    padding: 14px;
  }

  button,
  textarea {
    width: 100%;
  }
}
