:root {
  color-scheme: light dark;
  --bg: #f4f7f5;
  --surface: rgba(255, 255, 255, .82);
  --surface-solid: #fff;
  --surface-soft: rgba(241, 247, 244, .82);
  --text: #13231f;
  --muted: #64736e;
  --line: rgba(20, 50, 41, .11);
  --line-strong: rgba(20, 50, 41, .18);
  --primary: #126b56;
  --primary-strong: #0b5745;
  --primary-soft: #dff1ea;
  --primary-pale: #eef8f4;
  --success: #087a58;
  --danger: #a63f3a;
  --danger-soft: #f9e9e7;
  --shadow: 0 24px 80px rgba(25, 53, 45, .09);
  --shadow-small: 0 12px 36px rgba(25, 53, 45, .07);
  --radius: 28px;
  --radius-small: 16px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 16% 12%, rgba(121, 198, 169, .14), transparent 32rem),
    radial-gradient(circle at 88% 82%, rgba(94, 167, 149, .11), transparent 30rem),
    var(--bg);
  line-height: 1.55;
  overflow-x: hidden;
}

body.dialog-open { overflow: hidden; }

button,
input,
select { font: inherit; }

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

button { color: inherit; }
button:disabled { cursor: not-allowed; opacity: .48; }
img { max-width: 100%; }

.hidden { display: none !important; }

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(2px);
  pointer-events: none;
}

.ambient-one {
  width: 25rem;
  height: 25rem;
  top: -12rem;
  right: -8rem;
  background: rgba(57, 150, 119, .08);
}

.ambient-two {
  width: 18rem;
  height: 18rem;
  bottom: -9rem;
  left: -6rem;
  background: rgba(78, 132, 115, .07);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.clipboard-proxy {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.shell { min-height: 100vh; }

.boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--bg);
  transition: opacity .35s ease, visibility .35s ease;
}

.boot.is-ready { opacity: 0; visibility: hidden; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 760;
  letter-spacing: .025em;
  text-decoration: none;
}

.brand-logo {
  flex: 0 0 auto;
  width: 2.8rem;
  height: 2.2rem;
  object-fit: contain;
}

.brand-logo-large {
  width: 7.6rem;
  height: 5.9rem;
  animation: breathe 1.5s ease-in-out infinite;
}

