@import url("/fontsource/inter/400.css");
@import url("/fontsource/inter/500.css");
@import url("/fontsource/inter/600.css");
@import url("/fontsource/inter/700.css");
@import url("/fontsource/inter/800.css");
@import url("/fontsource/noto-sans-sc/chinese-simplified-400.css");
@import url("/fontsource/noto-sans-sc/chinese-simplified-500.css");
@import url("/fontsource/noto-sans-sc/chinese-simplified-600.css");
@import url("/fontsource/noto-sans-sc/chinese-simplified-700.css");
@import url("/fontsource/noto-sans-sc/chinese-simplified-800.css");

:root {
  color-scheme: light;
  --background: #ffffff;
  --foreground: #171717;
  --muted: #f4f4f5;
  --muted-strong: #e9e9ec;
  --muted-foreground: #71717a;
  --border: rgba(24, 24, 27, 0.08);
  --ring: rgba(24, 24, 27, 0.18);
  --primary: #18181b;
  --primary-foreground: #fafafa;
  --success: #059669;
  --danger: #dc2626;
  --warning: #d97706;
  --radius: 22px;
  --radius-sm: 12px;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--background);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(244, 244, 245, 0.9), transparent 34rem),
    var(--background);
  color: var(--foreground);
  font-family: Inter, "Inter Fallback", "Noto Sans SC", "Noto Sans SC Fallback", system-ui, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: normal;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  width: min(1040px, calc(100% - 32px));
  min-height: 64px;
  margin: 14px auto 0;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.06);
}

.brand {
  display: inline-flex;
  align-items: center;
  height: 42px;
  max-width: min(176px, 44vw);
  padding-left: 6px;
  font-size: 14px;
  font-weight: 600;
}

.user-chip,
.login-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--background);
  color: var(--foreground);
  box-shadow: inset 0 0 0 1px var(--border);
}

.user-chip {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
}

.login-icon img {
  display: block;
  width: 72%;
  height: 72%;
  object-fit: contain;
}

.brand-logo {
  display: block;
  width: 170px;
  max-width: 100%;
  height: auto;
  max-height: 32px;
  object-fit: contain;
  object-position: left center;
}

.user-chip {
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: none;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  color: var(--muted-foreground);
  font-size: 13px;
  font-weight: 500;
}

.nav a,
.link-button {
  min-height: 34px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  transition: background 0.18s ease, color 0.18s ease;
}

.nav a:hover,
.link-button:hover {
  background: var(--muted);
  color: var(--foreground);
}

.nav form {
  margin: 0;
}

.user-profile {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 4px;
  border-radius: 999px;
  background: var(--muted);
  color: var(--foreground);
}

.user-avatar {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 12px;
  font-weight: 700;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.user-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page {
  width: min(1040px, calc(100% - 32px));
  margin: 46px auto 64px;
}

.flash {
  width: min(560px, calc(100% - 32px));
  margin: 18px auto 0;
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--muted);
  color: var(--foreground);
  font-size: 13px;
  text-align: center;
}

.flash.error,
.result.error {
  color: var(--danger);
  background: #fef2f2;
}

.flash.success,
.result.success {
  color: var(--success);
  background: #ecfdf5;
}

.login-shell {
  min-height: calc(100vh - 174px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
}

.login-card,
.panel.narrow {
  width: min(448px, 100%);
  padding: 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow);
}

.login-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  font-size: 18px;
  font-weight: 700;
}

.login-card h1,
.panel.narrow h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.4;
  letter-spacing: -0.3px;
  text-align: center;
}

.eyebrow {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: uppercase;
}

.lead {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 15px;
  line-height: 1.75;
}

.lead.compact {
  max-width: 360px;
  text-align: center;
}

.fineprint {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 12px;
  line-height: 1.7;
  text-align: center;
}

.rule-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.rule-strip span,
.pill,
.mini-stats span,
.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-height: 28px;
  border-radius: 999px;
  background: var(--muted);
  color: var(--muted-foreground);
  padding: 0 10px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.pill {
  color: var(--foreground);
}

.actions,
.filters,
.code-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.actions.stacked {
  width: 100%;
  display: grid;
}

.button,
.icon-button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

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

.button:disabled {
  cursor: wait;
  opacity: 0.68;
  transform: none;
}

.button.full {
  width: 100%;
}

.button.primary {
  background: var(--primary);
  color: var(--primary-foreground);
}

.button.secondary,
.icon-button {
  background: var(--muted);
  color: var(--foreground);
}

.button.danger {
  background: #fef2f2;
  color: var(--danger);
}

.button.disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.button.secondary:hover,
.icon-button:hover {
  background: var(--muted-strong);
}

.receive-page,
.project-page,
.panel {
  animation: rise 0.36s ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.receive-header,
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 26px;
}

.receive-header h1,
.panel h1 {
  margin: 4px 0 0;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: -0.75px;
}

