/* ベース */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    "ヒラギノ角ゴ ProN", "Hiragino Kaku Gothic ProN", "メイリオ", Meiryo, sans-serif;
  background-color: #f8f4ef;
  color: #333;
}

/* レイアウト */
.page-wrapper {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 12px 32px;
}

.page-header {
  margin-bottom: 16px;
  text-align: left;
}

.site-title {
  font-size: 1.4rem;
  margin: 0 0 6px;
  color: #ff6600;
  font-weight: 700;
}

.site-subtitle {
  font-size: 0.9rem;
  margin: 0;
  line-height: 1.6;
  color: #555;
}

/* カード */
.card {
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 14px 14px 16px;
  margin-top: 14px;
}

.card-subtle {
  background-color: #fffaf4;
  box-shadow: none;
  border: 1px solid #ffe0b8;
}

.card-title {
  font-size: 1.05rem;
  margin: 0 0 10px;
  color: #444;
  border-left: 4px solid #ff6600;
  padding-left: 8px;
}

/* フォーム要素 */
.form-group {
  margin-top: 10px;
}

.form-label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 4px;
  font-weight: 600;
  color: #444;
}

.form-select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 0.95rem;
}

.form-note {
  font-size: 0.8rem;
  color: #777;
  margin: 4px 0 0;
}

/* 入力行 */
.input-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.range-input {
  width: 100%;
}

.number-input-wrapper {
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  border: 1px solid #ccc;
  padding: 4px 8px;
  background-color: #fafafa;
}

.number-input {
  border: none;
  width: 80px;
  font-size: 0.95rem;
  padding: 4px;
  background: transparent;
}

.number-input:focus {
  outline: none;
}

.unit-label {
  font-size: 0.8rem;
  color: #777;
  margin-left: 4px;
}

/* 睡眠（時刻入力） */
.sleep-time-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.time-input-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 120px;
}

.time-label {
  font-size: 0.8rem;
  color: #555;
}

.time-input {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 0.9rem;
}

.sleep-result {
  font-size: 0.85rem;
  color: #555;
  margin: 6px 0 0;
}

/* ボタン */
.button-row {
  margin-top: 12px;
  text-align: center;
}

.primary-button {
  display: inline-block;
  width: 100%;
  max-width: 260px;
  padding: 10px 14px;
  border-radius: 999px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #ff8a00, #ff6600);
  box-shadow: 0 4px 10px rgba(255, 136, 0, 0.35);
  cursor: pointer;
}

.primary-button:active {
  transform: translateY(1px);
  box-shadow: 0 2px 6px rgba(255, 136, 0, 0.3);
}

/* エラーメッセージ */
.error-message {
  margin-top: 6px;
  font-size: 0.8rem;
  color: #c62828;
}

/* 結果表示 */
.hidden {
  display: none;
}

.grade-label {
  font-size: 0.95rem;
  margin: 4px 0 6px;
}

.grade-badge {
  display: inline-block;
  min-width: 32px;
  text-align: center;
  padding: 2px 10px;
  border-radius: 999px;
  background-color: #ff6600;
  color: #fff;
  font-weight: 700;
}

.overall-comment {
  font-size: 0.9rem;
  line-height: 1.7;
  margin: 6px 0 0;
}

/* 項目別リスト */
.detail-list {
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
}

.detail-list li {
  padding: 8px 0;
  border-bottom: 1px solid #f0eee9;
  font-size: 0.9rem;
}

.detail-list li:last-child {
  border-bottom: none;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.detail-label {
  font-weight: 600;
  margin-right: 4px;
}

.detail-mark {
  display: inline-block;
  min-width: 1.5em;
  font-weight: 600;
}

.detail-comment {
  margin: 2px 0 0;
  line-height: 1.6;
}

/* 凡例 */
.detail-legend {
  font-size: 0.8rem;
  color: #777;
  margin: 4px 0 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.legend-label {
  font-weight: 600;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

/* 参考データ */
.reference-toggle {
  width: 100%;
  text-align: left;
  padding: 6px 0;
  border: none;
  background: none;
  font-size: 0.9rem;
  color: #d86800;
  font-weight: 600;
  cursor: pointer;
}

.reference-toggle:active {
  opacity: 0.8;
}

.reference-content {
  display: none;
  margin-top: 6px;
  font-size: 0.85rem;
  line-height: 1.7;
  color: #555;
}

.reference-content.open {
  display: block;
}

.reference-heading {
  font-size: 0.9rem;
  margin: 10px 0 4px;
  color: #555;
}

.reference-text {
  margin: 0;
}

.reference-note {
  margin-top: 8px;
  color: #777;
}

.reference-intro {
  margin: 0 0 6px;
}

/* 注意書き */
.note-section {
  margin-top: 12px;
}

.note-text {
  font-size: 0.8rem;
  color: #777;
  line-height: 1.6;
}

/* スマホ対応 */
@media (min-width: 480px) {
  .card {
    padding: 16px 18px 18px;
  }
}
