:root {
  --page: #f5f6f8;
  --surface: #ffffff;
  --surface-subtle: #f7f8fa;
  --text: #111318;
  --text-secondary: #5f6673;
  --border: #e3e6eb;
  --border-strong: #cfd4dc;
  --accent: #0a59f7;
  --accent-hover: #084acd;
  --accent-soft: #edf3ff;
  --success: #18794e;
  --success-soft: #edf8f2;
  --danger: #c9362b;
  --shadow: 0 8px 28px rgba(17, 19, 24, 0.06);
  --radius-panel: 24px;
  --radius-control: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--page);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(10, 89, 247, 0.28);
  outline-offset: 2px;
}

.site-header {
  width: 100%;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.header-inner {
  width: min(1120px, calc(100% - 64px));
  min-height: 68px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  color: var(--text);
  font-size: 17px;
  font-weight: 680;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.privacy-status {
  min-height: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--success);
  background: var(--success-soft);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 620;
  white-space: nowrap;
}

.privacy-status svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.page-shell {
  width: min(1120px, calc(100% - 64px));
  margin: 0 auto;
}

.hero {
  padding: 64px 0 40px;
}

.eyebrow,
.section-label {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 720;
  letter-spacing: 0.1em;
}

.hero h1 {
  margin: 12px 0 0;
  max-width: 760px;
  font-size: clamp(38px, 5vw, 52px);
  line-height: 1.08;
  letter-spacing: -0.045em;
  font-weight: 700;
}

.hero-copy {
  max-width: 700px;
  margin: 20px 0 0;
  color: var(--text-secondary);
  font-size: 17px;
  line-height: 1.7;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: 24px;
  align-items: start;
}

.panel,
.info-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow);
}

.panel {
  padding: 28px;
}

.result-panel {
  position: sticky;
  top: 24px;
}

