/* ============================================================
   PUYSY 用户中心 — Graphite & Ice
   No green. No glass. No gradients. Flat ledgers and hairlines.
   ============================================================ */

:root {
  color-scheme: dark;

  --ground: #0a0c0f;
  --ground-2: #0d1014;
  --panel: #12161b;
  --panel-2: #171c22;
  --panel-3: #1d242b;

  --ink: #e6edf3;
  --ink-2: #a7b3bf;
  --ink-3: #7f8c99;
  --ink-4: #5f6b76;

  --rule: rgba(230, 237, 243, .12);
  --rule-strong: rgba(230, 237, 243, .22);

  --accent: #7aa2c8;
  --accent-bright: #9bbbd8;
  --accent-dim: rgba(122, 162, 200, .14);
  --info: #7aa2c8;
  --warn: #c99a5b;
  --bad: #c96b62;

  --hm-0: #18242e;
  --hm-1: #243b4d;
  --hm-2: #355a75;
  --hm-3: #4e7c9e;
  --hm-4: #7aa2c8;
  --hm-cell: 15px;
  --hm-gap: 4px;

  --font-display: "Bahnschrift", "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
  --font-body: "Segoe UI Variable Text", "Segoe UI", "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
  --font-mono: "Cascadia Mono", "JetBrains Mono", Consolas, monospace;

  --sidebar-w: 228px;
  --content-max: 1480px;

  --ease: cubic-bezier(.22, .61, .36, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --dur-1: 120ms;
  --dur-2: 180ms;
  --dur-3: 260ms;
}

*,
*::before,
*::after { box-sizing: border-box; }

html,
body { overflow-x: clip; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ground);
  color: var(--ink);
  font: 400 14px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, dl, dd, ol, ul { margin: 0; }
ul { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

::selection {
  background: var(--accent);
  color: var(--ground);
}

:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 3px;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--rule-strong) transparent;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--rule-strong);
  border: 3px solid var(--ground);
  border-radius: 999px;
}
*::-webkit-scrollbar-track { background: transparent; }

.mono {
  font-family: var(--font-mono);
  font-size: .92em;
  letter-spacing: .01em;
}

/* ============ buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  min-width: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--panel-3);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  transition:
    background-color var(--dur-2) var(--ease),
    border-color var(--dur-2) var(--ease),
    color var(--dur-2) var(--ease),
    transform var(--dur-1) var(--ease);
}

.btn:hover { background: #272b27; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:disabled:active { transform: none; }

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #0a0c0f;
}
.btn-accent:hover {
  background: var(--accent-bright);
  border-color: var(--accent-bright);
}

.btn-quiet {
  background: transparent;
  border-color: var(--rule-strong);
  color: var(--ink-2);
}
.btn-quiet:hover {
  background: var(--panel-2);
  border-color: var(--ink-3);
  color: var(--ink);
}

.btn-sm {
  min-height: 32px;
  padding: 0 12px;
  font-size: 12.5px;
}

.btn-block { width: 100%; }
.btn-icon { width: 14px; height: 14px; flex: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.btn-row-end { justify-content: flex-end; }

.link-btn {
  display: inline;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 12.5px;
  text-align: left;
}
.link-btn:hover { color: var(--accent-bright); }

.link-accent {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  font-size: 12px;
}
.link-accent:hover { color: var(--accent-bright); }

.btn-copy {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--rule);
  border-radius: 5px;
  background: transparent;
  color: var(--ink-3);
  font-size: 12px;
  transition:
    color var(--dur-2) var(--ease),
    border-color var(--dur-2) var(--ease),
    background-color var(--dur-2) var(--ease);
}
.btn-copy:hover {
  color: var(--ink);
  border-color: var(--ink-3);
  background: var(--panel-2);
}
.btn-copy[disabled] { opacity: .45; cursor: not-allowed; }

/* ============ form fields ============ */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.field-grow { flex: 1 1 220px; margin-bottom: 0; }

.field label {
  color: var(--ink-3);
  font-size: 12px;
}

.field input,
.field select,
.field textarea,
.input-wrap input {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--ground-2);
  color: var(--ink);
  font-size: 13.5px;
  transition:
    border-color var(--dur-2) var(--ease),
    background-color var(--dur-2) var(--ease);
}

.field textarea {
  line-height: 1.6;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder,
.input-wrap input::placeholder { color: var(--ink-4); }

.field input:hover,
.field select:hover,
.field textarea:hover,
.input-wrap input:hover { background: var(--panel); }

.field input:focus,
.field select:focus,
.field textarea:focus,
.input-wrap input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--panel);
}

