[hidden] {
  display: none !important;
}

:root {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --surface-soft: #fbfbf9;
  --ink: #1f242a;
  --muted: #6a737c;
  --line: #dcdeda;
  --line-strong: #c4c8c4;
  --accent: #0e766d;
  --accent-soft: #dff1ed;
  --danger: #b93a34;
  --warning: #a16207;
  --radius: 8px;
  --shadow: 0 12px 32px rgba(24, 28, 31, 0.08);
  --control-bg: #ffffff;
  --font: "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

html[data-theme='dark'] {
  --bg: #111417;
  --surface: #181c20;
  --surface-soft: #1d2227;
  --ink: #e7eaed;
  --muted: #9aa4ad;
  --line: #2a3037;
  --line-strong: #3a424b;
  --accent: #42c6b4;
  --accent-soft: rgba(66, 198, 180, 0.14);
  --danger: #f08a83;
  --warning: #e3a45c;
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
  --control-bg: #1d2227;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  letter-spacing: 0;
  line-height: 1.5;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 800;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
}

.lang-switch button {
  min-width: 38px;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.lang-switch button.active {
  background: var(--ink);
  color: var(--bg);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition:
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn .brand-letter {
  font-size: 17px;
  font-weight: 800;
}

.icon-btn.small {
  width: 32px;
  height: 32px;
}

.icon-btn .icon-sun {
  display: none;
}

html[data-theme='dark'] .icon-btn .icon-sun {
  display: block;
}

html[data-theme='dark'] .icon-btn .icon-moon {
  display: none;
}

.page-title {
  margin: 32px 0 20px;
  font-size: 26px;
  letter-spacing: 0;
}

.upload-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
  padding-bottom: 48px;
}

.form-main,
.form-side {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.field {
  display: block;
  margin-bottom: 18px;
}

.field:last-child {
  margin-bottom: 0;
}

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

.field-label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 600;
}

.text-input {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--control-bg);
  color: var(--ink);
  font: inherit;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.text-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

textarea.text-input {
  min-height: 84px;
  resize: vertical;
}

.field-hint {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.dropzone {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 84px;
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-soft);
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease;
}

.dropzone:hover,
.dropzone.drag {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.preview-panel {
  margin-top: 14px;
}

.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.preview-head .field-label {
  margin-bottom: 0;
}

.preview-frame {
  display: block;
  width: 100%;
  height: 260px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.button-icon {
  width: 16px;
  height: 16px;
  flex: none;
}

.input-with-status {
  position: relative;
}

.input-with-status .text-input {
  padding-right: 92px;
}

.alias-status {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  max-width: 84px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.alias-status.ok {
  color: var(--accent);
}

.alias-status.taken,
.alias-status.invalid {
  color: var(--danger);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    opacity 0.15s ease;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn.primary {
  width: 100%;
  background: var(--accent);
  color: #fff;
}

.btn.primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, #000);
}

.btn.primary:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn.ghost {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn.ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.result-panel {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.result-panel .field-label {
  margin-top: 14px;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.result-actions .btn {
  width: 100%;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge.success {
  background: var(--accent-soft);
  color: var(--accent);
}

.form-error {
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 42%, transparent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  color: var(--danger);
  font-size: 13px;
}

.footer {
  padding: 34px 0 28px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.footer-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  flex-wrap: wrap;
}

.footer-tagline {
  margin: 8px 0 0;
  font-size: 13px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  max-width: 640px;
}

.footer-links a {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.footer-links a:hover {
  color: var(--accent);
  text-decoration: none;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.view-body {
  overflow: hidden;
}

.view-stage {
  position: fixed;
  inset: 0;
}

.share-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.toolbar {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar .icon-btn {
  background: color-mix(in srgb, var(--surface) 94%, transparent);
}

.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.lock-box {
  width: min(480px, calc(100% - 32px));
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.lock-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent);
}

.lock-icon svg {
  width: 22px;
  height: 22px;
}

.lock-title {
  margin: 20px 0 8px;
  font-size: 22px;
  letter-spacing: 0;
}

.lock-meta {
  margin: 0 0 18px;
  font-size: 14px;
}

.lock-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lock-form .text-input {
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  font-size: 18px;
}

.lock-form .btn {
  width: 100%;
  min-height: 52px;
  padding: 12px 20px;
  font-size: 16px;
}

.meta-panel {
  position: fixed;
  top: 70px;
  right: 18px;
  z-index: 60;
  width: min(360px, calc(100vw - 36px));
  max-height: calc(100vh - 96px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.meta-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.meta-panel-head strong {
  min-width: 0;
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-body {
  padding: 14px 16px;
}

.meta-row {
  margin-bottom: 12px;
}

.meta-row:last-child {
  margin-bottom: 0;
}

.meta-label {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 12px;
}

.meta-value {
  overflow-wrap: anywhere;
  font-size: 14px;
  white-space: pre-wrap;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.tag {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  font-size: 12px;
}

.legal-shell {
  width: min(760px, calc(100% - 32px));
  margin: 40px auto 72px;
}

.legal-panel {
  padding: 36px 40px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.legal-panel h1 {
  margin: 0 0 8px;
  font-size: 26px;
  letter-spacing: 0;
}

.legal-updated {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 13px;
}

.legal-panel h2 {
  margin: 26px 0 8px;
  font-size: 17px;
  letter-spacing: 0;
}

.legal-panel p {
  margin: 0 0 14px;
}

@media (max-width: 800px) {
  .upload-grid {
    grid-template-columns: 1fr;
  }

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

  .legal-panel {
    padding: 24px 20px;
  }
}

@media (max-width: 600px) {
  .shell {
    width: min(100% - 24px, 1080px);
  }

  .topbar-inner {
    min-height: 58px;
  }

  .topbar-actions {
    gap: 8px;
  }

  .page-title {
    margin: 24px 0 16px;
    font-size: 22px;
  }

  .form-main,
  .form-side {
    padding: 18px 16px;
  }

  .toolbar {
    top: auto;
    right: 12px;
    bottom: 12px;
  }

  .meta-panel {
    top: 12px;
    right: 12px;
    width: calc(100vw - 24px);
    max-height: calc(100vh - 88px);
  }

  .footer-inner {
    flex-direction: column;
    gap: 18px;
  }
}
