:root {
  --bg: #0f1220;
  --panel: #171b2e;
  --panel-2: #1f2440;
  --text: #eef0fb;
  --muted: #9aa1c4;
  --accent: #7c9dff;
  --accent-2: #ff8b7c;
  --shadow-color: rgba(124, 157, 255, 0.35);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at 20% -10%, #232a52 0%, var(--bg) 55%);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.7;
}

.app {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.app__header h1 {
  font-size: clamp(28px, 5vw, 40px);
  margin: 0 0 8px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.app__subtitle {
  color: var(--muted);
  margin: 0 0 28px;
}

.intro, .panel, .result, .explain {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 20px;
}

.intro__example {
  color: var(--muted);
  font-size: 14px;
  border-left: 3px solid var(--accent);
  padding-left: 12px;
}

.panel h2, .result h2, .explain h2 {
  margin-top: 0;
  font-size: 18px;
}

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

.panel__example {
  background: var(--panel-2);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--accent);
  overflow-x: auto;
}

textarea {
  width: 100%;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: "Consolas", "Menlo", monospace;
  font-size: 14px;
  resize: vertical;
}

textarea:focus, .btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.panel__actions {
  display: flex;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn--primary {
  background: linear-gradient(90deg, var(--accent), #5a78e0);
  color: #0b0d1a;
  font-weight: 600;
}

.btn--ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

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

.chart {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  min-height: 220px;
  padding: 20px 8px 8px;
  overflow-x: auto;
}

.bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 64px;
}

.bar-group__stack {
  position: relative;
  width: 34px;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
}

.bar {
  width: 100%;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--accent), #4a63c0);
}

.bar--residue {
  background: repeating-linear-gradient(
    135deg,
    rgba(255, 139, 124, 0.55),
    rgba(255, 139, 124, 0.55) 4px,
    rgba(255, 139, 124, 0.25) 4px,
    rgba(255, 139, 124, 0.25) 8px
  );
  border-radius: 6px 6px 0 0;
}

.bar-group__label {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  max-width: 80px;
}

.bar-group__value {
  font-size: 11px;
  color: var(--accent-2);
}

.verdict {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--panel-2);
  font-size: 14px;
}

.explain ul {
  padding-left: 20px;
  color: var(--muted);
}

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

.app__footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin-top: 32px;
}

@media (prefers-reduced-motion: reduce) {
  .btn {
    transition: none;
  }
}

@media (max-width: 480px) {
  .app {
    padding: 20px 14px 48px;
  }
  .panel__actions {
    flex-direction: column;
  }
  .btn {
    width: 100%;
  }
}
