:root {
  color-scheme: dark;
  --ink: #f2f7ff;
  --muted: #9aa9c7;
  --line: rgba(126, 193, 255, 0.2);
  --line-strong: rgba(126, 213, 255, 0.5);
  --panel: rgba(5, 10, 25, 0.72);
  --panel-strong: rgba(8, 16, 37, 0.9);
  --cyan: #7fe8ff;
  --blue: #7896ff;
  --green: #8ef0c0;
  --danger: #ffb4ae;
  --shadow: 0 30px 100px rgba(0, 0, 0, 0.48);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  position: relative;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(2, 4, 13, 0.28), rgba(2, 5, 16, 0.92)),
    url("/personal/assets/duskrain-planet-horizon-4k.avif?v=20260714a") center top / cover fixed,
    #020510;
  font-family: Inter, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body::before,
body::after {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
}

body::before {
  background:
    linear-gradient(rgba(116, 194, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(116, 194, 255, 0.045) 1px, transparent 1px);
  background-size: 58px 58px;
  mask-image: linear-gradient(to bottom, #000, transparent 82%);
}

body::after {
  background:
    radial-gradient(circle at 15% 18%, rgba(77, 141, 255, 0.16), transparent 26%),
    radial-gradient(circle at 84% 72%, rgba(48, 218, 255, 0.1), transparent 28%);
}

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

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

button,
input,
textarea {
  font: inherit;
}

.auth-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 26px 0 42px;
}

.auth-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  padding: 10px 12px 10px 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(5, 10, 25, 0.58);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(24px) saturate(130%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand img {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  box-shadow: 0 0 26px rgba(103, 211, 255, 0.24);
}

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

.nav-link {
  padding: 10px 13px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 13px;
  transition: color 180ms ease, background 180ms ease;
}

.nav-button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

.auth-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(320px, 0.84fr);
  gap: 22px;
  align-items: stretch;
  padding-top: clamp(46px, 9vh, 104px);
}

.auth-card,
.info-card,
.service-card {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(28px) saturate(135%);
}

.auth-card {
  position: relative;
  min-height: 540px;
  padding: clamp(30px, 5vw, 68px);
  overflow: hidden;
  border-radius: 32px;
}

.auth-card::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(118deg, transparent 0 42%, rgba(126, 232, 255, 0.08) 50%, transparent 58%),
    radial-gradient(circle at 100% 0, rgba(77, 141, 255, 0.2), transparent 35%);
}

.tech-line {
  position: absolute;
  right: -7%;
  bottom: 8%;
  width: 72%;
  height: auto;
  color: var(--cyan);
  opacity: 0.42;
  filter: drop-shadow(0 0 12px rgba(75, 212, 255, 0.3));
}

.tech-line path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
  stroke-dasharray: 7 11;
  animation: line-flow 14s linear infinite;
}

.tech-line circle {
  fill: #dffaff;
  animation: node-pulse 3s ease-in-out infinite;
}

.auth-content {
  position: relative;
  z-index: 1;
  max-width: 610px;
}

.kicker,
.status-label,
.mini-label {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 24px;
}

.kicker::before {
  width: 28px;
  height: 1px;
  background: currentColor;
  content: "";
}

h1 {
  max-width: 680px;
  margin: 0;
  font-size: clamp(42px, 7vw, 78px);
  font-weight: 650;
  letter-spacing: -0.065em;
  line-height: 0.98;
}

.lede {
  max-width: 590px;
  margin: 24px 0 0;
  color: #b8c5dc;
  font-size: clamp(15px, 1.7vw, 18px);
  line-height: 1.8;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  min-width: min(100%, 270px);
  min-height: 58px;
  margin-top: 34px;
  padding: 0 20px 0 22px;
  border: 1px solid rgba(169, 235, 255, 0.58);
  border-radius: 17px;
  background: linear-gradient(135deg, rgba(98, 214, 255, 0.23), rgba(90, 113, 255, 0.18));
  color: #f7fcff;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.18), 0 16px 42px rgba(19, 91, 179, 0.24);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.primary-action:hover,
.primary-action:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(214, 249, 255, 0.92);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.2), 0 18px 48px rgba(26, 115, 218, 0.34);
  outline: none;
}

