:root {
  --app-max-width: 1400px;
  --page-bg: radial-gradient(circle at 15% 15%, #fff 0%, #f4f6fb 46%, #e2e8f0 85%);
  --surface: #fff;
  --surface-muted: #f8fafc;
  --border-soft: rgba(15, 23, 42, 0.06);
  --border-faint: rgba(15, 23, 42, 0.02);
  --primary: #2563eb;
  --text: #0f172a;
  --text-muted: #64748b;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --radius-lg: 22px;
  --shadow-lg: 0 18px 40px rgba(15, 23, 42, 0.07);
  --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.11);
  --copy-btn-bg: #eef2ff;
  --copy-btn-bg-hover: #b2c7f9;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 1.7rem;
  font-family: var(--font-sans);
  background: var(--page-bg);
  color: var(--text);
}

.app-warning,
.topbar,
.container,
.footer-notice {
  width: min(var(--app-max-width), 96vw);
  margin: 0 auto;
}

.app-warning {
  margin-top: 0.7rem;
  padding: 0.4rem 0.65rem 0.45rem;
  background: #fff5f5;
  border: 1px solid #ffe4e6;
  border-radius: 14px;
  color: #b91c1c;
  font-size: 0.63rem;
  line-height: 1.4;
  text-align: center;
}

.topbar {
  margin: 1.35rem auto 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.topbar-title {
  display: flex;
  gap: 0.65rem;
  align-items: center;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(1.3rem, 3.3vw, 1.7rem);
}

.topbar small {
  color: var(--text-muted);
  font-size: 0.68rem;
}

.topbar-nav {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.topbar-link {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.28rem 0.7rem 0.33rem;
  font-size: 0.68rem;
  color: var(--text);
  text-decoration: none;
  transition: background 0.1s, border 0.1s, box-shadow 0.1s;
}

.topbar-link:hover {
  background: rgba(255, 255, 255, 0.3);
}

.topbar-link.is-active {
  border-color: rgba(15, 23, 42, 0.05);
  background: #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.container {
  position: relative;
  margin-top: 0.5rem;
  padding: 1.3rem clamp(1rem, 2.1vw, 1.6rem) 1.6rem;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.page-desc {
  margin: 0 0 1.1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.grid {
  display: grid;
  gap: 1.05rem;
}

.grid.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.8rem 0.85rem 0.9rem;
  background: var(--surface-muted);
  border: 1px solid var(--border-faint);
  border-radius: 16px;
}

.field label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.78rem;
}

.field small {
  color: var(--text-muted);
  line-height: 1.4;
  font-size: 0.73rem;
}

textarea,
input[type="text"],
input[type="password"],
select {
  width: 100%;
  padding: 0.55rem 0.65rem 0.6rem;
  font-size: 0.82rem;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: 13px;
  outline: none;
  transition: border 0.12s, box-shadow 0.12s, background 0.12s;
}

textarea {
  resize: vertical;
  min-height: 140px;
  max-height: 320px;
  font-family: var(--font-mono);
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(15, 23, 42, 0.55) 50%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.55) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(1em + 2px),
    calc(100% - 13px) calc(1em + 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2rem;
}

textarea:focus,
input[type="text"]:focus,
input[type="password"]:focus,
select:focus {
  border-color: rgba(37, 99, 235, 0.85);
  box-shadow: var(--focus-ring);
  background: #fff;
}

input[readonly],
textarea[readonly] {
  background: #fff;
  color: rgba(15, 23, 42, 0.85);
}

.buttons-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
  align-items: center;
}

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.52rem 1.2rem 0.58rem;
  border: none;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.25);
  transition: transform 0.085s, box-shadow 0.085s, background 0.1s, opacity 0.1s;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(37, 99, 235, 0.25);
}

.btn.secondary {
  background: var(--copy-btn-bg);
  color: var(--text);
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: none;
}

.btn.secondary:hover {
  background: var(--copy-btn-bg-hover);
  transform: translateY(-1px);
  box-shadow: none;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}

.doc-card {
  margin-top: 1.25rem;
  padding: 0.85rem 0.85rem 0.7rem;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.045);
  border-radius: 16px;
}

.codebox {
  margin: 0;
  padding: 0.7rem 0.75rem;
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: 13px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.78rem;
  line-height: 1.45;
}

.mono {
  font-family: var(--font-mono);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 280px;
  padding: 0.5rem 0.85rem 0.45rem;
  background: #fff;
  color: var(--text);
  font-size: 0.72rem;
  border: 1px solid rgba(15, 23, 42, 0.05);
  border-radius: 14px;
  box-shadow: 0 15px 40px rgba(15, 23, 42, 0.1);
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.22s, opacity 0.22s;
  z-index: 200;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.footer-notice {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.footer-notice p {
  margin: 0.35rem 0;
}

@media (max-width: 950px) {
  .grid.grid-2 {
    grid-template-columns: 1fr;
  }

  .buttons-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .btn {
    justify-content: center;
  }
}