.field select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%238b8a82' stroke-width='1.2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.form-error {
  margin: 8px 0 0;
  color: var(--bad);
  font-size: 12px;
}

.input-wrap { position: relative; }

.redeem-form {
  display: flex;
  align-items: end;
  gap: 12px;
}

/* ============ login ============ */
.login-view {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  min-height: 100svh;
}

.login-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  padding: 32px clamp(24px, 5vw, 64px);
}

.login-back {
  align-self: flex-start;
  color: var(--ink-3);
  font-size: 12.5px;
  transition: color var(--dur-2) var(--ease);
}
.login-back:hover { color: var(--ink); }

.login-form-wrap {
  width: min(380px, 100%);
  margin: auto;
  padding: 40px 0;
  animation: rise-in 360ms var(--ease) both;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 36px;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: .01em;
}

.login-mark { width: 24px; height: 24px; }

.login-title {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.02em;
}

.login-sub {
  margin-top: 8px;
  color: var(--ink-3);
  font-size: 13px;
}

.auth-tabs {
  display: inline-flex;
  gap: 2px;
  margin: 26px 0 22px;
  padding: 3px;
  border: 1px solid var(--rule);
  border-radius: 7px;
  background: var(--ground-2);
}

.auth-tab {
  min-height: 32px;
  padding: 0 18px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-3);
  font-size: 12.5px;
  transition:
    background-color var(--dur-2) var(--ease),
    color var(--dur-2) var(--ease);
}

.auth-tab:hover { color: var(--ink-2); }

.auth-tab.is-active {
  background: var(--panel-3);
  color: var(--ink);
}

.login-form .btn-block {
  min-height: 46px;
  margin-top: 6px;
  font-size: 14px;
}

.auth-switch {
  margin-top: 18px;
  color: var(--ink-3);
  font-size: 12.5px;
}

.login-version {
  margin-top: 28px;
  color: var(--ink-4);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.login-aside {
  display: flex;
  padding: clamp(32px, 5vw, 72px);
  background: var(--panel);
  border-left: 1px solid var(--rule);
}

.aside-inner {
  width: min(440px, 100%);
  margin: auto;
}

.aside-label {
  color: var(--ink-4);
  font-size: 11.5px;
}

.aside-inner h2 {
  margin-top: 18px;
  font-family: var(--font-display);
  font-size: clamp(38px, 4vw, 56px);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -.03em;
}

.aside-steps {
  margin-top: 48px;
  border-top: 1px solid var(--rule);
}

.aside-steps li {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 18px 0;
  border-bottom: 1px solid var(--rule);
}

.aside-mark {
  width: 12px;
  height: 12px;
  margin-top: 3px;
  border: 1px solid var(--accent);
  border-radius: 2px;
}

.aside-steps strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
}

.aside-steps small {
  display: block;
  margin-top: 3px;
  color: var(--ink-3);
  font-size: 12px;
}

.aside-note {
  margin-top: 28px;
  color: var(--ink-4);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

/* ============ app shell ============ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100svh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100svh;
  padding: 24px 14px 16px;
  background: var(--panel);
  border-right: 1px solid var(--rule);
}

.sidebar-head { padding: 0 10px 24px; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .01em;
}

.sidebar-mark { width: 21px; height: 21px; }

.sidebar-sub {
  margin-top: 5px;
  color: var(--ink-4);
  font-size: 10.5px;
}

.nav {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 12px;
}

.nav-label {
  margin: 16px 10px 7px;
  color: var(--ink-4);
  font-size: 10.5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-left: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 13px;
  text-align: left;
  transition:
    background-color var(--dur-2) var(--ease),
    color var(--dur-2) var(--ease),
    border-color var(--dur-2) var(--ease);
}

.nav-item:hover {
  background: var(--panel-2);
  color: var(--ink);
}

.nav-item.is-active {
  border-left-color: var(--accent);
  background: var(--panel-2);
  color: var(--ink);
}

.nav-icon {
  width: 17px;
  height: 17px;
  flex: none;
  opacity: .8;
}

.nav-admin { margin-top: 2px; }

.sidebar-user {
  position: relative;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  transition:
    background-color var(--dur-2) var(--ease),
    border-color var(--dur-2) var(--ease);
}

.user-chip:hover {
  background: var(--panel-2);
  border-color: var(--rule);
}

.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 5px;
  background: var(--accent);
  color: #0a0c0f;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
}

.user-meta {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.user-name {
  overflow: hidden;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.user-sub {
  color: var(--ink-4);
  font-size: 10.5px;
}

.user-chevron {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--ink-4);
}

.user-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 30;
  padding: 6px;
  border: 1px solid var(--rule);
  border-radius: 7px;
  background: var(--panel-2);
  animation: pop-in var(--dur-2) var(--ease) both;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 0 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px;
  text-align: left;
}

.user-menu-item:hover {
  background: var(--panel-3);
  color: var(--ink);
}

.user-menu-item svg {
  width: 16px;
  height: 16px;
}

/* ============ content ============ */
.content {
  min-width: 0;
  padding: 0 clamp(24px, 4vw, 48px) 64px;
}

.content-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 64px;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--rule);
}

