:root {
  --bg: #f7f1f3;
  --panel: rgba(255,255,255,.88);
  --panel-solid: #fff;
  --text: #231f20;
  --muted: #7b6d72;
  --line: #eadde2;
  --brand: #d85d86;
  --brand-2: #ff8eb1;
  --danger: #cc334d;
  --ok: #248a5a;
  --warning: #aa7a16;
  --shadow: 0 18px 50px rgba(75, 41, 54, .10);
  --radius: 22px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 142, 177, .28), transparent 32%),
    radial-gradient(circle at 85% 0%, rgba(216, 93, 134, .20), transparent 30%),
    linear-gradient(135deg, #fff7fa 0%, var(--bg) 45%, #f9f7fb 100%);
  color: var(--text);
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
textarea { resize: vertical; }

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  border-right: 1px solid rgba(234, 221, 226, .85);
  background: rgba(255,255,255,.50);
  backdrop-filter: blur(18px);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}
.logo-mark {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 10px 26px rgba(216, 93, 134, .24);
  font-weight: 800;
}
.logo-title { font-weight: 800; letter-spacing: -.02em; }
.logo-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

.nav { display: grid; gap: 10px; }
.nav a, .nav button {
  border: 0;
  text-align: left;
  border-radius: 16px;
  padding: 12px 14px;
  background: transparent;
  color: var(--muted);
}
.nav a.active, .nav button.active {
  background: var(--panel-solid);
  color: var(--text);
  box-shadow: 0 10px 22px rgba(75, 41, 54, .08);
}

.sidebar-footer {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 24px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.main {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}
.h1 {
  font-size: clamp(28px, 4vw, 44px);
  margin: 0;
  letter-spacing: -.04em;
}
.lead {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.grid {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.grid-3 {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr) minmax(260px, 360px);
  gap: 18px;
  align-items: start;
}

.card {
  background: var(--panel);
  border: 1px solid rgba(234, 221, 226, .88);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.card + .card { margin-top: 18px; }
.card-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.card h2, .card h3 { margin: 0; letter-spacing: -.02em; }
.card h2 { font-size: 18px; }
.card h3 { font-size: 16px; }

.form { display: grid; gap: 14px; }
.row { display: grid; gap: 7px; }
.row label {
  color: #5b4d52;
  font-size: 13px;
  font-weight: 650;
}
.input, .textarea, .select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.88);
  color: var(--text);
  padding: 12px 13px;
  outline: none;
  transition: border .15s ease, box-shadow .15s ease;
}
.textarea { min-height: 116px; line-height: 1.55; }
.input:focus, .textarea:focus, .select:focus {
  border-color: rgba(216, 93, 134, .65);
  box-shadow: 0 0 0 4px rgba(216, 93, 134, .12);
}

.inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--text);
  background: #fff;
  box-shadow: 0 8px 18px rgba(75, 41, 54, .08);
}
.btn.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 12px 26px rgba(216, 93, 134, .23);
}
.btn.ghost { background: transparent; box-shadow: none; border-color: var(--line); }
.btn.danger { color: #fff; background: var(--danger); }
.btn.small { padding: 7px 10px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 12px;
}
.pill.ok { color: var(--ok); }
.pill.warn { color: var(--warning); }
.pill.danger { color: var(--danger); }

.output {
  white-space: pre-wrap;
  line-height: 1.72;
  background: rgba(255,255,255,.72);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  min-height: 90px;
  overflow-wrap: anywhere;
}
.output.mono { font-family: var(--mono); font-size: 12px; line-height: 1.6; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tab {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 7px 12px;
  color: var(--muted);
}
.tab.active { color: #fff; background: var(--brand); border-color: var(--brand); }

.file-list { display: grid; gap: 8px; max-height: 64vh; overflow: auto; padding-right: 4px; }
.file-item {
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 10px 11px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.file-item.active { color: var(--text); border-color: rgba(216,93,134,.55); box-shadow: 0 0 0 4px rgba(216,93,134,.10); }

.history-list { display: grid; gap: 8px; }
.history-item {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 10px;
  color: var(--muted);
  text-align: left;
}
.history-item strong { color: var(--text); }

.notice {
  border: 1px solid rgba(170, 122, 22, .25);
  background: rgba(255, 247, 224, .78);
  color: #6b4a0c;
  border-radius: 16px;
  padding: 12px 13px;
  line-height: 1.6;
}
.notice.info {
  border-color: rgba(216,93,134,.20);
  background: rgba(255,255,255,.62);
  color: var(--muted);
}

.kv {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 8px 12px;
  color: var(--muted);
  line-height: 1.6;
}
.kv strong { color: var(--text); }

.score-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.score {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 16px;
  padding: 12px;
}
.score b { display: block; font-size: 22px; letter-spacing: -.03em; }
.score span { color: var(--muted); font-size: 12px; }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.footer-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.danger-text { color: var(--danger); }
.ok-text { color: var(--ok); }

@media (max-width: 1100px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .sidebar-footer { position: static; margin-top: 18px; }
  .grid, .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .main, .sidebar { padding: 16px; }
  .two { grid-template-columns: 1fr; }
  .topbar { display: grid; }
  .score-grid { grid-template-columns: 1fr; }
}
