:root {
  color-scheme: light dark;
  font-family: 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Meiryo', sans-serif;
  color: #2a2a2a;
  background-color: #f7f3ee;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #fffdf9 0%, #efe3d6 100%);
}

.name-app {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 16px 64px;
}

.app-header {
  text-align: center;
  margin-bottom: 32px;
}

.app-header h1 {
  margin: 0;
  font-size: 2.6rem;
  letter-spacing: 0.12em;
}

.app-header p {
  margin: 12px 0 0;
  color: #6a6154;
  font-size: 1rem;
}

.app-main {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.form-section {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: 0 18px 36px rgba(46, 32, 22, 0.08);
}

.name-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.input-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
}

.input-field {
  flex: 1 1 220px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-field label {
  font-weight: 600;
  color: #4d4033;
  font-size: 0.95rem;
}

.input-field input {
  font-size: 1.1rem;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #d6c5b2;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-field input:focus {
  outline: none;
  border-color: #d4553f;
  box-shadow: 0 0 0 3px rgba(212, 85, 63, 0.2);
}

.submit-field {
  flex: 0 0 auto;
  min-width: 150px;
  display: flex;
  align-items: stretch;
}

.submit-button {
  width: 100%;
  margin-top: 8px;
  padding: 14px 18px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #d9333f, #ef8f2b);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.submit-button:hover,
.submit-button:focus {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(217, 51, 63, 0.25);
}

.submit-button:disabled {
  opacity: 0.6;
  cursor: progress;
  box-shadow: none;
  transform: none;
}

.results-section {
  display: flex;
  flex-direction: column;
}

.results-layout {
  display: grid;
  gap: 24px;
}

.results-summary {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 18px 36px rgba(46, 32, 22, 0.08);
  border-left: 6px solid #d4553f;
  display: grid;
  gap: 16px;
}

.results-summary.placeholder {
  border-left-color: #c1b5a8;
}

.summary-message {
  margin: 0;
  line-height: 1.7;
}

.summary-message.muted {
  color: #7a7062;
}

.summary-message.error {
  color: #c23b3b;
  font-weight: 600;
}

.summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.summary-score {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.summary-score-value {
  font-size: 2.3rem;
  font-weight: 700;
  color: #d9333f;
}

.summary-score-caption {
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  color: #645646;
}

.pending-hint {
  margin: 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fff3ea;
  color: #8a4a32;
  font-size: 0.9rem;
  line-height: 1.5;
}

.results-detail {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 18px 36px rgba(46, 32, 22, 0.08);
  display: grid;
  gap: 24px;
}

.results-detail.placeholder {
  text-align: center;
  color: #7a7062;
  font-size: 0.95rem;
  font-style: italic;
  padding: 48px 24px;
  border: 2px dashed #d6c5b2;
  box-shadow: none;
}

.detail-overview {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.detail-overview h2 {
  margin: 0;
  font-size: 1.3rem;
  color: #4d4033;
}

.detail-total {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: #d9333f;
}

.detail-total-label {
  font-weight: 600;
}

.detail-total-value {
  font-size: 1.8rem;
  font-weight: 700;
}

.stroke-columns {
  display: grid;
  gap: 16px;
}

.stroke-card {
  border: 1px solid #e4d6c6;
  border-radius: 14px;
  padding: 18px;
  background: #fffdfa;
  display: grid;
  gap: 12px;
}

.stroke-card.empty {
  text-align: center;
  color: #8a8073;
  font-style: italic;
}

.stroke-card h3 {
  margin: 0;
  font-size: 1.1rem;
  color: #4d4033;
}

.stroke-card ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.stroke-card li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  background: #f8f1e7;
}

.stroke-char {
  font-weight: 600;
  color: #4d4033;
}

.stroke-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stroke-count {
  color: #5f5244;
}

.stroke-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid #e4d6c6;
}

.stroke-total strong {
  font-size: 1.1rem;
  color: #d9333f;
}

.fortune-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 0.85rem;
  font-weight: 600;
  background: #fff;
}

.fortune-chip.prominent {
  font-size: 1rem;
  padding: 6px 18px;
  background: #fff6f2;
}

@media (min-width: 900px) {
  .input-row {
    flex-wrap: nowrap;
  }

  .submit-field {
    align-self: stretch;
  }

  .results-layout {
    grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
    align-items: start;
  }

  .stroke-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .app-header h1 {
    font-size: 2rem;
  }

  .submit-field {
    width: 100%;
  }

  .summary-score-value {
    font-size: 2rem;
  }

  .detail-overview {
    flex-direction: column;
    align-items: flex-start;
  }
}