.content-crumb {
  color: var(--ink-4);
  font-size: 11.5px;
}

.top-action {
  border: 0;
  background: none;
  color: var(--ink-3);
  font-size: 12.5px;
  transition: color var(--dur-2) var(--ease);
}
.top-action:hover { color: var(--ink); }

.view {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  min-width: 0;
  max-width: var(--content-max);
  margin: 0 auto;
}

/* 管理后台嵌入：铺满整行，不跟着内容列宽收窄 */
.view[data-view="admin"] { max-width: none; }

html.js .view { display: none; }
html.js .view.is-active {
  display: flex;
  animation: view-in var(--dur-2) var(--ease) both;
}
html.js .view.is-leaving {
  display: flex;
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  pointer-events: none;
  animation: view-out var(--dur-1) var(--ease) both;
}

.view-head {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 8px 24px;
  min-height: 44px;
}

.view-head > .btn,
.view-head > .view-note { margin-left: auto; }

.view-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 3vw, 36px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.02em;
}

.view-desc {
  margin-top: 6px;
  color: var(--ink-3);
  font-size: 12.5px;
}

.view-note {
  color: var(--ink-4);
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* ============ panels ============ */
.panel {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--panel);
}

.overview-grid > * { min-width: 0; }
.heatmap-panel { overflow: hidden; }

.heatmap-wrap {
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 2px;
}

.panel-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.panel-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
}

.panel-note {
  margin-left: auto;
  color: var(--ink-4);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.panel-help {
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1.7;
}

.overview-grid {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.status-panel { display: flex; flex-direction: column; }

.sub-label {
  color: var(--ink-4);
  font-size: 11.5px;
}

.sub-big {
  margin-top: 2px;
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}

.kv { margin: 18px 0 0; }

.kv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-top: 1px solid var(--rule);
}

.kv-row dt {
  color: var(--ink-4);
  font-size: 11.5px;
}

.kv-row dd {
  margin: 0;
  min-width: 0;
  color: var(--ink-2);
  font-size: 12px;
  text-align: right;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.status-panel .btn-row { margin-top: auto; padding-top: 16px; }

/* ============ heatmap ============ */
.heatmap-months {
  display: grid;
  gap: var(--hm-gap);
  margin: 0 0 4px calc(var(--hm-cell) + 14px);
  color: var(--ink-4);
  font-family: var(--font-mono);
  font-size: 9.5px;
  white-space: nowrap;
}

.heatmap-body {
  display: flex;
  gap: 8px;
}

.heatmap-days {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1px 0;
  color: var(--ink-4);
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1;
}

.heatmap {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, var(--hm-cell));
  grid-auto-columns: var(--hm-cell);
  gap: var(--hm-gap);
}

.hm-cell {
  width: var(--hm-cell);
  height: var(--hm-cell);
  border-radius: 2px;
  background: var(--hm-0);
}

.hm-cell[data-level="1"] { background: var(--hm-1); }
.hm-cell[data-level="2"] { background: var(--hm-2); }
.hm-cell[data-level="3"] { background: var(--hm-3); }
.hm-cell[data-level="4"] { background: var(--hm-4); }

.heatmap-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  color: var(--ink-4);
  font-size: 10.5px;
}

.heatmap-legend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.heatmap-legend .hm-cell {
  width: 10px;
  height: 10px;
}

.tooltip {
  position: fixed;
  z-index: 60;
  padding: 6px 9px;
  border: 1px solid var(--rule);
  border-radius: 5px;
  background: var(--panel-2);
  color: var(--ink);
  font-size: 10.5px;
  pointer-events: none;
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 8px));
  font-variant-numeric: tabular-nums;
}

