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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f3f0;
  color: #1a1a1a;
  line-height: 1.6;
  min-height: 100vh;
}

#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #e0ddd9;
  z-index: 100;
}

#progress-fill {
  height: 100%;
  background: #2563eb;
  width: 0%;
  transition: width 0.4s ease;
}

#app {
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 40px 36px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
}

.screen { animation: fadeIn 0.3s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

h2 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}

.subtitle {
  font-size: 16px;
  color: #666;
  margin-bottom: 32px;
}

.step-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #2563eb;
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #444;
  margin-bottom: 6px;
  margin-top: 20px;
}

label:first-of-type { margin-top: 0; }

textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px 14px;
  border: 1px solid #d4d0cc;
  border-radius: 8px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.2s;
  background: #fafaf9;
}

textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
  background: #fff;
}

.btn {
  display: inline-block;
  padding: 14px 32px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  margin-top: 28px;
}

.btn:hover { background: #1d4ed8; }
.btn:active { transform: scale(0.98); }
.btn:disabled { background: #94a3b8; cursor: not-allowed; }

.question-text {
  font-size: 18px;
  line-height: 1.6;
  margin-bottom: 32px;
  color: #1a1a1a;
}

.story-ref {
  font-size: 13px;
  color: #888;
  margin-bottom: 12px;
  font-style: italic;
}

.scale {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 8px;
}

.scale-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #d4d0cc;
  background: #fff;
  font-size: 15px;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scale-btn:hover {
  border-color: #2563eb;
  color: #2563eb;
}

.scale-btn.selected {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #999;
  margin-top: 4px;
  padding: 0 4px;
}

.loading {
  text-align: center;
  padding: 60px 20px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e0ddd9;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 24px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
  font-size: 16px;
  color: #666;
}

.result-item {
  padding: 20px 0;
  border-bottom: 1px solid #eee;
}

.result-item:last-child { border-bottom: none; }

.result-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: #2563eb;
  color: #fff;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  margin-right: 12px;
  flex-shrink: 0;
}

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

.result-name {
  font-size: 18px;
  font-weight: 600;
}

.result-score {
  font-size: 14px;
  color: #888;
  margin-left: auto;
  font-weight: 600;
}

.result-desc {
  font-size: 15px;
  color: #555;
  padding-left: 44px;
  line-height: 1.5;
}

.error-msg {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-top: 16px;
}

@media (max-width: 480px) {
  #app { padding: 32px 16px 60px; }
  .card { padding: 28px 20px; }
  h1 { font-size: 24px; }
  .scale-btn { width: 36px; height: 36px; font-size: 13px; }
  .scale { gap: 4px; }
}
