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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Noto Sans JP", "SF Mono", "Fira Code", monospace, sans-serif;
  background: #f0f2f5;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: #3b4351;
}

.dashboard {
  width: 100%;
  max-width: 640px;
}

.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 0 4px;
}

.dash-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dash-header h1 {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a2e;
  letter-spacing: 0.08em;
}

.dash-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #8896a6;
}



.help-btn {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 4px;
  background: #fff;
  color: #8896a6;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border: 1px solid #d0d6de;
  font-family: inherit;
}

.help-btn:hover {
  background: #e6f4f8;
  color: #0891b2;
  border-color: #0891b2;
}

.dash-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel {
  background: #fff;
  border: 1px solid #dce0e6;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.panel-body {
  padding: 16px;
}

.panel-footer {
  padding: 10px 16px;
  border-top: 1px solid #e8ecf0;
  background: #fafbfc;
}

textarea {
  width: 100%;
  padding: 14px 16px;
  background: #f7f8fa;
  border: 1px solid #dce0e6;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  color: #3b4351;
  outline: none;
  resize: vertical;
  min-height: 120px;
  line-height: 1.7;
  transition: border-color 0.2s, background 0.2s;
}

textarea:focus {
  border-color: #0891b2;
  background: #fff;
}

textarea::placeholder {
  color: #b0b8c4;
}

.input-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 12px;
  position: relative;
}

.char-count {
  position: absolute;
  right: 0;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 11px;
  color: #8896a6;
}

.char-count.warn {
  color: #e11d48;
}

button {
  padding: 10px 24px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  font-family: inherit;
  letter-spacing: 0.03em;
}

button:active {
  transform: scale(0.97);
}

#diagnoseBtn {
  background: #0891b2;
  color: #fff;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 13px;
  letter-spacing: 0.08em;
  padding: 14px 32px;
}

#diagnoseBtn:hover {
  background: #0e7490;
  box-shadow: 0 2px 12px rgba(8, 145, 178, 0.3);
}

#diagnoseBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

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

.loader-ring {
  display: inline-block;
  position: relative;
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
}

.loader-ring div {
  box-sizing: border-box;
  display: block;
  position: absolute;
  width: 40px;
  height: 40px;
  margin: 4px;
  border: 3px solid #dce0e6;
  border-radius: 50%;
  animation: ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
  border-color: #0891b2 transparent transparent transparent;
}

.loader-ring div:nth-child(1) { animation-delay: -0.45s; }
.loader-ring div:nth-child(2) { animation-delay: -0.3s; }
.loader-ring div:nth-child(3) { animation-delay: -0.15s; }

@keyframes ring {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loader-text {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin-bottom: 8px;
}

.loader-label {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 14px;
  font-weight: 700;
  color: #3b4351;
  letter-spacing: 0.08em;
}

.loader-dots span {
  animation: blink 1.4s infinite;
  font-size: 18px;
  color: #0891b2;
  font-weight: 700;
}

.loader-dots span:nth-child(2) { animation-delay: 0.2s; }
.loader-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%, 20% { opacity: 0; }
  50% { opacity: 1; }
  100% { opacity: 0; }
}

.loader-hint {
  font-size: 12px;
  color: #8896a6;
}

#resultContent {
  animation: fadeIn 0.4s ease;
}

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

.result-card {
  background: #f7f8fa;
  border: 1px solid #dce0e6;
  border-radius: 6px;
  padding: 20px;
}

.result-primary {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e8ecf0;
}

.result-emoji {
  font-size: 42px;
  line-height: 1;
  flex-shrink: 0;
}

.result-meta {
  flex: 1;
  min-width: 0;
}

.result-type {
  font-size: 18px;
  font-weight: 800;
  color: #1a1a2e;
  margin-bottom: 4px;
}

.result-score {
  display: inline-block;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 11px;
  color: #0891b2;
  background: rgba(8, 145, 178, 0.08);
  border: 1px solid rgba(8, 145, 178, 0.18);
  padding: 2px 10px;
  border-radius: 3px;
}

.result-detail {
  margin-bottom: 20px;
  padding: 12px 14px;
  background: #fff;
  border-left: 2px solid #0891b2;
  border-radius: 0 4px 4px 0;
}

.result-detail p {
  font-size: 13px;
  color: #5a6a7e;
  line-height: 1.7;
}