@keyframes breathe {
  50% { transform: translateY(-4px); filter: drop-shadow(0 18px 18px rgba(13, 100, 78, .2)); }
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.eyebrow {
  color: var(--primary);
  font-size: .7rem;
  font-weight: 820;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h2,
h3,
p { overflow-wrap: anywhere; }

h2,
h3 { color: var(--text); }
h2 { margin: .42rem 0 .55rem; font-size: clamp(1.55rem, 3vw, 2rem); letter-spacing: -.035em; }
h3 { margin: .4rem 0 .35rem; font-size: 1.05rem; letter-spacing: -.02em; }
.muted { margin: 0; color: var(--muted); }

label {
  display: block;
  margin: 1.45rem 0 .52rem;
  font-size: .8rem;
  font-weight: 740;
}

input,
select {
  width: 100%;
  height: 3.45rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  outline: 0;
  padding: 0 1rem;
  color: var(--text);
  background: rgba(255, 255, 255, .72);
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

select {
  appearance: none;
  padding-right: 2.6rem;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 1.15rem) 1.45rem, calc(100% - .85rem) 1.45rem;
  background-size: .32rem .32rem, .32rem .32rem;
  background-repeat: no-repeat;
}

input:focus,
select:focus {
  border-color: rgba(18, 107, 86, .62);
  background-color: var(--surface-solid);
  box-shadow: 0 0 0 4px rgba(18, 107, 86, .1);
}

input::placeholder { color: color-mix(in srgb, var(--muted) 72%, transparent); }
input[type="search"]::-webkit-search-cancel-button { opacity: .55; }

.button {
  min-height: 2.9rem;
  border: 0;
  border-radius: 14px;
  padding: .72rem 1.08rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .62rem;
  cursor: pointer;
  font-weight: 730;
  text-decoration: none;
  white-space: nowrap;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, opacity .18s ease;
}

.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:active:not(:disabled) { transform: translateY(0); }
.button:focus-visible,
.tab:focus-visible,
.token-action-btn:focus-visible,
.token-code:focus-visible,
.dialog-close:focus-visible,
.qr-dropzone:focus-visible {
  outline: 3px solid rgba(18, 107, 86, .22);
  outline-offset: 2px;
}

.button-wide { width: 100%; margin-top: 1rem; }
.button-primary {
  color: #fff;
  background: linear-gradient(145deg, var(--primary), var(--primary-strong));
  box-shadow: 0 12px 28px rgba(15, 101, 79, .18);
}
.button-primary:hover:not(:disabled) { box-shadow: 0 16px 34px rgba(15, 101, 79, .24); }
.button-secondary { color: var(--text); border: 1px solid var(--line); background: rgba(255, 255, 255, .66); }
.button-quiet { min-height: 2.4rem; padding: .5rem .75rem; color: var(--muted); background: transparent; box-shadow: none; }
.button-small { min-height: 2.5rem; padding: .55rem .82rem; font-size: .82rem; }
.button-danger { color: #fff; background: var(--danger); box-shadow: 0 10px 24px rgba(166, 63, 58, .2); }

.auth-view {
  width: min(1120px, calc(100% - 2rem));
  min-height: 100vh;
  margin: auto;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, .72fr);
  gap: clamp(3rem, 10vw, 9rem);
  align-items: center;
  padding: 4rem 0;
}

.brand-hero {
  gap: clamp(1rem, 2.5vw, 1.8rem);
  font-size: clamp(3rem, 7vw, 6.4rem);
  line-height: 1;
  letter-spacing: .04em;
}

.brand-hero .brand-logo {
  width: clamp(5.2rem, 11vw, 9.5rem);
  height: clamp(4rem, 8.5vw, 7.4rem);
}

.auth-panel {
  min-height: 31rem;
  padding: clamp(2rem, 5vw, 3.25rem);
  display: grid;
  align-items: center;
}

.auth-panel .eyebrow {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .14em;
}

.auth-panel h2 {
  margin: .45rem 0 .55rem;
  font-size: clamp(1.55rem, 3vw, 2rem);
  letter-spacing: -.035em;
}

.auth-panel label {
  margin: 2rem 0 .55rem;
  font-size: .82rem;
  font-weight: 700;
}

.auth-panel input {
  height: 3.55rem;
  background: rgba(255, 255, 255, .72);
  transition: border-color .2s, box-shadow .2s, background .2s;
}

.auth-panel input:focus {
  border-color: rgba(18, 107, 86, .62);
  background: var(--surface-solid);
  box-shadow: 0 0 0 4px rgba(18, 107, 86, .1);
}

.auth-panel input::placeholder { color: revert; }

.auth-panel .button {
  min-height: 2.9rem;
  padding: .75rem 1.08rem;
  gap: .7rem;
  font-weight: 720;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, opacity .18s ease;
}

.auth-panel .button:focus-visible {
  outline-color: rgba(18, 107, 86, .2);
}

.auth-panel .button-quiet {
  min-height: 2.4rem;
  padding: .5rem .75rem;
}

.mail-sent { text-align: center; }
.mail-sent p { color: var(--muted); }
.mail-sent strong { color: var(--text); font-weight: 720; }
.mail-icon {
  width: 4rem;
  height: 4rem;
  margin: 0 auto 1.5rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--success);
  background: var(--primary-soft);
  font-size: 1.5rem;
  font-weight: 800;
}

.app-view { min-height: 100vh; }

.topbar {
  width: min(1180px, calc(100% - 2rem));
  height: 6rem;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.account { min-width: 0; display: flex; align-items: center; gap: .65rem; }
.account-email {
  max-width: 19rem;
  overflow: hidden;
  color: var(--muted);
  font-size: .83rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard { width: min(1180px, calc(100% - 2rem)); margin: auto; padding: .75rem 0 5rem; }
.token-section { margin-top: .5rem; }

.toolbar {
  margin: 0 0 1rem;
  padding: .65rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .65rem;
  border-radius: 16px;
  box-shadow: var(--shadow-small);
}

.search-field { position: relative; flex: 1 1 auto; min-width: 0; max-width: 25rem; }
.search-field input { height: 3rem; padding-left: 2.65rem; border: 0; background: transparent; }
.search-field input:focus { background: var(--surface-soft); box-shadow: none; }
.search-icon {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 1rem;
  width: .82rem;
  height: .82rem;
  border: 1.8px solid var(--muted);
  border-radius: 50%;
  pointer-events: none;
  transform: translateY(-58%);
  opacity: .72;
}
.search-icon::after {
  content: "";
  position: absolute;
  width: .42rem;
  height: 1.8px;
  right: -.32rem;
  bottom: -.18rem;
  border-radius: 2px;
  background: var(--muted);
  transform: rotate(45deg);
}
.toolbar-actions { display: flex; align-items: center; gap: .55rem; }

.token-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: .85rem;
}

.token-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 1.5rem;
  background: var(--surface);
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}

.token-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 18px 45px rgba(25, 53, 45, .1);
  transform: translateY(-2px);
}

