:root {
  --black: #000000;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-lift: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.10);
  --border-bright: rgba(255, 255, 255, 0.22);
  --highlight: rgba(255, 255, 255, 0.08);
  --shadow: rgba(0, 0, 0, 0.6);

  --text: #fafafa;
  --dim: #9a9a9a;
  --faint: #6a6a6a;
  --good: #a8e0b4;
  --warn: #e5c99a;

  --xs: 8px;
  --sm: 12px;
  --md: 16px;
  --lg: 24px;
  --xl: 32px;
  --xxl: 56px;

  --r-sm: 10px;
  --r-md: 16px;
  --r-pill: 98px;

  --ease: cubic-bezier(0.34, 1.56, 0.64, 1);
  --soft: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur: 240ms;
  --blur: 30px;
  --bar: 56px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--black);
  color: var(--text);
  font-family: "Times New Roman", Times, serif;
  font-size: 20px;
  line-height: 1.6;
  letter-spacing: 0.2px;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  overflow-x: hidden;
}

button, input { font-family: inherit; letter-spacing: inherit; }

.shell { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 var(--lg); }

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

:focus-visible { outline: 2px solid var(--dim); outline-offset: 3px; }

/* ============ screens ============ */

.screen { display: none; }
.screen.is-active { display: block; }

/* ============ sign in ============ */

#signin {
  min-height: 100dvh;
  display: none;
  place-items: center;
  padding: var(--xl) var(--lg);
}

#signin.is-active { display: grid; }

.signin__card {
  width: min(520px, 100%);
  text-align: center;
  transition: opacity 420ms var(--soft), transform 420ms var(--soft), filter 420ms var(--soft);
}

.signin__card[data-state="leaving"] {
  opacity: 0;
  transform: scale(0.96) translateY(-8px);
  filter: blur(6px);
}

.wordmark {
  font-size: clamp(64px, 13vw, 128px);
  line-height: 1;
  letter-spacing: -0.03em;
}

.wordmark em { font-style: normal; color: var(--faint); }

.signin__tag {
  color: var(--dim);
  font-size: clamp(20px, 2.6vw, 26px);
  margin-top: var(--md);
}

.signin__action { margin-top: var(--xxl); position: relative; display: inline-block; }

/* login ring */

.ring {
  position: absolute;
  inset: -10px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  pointer-events: none;
  opacity: 0;
}

.is-authing .ring {
  opacity: 1;
  border-top-color: var(--text);
  border-right-color: var(--border-bright);
  animation: spin 900ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.signin__note { color: var(--faint); font-size: 17px; margin-top: var(--lg); min-height: 1.6em; }

/* ============ app bar ============ */

.bar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--bar);
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(var(--blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(140%);
  border-bottom: 1px solid var(--border);
}

.bar__inner {
  width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 var(--lg);
  display: flex; align-items: center; justify-content: space-between; gap: var(--md);
}

.bar__mark { font-size: 19px; letter-spacing: 0.3px; flex: none; }
.bar__mark em { font-style: normal; color: var(--faint); }

.bar__right { display: flex; align-items: center; gap: var(--sm); min-width: 0; flex: 1 1 auto; justify-content: flex-end; }

.me {
  display: flex; align-items: center; gap: var(--xs);
  font-size: 16px; color: var(--dim);
  border: 1px solid var(--border); border-radius: var(--r-pill);
  padding: 6px 14px;
  min-width: 0;
}

.me__name {
  background: none; border: none; color: var(--text); font-size: 16px;
  width: 15ch; min-width: 0; padding: 0;
}

.me__name:focus { outline: none; border-bottom: 1px solid var(--border-bright); }

/* ============ buttons ============ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--xs);
  font-size: 20px; line-height: 1;
  padding: 15px 30px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-bright);
  background: var(--surface-lift);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease), opacity var(--dur) var(--ease);
}

.btn:hover:not(:disabled) { background: rgba(255,255,255,0.12); }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn--solid { background: var(--text); color: var(--black); border-color: var(--text); }
.btn--solid:hover:not(:disabled) { background: #fff; }

.btn--sm { font-size: 16px; padding: 9px 18px; white-space: nowrap; }

.btn--ghost { background: transparent; border-color: var(--border); }

/* ============ layout ============ */

main { padding: var(--xl) 0 var(--xxl); }

.section { margin-top: var(--xxl); }
.section:first-child { margin-top: var(--xl); }

.section__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--md); flex-wrap: wrap; margin-bottom: var(--lg);
}

h2 { font-size: clamp(30px, 4vw, 44px); line-height: 1.1; font-weight: 400; letter-spacing: -0.015em; }

.eyebrow {
  font-size: 15px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--faint);
}