.subtle {
  margin: 8px 0 0;
  color: var(--muted-foreground);
  font-size: 14px;
  line-height: 1.6;
}

.receive-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(320px, 0.92fr);
  gap: 28px;
  align-items: start;
}

.project-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
  gap: 28px;
  align-items: start;
}

.project-main {
  min-width: 0;
  display: grid;
  gap: 22px;
}

.project-hero {
  display: grid;
  gap: 14px;
}

.project-hero h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: normal;
}

.project-counts,
.project-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.project-counts {
  margin-top: 8px;
  color: var(--muted-foreground);
  font-size: 12px;
}

.project-counts span:nth-child(even) {
  color: rgba(113, 113, 122, 0.5);
}

.badge {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 9px;
  background: var(--muted);
  color: var(--foreground);
  font-size: 11px;
  font-weight: 500;
}

.project-section {
  display: grid;
  gap: 10px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
}

.section-label {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 11px;
  font-weight: 500;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 34px;
}

.summary-grid div,
.claim-metrics div {
  min-width: 0;
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
}

.summary-grid span,
.claim-metrics span,
.claim-summary span {
  color: var(--muted-foreground);
  font-size: 11px;
  font-weight: 500;
}

.summary-grid strong,
.claim-metrics strong {
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.content-preview {
  border-radius: 16px;
  background: var(--muted);
  padding: 11px 13px;
  color: var(--muted-foreground);
  font-size: 13px;
  font-weight: 500;
}

.claimed-content {
  display: grid;
  gap: 8px;
  color: var(--foreground);
}

.claimed-content span {
  color: var(--muted-foreground);
  font-size: 11px;
}

.claimed-content code {
  width: fit-content;
  max-width: 100%;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--background);
  overflow-wrap: anywhere;
  word-break: break-all;
  box-shadow: inset 0 0 0 1px var(--border);
}

.project-description {
  margin: 0;
  max-width: 690px;
  color: rgba(24, 24, 27, 0.9);
  font-size: 14px;
  line-height: 1.75;
}

.project-claim {
  display: grid;
  gap: 16px;
}

.project-side {
  min-width: 0;
  width: 100%;
  display: grid;
  gap: 14px;
}

.claim-summary {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.claim-summary .status {
  align-self: flex-start;
  flex: 0 0 auto;
  width: auto;
  height: 24px;
  min-height: 24px;
  padding: 0 9px;
  white-space: nowrap;
  writing-mode: horizontal-tb;
}

.claim-summary strong {
  display: block;
  margin-top: 2px;
  font-size: 32px;
  line-height: 1.15;
  font-weight: 700;
}

.claim-summary p {
  margin: 4px 0 0;
  color: var(--muted-foreground);
  font-size: 12px;
}

.claim-metrics {
  display: grid;
  gap: 8px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.claim-action {
  display: grid;
  gap: 10px;
}

.button.disabled.claim-state {
  min-height: 48px;
  font-size: 18px;
  font-weight: 700;
  opacity: 0.62;
}

.countdown {
  display: grid;
  gap: 4px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  padding: 12px;
  text-align: center;
  box-shadow: inset 0 0 0 1px var(--border);
}

.countdown span {
  color: var(--muted-foreground);
  font-size: 11px;
  font-weight: 500;
}

.countdown strong {
  color: var(--foreground);
  font-size: 22px;
  line-height: 1.2;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.receive-copy {
  min-width: 0;
  display: grid;
  gap: 24px;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 28px;
  padding: 18px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.meta-grid div,
.details div {
  display: grid;
  gap: 5px;
}

.meta-grid span,
.content-block span,
dt {
  color: var(--muted-foreground);
  font-size: 11px;
  font-weight: 500;
}

.meta-grid strong {
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
}

.content-block {
  display: grid;
  gap: 8px;
}

.content-block p {
  max-width: 660px;
  margin: 0;
  color: rgba(24, 24, 27, 0.9);
  font-size: 14px;
  line-height: 1.75;
}

.claim-panel {
  position: sticky;
  top: 100px;
  border-radius: var(--radius);
  background: rgba(244, 244, 245, 0.88);
  padding: 18px;
}

.online-widget {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 18px;
  background: rgba(244, 244, 245, 0.72);
  padding: 14px;
}

.online-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.online-head span,
.online-empty {
  color: var(--muted-foreground);
  font-size: 11px;
  font-weight: 500;
}

.online-empty {
  margin: 0;
}

.online-avatar-list {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.online-avatar {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  max-width: 32px;
  max-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--background);
  color: var(--foreground);
  font-size: 12px;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--border);
}

.online-avatar img {
  width: 100%;
  height: 100%;
  max-width: 32px;
  max-height: 32px;
  display: block;
  object-fit: cover;
}

.success-box,
.empty-state,
.result {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  padding: 16px;
}

.result {
  margin-top: 14px;
}

.code-row {
  margin-top: 8px;
}

.code-row code {
  min-height: 42px;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 16px;
  background: var(--background);
  color: var(--foreground);
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
  word-break: break-all;
  box-shadow: inset 0 0 0 1px var(--border);
}

.details {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
}

dd {
  margin: 0;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.panel {
  padding: 0;
}

.admin-panel {
  display: grid;
  gap: 18px;
}

.panel.narrow {
  margin: 80px auto;
}

.login-panel {
  text-align: center;
}

.login-panel .form {
  text-align: left;
}

.form {
  width: 100%;
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 500;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--background);
  color: var(--foreground);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

input,
select {
  height: 40px;
  padding: 0 12px;
}

textarea {
  min-height: 128px;
  padding: 12px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.06);
}

.import-form {
  max-width: none;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--muted);
}

.project-form {
  gap: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
}

.row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.row-actions form {
  margin: 0;
}

.filters {
  margin: 0;
}

.filters input {
  max-width: 360px;
}

.filters select {
  max-width: 160px;
}

.mini-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stat {
  min-height: 108px;
  display: grid;
  align-content: space-between;
  gap: 14px;
  border-radius: var(--radius);
  padding: 16px;
  background: var(--muted);
  transition: transform 0.18s ease, background 0.18s ease;
}

.stat:hover {
  transform: translateY(-2px);
  background: var(--muted-strong);
}

.stat span {
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 500;
}

.stat strong {
  color: var(--foreground);
  font-size: 34px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -1.02px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius);
  background: var(--muted);
  padding: 8px;
}

table {
  width: 100%;
  min-width: 840px;
  border-collapse: separate;
  border-spacing: 0 4px;
}

th,
td {
  padding: 11px 12px;
  text-align: left;
  white-space: nowrap;
  font-size: 13px;
}

th {
  color: var(--muted-foreground);
  font-size: 11px;
  font-weight: 500;
}

tbody tr {
  background: rgba(255, 255, 255, 0.8);
}

tbody td:first-child {
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
}

tbody td:last-child {
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
}

.empty-cell {
  color: var(--muted-foreground);
  text-align: center;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted-foreground);
  font-size: 13px;
}