.token-header {
  min-width: 0;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
}
.token-info { min-width: 0; }
.token-name {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.token-actions { display: flex; align-items: center; gap: .15rem; }
.token-action-btn {
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: color .18s ease, background .18s ease;
}
.token-action-btn svg { width: 1rem; height: 1rem; pointer-events: none; }
.token-action-btn:hover { color: var(--primary); background: var(--primary-pale); }
.token-action-btn.is-danger:hover { color: var(--danger); background: var(--danger-soft); }

.token-code-section { display: flex; align-items: center; gap: .85rem; }
.token-code {
  flex: 0 1 auto;
  min-width: 0;
  min-height: 2.75rem;
  border: 0;
  border-radius: 10px;
  appearance: none;
  padding: .35rem .25rem;
  overflow: hidden;
  display: flex;
  align-items: center;
  color: var(--primary);
  background: transparent;
  cursor: copy;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: clamp(1.55rem, 2.7vw, 1.75rem);
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  letter-spacing: .09em;
  line-height: 1;
  text-align: left;
  text-overflow: clip;
  white-space: nowrap;
  transition: color .18s ease, background .18s ease, transform .18s ease;
}
.token-code:hover:not([aria-disabled="true"]) { background: var(--primary-pale); }
.token-code:active:not([aria-disabled="true"]) { transform: scale(.99); }
.token-code[aria-disabled="true"] { cursor: wait; opacity: .62; }

.countdown {
  position: relative;
  flex: 0 0 auto;
  margin-left: auto;
  width: 2.5rem;
  height: 2.5rem;
}
.countdown svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track,
.ring-progress { fill: none; stroke-width: 3; }
.ring-track { stroke: var(--line); }
.ring-progress {
  stroke: var(--primary);
  stroke-linecap: round;
  transition: stroke-dashoffset .45s linear, stroke .2s ease;
}

.loading-state {
  min-height: 13rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  color: var(--muted);
  font-size: .85rem;
}
.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--line-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  min-height: 18rem;
  padding: 3rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: var(--shadow-small);
}
.empty-state p { margin: 0 0 1.5rem; color: var(--muted); font-size: .9rem; }
.empty-mark {
  width: 3.7rem;
  height: 3.7rem;
  margin-bottom: .8rem;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 1rem;
  font-weight: 820;
  letter-spacing: .08em;
}
.empty-state.compact { min-height: 12rem; border: 0; background: transparent; box-shadow: none; }
.empty-state.compact p { margin: 0; }
.empty-actions { display: flex; align-items: center; justify-content: center; gap: .65rem; }
#loadError .button { margin-top: 1rem; }

.dialog {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.dialog-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(8, 24, 20, .55);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  cursor: default;
}
.dialog-card {
  position: relative;
  z-index: 1;
  width: min(31rem, 100%);
  max-height: calc(100vh - 2rem);
  overflow: auto;
  padding: 2.35rem;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 28px;
  outline: 0;
  background: var(--surface-solid);
  box-shadow: 0 30px 100px rgba(0, 25, 18, .25);
  animation: dialog-in .2s ease both;
}
.dialog-card-wide { width: min(36rem, 100%); }
.dialog-card-small { width: min(27rem, 100%); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(9px) scale(.99); } }
.dialog-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.4rem;
  height: 2.4rem;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface-soft);
  cursor: pointer;
  font-size: 1.3rem;
}
.dialog-actions {
  margin-top: 2rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .55rem;
}

.tabs {
  margin-top: 1.4rem;
  padding: .3rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-radius: 15px;
  background: var(--surface-soft);
}
.tab {
  min-height: 2.6rem;
  border: 0;
  border-radius: 11px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: .82rem;
  font-weight: 740;
}
.tab.is-active { color: var(--text); background: var(--surface-solid); box-shadow: 0 5px 18px rgba(25, 53, 45, .08); }
.tab-panel { padding-top: .2rem; }
.field-hint { margin: .45rem 0 0; color: var(--muted); font-size: .72rem; }
.field-grid { display: grid; grid-template-columns: 1.25fr .8fr .9fr; gap: .7rem; }
.input-suffix { position: relative; }
.input-suffix input { padding-right: 2.6rem; }
.input-suffix span { position: absolute; top: 50%; right: .9rem; color: var(--muted); font-size: .75rem; transform: translateY(-50%); }

