:root {
  --page-bg: #f4efe6;
  --page-bg-soft: #fffaf2;
  --surface: rgba(255, 250, 242, 0.88);
  --surface-strong: #fffdf8;
  --surface-accent: #f4e3cc;
  --text: #2d241d;
  --muted: #786757;
  --border: rgba(123, 92, 61, 0.18);
  --border-strong: rgba(123, 92, 61, 0.3);
  --primary: #d06b2f;
  --primary-strong: #b84f17;
  --primary-soft: #f9dfc8;
  --danger: #bf3f34;
  --danger-soft: #f7d5d0;
  --link: #185a72;
  --shadow: 0 24px 60px rgba(120, 84, 48, 0.12);
  --shadow-soft: 0 12px 28px rgba(120, 84, 48, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  background: var(--page-bg);
  font-family: "Space Grotesk", "Avenir Next", "PingFang SC", sans-serif;
}

.page {
  position: relative;
  padding: 36px 28px 0;
}

.page-app {
  max-width: 1240px;
  margin: 0 auto;
}

.page-auth {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-shell {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(380px, 480px);
  gap: 26px;
  align-items: stretch;
  flex: 1 0 auto;
  margin: auto 0;
}

.auth-aside {
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 20px 10px 20px 6px;
}

.bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 12% 14%, rgba(243, 190, 107, 0.22), transparent 34%),
    radial-gradient(circle at 82% 16%, rgba(80, 141, 153, 0.18), transparent 32%),
    radial-gradient(circle at 48% 88%, rgba(208, 107, 47, 0.14), transparent 28%),
    linear-gradient(180deg, #fffaf2 0%, #f4efe6 52%, #efe5d7 100%);
  z-index: -1;
}

h1,
h2 {
  margin: 0;
  letter-spacing: -0.04em;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.3rem);
  line-height: 0.96;
}

h2 {
  font-size: 1.2rem;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--primary-strong);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.site-footer {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 16px;
  padding: 18px 16px 28px;
  font-size: 0.75rem;
  color: var(--muted);
}

.site-footer span {
  opacity: 0.7;
}

.site-footer .footer-sep {
  opacity: 0.3;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.site-footer a:hover {
  color: var(--primary);
}

.card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.96), rgba(255, 248, 238, 0.88));
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.auth-card {
  width: 100%;
  min-height: 100%;
  padding: 32px 30px 28px;
}

.auth-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.auth-card-title {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.auth-lead {
  max-width: 520px;
  font-size: 1rem;
}

.auth-visual {
  position: relative;
  min-height: 250px;
  border: 1px solid var(--border);
  border-radius: 30px;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.75), transparent 30%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.55), rgba(244, 227, 204, 0.74));
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.auth-grid {
  position: absolute;
  inset: 24px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 12px;
}

.auth-grid span {
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid rgba(123, 92, 61, 0.08);
}

.auth-orbit {
  position: absolute;
  border-radius: 999px;
  border: 1px dashed rgba(208, 107, 47, 0.36);
}

.auth-orbit-a {
  width: 220px;
  height: 220px;
  left: -20px;
  top: 12px;
}

.auth-orbit-b {
  width: 180px;
  height: 180px;
  right: 24px;
  bottom: -18px;
  border-color: rgba(24, 90, 114, 0.28);
}

.auth-chip {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}

.auth-chip-a {
  left: 28px;
  top: 28px;
}

.auth-chip-b {
  right: 34px;
  top: 68px;
}

.auth-chip-c {
  left: 96px;
  bottom: 34px;
}

.auth-points {
  display: grid;
  gap: 12px;
}

.auth-point {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.52);
}

.auth-point strong {
  font-size: 0.95rem;
}

.auth-point span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.app-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding: 6px 4px 4px;
}

.hero-copy {
  display: grid;
  gap: 14px;
  max-width: 720px;
}

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

.user-badge {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  box-shadow: var(--shadow-soft);
  color: var(--muted);
  font-size: 0.88rem;
}

.layout {
  display: grid;
  gap: 22px;
  margin-top: 26px;
  grid-template-columns: 1fr;
  flex: 1 0 auto;
}

.upload-panel,
.sites-panel {
  position: relative;
  overflow: hidden;
}

.upload-panel::before,
.sites-panel::before,
.auth-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), #f1c88f, #5f9ea0);
}

.panel-heading,
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-tag {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 0.8rem;
  font-weight: 700;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 24px 0 20px;
}

.mode-btn {
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--border);
  color: var(--muted);
}

.mode-btn.active {
  background: var(--text);
  border-color: var(--text);
  color: #fffaf2;
}

.upload-panel #uploadSubmitBtn {
  width: 100%;
  margin-top: 16px;
}

.form,
.form-stack {
  display: grid;
  gap: 14px;
}

.setup-header {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(244, 227, 204, 0.45);
}

label {
  display: grid;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="file"] {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--text);
  padding: 0 14px;
  font: inherit;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

input[type="file"] {
  padding: 11px 14px;
}

input:focus {
  outline: none;
  border-color: rgba(208, 107, 47, 0.5);
  box-shadow: 0 0 0 4px rgba(208, 107, 47, 0.12);
}

.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.code-input-wrap {
  min-width: 0;
}

button {
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
  color: #fff8f1;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease, border-color 140ms ease;
  box-shadow: 0 10px 22px rgba(208, 107, 47, 0.24);
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
  box-shadow: none;
}

button.ghost {
  background: rgba(255, 255, 255, 0.7);
  border-color: var(--border);
  color: var(--text);
  box-shadow: none;
}

button.danger {
  background: linear-gradient(135deg, var(--danger) 0%, #8f251c 100%);
  box-shadow: 0 10px 22px rgba(191, 63, 52, 0.18);
}

.error,
.result,
.tip {
  min-height: 20px;
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 0.9rem;
}

.error:empty,
.result:empty,
.tip:empty {
  display: none;
}

.error {
  color: #9d2f25;
  background: rgba(247, 213, 208, 0.72);
}

.result {
  color: #185a72;
  background: rgba(208, 234, 240, 0.68);
}

.tip {
  margin-top: 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.52);
}

.list {
  display: grid;
  gap: 14px;
}

.item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.64);
  box-shadow: var(--shadow-soft);
}

.item-id {
  margin-bottom: 6px;
  font-size: 1.02rem;
  font-weight: 700;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.item-pv {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--muted);
}

.item-meta {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.item-link {
  color: var(--link);
  font-size: 0.92rem;
  text-decoration: none;
  word-break: break-all;
}

.item-link:hover {
  text-decoration: underline;
}

.item-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (min-width: 940px) {
  .layout {
    grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
    align-items: start;
  }

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

@media (max-width: 760px) {
  .page {
    padding: 20px 16px 34px;
  }

  .auth-shell {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .auth-aside {
    padding: 0;
  }

  .app-hero,
  .topbar-actions,
  .section-title,
  .item {
    flex-direction: column;
    align-items: stretch;
  }

  .user-badge,
  .topbar-actions button,
  .item-actions button {
    width: 100%;
  }

  .mode-switch,
  .code-row {
    grid-template-columns: 1fr;
  }

  .auth-card {
    padding: 24px 18px 20px;
  }
}
