:root {
  /* Align with https://inf.ink/ Astra palette */
  --ast-0: #0170b9;
  --ast-1: #3a3a3a;
  --ast-3: #4b4f58;
  --ast-6: #f2f5f7;
  --ast-7: #424242;
  --ast-8: #000000;

  --bg: #000000;
  --text: var(--ast-3);
  --muted: var(--ast-7);
  --hover: var(--ast-6);
  --accent: var(--ast-0);
  --line: rgba(48, 48, 48, 0.93);
  --danger: #c45c5c;
  --warn: #c9a227;
  --ok: #3ecf8e;
  --pad: clamp(16px, 4vw, 35px);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: Verdana, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeSpeed;
}

.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;
}

/* Subtle vignette + grain — atmosphere without SaaS gradients */
.atmosphere {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 55% at 50% -10%, rgba(1, 112, 185, 0.09), transparent 55%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(242, 245, 247, 0.03), transparent 50%);
  animation: atmosphere-breathe 14s ease-in-out infinite alternate;
}

.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@keyframes atmosphere-breathe {
  from { opacity: 0.7; }
  to { opacity: 1; }
}

.site-header,
main,
.site-footer {
  position: relative;
  z-index: 1;
}

/* —— Header (inf.ink nav language) —— */
.site-header {
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.nav {
  max-width: 100%;
  margin: 0 auto;
  padding: 10px var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 50px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ast-7);
  transition: color 0.5s ease;
}

.brand:hover {
  color: var(--ast-6);
}

.brand img {
  width: 48px;
  height: auto;
}

.brand .title {
  font-family: "Abhaya Libre", serif;
  font-size: clamp(22px, 4vw, 32px);
  letter-spacing: 0.2px;
  font-weight: 300;
}