.qr-dropzone {
  min-height: 13rem;
  margin: 1.45rem 0 .7rem;
  border: 1.5px dashed var(--line-strong);
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  color: var(--muted);
  background: var(--surface-soft);
  cursor: pointer;
  text-align: center;
  transition: border-color .18s ease, background .18s ease;
}
.qr-dropzone:hover,
.qr-dropzone.is-dragging { border-color: var(--primary); background: var(--primary-pale); }
.qr-dropzone strong { color: var(--text); font-size: .9rem; }
.qr-dropzone > span:last-child { font-size: .75rem; }
.qr-symbol {
  position: relative;
  width: 2.8rem;
  height: 2.8rem;
  margin-bottom: .45rem;
  border: 2px solid var(--primary);
  border-radius: 10px;
  opacity: .85;
}
.qr-symbol::before,
.qr-symbol::after {
  content: "";
  position: absolute;
  width: .62rem;
  height: .62rem;
  border: 2px solid var(--primary);
}
.qr-symbol::before { top: .42rem; left: .42rem; }
.qr-symbol::after { right: .42rem; bottom: .42rem; }
.qr-result {
  min-width: 0;
  margin-top: 1rem;
  padding: .8rem;
  display: grid;
  grid-template-columns: 4.1rem minmax(0, 1fr);
  align-items: center;
  gap: .85rem;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface-soft);
}
.qr-result img { width: 4.1rem; height: 4.1rem; border-radius: 11px; background: #fff; object-fit: cover; }
.qr-result-details { min-width: 0; }
.qr-result label { margin: .18rem 0 .28rem; color: var(--muted); font-size: .68rem; font-weight: 700; }
.qr-result input { height: 2.45rem; border-radius: 11px; padding: 0 .7rem; font-size: .82rem; }
.qr-result p { margin: .12rem 0 0; color: var(--muted); font-size: .72rem; }
.qr-hint { text-align: center; }

.danger-mark {
  width: 3.2rem;
  height: 3.2rem;
  margin-bottom: 1rem;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: var(--danger);
  background: var(--danger-soft);
  font-size: 1.25rem;
  font-weight: 850;
}

.toast-region {
  position: fixed;
  z-index: 80;
  right: 1rem;
  bottom: 1rem;
  display: grid;
  gap: .6rem;
}
.toast {
  max-width: min(24rem, calc(100vw - 2rem));
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  background: var(--surface-solid);
  box-shadow: 0 14px 45px rgba(13, 43, 35, .18);
  animation: toast-in .25s ease both;
}
.toast.error { color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 760px) {
  .auth-view { grid-template-columns: 1fr; gap: 2.2rem; align-content: center; padding: 2rem 0; }
  .brand-hero { justify-content: center; font-size: clamp(2.5rem, 13vw, 4.5rem); }
  .auth-panel { min-height: 28rem; }
}

@media (max-width: 700px) {
  .topbar { height: 5rem; }
  .account-email { display: none; }
  .dashboard { padding-top: .4rem; }
  .token-grid { grid-template-columns: 1fr; }
  .dialog-card { padding: 2.1rem 1.25rem 1.4rem; }
  .field-grid { grid-template-columns: 1fr 1fr; }
  .field-grid > div:first-child { grid-column: span 2; }
}

@media (max-width: 460px) {
  .topbar .brand-logo { width: 2.3rem; height: 2.3rem; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search-field { max-width: none; }
  .toolbar-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .toolbar-actions .button { min-width: 0; padding-inline: .45rem; }
  .token-card { padding: 1.25rem; }
  .token-code-section { gap: .65rem; }
  .token-code { font-size: clamp(1.4rem, 7.6vw, 1.7rem); }
  .empty-actions { width: 100%; flex-direction: column; }
  .empty-actions .button { width: min(18rem, 100%); }
  .dialog-actions .button { flex: 1 1 0; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1513;
    --surface: rgba(22, 33, 30, .88);
    --surface-solid: #17211e;
    --surface-soft: rgba(10, 18, 16, .55);
    --text: #edf5f1;
    --muted: #9ba9a4;
    --line: rgba(218, 239, 231, .1);
    --line-strong: rgba(218, 239, 231, .18);
    --primary: #65c3a3;
    --primary-strong: #299575;
    --primary-soft: rgba(72, 173, 137, .15);
    --primary-pale: rgba(72, 173, 137, .1);
    --danger: #ef8d86;
    --danger-soft: rgba(181, 70, 63, .15);
    --shadow: 0 24px 80px rgba(0, 0, 0, .2);
    --shadow-small: 0 12px 36px rgba(0, 0, 0, .16);
  }
  .auth-panel input,
  input,
  select,
  .button-secondary { background-color: rgba(10, 18, 16, .55); }
  .brand-logo { filter: brightness(0) invert(1); }
  .brand-logo-large { animation-name: breathe-dark; }
}

@keyframes breathe-dark {
  50% { transform: translateY(-4px); filter: brightness(0) invert(1) drop-shadow(0 18px 18px rgba(101, 195, 163, .18)); }
}

@media (forced-colors: active) {
  .panel,
  .token-card,
  .toolbar,
  .dialog-card { border: 1px solid CanvasText; }
  .ring-progress { stroke: Highlight; }
}
