:root {
  color-scheme: dark;
  --bg: #050505;
  --surface: #101010;
  --surface-soft: #171717;
  --ink: #f4f1ea;
  --muted: #9a9a96;
  --muted-strong: #c7c4bc;
  --line: #2a2a28;
  --line-soft: rgba(244, 241, 234, 0.08);
  --accent: #d7ff6f;
  --accent-ink: #101204;
  --sage: #88b8a1;
  --danger: #ff7a8a;
  --radius: 8px;
  font-family:
    "Noto Sans TC",
    "Microsoft JhengHei",
    "Segoe UI Variable",
    system-ui,
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  touch-action: manipulation;
}

h1,
h2,
p {
  margin: 0;
}

.auth-page {
  min-height: 100dvh;
  background:
    linear-gradient(90deg, rgba(244, 241, 234, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(244, 241, 234, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 50% 0%, rgba(215, 255, 111, 0.08), transparent 34%),
    var(--bg);
  background-size: 42px 42px, 42px 42px, auto, auto;
}

.auth-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-panel {
  width: min(360px, 100%);
  display: grid;
  grid-template-rows: auto 8px auto;
  gap: 10px;
  justify-items: center;
  min-height: 168px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(16, 16, 16, 0.94);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.46);
  text-align: center;
}

.auth-logo {
  width: 100%;
  min-height: 54px;
  display: grid;
  grid-row: 1;
  place-items: center;
  color: var(--sage);
  font-size: clamp(36px, 10vw, 50px);
  font-weight: 780;
  line-height: 0.95;
  text-align: center;
}

.auth-panel .primary-action {
  grid-row: 3;
}

.eyebrow {
  color: var(--sage);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(30px, 7vw, 54px);
  font-weight: 760;
  line-height: 0.96;
}

h2 {
  font-size: 18px;
  font-weight: 760;
  line-height: 1.12;
}

.primary-action,
.text-action {
  min-height: 42px;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 780;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    opacity 140ms ease,
    transform 140ms ease;
}

.primary-action {
  width: 100%;
  align-self: end;
  border: 1px solid rgba(215, 255, 111, 0.72);
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 14px;
}

@media (hover: hover) and (pointer: fine) {
  .primary-action:hover {
    background: #c6f85e;
    transform: translateY(-1px);
  }
}

.primary-action:disabled,
.text-action:disabled {
  cursor: not-allowed;
  opacity: 0.54;
  transform: none;
}

.text-action {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted-strong);
  padding: 9px 12px;
}

@media (hover: hover) and (pointer: fine) {
  .text-action:hover {
    border-color: rgba(215, 255, 111, 0.38);
    background: var(--surface-soft);
    color: var(--ink);
  }
}

.auth-status,
.floating-status {
  position: fixed;
  left: 50%;
  top: 12px;
  z-index: 120;
  max-width: min(520px, calc(100vw - 36px));
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid rgba(215, 255, 111, 0.3);
  border-radius: var(--radius);
  background: rgba(15, 15, 15, 0.96);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.46);
  color: var(--muted-strong);
  font-size: 13px;
  line-height: 1.45;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  text-overflow: ellipsis;
  transform: translate(-50%, -10px);
  transform-origin: center top;
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    visibility 0s linear 180ms,
    width 240ms cubic-bezier(0.22, 1, 0.36, 1);
  visibility: hidden;
  white-space: nowrap;
}

.auth-status.is-visible,
.floating-status.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
  transition-delay: 0s;
  visibility: visible;
}

.auth-status.is-error,
.floating-status.is-error {
  border-color: rgba(255, 122, 138, 0.48);
  color: #ffd0d6;
}

.admin-shell {
  width: min(920px, calc(100% - 32px));
  min-height: 100dvh;
  display: grid;
  align-content: start;
  gap: 16px;
  margin: 0 auto;
  padding: 24px 0 42px;
}

.admin-header {
  min-height: 76px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}

.admin-header h1 {
  color: var(--sage);
  font-size: clamp(34px, 6vw, 56px);
  font-weight: 780;
  line-height: 0.95;
}

.admin-tool {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(16, 16, 16, 0.94);
}

.tool-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.badge {
  min-width: 28px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(136, 184, 161, 0.38);
  border-radius: 999px;
  background: rgba(136, 184, 161, 0.1);
  color: var(--sage);
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 780;
  white-space: nowrap;
}

.passkey-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 680;
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0b0b0b;
  color: var(--ink);
  outline: none;
  padding: 9px 10px;
  transition:
    border-color 140ms ease,
    background 140ms ease,
    box-shadow 140ms ease;
}

input::placeholder {
  color: #706f6a;
}

input:focus {
  border-color: rgba(215, 255, 111, 0.72);
  background: #090909;
  box-shadow: 0 0 0 4px rgba(215, 255, 111, 0.1);
}

.passkey-list {
  display: grid;
  gap: 8px;
}

.empty-state,
.passkey-item {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: #0d0d0d;
}

.empty-state {
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.passkey-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
}

.passkey-meta {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.passkey-meta strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 760;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.passkey-meta span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.passkey-actions {
  display: grid;
  grid-template-columns: minmax(160px, 220px) auto auto;
  gap: 8px;
  align-items: center;
}

.passkey-actions .text-action {
  min-height: 38px;
  padding: 8px 10px;
  font-size: 12px;
}

.passkey-actions .delete-action {
  border-color: rgba(255, 122, 138, 0.28);
  color: #ffd0d6;
}

@media (hover: hover) and (pointer: fine) {
  .passkey-actions .delete-action:hover {
    border-color: rgba(255, 122, 138, 0.48);
    background: rgba(255, 122, 138, 0.12);
  }
}

.admin-transition {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 50%, rgba(136, 184, 161, 0.12), transparent 34%),
    #050505;
  opacity: 0;
  pointer-events: none;
  transform: scale(1.04);
  transition:
    opacity 220ms ease,
    transform 620ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.admin-transition.is-active {
  opacity: 1;
  transform: scale(1);
}

.admin-transition-mark {
  color: var(--sage);
  font-size: clamp(42px, 12vw, 86px);
  font-weight: 780;
  line-height: 0.95;
  opacity: 0;
  transform: translateY(8px) scale(0.94);
}

.admin-transition.is-active .admin-transition-mark {
  animation: admin-transition-mark 720ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes admin-transition-mark {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.94);
  }

  38% {
    opacity: 1;
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 720px) {
  .passkey-form,
  .passkey-item,
  .passkey-actions {
    grid-template-columns: 1fr;
  }

  .passkey-actions {
    align-items: stretch;
  }

  .admin-header {
    align-items: start;
    flex-direction: column;
  }
}
