:root {
  color: #e8e4dc;
  background: #090a0c;
  font-family: "Segoe UI Variable Text", "Segoe UI", Helvetica, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #090a0c;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.top, .rail, .status, .ask, .spiral, .close, .reader, .welcome {
  position: absolute;
  z-index: 2;
}

.top {
  top: 22px;
  left: 28px;
  pointer-events: none;
}

.mark {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 600;
}

.product {
  margin: 6px 0 0;
  color: #9a948a;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.rail {
  top: 92px;
  left: 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(240px, 34vw);
}

.rail-seat, .seat-label, .ask button, .close {
  font: inherit;
  color: inherit;
  background: rgba(12, 13, 16, 0.72);
  border: 1px solid rgba(232, 228, 220, 0.16);
  border-radius: 2px;
}

.rail-seat {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
}

.rail-seat small {
  color: #9a948a;
}

.rail-seat.is-on, .seat-label.is-on {
  border-color: #c4b8a5;
  background: rgba(196, 184, 165, 0.14);
}

.seat-label {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 4px 8px;
  cursor: pointer;
  white-space: nowrap;
}

.seat-name { font-size: 12px; }
.seat-house { color: #9a948a; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }

.status {
  left: 28px;
  bottom: 92px;
  margin: 0;
  color: #9a948a;
  font-size: 13px;
  max-width: 36rem;
  pointer-events: none;
}

.ask {
  left: 22px;
  right: 22px;
  bottom: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: center;
}

.ask label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.ask input {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
  font: inherit;
  color: #e8e4dc;
  background: rgba(12, 13, 16, 0.82);
  border: 1px solid rgba(232, 228, 220, 0.16);
  border-radius: 2px;
  padding: 12px 14px;
}

.ask button, .close {
  padding: 12px 16px;
  cursor: pointer;
}

.spiral { inset: 0; pointer-events: none; }

.welcome {
  inset: 0;
  z-index: 7;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(9, 10, 12, 0.72);
}

.welcome[hidden] { display: none; }

.welcome-card {
  width: min(440px, 100%);
  padding: 22px;
  background: #12141a;
  border: 1px solid rgba(232, 228, 220, 0.18);
}

.welcome-card h2 {
  margin: 8px 0;
  font-size: 22px;
  font-weight: 600;
}

.welcome-card p { margin: 0 0 10px; line-height: 1.45; }

.welcome-question { color: #e8e4dc; }

.welcome-actions { display: flex; gap: 8px; }

.welcome-actions button {
  font: inherit;
  color: inherit;
  background: rgba(12, 13, 16, 0.72);
  border: 1px solid rgba(232, 228, 220, 0.16);
  border-radius: 2px;
  padding: 10px 12px;
  cursor: pointer;
}

.card {
  position: absolute;
  width: min(280px, max(168px, 72vw));
  height: 156px;
  overflow: auto;
  padding: 14px 16px 16px;
  pointer-events: auto;
  background: rgba(12, 13, 16, 0.92);
  border: 1px solid rgba(232, 228, 220, 0.18);
  border-radius: 2px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.kicker {
  margin: 0;
  color: #9a948a;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.card h2 {
  margin: 6px 0 8px;
  font-size: 18px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.card p {
  margin: 0;
  line-height: 1.45;
  max-height: 4.4em;
  overflow: auto;
}

.close {
  top: 22px;
  right: 22px;
  pointer-events: auto;
  z-index: 6;
}

.file-row,
.file-list,
.send-to,
.cost-hint,
.mode-label,
.mode-pick,
.balance,
.packs,
.credit-note,
.spend-line {
  grid-column: 1 / -1;
}

.cost-hint,
.mode-label,
.balance,
.credit-note,
.spend-line {
  margin: 0;
}

.cost-hint,
.credit-note,
.spend-line,
.mode-label {
  color: #9a948a;
  font-size: 12px;
  line-height: 1.4;
}

.cost-hint.is-short { color: #d2b48c; }

.mode-label {
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 11px;
}

.mode-pick,
.packs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.packs { grid-template-columns: repeat(5, 1fr); }

.ask .mode-pick button,
.ask .packs button {
  padding: 8px 4px;
  font-size: 12px;
}

.mode-pick button[aria-pressed="true"] {
  border-color: #c4b8a5;
  background: rgba(196, 184, 165, 0.14);
}

.balance {
  color: #e8e4dc;
  font-size: 13px;
}

.file-row {
  display: flex;
  gap: 8px;
}

.file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.file-list:empty { display: none; }

.file-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  color: #e8e4dc;
  font-size: 12px;
}

.file-list button,
.send-chip,
.reader-bar button,
.reader-grip {
  font: inherit;
  color: inherit;
  background: rgba(12, 13, 16, 0.72);
  border: 1px solid rgba(232, 228, 220, 0.16);
  border-radius: 2px;
  cursor: pointer;
}

.file-list button { padding: 4px 8px; }

.send-to {
  margin: 0;
  padding: 8px;
  border: 1px solid rgba(232, 228, 220, 0.16);
  min-width: 0;
}

.send-to legend {
  padding: 0 6px;
  color: #9a948a;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#send-to {
  display: flex;
  gap: 4px;
  overflow-x: auto;
}

.send-chip {
  flex: 0 0 auto;
  padding: 6px 8px;
  font-size: 12px;
}

.send-chip[aria-pressed="true"] {
  border-color: #c4b8a5;
  background: rgba(196, 184, 165, 0.14);
}

.ask textarea {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 88px;
  max-height: 180px;
  resize: vertical;
  padding: 10px 12px;
  color: #e8e4dc;
  background: #12141a;
  border: 1px solid rgba(232, 228, 220, 0.2);
  border-radius: 2px;
  font: inherit;
  line-height: 1.4;
}

#together[aria-pressed="true"] {
  border-color: #c4b8a5;
  background: rgba(196, 184, 165, 0.18);
}

.reader {
  z-index: 4;
  top: 72px;
  right: 22px;
  width: min(720px, calc(100vw - 44px));
  height: min(74vh, calc(100vh - 96px));
  display: flex;
  flex-direction: column;
  min-width: 280px;
  min-height: 160px;
  background: #12141a;
  border: 1px solid rgba(232, 228, 220, 0.2);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.reader[hidden] { display: none; }

.reader.is-max {
  left: 16px;
  top: 16px;
  right: auto;
  bottom: auto;
  width: calc(100vw - 32px);
  height: calc(100vh - 32px);
}

.reader-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 0;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.reader-names {
  min-width: 0;
  flex: 1;
}

.reader-names h2 {
  margin: 4px 0 0;
  font-size: 18px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-bar button {
  padding: 8px 10px;
  cursor: pointer;
  touch-action: auto;
}

.reader-model {
  margin: 6px 12px 0;
  color: #9a948a;
  font-size: 12px;
  min-height: 1em;
}

.reader-body {
  flex: 1;
  min-height: 0;
  margin: 8px 12px 22px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.45;
  scrollbar-color: #c4b8a5 #12141a;
}

.reader-body pre,
.reader-copy {
  margin: 0 0 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
}

.reader-seat {
  margin: 0 0 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(232, 228, 220, 0.16);
}

.reader-seat h3 {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
}

.reader-seat .pass {
  margin: 8px 0 4px;
  color: #9a948a;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.reader-grip {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 22px;
  height: 22px;
  padding: 0;
  cursor: nwse-resize;
  touch-action: none;
  background:
    linear-gradient(135deg, transparent 0 45%, #c4b8a5 45% 55%, transparent 55% 70%, #c4b8a5 70% 80%, transparent 80%);
}

.spiral[hidden] { display: none; }

@media (min-width: 801px) {
  .ask {
    right: auto;
    width: min(320px, 38vw);
    max-height: 62vh;
    overflow: auto;
  }
  .status {
    bottom: calc(62vh + 28px);
    max-width: min(320px, 38vw);
  }
}

@media (max-width: 800px) {
  .reader {
    left: 12px;
    right: auto;
    top: 64px;
    width: calc(100vw - 24px);
    height: 42vh;
  }
  .rail {
    top: auto;
    bottom: 132px;
    left: 12px;
    right: 12px;
    width: auto;
    flex-direction: row;
    overflow-x: auto;
  }
  .rail-seat { flex: 0 0 auto; }
  .status { display: none; }
  .top { left: 16px; top: 14px; }
  .ask {
    max-height: 46vh;
    overflow: auto;
    bottom: 8px;
  }
}