.action-arrow {
  font-size: 21px;
  font-weight: 400;
}

.trust-note {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 12px;
}

.trust-note::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px rgba(142, 240, 192, 0.72);
  content: "";
}

.side-stack {
  display: grid;
  gap: 16px;
  align-content: start;
}

.info-card {
  padding: 25px;
  border-radius: 24px;
}

.status-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #71809d;
  box-shadow: 0 0 0 5px rgba(113, 128, 157, 0.1);
}

[data-state="ready"] .status-dot,
[data-state="authenticated"] .status-dot {
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(142, 240, 192, 0.1), 0 0 16px rgba(142, 240, 192, 0.5);
}

[data-state="error"] .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 5px rgba(255, 180, 174, 0.1);
}

.status-title {
  margin: 22px 0 7px;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.status-copy {
  min-height: 46px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.security-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.security-list li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  padding: 17px 0;
  border-bottom: 1px solid rgba(126, 193, 255, 0.12);
}

.security-list li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.security-index {
  color: var(--cyan);
  font: 700 11px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.security-list strong,
.security-list span {
  display: block;
}

.security-list strong {
  margin-bottom: 4px;
  font-size: 13px;
}

.security-list span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.account-stage {
  padding-top: clamp(38px, 7vh, 80px);
}

.account-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 34px;
}

.account-hero h1 {
  font-size: clamp(40px, 6vw, 68px);
}

.account-hero .lede {
  margin-top: 16px;
}

.account-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(0, 1.28fr);
  gap: 20px;
}

.identity-card {
  padding: 28px;
  border-radius: 27px;
}

.avatar-mark {
  position: relative;
  display: grid;
  width: 58px;
  height: 58px;
  margin-bottom: 24px;
  place-items: center;
  border: 1px solid rgba(154, 230, 255, 0.4);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(89, 207, 255, 0.25), rgba(83, 104, 255, 0.16));
  color: var(--cyan);
  font: 700 20px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow: hidden;
}

.avatar-mark img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.identity-name {
  margin: 8px 0 22px;
  font-size: 28px;
  letter-spacing: -0.04em;
}

.identity-list {
  display: grid;
  gap: 14px;
  margin: 0;
}

.identity-list div {
  display: grid;
  gap: 5px;
  padding-top: 14px;
  border-top: 1px solid rgba(126, 193, 255, 0.12);
}

.identity-list dt {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.services-panel {
  padding: 28px;
  border-radius: 27px;
}

.services-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.services-head h2 {
  margin: 7px 0 0;
  font-size: clamp(26px, 4vw, 38px);
  letter-spacing: -0.045em;
}

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

.service-card {
  min-height: 168px;
  padding: 20px;
  border-radius: 19px;
  box-shadow: none;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.service-card:hover,
.service-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  background: var(--panel-strong);
  outline: none;
}

.service-card h3 {
  margin: 26px 0 8px;
  font-size: 17px;
}

.service-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.service-number {
  color: var(--cyan);
  font: 700 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.account-forms {
  display: grid;
  gap: 14px;
}

.setting-form,
.session-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  padding: 18px;
  border: 1px solid rgba(126, 193, 255, 0.13);
  border-radius: 18px;
  background: rgba(3, 9, 23, 0.46);
}

.setting-form label {
  display: grid;
  gap: 7px;
}

.setting-form label + label {
  grid-column: 1;
}

.setting-form label span,
.session-actions span {
  color: var(--muted);
  font-size: 11px;
}

.setting-form input {
  width: 100%;
  min-height: 45px;
  padding: 0 13px;
  border: 1px solid rgba(126, 193, 255, 0.18);
  border-radius: 12px;
  outline: none;
  background: rgba(4, 9, 22, 0.7);
  color: var(--ink);
}

.setting-form textarea {
  width: 100%;
  min-height: 86px;
  padding: 12px 13px;
  resize: vertical;
  border: 1px solid rgba(126, 193, 255, 0.18);
  border-radius: 12px;
  outline: none;
  background: rgba(4, 9, 22, 0.7);
  color: var(--ink);
}

.setting-form input:focus,
.setting-form textarea:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(126, 213, 255, 0.08);
}