.pagination div {
  display: flex;
  gap: 8px;
}

.status.unused,
.status.success {
  background: #ecfdf5;
  color: var(--success);
}

.status.claimed {
  background: #fff7ed;
  color: var(--warning);
}

.status.failed {
  background: #fef2f2;
  color: var(--danger);
}

.status.disabled,
.status.closed {
  background: var(--muted-strong);
  color: var(--muted-foreground);
}

@media (max-width: 860px) {
  .receive-layout,
  .project-layout {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .claim-panel {
    position: static;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar {
    min-height: 56px;
    margin-top: 10px;
    padding: 8px 10px;
    gap: 10px;
  }

  .brand {
    height: 36px;
    max-width: min(148px, 48vw);
    padding-left: 4px;
  }

  .brand-logo {
    width: 144px;
    max-height: 27px;
  }

  .nav {
    flex: 0 0 auto;
    justify-content: flex-end;
    flex-wrap: nowrap;
    font-size: 12px;
  }

  .nav a,
  .link-button {
    min-height: 32px;
    padding: 0 9px;
  }

  .user-profile {
    max-width: 140px;
  }

  .user-name {
    max-width: 84px;
  }

  .page {
    width: min(1040px, calc(100% - 32px));
    margin-top: 28px;
  }

  .project-main {
    gap: 18px;
  }

  .project-hero h1 {
    font-size: 26px;
  }

  .project-section {
    padding: 14px 0;
  }

  .claim-panel,
  .online-widget {
    padding: 16px;
  }

  .login-card,
  .panel.narrow {
    padding: 24px;
  }

  .receive-header,
  .section-head {
    display: grid;
  }

  .receive-header h1,
  .panel h1 {
    font-size: 25px;
  }

  .meta-grid,
  .summary-grid,
  .form-grid,
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .summary-grid div,
  .claim-metrics div {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .actions,
  .filters,
  .code-row,
  .pagination {
    align-items: stretch;
  }

  .pagination {
    display: grid;
  }

  .pagination div {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .button,
  .icon-button {
    width: 100%;
  }

  .filters input,
  .filters select {
    max-width: none;
  }
}

@media (max-width: 420px) {
  .topbar,
  .page {
    width: min(1040px, calc(100% - 24px));
  }

  .brand {
    max-width: 128px;
  }

  .brand-logo {
    width: 126px;
  }

  .nav {
    gap: 2px;
  }

  .nav a,
  .link-button {
    padding: 0 8px;
  }

  .user-profile {
    max-width: 112px;
    gap: 6px;
  }

  .user-name {
    max-width: 58px;
  }

  .summary-grid div,
  .claim-metrics div {
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 9px;
  }
}
