* {
  box-sizing: border-box;
}

:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --border: #e5e7eb;
  --soft: #eef2ff;
  --green: #16a34a;
  --yellow: #d97706;
  --red: #dc2626;
  --shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(79, 70, 229, 0.15), transparent 30%),
    radial-gradient(circle at top right, rgba(14, 165, 233, 0.13), transparent 35%),
    var(--bg);
  color: var(--text);
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 36px 20px 60px;
}

.hero {
  background: linear-gradient(135deg, #111827, #312e81);
  color: white;
  border-radius: 28px;
  padding: 42px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #c7d2fe;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 13px;
}

.hero h1 {
  margin: 0;
  font-size: 42px;
  line-height: 1.15;
}

.subtitle {
  max-width: 720px;
  margin: 14px 0 0;
  color: #e0e7ff;
  line-height: 1.8;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 20px;
}

.card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(229, 231, 235, 0.8);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.input-card,
.result-card {
  grid-column: 1 / 2;
}

.history-card {
  grid-column: 2 / 3;
  grid-row: 1 / span 2;
  padding: 22px;
  align-self: start;
  position: sticky;
  top: 20px;
}

.input-card {
  padding: 24px;
}

.input-card h2,
.history-card h2 {
  margin: 0 0 16px;
  font-size: 20px;
}

.form {
  display: flex;
  gap: 12px;
}

input {
  flex: 1;
  height: 48px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0 16px;
  font-size: 16px;
  outline: none;
  transition: border 0.2s, box-shadow 0.2s;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

button {
  border: none;
  cursor: pointer;
  border-radius: 14px;
  font-weight: 700;
  transition: transform 0.15s, background 0.15s, opacity 0.15s;
}

button:active {
  transform: translateY(1px);
}

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

#generateBtn {
  height: 48px;
  padding: 0 22px;
  background: var(--primary);
  color: white;
  font-size: 15px;
}

#generateBtn:hover {
  background: var(--primary-dark);
}

.secondary-btn {
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--soft);
  color: var(--primary-dark);
}

.text-btn {
  background: transparent;
  color: var(--primary);
  font-size: 14px;
}

.status {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--muted);
}

.result-card {
  min-height: 360px;
  padding: 0;
  overflow: hidden;
}

.result-card.empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 40px;
}

.empty-icon {
  font-size: 46px;
  margin-bottom: 10px;
}

.report {
  padding: 26px;
}

.report-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.report-title h2 {
  margin: 0 0 8px;
  font-size: 28px;
}

.meta {
  color: var(--muted);
  font-size: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--primary-dark);
  margin-left: 8px;
  font-size: 12px;
  font-weight: 700;
}

.score-circle {
  width: 126px;
  height: 126px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, white 58%, transparent 60%),
    conic-gradient(var(--primary) var(--score-deg), #e5e7eb 0);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.score-inner {
  text-align: center;
}

.score-num {
  font-size: 32px;
  font-weight: 900;
  color: var(--primary-dark);
}

.score-label {
  color: var(--muted);
  font-size: 13px;
}

.comment {
  margin: 22px 0;
  padding: 18px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 18px;
  line-height: 1.8;
}

.dimension-list {
  display: grid;
  gap: 14px;
}

.dimension-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  background: white;
}

.dimension-main {
  padding: 16px;
}

.dimension-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.dimension-name {
  font-weight: 800;
}

.dimension-score {
  font-weight: 900;
  color: var(--primary);
}

.progress {
  margin-top: 12px;
  height: 10px;
  background: #eef2f7;
  border-radius: 999px;
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #06b6d4);
  border-radius: inherit;
}

.child-list {
  padding: 0 16px 16px;
  display: grid;
  gap: 10px;
}

.child-item {
  padding: 12px;
  background: #f9fafb;
  border-radius: 14px;
  border: 1px solid #eef2f7;
}

.child-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
}

.reason {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

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

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

.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
}

.history-item-main {
  flex: 1;
  text-align: left;
  padding: 13px;
  background: transparent;
  border: none;
  border-radius: 0;
  cursor: pointer;
}

.history-item-main:hover {
  background: #f8fafc;
}

.history-name {
  font-weight: 800;
  margin-bottom: 5px;
}

.history-meta {
  color: var(--muted);
  font-size: 13px;
}

.delete-btn {
  width: 32px;
  height: 32px;
  margin-right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #9ca3af;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.delete-btn:hover {
  background: #fef2f2;
  color: var(--red);
}

.knowledge-item {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #e0e7ff;
  background: #f8faff;
  border-radius: 16px;
  overflow: hidden;
}

.knowledge-item-main {
  flex: 1;
  text-align: left;
  padding: 13px;
  background: transparent;
  border: none;
  border-radius: 0;
  cursor: pointer;
}

.knowledge-item-main:hover {
  background: #eef2ff;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .input-card,
  .result-card,
  .history-card {
    grid-column: auto;
    grid-row: auto;
  }

  .history-card {
    position: static;
  }

  .form {
    flex-direction: column;
  }

  #generateBtn {
    width: 100%;
  }

  .report-top {
    flex-direction: column;
    align-items: flex-start;
  }
}