.panel-heading {
  min-height: 52px;
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.panel-heading h2,
.info-heading h2 {
  margin: 5px 0 0;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -0.025em;
  font-weight: 660;
}

.text-button {
  min-width: 48px;
  min-height: 48px;
  padding: 0 8px;
  border: 0;
  color: var(--accent);
  background: transparent;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 620;
  cursor: pointer;
}

.text-button:hover {
  background: var(--accent-soft);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.field-wide {
  grid-column: 1 / -1;
}

.field > span:first-child {
  color: #353a44;
  font-size: 14px;
  font-weight: 620;
}

.field input,
.field select {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  outline: none;
  color: var(--text);
  background: var(--surface-subtle);
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.field input:hover,
.field select:hover {
  border-color: #aeb5c0;
}

.field input:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10, 89, 247, 0.12);
  background: var(--surface);
}

.field small {
  min-height: 20px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.field.invalid input,
.field.invalid select {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(201, 54, 43, 0.1);
}

.password-wrap {
  position: relative;
  display: block;
}

.password-wrap input {
  padding-right: 58px;
}

.icon-button {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 48px;
  height: 48px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
}

.icon-button:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.icon-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.form-message {
  min-height: 22px;
  margin: 14px 0 8px;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.5;
}

.primary-button,
.secondary-button {
  min-height: 52px;
  border-radius: var(--radius-control);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.primary-button {
  width: 100%;
  padding: 0 18px;
  border: 1px solid var(--accent);
  color: #ffffff;
  background: var(--accent);
}

.primary-button:hover:not([aria-disabled="true"]) {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

.primary-button:active:not([aria-disabled="true"]),
.secondary-button:active:not(:disabled) {
  transform: scale(0.99);
}

.primary-button svg,
.secondary-button svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ready-badge {
  min-height: 32px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-secondary);
  background: var(--surface-subtle);
  font-size: 12px;
  font-weight: 620;
  white-space: nowrap;
}

.ready-badge.is-ready {
  color: var(--success);
  border-color: #c7e6d4;
  background: var(--success-soft);
}

.qr-frame {
  min-height: 300px;
  padding: 24px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px dashed var(--border-strong);
  border-radius: 18px;
  background: var(--surface-subtle);
}

.qr-placeholder {
  display: grid;
  justify-items: center;
  gap: 14px;
  color: var(--text-secondary);
  font-size: 14px;
}

.qr-placeholder svg {
  width: 88px;
  fill: none;
  stroke: #aeb5c0;
  stroke-width: 3;
}

.qr-placeholder p {
  margin: 0;
}

.qr-code {
  display: none;
  width: min(72vw, 260px);
  aspect-ratio: 1;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.qr-code svg {
  width: 100%;
  height: 100%;
  display: block;
}

.qr-frame.has-code .qr-placeholder {
  display: none;
}

.qr-frame.has-code .qr-code {
  display: block;
}

.node-summary {
  min-height: 60px;
  padding: 0 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.summary-name {
  font-size: 16px;
  font-weight: 660;
}

.summary-address {
  color: var(--text-secondary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.open-button[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
}

.secondary-actions {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.secondary-button {
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  color: var(--text);
  background: var(--surface);
}

.secondary-button:hover:not(:disabled) {
  border-color: #aeb5c0;
  background: var(--surface-subtle);
}

.secondary-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.action-wide {
  grid-column: 1 / -1;
}

.link-details {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.link-details summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  color: var(--text-secondary);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 560;
  cursor: pointer;
}

.link-details textarea {
  width: 100%;
  min-height: 96px;
  margin-top: 8px;
  padding: 12px;
  resize: vertical;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  color: #353a44;
  background: var(--surface-subtle);
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.info-panel {
  margin: 24px 0 72px;
  padding: 28px;
}

.info-heading {
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.info-heading > svg {
  width: 46px;
  height: 46px;
  padding: 11px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  border-radius: 14px;
  background: var(--accent-soft);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--border);
}

.info-grid > div {
  min-width: 0;
  padding: 24px 24px 4px 0;
}

.info-grid > div + div {
  padding-left: 24px;
  border-left: 1px solid var(--border);
}

.info-grid span {
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
}

.info-grid h3 {
  margin: 8px 0 6px;
  font-size: 16px;
  font-weight: 650;
}

.info-grid p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.65;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.site-footer > div {
  width: min(1120px, calc(100% - 64px));
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--text-secondary);
  font-size: 13px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 10;
  max-width: calc(100% - 32px);
  min-height: 44px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  color: #ffffff;
  background: #24272d;
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(17, 19, 24, 0.18);
  font-size: 13px;
  font-weight: 620;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 860px) {
  .header-inner,
  .page-shell,
  .site-footer > div {
    width: min(680px, calc(100% - 48px));
  }

  .hero {
    padding: 52px 0 32px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .result-panel {
    position: static;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .info-grid > div {
    padding: 20px 0;
  }

  .info-grid > div + div {
    padding-left: 0;
    border-top: 1px solid var(--border);
    border-left: 0;
  }
}

@media (max-width: 560px) {
  .header-inner,
  .page-shell,
  .site-footer > div {
    width: calc(100% - 32px);
  }

  .header-inner {
    min-height: 64px;
  }

  .privacy-status {
    padding: 0 9px;
    font-size: 12px;
  }

  .hero {
    padding: 44px 0 28px;
  }

  .hero h1 {
    font-size: clamp(32px, 10vw, 38px);
    letter-spacing: -0.035em;
  }

  .hero-copy {
    margin-top: 16px;
    font-size: 16px;
  }

  .panel,
  .info-panel {
    padding: 20px;
    border-radius: 20px;
  }

  .panel-heading {
    margin-bottom: 20px;
  }

  .panel-heading h2,
  .info-heading h2 {
    font-size: 20px;
  }

  .field-grid,
  .secondary-actions {
    grid-template-columns: 1fr;
  }

  .field,
  .field-wide,
  .action-wide {
    grid-column: 1;
  }

  .qr-frame {
    min-height: 270px;
    padding: 18px;
  }

  .node-summary {
    padding: 14px 2px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 5px;
  }

  .info-panel {
    margin-bottom: 56px;
  }

  .site-footer > div {
    min-height: 82px;
    padding: 18px 0 max(18px, env(safe-area-inset-bottom));
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