.setting-form .wide-field {
  grid-column: 1 / -1;
}

.connections {
  padding: 18px;
  border: 1px solid rgba(126, 193, 255, 0.13);
  border-radius: 18px;
  background: rgba(3, 9, 23, 0.46);
}

.settings-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.settings-title h3 {
  margin: 5px 0 0;
  font-size: 18px;
}

.settings-title > button,
.device-item button,
.connection-item > a,
.connection-item > button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(169, 235, 255, 0.28);
  border-radius: 10px;
  background: rgba(103, 183, 255, 0.1);
  color: var(--ink);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.connection-list,
.device-list {
  display: grid;
  gap: 8px;
}

.connection-item,
.device-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 10px 12px;
  border: 1px solid rgba(126, 193, 255, 0.1);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.025);
}

.connection-icon,
.device-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid rgba(126, 213, 255, 0.18);
  border-radius: 11px;
  color: var(--cyan);
  font: 700 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.connection-item > div:nth-child(2),
.device-item > div:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.connection-item strong,
.device-item strong {
  font-size: 12px;
}

.connection-item span,
.device-item span,
.device-empty,
.connection-note {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.connection-state.verified,
.device-current {
  color: var(--green);
}

.connection-item.is-connected > a {
  pointer-events: none;
  border-color: transparent;
  background: transparent;
  color: var(--green);
}

.connection-item.is-disabled {
  opacity: 0.62;
}

.connection-item button:disabled {
  cursor: not-allowed;
}

.connection-note {
  min-height: 0;
  margin-top: 10px;
  color: var(--green);
}

.connection-note.error {
  color: var(--danger);
}

.inbox-panel {
  padding: 20px;
  background: linear-gradient(135deg, rgba(21, 82, 105, 0.13), rgba(3, 9, 23, 0.58));
}

.inbox-heading {
  margin-bottom: 16px;
}

.unread-badge {
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid rgba(142, 240, 192, 0.28);
  border-radius: 999px;
  background: rgba(142, 240, 192, 0.08);
  color: var(--green);
  font-size: 9px;
  font-weight: 700;
}

.inbox-layout {
  display: grid;
  grid-template-columns: minmax(190px, 0.72fr) minmax(0, 1.28fr);
  min-height: 260px;
  overflow: hidden;
  border: 1px solid rgba(126, 193, 255, 0.11);
  border-radius: 15px;
  background: rgba(1, 6, 17, 0.36);
}

.inbox-list {
  display: grid;
  max-height: 360px;
  align-content: start;
  overflow-y: auto;
  border-right: 1px solid rgba(126, 193, 255, 0.11);
  scrollbar-color: rgba(126, 213, 255, 0.28) transparent;
}

.inbox-message {
  position: relative;
  display: grid;
  gap: 7px;
  width: 100%;
  min-width: 0;
  padding: 13px 14px;
  border: 0;
  border-bottom: 1px solid rgba(126, 193, 255, 0.09);
  outline: none;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.inbox-message:hover,
.inbox-message:focus-visible,
.inbox-message.is-active {
  background: rgba(103, 183, 255, 0.09);
}

.inbox-message.is-active::after {
  position: absolute;
  top: 9px;
  bottom: 9px;
  right: 0;
  width: 2px;
  border-radius: 2px;
  background: var(--cyan);
  content: "";
}

.inbox-message-top {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.inbox-message-top strong {
  overflow: hidden;
  font-size: 11px;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inbox-message.is-unread .inbox-message-top strong {
  color: var(--cyan);
  font-weight: 750;
}

.inbox-message.is-unread .inbox-message-top strong::before {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 9px rgba(142, 240, 192, 0.55);
  content: "";
  vertical-align: 1px;
}

.inbox-message-top time {
  flex: 0 0 auto;
  color: #667693;
  font-size: 8px;
}

.inbox-message-excerpt {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.inbox-empty {
  margin: 0;
  padding: 28px 15px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
  text-align: center;
}

.message-detail {
  min-width: 0;
  padding: 21px;
}

.message-detail h4 {
  margin: 8px 0 13px;
  font-size: 18px;
  letter-spacing: -0.025em;
}

.message-detail > p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.75;
}

.message-detail .message-detail-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message-detail-link {
  display: inline-flex;
  margin-top: 18px;
  padding: 8px 11px;
  border: 1px solid rgba(169, 235, 255, 0.25);
  border-radius: 10px;
  background: rgba(103, 183, 255, 0.08);
  color: var(--cyan);
  font-size: 10px;
  font-weight: 700;
}

.message-detail-link:hover,
.message-detail-link:focus-visible {
  border-color: var(--line-strong);
  outline: none;
}

.owner-tools {
  display: grid;
  gap: 8px;
}

.owner-tools[hidden] {
  display: none;
}

.owner-tools .settings-title {
  margin-bottom: 6px;
}

.admin-entry {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 12px;
  border: 1px solid rgba(126, 193, 255, 0.13);
  border-radius: 14px;
  background: linear-gradient(100deg, rgba(57, 151, 218, 0.09), rgba(255, 255, 255, 0.02));
  color: var(--ink);
}

.admin-entry > span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.admin-entry strong {
  font-size: 13px;
}

.admin-entry small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.admin-entry b {
  color: var(--cyan);
  font-size: 11px;
}

.admin-entry:hover,
.admin-entry:focus-visible {
  border-color: var(--line-strong);
  background: rgba(103, 183, 255, 0.11);
  outline: none;
}

.setting-form button,
.session-actions button {
  min-height: 45px;
  padding: 0 15px;
  border: 1px solid rgba(169, 235, 255, 0.35);
  border-radius: 12px;
  background: rgba(103, 183, 255, 0.12);
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.setting-form button:disabled,
.session-actions button:disabled,
.nav-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.setting-form > p,
.session-actions > p {
  grid-column: 1 / -1;
  min-height: 0;
  margin: 0;
  color: var(--green);
  font-size: 11px;
}

.setting-form > p.error,
.session-actions > p.error {
  color: var(--danger);
}

.session-actions div {
  display: grid;
  gap: 5px;
}

.session-actions strong {
  font-size: 13px;
}

.auth-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 28px;
  color: #7483a1;
  font-size: 11px;
}

.auth-footer a:hover,
.auth-footer a:focus-visible,
.auth-footer button:hover,
.auth-footer button:focus-visible {
  color: var(--ink);
  outline: none;
}

.auth-footer button {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

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

@keyframes line-flow {
  to { stroke-dashoffset: -180; }
}

@keyframes node-pulse {
  0%, 100% { opacity: 0.45; transform: scale(0.86); transform-origin: center; }
  50% { opacity: 1; transform: scale(1.12); transform-origin: center; }
}

@media (max-width: 860px) {
  body {
    background-image:
      linear-gradient(180deg, rgba(2, 4, 13, 0.28), rgba(2, 5, 16, 0.94)),
      url("/personal/assets/duskrain-planet-horizon-mobile.avif?v=20260714a");
  }

  .auth-stage,
  .account-grid {
    grid-template-columns: 1fr;
  }

  .auth-stage {
    padding-top: 28px;
  }

  .auth-card {
    min-height: 500px;
  }

  .account-hero {
    align-items: start;
    flex-direction: column;
  }
}

@media (max-width: 580px) {
  .auth-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 10px;
  }

  .auth-nav {
    min-height: 56px;
    border-radius: 17px;
  }

  .brand span {
    display: none;
  }

  .nav-link {
    padding-inline: 9px;
  }

  .auth-card,
  .info-card,
  .identity-card,
  .services-panel {
    border-radius: 22px;
  }

  .auth-card {
    min-height: 490px;
    padding: 28px 22px;
  }

  h1 {
    font-size: clamp(40px, 13vw, 58px);
  }

  .service-grid {
    grid-template-columns: 1fr;
  }

  .setting-form,
  .session-actions {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .inbox-layout {
    grid-template-columns: 1fr;
  }

  .inbox-list {
    max-height: 260px;
    border-right: 0;
    border-bottom: 1px solid rgba(126, 193, 255, 0.11);
  }

  .message-detail {
    min-height: 210px;
  }

  .service-card {
    min-height: 142px;
  }

  .auth-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

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