.result-detail .detail-label {
  font-size: 14px;
  font-weight: 700;
  color: #0891b2;
  margin-bottom: 8px;
  display: block;
}

.result-charts {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.creativity-section {
  background: #fff;
  border: 1px solid #dce0e6;
  border-radius: 6px;
  padding: 14px;
}

.creativity-title {
  font-size: 14px;
  font-weight: 700;
  color: #0891b2;
  margin-bottom: 12px;
}

.c-bar {
  margin-bottom: 8px;
}

.c-bar:last-child {
  margin-bottom: 0;
}

.c-bar-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 4px;
}

.c-bar-label {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 11px;
  font-weight: 700;
  color: #0891b2;
  min-width: 50px;
}

.c-bar-desc {
  font-size: 10px;
  color: #8896a6;
  flex: 1;
}

.c-bar-val {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 11px;
  font-weight: 700;
  color: #3b4351;
  min-width: 24px;
  text-align: right;
}

.c-bar-track {
  height: 4px;
  background: #e8ecf0;
  border-radius: 2px;
  overflow: hidden;
}

.c-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0891b2, #06b6d4);
  border-radius: 2px;
  transition: width 0.6s ease;
}

.radar-wrapper {
  display: flex;
  justify-content: center;
  background: #fff;
  border: 1px solid #dce0e6;
  border-radius: 6px;
  padding: 12px;
}

.radar-wrapper canvas {
  max-width: 100%;
  height: auto;
}

.retry-btn {
  width: 100%;
  background: #f0f2f5;
  color: #6b7a8a;
  border: 1px solid #dce0e6;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
}

.retry-btn:hover {
  background: #e6f4f8;
  color: #0891b2;
  border-color: #0891b2;
}

.dash-notice {
  text-align: left;
  margin: 16px 0 8px;
  font-size: 11px;
  color: #b0b8c4;
  line-height: 1.6;
  padding: 0 8px;
}



.error-msg {
  color: #e11d48;
  font-size: 12px;
  text-align: center;
  padding: 12px;
  background: rgba(225, 29, 72, 0.05);
  border: 1px solid rgba(225, 29, 72, 0.15);
  border-radius: 4px;
  font-family: "SF Mono", "Fira Code", monospace;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  background: #fff;
  border: 1px solid #dce0e6;
  border-radius: 8px;
  padding: 28px 24px;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  animation: slideUp 0.3s ease;
}

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

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 4px;
  background: #f0f2f5;
  color: #8896a6;
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid #dce0e6;
  font-family: inherit;
}

.modal-close:hover {
  background: #fee2e2;
  color: #e11d48;
  border-color: #e11d48;
}

.modal h2 {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 20px;
  text-align: center;
  letter-spacing: 0.05em;
}

.modal-body section {
  margin-bottom: 20px;
}

.modal-body section:last-child {
  margin-bottom: 0;
}

.modal-body h3 {
  font-size: 14px;
  font-weight: 700;
  color: #0891b2;
  margin-bottom: 8px;
}

.modal-body p {
  font-size: 13px;
  color: #5a6a7e;
  line-height: 1.7;
}

.modal-body p strong {
  color: #e11d48;
}

.criterion {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #e8ecf0;
}

.criterion:last-child {
  border-bottom: none;
}

.criterion-label {
  font-size: 13px;
  font-weight: 700;
  color: #0891b2;
  white-space: nowrap;
  min-width: 80px;
}

.criterion-desc {
  font-size: 12px;
  color: #8896a6;
}

.score-guide {
  margin: 8px 0 4px;
}

.score-bar {
  height: 6px;
  background: #e8ecf0;
  border-radius: 3px;
  overflow: hidden;
}

.score-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #0891b2, #06b6d4);
  border-radius: 3px;
}

.score-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #8896a6;
  margin-top: 2px;
  font-family: "SF Mono", "Fira Code", monospace;
}

.score-list {
  list-style: none;
  padding: 0;
  margin-top: 8px;
}

.score-list li {
  font-size: 12px;
  color: #5a6a7e;
  padding: 3px 0;
  line-height: 1.5;
}

.score-list li strong {
  color: #1a1a2e;
  margin-right: 4px;
}

#inputArea[hidden] {
  display: none;
}

#loading[hidden] {
  display: none;
}

#resultArea[hidden] {
  display: none;
}

#retryBtn[hidden] {
  display: none;
}

.dash-status .help-btn {
  width: 24px;
  height: 24px;
  font-size: 12px;
}