:root {
  color-scheme: dark;
  --background: #111713;
  --surface: rgba(29, 39, 32, 0.88);
  --surface-strong: #202c24;
  --surface-soft: #18211b;
  --ink: #f1f2e9;
  --muted: #a7afa8;
  --line: rgba(230, 238, 226, 0.12);
  --accent: #d8f49a;
  --accent-strong: #bfe56c;
  --accent-ink: #17200f;
  --danger: #ff9289;
  --success: #aee792;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--background);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% -30%, rgba(149, 187, 106, 0.16), transparent 48%),
    linear-gradient(180deg, #141c16, var(--background));
  color: var(--ink);
}

button,
input {
  font: inherit;
}

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

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 30rem;
  height: 30rem;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.08;
  pointer-events: none;
}

.ambient-one {
  top: 8rem;
  left: -16rem;
  background: #cbf889;
}

.ambient-two {
  right: -18rem;
  bottom: 0;
  background: #7ac4a5;
}

.site-header {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(216, 244, 154, 0.4);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(216, 244, 154, 0.2), rgba(216, 244, 154, 0.03));
  color: var(--accent);
  font-weight: 900;
  letter-spacing: -0.07em;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1.05rem;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.service-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.service-state i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 16px var(--success);
}

main {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 44px 0 80px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 780px;
  margin-bottom: 20px;
  font-size: clamp(2.8rem, 6.4vw, 6.4rem);
  line-height: 0.96;
  letter-spacing: -0.07em;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  letter-spacing: -0.035em;
}