/* ============ tables ============ */
.table-wrap { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.table th {
  padding: 8px 10px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink-4);
  font-size: 10.5px;
  font-weight: 500;
  text-align: left;
}

.table td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink-2);
  vertical-align: top;
}

.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: rgba(236, 233, 226, .025); }

.table .col-amount { width: 90px; text-align: right; }
.table .col-time { width: 150px; }
.table td.col-amount {
  color: var(--accent-bright);
  font-family: var(--font-mono);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.table td.col-time {
  color: var(--ink-4);
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* ============ badges ============ */
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 19px;
  padding: 0 6px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  color: var(--ink-4);
  font-family: var(--font-mono);
  font-size: 9.5px;
  line-height: 1;
  white-space: nowrap;
}

.badge-ok {
  border-color: rgba(201, 162, 39, .5);
  color: var(--accent-bright);
}
.badge-warn {
  border-color: rgba(208, 138, 62, .45);
  color: var(--warn);
}
.badge-bad {
  border-color: rgba(194, 91, 78, .45);
  color: var(--bad);
}
.badge-dim { color: var(--ink-4); }
.badge-accent {
  border-color: rgba(201, 162, 39, .45);
  color: var(--accent);
}

/* ============ redeem ============ */
.redeem-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  gap: 16px;
  align-items: start;
}

/* ============ invites ============ */
.invite-codes { display: flex; flex-direction: column; }

.invite-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 11px 0;
  border-top: 1px solid var(--rule);
}
.invite-row:first-child { border-top: 0; padding-top: 0; }

.invite-code {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: .02em;
}

.preset-time {
  color: var(--ink-4);
  font-family: var(--font-mono);
  font-size: 10.5px;
  white-space: nowrap;
}

/* ============ presets / tickets / changelog ============ */
.preset-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--rule);
}

.preset-card {
  padding: 20px 0;
  border-bottom: 1px solid var(--rule);
}

.preset-top {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.preset-name {
  flex: 1;
  min-width: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

.preset-preview {
  max-height: 160px;
  margin-top: 12px;
  padding: 12px;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--ground-2);
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-all;
}

.preset-actions { display: flex; gap: 8px; margin-top: 12px; }

.changelog {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--rule);
}

.release {
  padding: 20px 0;
  border-bottom: 1px solid var(--rule);
}

.release-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
}

.release-version {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.release-date {
  color: var(--ink-4);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.release-title {
  margin-top: 7px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
}

.release-body {
  margin-top: 8px;
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1.75;
}

.release-body ul {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-left: 16px;
  list-style: square;
}

.release-body li::marker { color: var(--accent); }
.release-body p + p { margin-top: 6px; }

.ticket-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--rule);
}

.ticket-card {
  padding: 20px 0;
  border-bottom: 1px solid var(--rule);
}

.ticket-top {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
}

.ticket-subject {
  flex: 1;
  min-width: 180px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.ticket-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
  color: var(--ink-4);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.ticket-body {
  margin-top: 10px;
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.ticket-reply {
  margin-top: 12px;
  padding: 12px;
  border-left: 1px solid var(--accent);
  background: var(--ground-2);
}

.ticket-reply-label {
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 10.5px;
}

.ticket-reply-text {
  color: var(--ink-2);
  font-size: 12.5px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ============ download ============ */
.download-card {
  display: flex;
  align-items: center;
  gap: 18px;
}

.admin-frame {
  width: 100%;
  height: calc(100vh - 190px);
  min-height: 620px;
  border: 0;
  border-radius: 10px;
  background: var(--ground);
}

.download-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  color: var(--accent);
}

.download-icon svg { width: 22px; height: 22px; }
.download-card .btn { margin-left: auto; }

/* ============ modals ============ */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .72);
  animation: fade-in var(--dur-2) var(--ease) both;
}

.modal {
  position: relative;
  width: min(480px, 100%);
  max-height: calc(100svh - 40px);
  overflow-y: auto;
  padding: 28px;
  border: 1px solid var(--rule-strong);
  border-radius: 12px;
  background: var(--panel);
  animation: modal-in var(--dur-3) var(--ease) both;
}

.modal-title {
  margin-bottom: 20px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.01em;
}

html.js .modal-root.is-closing .modal {
  animation: modal-out var(--dur-2) var(--ease) both;
}
html.js .modal-root.is-closing .modal-scrim {
  animation: fade-out var(--dur-2) var(--ease) both;
}

