:root {
  color-scheme: light;
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  background: #f4f6f7;
  color: #13283e;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 8% 12%, rgba(103, 183, 207, 0.12), transparent 34%),
    radial-gradient(circle at 92% 88%, rgba(241, 84, 23, 0.1), transparent 30%),
    #f4f6f7;
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
input { color: #13283e; }

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  padding: 14px clamp(20px, 4vw, 64px);
  border-bottom: 1px solid rgba(19, 40, 62, 0.1);
  background: rgba(251, 251, 249, 0.92);
  backdrop-filter: blur(16px);
}

.brand img { display: block; width: 146px; height: auto; }
.topbar__meta { display: flex; align-items: center; gap: 24px; }
.topbar__meta a { color: #526273; text-decoration: none; }
.product-label { color: #13283e; font-weight: 650; }

main {
  width: min(1280px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(48px, 7vh, 88px) 0 80px;
}

.state-card {
  display: grid;
  width: min(620px, 100%);
  min-height: 360px;
  margin: 8vh auto 0;
  place-content: center;
  justify-items: start;
  gap: 18px;
  padding: clamp(36px, 6vw, 72px);
  border: 1px solid rgba(19, 40, 62, 0.12);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 24px 80px rgba(19, 40, 62, 0.08);
}

.state-card h1, .editor h1 { margin: 0; letter-spacing: -0.045em; }
.state-card h1 { font-size: clamp(34px, 5vw, 54px); line-height: 1.08; }
.state-card p, .editor__heading p { max-width: 660px; margin: 0; color: #5c6d7e; line-height: 1.75; }
.eyebrow { color: #d94712; font-size: 13px; font-weight: 750; letter-spacing: 0.14em; }

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid #d9e1e6;
  border-top-color: #d94712;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.primary-button, .secondary-button, .text-button {
  min-height: 48px;
  border: 0;
  cursor: pointer;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 0 24px;
  border-radius: 999px;
  background: #d94712;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 12px 30px rgba(217, 71, 18, 0.18);
}

.primary-button:hover { background: #c83f0e; transform: translateY(-1px); }
.primary-button:disabled { cursor: wait; opacity: 0.58; transform: none; }
.secondary-button { padding: 0 20px; border: 1px solid #cfd9df; border-radius: 999px; background: #fff; color: #13283e; }
.text-button { min-height: 36px; padding: 0; background: transparent; color: #6b7b8b; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(217, 71, 18, 0.28); outline-offset: 3px; }
.error-message { color: #ba2c12 !important; }

.login-form {
  display: grid;
  width: min(400px, 100%);
  gap: 16px;
  margin-top: 6px;
}
.login-form label,
.password-dialog label {
  display: grid;
  gap: 8px;
  color: #536476;
  font-size: 14px;
}
.login-form input,
.password-dialog input {
  width: 100%;
  min-height: 50px;
  padding: 0 15px;
  border: 1px solid #ccd7dd;
  border-radius: 13px;
  background: #fff;
}
.login-form .primary-button { width: 100%; margin-top: 4px; }

.editor { display: grid; gap: 36px; }
.editor__heading { display: flex; align-items: end; justify-content: space-between; gap: 40px; }
.editor__heading h1 { margin-top: 10px; font-size: clamp(44px, 6vw, 72px); line-height: 1; }
.editor__heading p { margin-top: 18px; }
.account-panel { display: flex; align-items: center; gap: 16px; padding: 10px 16px; border: 1px solid #d6dfe4; border-radius: 999px; background: rgba(255,255,255,.7); color: #526273; font-size: 14px; white-space: nowrap; }
.account-panel .text-button + .text-button { padding-left: 14px; border-left: 1px solid #d6dfe4; }

.policy-form {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  min-height: 660px;
  overflow: hidden;
  border: 1px solid rgba(19, 40, 62, 0.12);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 24px 80px rgba(19, 40, 62, 0.08);
}

.policy-meta { display: grid; align-content: start; gap: 20px; padding: 30px; border-right: 1px solid #e0e6ea; background: rgba(245,247,248,.72); }
.policy-meta label, .body-editor__label { display: grid; gap: 8px; color: #536476; font-size: 14px; }
.policy-meta input, .policy-meta select { width: 100%; min-height: 46px; padding: 0 13px; border: 1px solid #ccd7dd; border-radius: 12px; background: #fff; color: #13283e; }
.two-column-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.publish-note { margin-top: 6px; padding: 18px; border-left: 3px solid #d94712; background: #fff1eb; color: #364b60; }
.publish-note strong { color: #13283e; }
.publish-note p { margin: 8px 0 0; font-size: 13px; line-height: 1.65; }
.preview-link { color: #d94712; font-weight: 650; text-decoration: none; }

.body-editor { display: grid; min-width: 0; grid-template-rows: auto 1fr auto; gap: 14px; padding: 30px; }
.body-editor__label { display: flex; align-items: center; justify-content: space-between; }
.body-editor__label label { color: #13283e; font-size: 18px; font-weight: 700; }
.body-editor textarea { width: 100%; min-height: 520px; resize: vertical; padding: 24px; border: 1px solid #ccd7dd; border-radius: 18px; background: #fbfcfc; color: #13283e; font: 16px/1.75 ui-monospace, "SFMono-Regular", Menlo, monospace; }
.form-actions { display: flex; min-height: 52px; align-items: center; justify-content: flex-end; gap: 12px; }
.form-actions p { margin: 0 auto 0 0; color: #526273; font-size: 14px; }
.form-actions p[data-state="error"] { color: #ba2c12; }
.form-actions p[data-state="success"] { color: #197064; }

.password-dialog {
  width: min(520px, calc(100% - 28px));
  padding: 0;
  border: 1px solid rgba(19, 40, 62, 0.13);
  border-radius: 24px;
  background: #fbfcfc;
  color: #13283e;
  box-shadow: 0 34px 100px rgba(19, 40, 62, 0.24);
}
.password-dialog::backdrop { background: rgba(10, 27, 43, 0.46); backdrop-filter: blur(5px); }
.password-dialog form { display: grid; gap: 18px; padding: 30px; }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: 24px; }
.dialog-heading h2 { margin: 7px 0 0; font-size: 31px; letter-spacing: -0.04em; }
.dialog-close { width: 42px; height: 42px; border: 0; border-radius: 50%; background: #edf1f3; color: #526273; cursor: pointer; font-size: 26px; line-height: 1; }
.dialog-intro { margin: -2px 0 2px; color: #5c6d7e; font-size: 14px; line-height: 1.7; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 4px; }
.dialog-actions .primary-button { min-width: 132px; }
.password-dialog .error-message { margin: 0; font-size: 14px; }

[hidden] { display: none !important; }

@media (max-width: 820px) {
  .topbar { min-height: 68px; padding-inline: 18px; }
  .brand img { width: 128px; }
  .product-label { display: none; }
  main { width: min(100% - 28px, 680px); padding-top: 42px; }
  .editor__heading { align-items: start; flex-direction: column; gap: 22px; }
  .editor__heading h1 { font-size: 46px; }
  .policy-form { grid-template-columns: 1fr; }
  .policy-meta { border-right: 0; border-bottom: 1px solid #e0e6ea; }
  .body-editor, .policy-meta { padding: 22px; }
  .body-editor textarea { min-height: 480px; padding: 18px; }
  .form-actions { flex-wrap: wrap; }
  .form-actions p { width: 100%; }
  .account-panel { width: 100%; justify-content: space-between; overflow-x: auto; }
  .password-dialog form { padding: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