.eyebrow {
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.lede {
  max-width: 680px;
  color: #c6ccc6;
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  line-height: 1.65;
}

.muted {
  color: var(--muted);
  line-height: 1.6;
}

.auth-layout {
  min-height: calc(100vh - 190px);
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(330px, 0.6fr);
  align-items: center;
  gap: clamp(36px, 8vw, 110px);
}

.promise-grid {
  max-width: 760px;
  margin-top: 50px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
}

.promise-grid article {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.promise-grid span {
  display: block;
  margin-bottom: 28px;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
}

.promise-grid strong {
  display: block;
  margin-bottom: 8px;
}

.promise-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

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

.auth-panel {
  padding: 30px 28px;
}

label {
  display: block;
  margin: 17px 0 7px;
  font-size: 0.82rem;
  font-weight: 750;
}

label span {
  color: var(--muted);
  font-weight: 500;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  padding: 13px 14px;
  background: rgba(7, 10, 8, 0.34);
  color: var(--ink);
}

input:focus {
  border-color: rgba(216, 244, 154, 0.58);
  box-shadow: 0 0 0 3px rgba(216, 244, 154, 0.08);
}

.field-help {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.73rem;
}

.primary-button,
.secondary-button,
.quiet-button,
.danger-button,
.download-button {
  border: 0;
  border-radius: 11px;
  padding: 12px 16px;
  font-weight: 800;
  text-decoration: none;
}

.primary-button {
  width: 100%;
  margin-top: 23px;
  background: var(--accent);
  color: var(--accent-ink);
}

.primary-button:hover,
.secondary-button:hover {
  background: var(--accent-strong);
  color: var(--accent-ink);
}

.secondary-button {
  width: 100%;
  margin-top: 18px;
  background: rgba(216, 244, 154, 0.12);
  color: var(--accent);
}

.quiet-button,
.download-button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}

.danger-button {
  background: rgba(255, 146, 137, 0.1);
  color: var(--danger);
}

button:disabled {
  cursor: wait;
  opacity: 0.52;
}

.form-message {
  min-height: 20px;
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.form-message.error {
  color: var(--danger);
}

.form-message.success {
  color: var(--success);
}

.dashboard-heading {
  margin-bottom: 32px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.dashboard-heading h1 {
  margin: 0;
  font-size: clamp(2.6rem, 6vw, 5.4rem);
}

.account-label {
  margin-bottom: 8px;
  color: var(--muted);
}

.stat-grid {
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.stat-card {
  min-height: 150px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
}

.stat-card span,
.stat-card small {
  color: var(--muted);
  font-size: 0.76rem;
}

.stat-card strong {
  margin: auto 0 8px;
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  letter-spacing: -0.06em;
}

.dashboard-grid {
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
}

.upload-panel,
.sync-panel,
.library-panel,
.device-panel {
  padding: 26px;
}

.library-panel,
.device-panel {
  margin-bottom: 18px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.format-pill,
.secure-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.65rem;
  white-space: nowrap;
}

.secure-pill {
  border-color: rgba(216, 244, 154, 0.22);
  color: var(--accent);
}

.drop-zone {
  min-height: 160px;
  margin-top: 24px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(216, 244, 154, 0.28);
  border-radius: 16px;
  background: rgba(216, 244, 154, 0.025);
  text-align: center;
  cursor: pointer;
}

.drop-zone:hover {
  border-color: rgba(216, 244, 154, 0.58);
  background: rgba(216, 244, 154, 0.05);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-zone strong,
.drop-zone small {
  display: block;
}

.drop-zone small {
  margin-top: 6px;
  color: var(--muted);
  font-weight: 500;
}

.drop-icon {
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 2rem;
  font-weight: 300;
}

.flow-list {
  margin: 30px 0 0;
  padding: 0;
  list-style: none;
}

.flow-list li {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 13px;
  padding: 15px 0;
  border-top: 1px solid var(--line);
}

.flow-list li > span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(216, 244, 154, 0.3);
  border-radius: 50%;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem;
}

.flow-list p,
.flow-list strong {
  display: block;
}

.flow-list p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.flow-list strong {
  margin-bottom: 2px;
  color: var(--ink);
}

.sync-note {
  margin-top: 18px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(216, 244, 154, 0.07);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.5;
}

.empty-state {
  padding: 54px 20px;
  text-align: center;
  color: var(--muted);
}

.empty-state span {
  display: block;
  margin-bottom: 14px;
  color: var(--accent);
  font-size: 2rem;
}

.empty-state strong {
  color: var(--ink);
}

.empty-state p {
  margin: 7px 0 0;
  font-size: 0.86rem;
}

.empty-state.compact {
  padding: 32px 20px;
}

.item-list {
  margin-top: 20px;
}

.list-item {
  min-height: 74px;
  padding: 15px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  border-top: 1px solid var(--line);
}

.item-main {
  min-width: 0;
}

.item-main strong,
.item-main small {
  display: block;
}

.item-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-main small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.74rem;
}

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

.download-button,
.danger-button {
  font-size: 0.74rem;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--success);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10;
  max-width: min(380px, calc(100% - 44px));
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #29362d;
  box-shadow: var(--shadow);
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 840px) {
  main {
    padding-top: 20px;
  }

  .auth-layout,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .auth-layout {
    align-items: start;
  }

  .intro h1 {
    max-width: 640px;
  }

  .promise-grid {
    margin-top: 32px;
  }

  .auth-panel {
    max-width: 600px;
  }
}

@media (max-width: 620px) {
  .site-header,
  main {
    width: min(100% - 24px, 1180px);
  }

  .site-header {
    padding-top: 14px;
  }

  .service-state {
    display: none;
  }

  main {
    padding-bottom: 48px;
  }

  h1 {
    font-size: 3.05rem;
  }

  .promise-grid,
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .promise-grid {
    gap: 16px;
  }

  .dashboard-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-heading h1 {
    font-size: 3.1rem;
  }

  .stat-card {
    min-height: 112px;
  }

  .stat-card strong {
    margin-top: 20px;
  }

  .upload-panel,
  .pair-panel,
  .library-panel,
  .device-panel {
    padding: 20px;
  }

  .section-heading {
    align-items: flex-start;
  }

  .format-pill {
    display: none;
  }

  .list-item {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .item-actions {
    justify-content: flex-start;
  }
}