.nav-meta {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* —— Layout —— */
main {
  flex: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 var(--pad) 40px;
}

.hidden {
  display: none !important;
}

/* —— Home: one composition, brand first —— */
.view-home {
  min-height: calc(100vh - 140px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-stage {
  width: 100%;
  max-width: 400px;
  padding: 28px 0 40px;
  animation: rise-in 0.7s ease both;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.home-brand {
  margin: 0;
  font-family: "Abhaya Libre", serif;
  font-weight: 300;
  font-size: clamp(40px, 11vw, 56px);
  line-height: 1.05;
  color: var(--ast-7);
  letter-spacing: 0.01em;
  animation: brand-in 1s ease 0.1s both;
}

@keyframes brand-in {
  from {
    opacity: 0;
    letter-spacing: 0.12em;
  }
  to {
    opacity: 1;
    letter-spacing: 0.01em;
  }
}

.home-lead {
  margin: 10px 0 28px;
  font-size: 15px;
  color: var(--ast-3);
  font-weight: 300;
  animation: rise-in 0.8s ease 0.25s both;
  text-align: right;
}

.home-form {
  display: grid;
  gap: 12px;
  animation: rise-in 0.8s ease 0.35s both;
}

.home-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0;
  color: var(--muted);
  font-size: 12px;
}

.home-divider::before,
.home-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

/* —— Fields & buttons —— */
.field {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.field span {
  letter-spacing: 0.02em;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--hover);
  font: inherit;
  transition: border-color 0.25s ease, background 0.25s ease;
}

input:focus {
  outline: none;
  border-color: rgba(1, 112, 185, 0.55);
  background: rgba(255, 255, 255, 0.05);
}

.btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 2px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 400;
  letter-spacing: 0.02em;
  cursor: pointer;
  background: transparent;
  color: var(--hover);
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, opacity 0.2s ease, transform 0.15s ease;
}

.btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(242, 245, 247, 0.28);
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(242, 245, 247, 0.28);
}

.btn-xl {
  padding: 14px 18px;
  font-size: 15px;
  min-height: 48px;
}

.btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.error {
  color: var(--danger);
  font-size: 13px;
  min-height: 1.2em;
  margin: 4px 0 0;
}

/* —— Room —— */
.view-room {
  padding-top: 20px;
  animation: rise-in 0.55s ease both;
}

.alert-stack {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.alert {
  padding: 12px 14px;
  border-left: 2px solid var(--warn);
  background: rgba(201, 162, 39, 0.08);
  color: #e0c060;
  font-size: 13px;
  line-height: 1.45;
  animation: alert-in 0.35s ease both;
}

.alert.danger {
  border-left-color: var(--danger);
  background: rgba(196, 92, 92, 0.1);
  color: #e88;
}

.alert.info {
  border-left-color: var(--accent);
  background: rgba(1, 112, 185, 0.1);
  color: #7eb8dd;
}

@keyframes alert-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.session-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.session-kicker {
  display: block;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.session-id strong {
  font-family: "Abhaya Libre", serif;
  font-weight: 400;
  font-size: clamp(28px, 7vw, 36px);
  color: var(--hover);
  letter-spacing: 0.08em;
}

.role-pill {
  display: inline-block;
  font-size: 12px;
  color: var(--hover);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 4px 10px;
  border-radius: 2px;
}

.stage-hint {
  margin: 12px 0 18px;
  font-size: 13px;
  color: var(--warn);
  line-height: 1.4;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin-bottom: 22px;
}

@media (min-width: 480px) {
  .status-strip {
    grid-template-columns: repeat(4, 1fr);
  }
}

.status-chip {
  background: var(--bg);
  padding: 12px 10px;
}

.chip-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.chip-value {
  font-size: 13px;
  color: var(--hover);
  word-break: break-word;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.status-chip[data-ok="true"] .chip-value {
  color: var(--ok);
}

.status-chip[data-ok="false"] .chip-value {
  color: #e0a0a0;
}

.block {
  margin: 0 0 26px;
  padding-top: 4px;
}

.block-title {
  margin: 0 0 6px;
  font-family: "Abhaya Libre", serif;
  font-weight: 400;
  font-size: 1.35rem;
  color: var(--hover);
}

.block-sub {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--muted);
}

.host-project {
  display: grid;
  gap: 10px;
}

.host-project.hidden {
  display: none;
}

.project-body {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 14px;
}

.file-picker {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 0;
  padding: 12px 16px;
  text-align: center;
  cursor: pointer;
  box-sizing: border-box;
}

.file-picker input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.file-picker-title {
  font-size: inherit;
  letter-spacing: 0.02em;
  color: var(--hover);
}

.file-picker-hint {
  display: none;
}

.file-picker.has-files .file-picker-hint {
  display: inline;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-picker:hover:not(.is-disabled) {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(242, 245, 247, 0.28);
}

.file-picker.is-disabled {
  opacity: 0.38;
  cursor: not-allowed;
  pointer-events: none;
}

.transfer-progress {
  margin: 10px 0 0;
  min-height: 1.2em;
  font-size: 13px;
  color: var(--muted);
}

.metro-panel {
  padding: 4px 0 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.metro-grid {
  display: grid;
  gap: 16px;
  padding-top: 14px;
}

.metro-field {
  display: grid;
  gap: 8px;
  margin: 0;
}

.metro-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.metro-bpm-line {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.metro-bpm-input {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 4px 8px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0;
  background: transparent;
  color: var(--hover);
  font-family: "Abhaya Libre", serif;
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.02em;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}

.metro-bpm-input::-webkit-outer-spin-button,
.metro-bpm-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.metro-bpm-input:focus {
  outline: none;
  border-bottom-color: rgba(242, 245, 247, 0.55);
}

.metro-bpm-input:disabled {
  opacity: 0.55;
  cursor: default;
}

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

/* Volume / BPM: seek-like thumb, left light · right dark track */
.fill-slider {
  --fill: 0%;
  width: 100%;
  height: 28px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.fill-slider:disabled {
  opacity: 0.45;
  cursor: default;
}

.fill-slider::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(
    to right,
    rgba(242, 245, 247, 0.55) 0%,
    rgba(242, 245, 247, 0.55) var(--fill),
    rgba(255, 255, 255, 0.12) var(--fill),
    rgba(255, 255, 255, 0.12) 100%
  );
}

.fill-slider::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5.5px;
  border-radius: 50%;
  border: 1px solid rgba(242, 245, 247, 0.55);
  background: var(--bg);
}

.fill-slider:not(:disabled)::-webkit-slider-thumb {
  border-color: rgba(242, 245, 247, 0.75);
}

.fill-slider::-moz-range-track {
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.12);
}

.fill-slider::-moz-range-progress {
  height: 3px;
  border-radius: 2px;
  background: rgba(242, 245, 247, 0.55);
}

.fill-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(242, 245, 247, 0.55);
  background: var(--bg);
}

.fill-slider:not(:disabled)::-moz-range-thumb {
  border-color: rgba(242, 245, 247, 0.75);
}

.mix-panel {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.empty-hint,
.hint {
  font-size: 13px;
  color: var(--muted);
  margin: 10px 0;
}

.mix-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--hover);
  font-size: 13px;
}

.mix-row .fill-slider {
  margin-top: 8px;
}

.mix-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-mute {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  flex-shrink: 0;
}

.btn-mute .icon-speaker {
  width: 18px;
  height: 18px;
  display: block;
}

.btn-mute.is-on {
  color: rgba(232, 136, 136, 0.95);
  border-color: rgba(196, 92, 92, 0.45);
  background: rgba(196, 92, 92, 0.1);
}

.btn-mute.is-on .icon-waves {
  opacity: 0;
}

.btn-mute.is-on::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 1.5px;
  background: currentColor;
  transform: rotate(-45deg);
  border-radius: 1px;
  pointer-events: none;
}

.btn-mute.is-on:hover:not(:disabled) {
  color: #f0a8a8;
  border-color: rgba(196, 92, 92, 0.65);
  background: rgba(196, 92, 92, 0.14);
}

.transport-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.seek-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 14px;
}