.hint { color: var(--faint); font-size: 17px; }

/* ============ panels ============ */

.panel {
  background: var(--surface);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: 0 12px 28px var(--shadow), inset 0 1px 0 var(--highlight);
}

/* ============ devices ============ */

.devices { display: grid; gap: var(--sm); grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.device {
  position: relative;
  padding: var(--lg);
  text-align: left;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease);
  animation: rise 420ms var(--soft) both;
}

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

.device:hover { border-color: var(--border-bright); background: var(--surface-lift); }
.device:active { transform: scale(0.985); }

.device[aria-pressed="true"] {
  border-color: var(--text);
  background: var(--surface-lift);
}

.device__top { display: flex; align-items: center; gap: var(--xs); margin-bottom: var(--sm); }

.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--good);
  flex: none;
  animation: pulse 2.4s var(--soft) infinite;
}

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

.device__name { display: block; font-size: 23px; line-height: 1.2; }
.device__meta { display: block; color: var(--faint); font-size: 16px; margin-top: 2px; }

.device__check {
  position: absolute; top: var(--md); right: var(--md);
  font-size: 18px; color: var(--text);
  opacity: 0; transform: scale(0.6);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.device[aria-pressed="true"] .device__check { opacity: 1; transform: none; }

.empty {
  padding: var(--xl); text-align: center; color: var(--faint); font-size: 18px;
  border: 1px dashed var(--border); border-radius: var(--r-md);
}

/* ============ drop zone ============ */

.drop {
  padding: var(--xxl) var(--lg);
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.drop:hover { border-color: var(--border-bright); background: var(--surface); }

.drop.is-over {
  border-color: var(--text);
  background: var(--surface-lift);
  transform: scale(1.01);
}

.drop__title { font-size: clamp(24px, 3vw, 32px); line-height: 1.2; }
.drop__sub { color: var(--faint); font-size: 17px; margin-top: var(--xs); }

/* ============ transfers ============ */

.transfers { display: grid; gap: var(--sm); }

.transfer {
  display: flex; align-items: center; gap: var(--md);
  padding: var(--md) var(--lg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  animation: slide 420ms var(--soft) both;
}

@keyframes slide { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }

.transfer__body { flex: 1; min-width: 0; }

.transfer__name {
  display: block;
  font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.transfer__meta { display: block; font-size: 16px; color: var(--faint); }

.track {
  height: 2px; background: var(--border); border-radius: 2px; overflow: hidden; margin-top: var(--xs);
}

.track__fill {
  height: 100%; width: 0%; background: var(--text);
  transition: width 160ms linear;
}

.transfer[data-state="done"] .track { opacity: 0; }

.arc {
  width: 34px; height: 34px; flex: none;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--text);
  animation: spin 900ms linear infinite;
}

.transfer[data-state="done"] .arc {
  animation: none;
  border-color: var(--good);
  border-top-color: var(--good);
  display: grid; place-items: center;
  font-size: 16px; color: var(--good);
}

.transfer[data-state="done"] .arc::after { content: "✓"; }

.flash { animation: flash 620ms var(--soft); }

@keyframes flash {
  0% { box-shadow: 0 0 0 0 rgba(255,255,255,0.35); }
  100% { box-shadow: 0 0 0 22px rgba(255,255,255,0); }
}

/* ============ toast ============ */

.toasts {
  position: fixed; left: 50%; bottom: var(--lg); transform: translateX(-50%);
  z-index: 60; display: grid; gap: var(--xs); width: min(520px, calc(100% - 2 * var(--lg)));
}

.toast {
  padding: var(--sm) var(--lg);
  border: 1px solid var(--border-bright);
  border-radius: var(--r-pill);
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  font-size: 17px; text-align: center;
  animation: toast-in 320ms var(--ease) both;
}

.toast[data-leaving="true"] { animation: toast-out 260ms var(--soft) both; }

@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ============ notice ============ */

.notice {
  margin-top: var(--xxl);
  padding: var(--lg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--faint);
  font-size: 17px;
}

.notice strong { color: var(--dim); font-weight: 400; }

/* ============ responsive ============ */

@media (max-width: 560px) {
  body { font-size: 18px; }
  .signin__action { display: block; }
  .signin__action .btn { width: 100%; }
  .bar__inner { gap: var(--xs); }
  .me { flex: 1 1 auto; }
  .me__name { width: 100%; }
  .devices { grid-template-columns: 1fr; }

  .transfer { flex-wrap: wrap; }
  .transfer__body { flex: 1 1 100%; order: 2; }
  .transfer__action { flex: 1 1 100%; order: 3; }
  .transfer__action .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .dot, .arc, .ring { animation: none !important; }
}
