:root {
  --bg: #f3f4f6;
  --panel: #ffffff;
  --text: #495f76;
  --title: #2a4668;
  --muted: #7f90a1;
  --line: #dfe5e8;
  --green: #27be55;
  --green-dark: #1ea547;
  --green-border: #4dc36b;
  --green-text: #27b354;
  --danger: #d56d52;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  padding: 10px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}
button, textarea { font: inherit; }
.hidden { display: none !important; }

.panel {
  width: min(100%, 980px);
  margin: 0 auto;
  min-height: calc(100vh - 20px);
  padding: 28px 34px 24px;
  background: var(--panel);
  border-radius: 2px;
}

.page-head {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.site-brand {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 14px;
}
.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  height: 38px;
  padding: 0 12px;
  color: #f23a2f;
  background: #fff;
  border: 2px solid #f23a2f;
  border-radius: 12px;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: .01em;
}

h1 {
  margin: 0 0 10px;
  color: var(--title);
  font-size: 32px;
  font-weight: 800;
  line-height: 1.2;
}

.subtitle {
  margin: 0;
  color: #667d95;
  font-size: 14px;
  line-height: 1.7;
}

.generator-card,
.saved-card {
  padding: 18px 0 14px;
  border-bottom: 1px solid var(--line);
}

.saved-card { border-bottom: 0; padding-bottom: 0; }

.field-head { display: flex; justify-content: space-between; margin-bottom: 10px; }
label { color: #5d7387; font-size: 13px; font-weight: 700; }
.shortcut { color: #8d9ba8; font-size: 12px; }

.legacy-input {
  width: 100%;
  min-height: 50px;
  height: 50px;
  padding: 12px 18px;
  resize: vertical;
  border: 1px solid var(--green-border);
  border-radius: 10px;
  outline: none;
  background: #fff;
  color: #5a7087;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.6;
  box-shadow: inset 0 1px 1px rgba(0,0,0,.02);
}
.legacy-input::placeholder { color: #8d9aa7; font-weight: 600; }
.legacy-input:focus {
  border-color: #35c55e;
  box-shadow: 0 0 0 3px rgba(39, 190, 85, .08);
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

button {
  border: 0;
  cursor: pointer;
  transition: filter .15s ease, transform .15s ease;
}
button:hover:not(:disabled) { filter: brightness(.98); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; }

.primary {
  min-height: 32px;
  padding: 0 14px;
  border-radius: 6px;
  color: #fff;
  background: linear-gradient(180deg, #39d16c, #1fb74f);
  font-weight: 800;
  font-size: 16px;
  box-shadow: 0 1px 0 rgba(0,0,0,.08);
}
.secondary {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  color: #6b7f91;
  background: #f4f5f6;
  border: 1px solid #d9e0e5;
  font-size: 14px;
  font-weight: 700;
}
.impl-note {
  color: #8490a0;
  font-size: 14px;
}

.error {
  margin-top: 12px;
  color: #d44a42;
  font-size: 14px;
  line-height: 1.6;
}

.legacy-result {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-top: 10px;
}

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

.info-row {
  margin-top: 12px;
  color: #627789;
  font-size: 16px;
  line-height: 1.5;
}
.value-text {
  color: #536d87;
  font-weight: 700;
  word-break: break-all;
}
.inline-code {
  padding: 0;
  background: transparent;
  color: var(--green-text);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: .04em;
  line-height: 1;
  vertical-align: middle;
}
.inline-code:hover { filter: none; }
.result-side {
  padding-top: 58px;
}
.small-btn {
  min-height: 28px;
  padding: 0 12px;
  font-size: 14px;
}

.qr-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 16px;
  padding: 16px;
  border: 1px dashed #cfe0d0;
  border-radius: 8px;
  background: #fafcfb;
}
#qrcode {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 180px;
  min-height: 180px;
  padding: 8px;
  background: #fff;
  border: 1px solid #edf2ef;
}
.qr-warning {
  color: #a16b54;
  font-size: 14px;
  line-height: 1.7;
}

.saved-card h2 {
  margin: 0;
  color: var(--title);
  font-size: 22px;
  font-weight: 800;
}
.history-desc {
  margin: 6px 0 14px;
  color: #738496;
  font-size: 13px;
}

.saved-list {
  padding: 6px 0;
  border: 1px solid var(--green-border);
  border-radius: 10px;
  background: #fff;
}
.saved-list.empty {
  padding: 16px 14px;
  color: #8d9aa6;
  font-size: 14px;
}
.saved-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px 8px 12px;
}
.saved-item + .saved-item {
  border-top: 1px solid #edf2ef;
}
.history-line {
  min-width: 0;
  color: #667b8f;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 15px;
  line-height: 1.55;
  word-break: break-all;
}
.history-time { color: #718399; }
.history-secret { color: #5f7387; }
.item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.item-actions button {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 13px;
}

.history-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}
.danger-outline {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  color: #fff;
  background: linear-gradient(180deg, #db8c5b, #c2653c);
  font-size: 14px;
  font-weight: 700;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 10;
  padding: 9px 14px;
  background: rgba(36, 55, 73, .94);
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
}

@media (max-width: 760px) {
  body { padding: 0; }
  .site-brand { margin-bottom: 12px; }
  .brand-badge { min-width: 68px; height: 36px; font-size: 22px; border-radius: 11px; }
  .panel {
    width: 100%;
    min-height: 100vh;
    padding: 20px 16px 18px;
    border-radius: 0;
  }
  h1 { font-size: 28px; }
  .subtitle { font-size: 13px; }
  .legacy-result { flex-direction: column; }
  .result-side { padding-top: 0; }
  .qr-wrap { flex-direction: column; align-items: flex-start; }
  .saved-item { grid-template-columns: 1fr; }
  .item-actions { justify-content: flex-end; }
  .inline-code { font-size: 28px; }
}