.seek-time {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 2.6em;
}

.seek-bar {
  width: 100%;
  height: 28px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.seek-bar:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.seek-bar::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.16);
}

.seek-bar::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5.5px;
  border-radius: 50%;
  border: 1px solid rgba(242, 245, 247, 0.55);
  background: var(--bg);
}

.seek-bar:not(:disabled)::-webkit-slider-thumb {
  border-color: rgba(242, 245, 247, 0.75);
}

.seek-bar::-moz-range-track {
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.16);
}

.seek-bar::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(242, 245, 247, 0.55);
  background: var(--bg);
}

.seek-bar:not(:disabled)::-moz-range-thumb {
  border-color: rgba(242, 245, 247, 0.75);
}

.transport-grid .btn {
  width: 100%;
  min-height: 52px;
  letter-spacing: 0.12em;
}

.block.transport {
  padding-top: 8px;
  margin-bottom: 32px;
}

.roster {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 13px;
  color: var(--hover);
}

.roster li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.roster .name {
  flex: 1;
  min-width: 120px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 2px;
  font-size: 11px;
  letter-spacing: 0.02em;
}

.badge.ok {
  background: #1a3d2e;
  color: var(--ok);
}

.badge.bad {
  background: #3d1a1a;
  color: #e88;
}

.badge.mid {
  background: #3d351a;
  color: #e0c060;
}

.session-footer-actions {
  margin: 28px 0 32px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-leave {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 14px 18px;
  letter-spacing: 0.14em;
  color: rgba(232, 136, 136, 0.92);
  border-color: rgba(196, 92, 92, 0.35);
}

.btn-leave:hover:not(:disabled) {
  color: #f0a8a8;
  background: rgba(196, 92, 92, 0.08);
  border-color: rgba(196, 92, 92, 0.55);
}

.debug-drawer {
  margin-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.debug-drawer summary {
  cursor: pointer;
  user-select: none;
  color: var(--muted);
  list-style: none;
}

.debug-drawer summary::-webkit-details-marker {
  display: none;
}

.debug-list {
  margin-top: 10px;
  opacity: 0.75;
}

.debug-log {
  margin-top: 10px;
  max-height: 200px;
  overflow: auto;
  font-size: 11px;
  color: #8a93a3;
  white-space: pre-wrap;
  background: transparent;
  border: 0;
  padding: 0;
}

/* —— Footer (inf.ink) —— */
.site-footer {
  padding: 20px 0;
  margin-top: auto;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--pad);
}

.footer-copyright {
  text-align: center;
  color: var(--ast-3);
  font-size: 14px;
  line-height: 1.4;
}

@media (max-width: 544px) {
  .brand img {
    width: 40px;
  }

  .transport-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .transport-grid .btn {
    min-height: 48px;
    letter-spacing: 0.08em;
  }
}