/* ============ toasts ============ */
.toast-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100vw - 40px));
}

.toast {
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-left: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--ink);
  font-size: 12px;
  animation: toast-in var(--dur-2) var(--ease) both;
}

.toast.is-out { animation: toast-out var(--dur-1) var(--ease) both; }
.toast-bad { border-left-color: var(--bad); }
.toast-text { color: var(--ink-2); }

/* ============ skeleton / empty ============ */
.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: 5px;
  background: var(--panel-2);
  color: transparent !important;
  pointer-events: none;
}
.skeleton * { visibility: hidden; }
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(236, 233, 226, .04);
  transform: translateX(-100%);
  animation: sweep 1.4s var(--ease-in-out) infinite;
}
.sk-line { height: 12px; margin: 10px 0; }
.sk-line-lg { height: 18px; }
.sk-block { height: 84px; }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 28px 16px;
  color: var(--ink-4);
  font-size: 12px;
  text-align: center;
}
.empty-lg { padding: 64px 16px; }

/* ============ motion ============ */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes view-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-3px); }
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(4px) scale(.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes modal-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(4px) scale(.99); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(4px); }
}

@keyframes sweep {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

/* ============ responsive ============ */
@media (max-width: 1080px) {
  .overview-grid { grid-template-columns: 1fr; }
  .status-panel .btn-row { margin-top: 16px; }
  .redeem-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .login-view { grid-template-columns: 1fr; }
  .login-aside { display: none; }
  .login-panel { min-height: 100svh; }

  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }
  .sidebar-head { padding: 0 4px 14px; }
  .nav {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    overflow: visible;
    padding-bottom: 0;
  }
  .nav-label { display: none; }
  .nav-item { width: auto; min-height: 36px; padding: 0 10px; border-left: 0; border-bottom: 2px solid transparent; }
  .nav-item.is-active { border-left-color: transparent; border-bottom-color: var(--accent); }
  .nav-admin { margin-top: 0; }
  .sidebar-user { margin-top: 12px; }
  .user-menu { right: auto; width: 220px; }
  .content { padding: 0 20px 48px; }
  .content-bar { margin-bottom: 28px; }
}

@media (max-width: 620px) {
  :root {
    --hm-cell: 8px;
    --hm-gap: 2px;
  }
  .login-panel { padding: 20px; }
  .login-form-wrap { padding: 20px 0; }
  .login-title { font-size: 30px; }
  .content { padding: 0 16px 40px; }
  .content-bar { height: 56px; }
  .view { gap: 18px; }
  .panel { padding: 18px; }
  .overview-grid { gap: 12px; }
  .sub-big { font-size: 38px; }
  .view-head > .btn,
  .view-head > .view-note { margin-left: 0; }
  .view-head { align-items: start; }
  .redeem-form { align-items: stretch; flex-direction: column; }
  .redeem-form .btn { width: 100%; }
  .download-card { align-items: flex-start; flex-wrap: wrap; }
  .download-card .btn { width: 100%; margin-left: 0; }
  .table .col-time { width: 110px; }
  .table th, .table td { padding: 9px 6px; }
  .toast-root { right: 12px; bottom: 12px; width: calc(100vw - 24px); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .login-form-wrap,
  .user-menu,
  .modal,
  .toast,
  html.js .view.is-active {
    animation: none !important;
  }
  .skeleton::after { animation: none !important; opacity: 1; transform: none; }
}


/* ============================ Turnstile 验证 ============================ */
.verification-field { min-width: 0; }
.verification-field .field-label { color: var(--ink-3); font-size: 12px; }
.turnstile-widget { width: 100%; min-width: 0; min-height: 65px; }
.verification-status { margin: 0; font-size: 12px; color: var(--ink-2); overflow-wrap: anywhere; }
.verification-status.is-bad { color: var(--bad); }
.verification-retry { margin-bottom: 8px; }
.auth-tab:disabled, .link-btn:disabled { opacity: .5; cursor: not-allowed; }

/* 验证码行：输入 + 发送按钮 */
.input-wrap.input-row { display: flex; gap: 8px; align-items: center; }
.input-wrap.input-row input { flex: 1 1 auto; min-width: 0; }
.input-wrap.input-row .btn { flex: 0 0 auto; white-space: nowrap; }

/* QQ 头像：图片铺满头像圆 */
.avatar.has-img { padding: 0; overflow: hidden; }
.avatar.has-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
