:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel-2: #1c2330;
  --border: #2a3340;
  --text: #e6edf3;
  --muted: #9aa7b4;
  --accent: #2f81f7;
  --green: #3fb950;
  --amber: #d29922;
  --red: #f85149;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #14233b 0%, var(--bg) 55%) fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar { border-bottom: 1px solid var(--border); background: rgba(13,17,23,.7); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5; }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; padding-bottom: 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 14px; }
.logo { font-size: 30px; line-height: 1; }
h1 { font-size: 20px; margin: 0; letter-spacing: .2px; }
.tag { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.privacy { font-size: 12.5px; color: var(--green); background: rgba(63,185,80,.1); border: 1px solid rgba(63,185,80,.3); padding: 6px 10px; border-radius: 999px; white-space: nowrap; }

.layout { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 22px; padding-top: 24px; padding-bottom: 40px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.input-panel { padding: 18px; position: sticky; top: 78px; }

.field { margin-bottom: 14px; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.req { color: var(--accent); font-weight: 700; }
.counter { font-size: 12px; color: var(--muted); }
input[type=text], textarea {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  font-size: 14px; font-family: inherit; resize: vertical;
}
textarea { line-height: 1.65; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,129,247,.2); }

.prev-wrap { margin-bottom: 14px; }
.prev-wrap summary { cursor: pointer; font-size: 13px; color: var(--accent); padding: 6px 0; user-select: none; }
.prev-wrap[open] summary { margin-bottom: 8px; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; }
button { font: inherit; cursor: pointer; border-radius: 10px; padding: 10px 16px; border: 1px solid var(--border); transition: .15s; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; flex: 1; }
button.primary:hover { filter: brightness(1.08); }
button.ghost { background: transparent; color: var(--text); }
button.ghost:hover { background: var(--panel-2); }
.disclaimer { font-size: 12px; color: var(--muted); margin: 14px 0 0; }

.output-panel { padding: 22px; min-height: 360px; }
.empty { text-align: center; color: var(--muted); padding: 50px 20px; }
.empty-icon { font-size: 46px; }
.empty h2 { color: var(--text); font-size: 18px; margin: 12px 0 8px; }
.empty p { max-width: 460px; margin: 0 auto; font-size: 14px; }

.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding-bottom: 14px; margin-bottom: 16px; }
.card-title { margin: 0; font-size: 19px; }
.card-tools { display: flex; gap: 8px; }
.card-tools button { padding: 7px 12px; font-size: 13px; }
.health { font-size: 14px; color: var(--text); background: var(--panel-2); border: 1px solid var(--border); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 8px; margin-bottom: 18px; }

.stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.chip { font-size: 12px; color: var(--muted); background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 4px 11px; }
.chip strong { color: var(--text); }

.tone-bar { height: 10px; border-radius: 999px; background: linear-gradient(90deg, var(--red) 0%, #6e7681 50%, var(--green) 100%); position: relative; margin: 8px 0 6px; }
.tone-marker { position: absolute; top: -4px; width: 4px; height: 18px; background: #fff; border-radius: 3px; box-shadow: 0 0 0 2px rgba(0,0,0,.4); transform: translateX(-50%); }
.tone-legend { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); }

.sec { margin-bottom: 18px; }
.sec-h { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; margin: 0 0 10px; }
.sec-h .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.g { background: var(--green); } .dot.p { background: var(--accent); } .dot.r { background: var(--red); } .dot.t { background: var(--amber); }
.sec-h .n { color: var(--muted); font-weight: 500; font-size: 13px; }
ul.lines { list-style: none; margin: 0; padding: 0; }
ul.lines li { background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px; padding: 9px 12px; margin-bottom: 8px; font-size: 13.5px; }
.metric-tags { margin-top: 5px; display: flex; gap: 6px; flex-wrap: wrap; }
.metric-tags span { font-size: 11.5px; background: rgba(47,129,247,.14); color: #79b8ff; border: 1px solid rgba(47,129,247,.3); border-radius: 6px; padding: 1px 7px; font-variant-numeric: tabular-nums; }
.none { color: var(--muted); font-size: 13px; font-style: italic; }

.kw-wrap { display: flex; flex-wrap: wrap; gap: 7px; }
.kw { font-size: 12.5px; background: var(--bg); border: 1px solid var(--border); border-radius: 7px; padding: 3px 9px; color: var(--text); }
.kw b { color: var(--accent); }
.kw.add { border-color: rgba(63,185,80,.4); } .kw.add b { color: var(--green); }
.kw.drop { border-color: rgba(248,81,73,.4); opacity: .8; } .kw.drop b { color: var(--red); }

ol.qs { margin: 0; padding-left: 20px; }
ol.qs li { margin-bottom: 9px; font-size: 13.5px; }

.tone-words { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.tone-words b.c { color: var(--green); } .tone-words b.k { color: var(--amber); }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #fff; color: #0d1117; padding: 10px 18px; border-radius: 10px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow); z-index: 10; }

.foot { border-top: 1px solid var(--border); padding: 18px 0; color: var(--muted); font-size: 13px; }
.foot .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--muted); }

@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; }
  .input-panel { position: static; }
  .privacy { display: none; }
}
