:root {
  --cream: #f7f5ef;
  --paper: #fffef9;
  --ink: #17231d;
  --muted: #657168;
  --line: #d8d4c8;
  --blue: #386dec;
  --sky: #4bcbfd;
  --orange: #ff772b;
  --lime: #d0ff93;
  --purple: #8170ff;
  --red: #d94b45;
  --shadow: 5px 5px 0 var(--ink);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-width: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
textarea,
select {
  color: inherit;
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: .48;
}

[hidden] {
  display: none !important;
}

code {
  padding: .15em .35em;
  border-radius: 5px;
  background: rgba(23, 35, 29, .08);
  font-family: Consolas, Monaco, monospace;
  font-size: .9em;
}

.connection-bar {
  position: sticky;
  z-index: 30;
  top: 0;
  min-height: 104px;
  display: grid;
  grid-template-columns: auto minmax(320px, 1fr) auto auto;
  align-items: center;
  gap: 22px;
  padding: 14px max(20px, calc((100vw - 1440px) / 2));
  border-bottom: 3px solid var(--ink);
  background: rgba(255, 254, 249, .97);
  box-shadow: 0 5px 0 rgba(23, 35, 29, .08);
  backdrop-filter: blur(12px);
}

.connection-brand {
  display: flex;
  align-items: center;
  gap: 9px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--sky);
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 17px;
  font-weight: 950;

  img {
    height: 40px;
  }
}

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

.connection-brand strong {
  font-size: 14px;
  font-weight: 950;
  letter-spacing: -.3px;
}

.connection-brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
}

.connection-paths {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.connection-paths span {
  min-width: 0;
  padding-left: 12px;
  border-left: 2px solid var(--line);
}

.connection-paths small,
.connection-paths strong {
  display: block;
}

.connection-paths small {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .7px;
  text-transform: uppercase;
}

.connection-paths strong {
  overflow: hidden;
  font-family: Consolas, Monaco, monospace;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-status {
  min-width: 150px;
  display: grid;
  justify-items: start;
  gap: 5px;
}

.connection-status small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
}

.status-pill,
.dirty-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 8px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 950;
}

.status-pill.connected {
  background: var(--lime);
}

.status-pill.invalid,
.dirty-pill.dirty {
  background: #ffd6d1;
}

.dirty-pill {
  background: white;
}

.dirty-pill.saving {
  background: #fff0ad;
}

.dirty-pill.saved {
  background: #dff7cf;
}

.connection-actions,
.inline-actions,
.hero-actions,
.dialog-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.connection-actions {
  max-width: 250px;
  justify-content: flex-end;
}

.button {
  min-height: 42px;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 15px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
  transition: transform .16s ease, box-shadow .16s ease;
}

.button:hover:not(:disabled) {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 var(--ink);
}

.button.primary {
  background: var(--orange);
}

.button.accent {
  background: var(--lime);
}

.button.danger {
  background: #ffb9b2;
}

.button.subtle {
  min-height: 34px;
  padding: 7px 10px;
  box-shadow: none;
  font-size: 10px;
}

.workspace {
  max-width: 1440px;
  margin: auto;
  padding: 42px 28px 100px;
}

.auth-gate {
  min-height: calc(100vh - 104px);
  display: grid;
  place-items: center;
  padding: 40px 20px;
  background:
    radial-gradient(circle at 18% 20%, rgba(75, 203, 253, .28), transparent 28%),
    radial-gradient(circle at 82% 75%, rgba(208, 255, 147, .35), transparent 30%);
}

.auth-card {
  width: min(560px, 100%);
  padding: clamp(28px, 5vw, 54px);
  border: 3px solid var(--ink);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 9px 9px 0 var(--ink);
  text-align: center;
}

.auth-card .brand-mark {
  width: 66px;
  height: 66px;
  margin: 0 auto 24px;
  font-size: 22px;
}

.auth-card h1 {
  margin: 8px 0 14px;
  font-size: clamp(32px, 6vw, 54px);
  line-height: .98;
}

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

.auth-card .button {
  margin-top: 16px;
}

.configuration-problems {
  padding: 16px 16px 16px 36px;
  border: 2px solid var(--red);
  border-radius: 12px;
  background: #fff3f1;
  text-align: left;
}

.repository-loader {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 20%, rgba(75, 203, 253, .38), transparent 28%),
    radial-gradient(circle at 82% 75%, rgba(208, 255, 147, .48), transparent 30%),
    rgba(247, 245, 239, .96);
  backdrop-filter: blur(12px);
}

.repository-loader-card {
  width: min(570px, 100%);
  padding: clamp(30px, 5vw, 54px);
  border: 3px solid var(--ink);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: 10px 10px 0 var(--ink);
  text-align: center;
}

.repository-loader-card h1 {
  margin: 10px 0 14px;
  font-size: clamp(34px, 6vw, 54px);
  font-weight: 950;
  letter-spacing: -.055em;
  line-height: .94;
  text-transform: uppercase;
}

.repository-loader-card > p:not(.eyebrow) {
  min-height: 24px;
  margin: 0 0 22px;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.5;
}

.repository-loader-card > small {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
}

.loading-deck-stack {
  position: relative;
  width: 116px;
  height: 106px;
  margin: 0 auto 20px;
}

.loading-deck-stack span {
  position: absolute;
  top: 9px;
  left: 31px;
  width: 58px;
  height: 78px;
  border: 3px solid var(--ink);
  border-radius: 10px;
  box-shadow: 4px 4px 0 var(--ink);
  transform-origin: 50% 90%;
}

.loading-deck-stack span:nth-child(1) {
  background: var(--sky);
  animation: loading-card-left 1.8s ease-in-out infinite;
}

.loading-deck-stack span:nth-child(2) {
  z-index: 2;
  background: var(--orange);
  animation: loading-card-center 1.8s ease-in-out infinite;
}

.loading-deck-stack span:nth-child(3) {
  background: var(--lime);
  animation: loading-card-right 1.8s ease-in-out infinite;
}

.loading-deck-stack i {
  position: absolute;
  width: 10px;
  height: 10px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--purple);
  animation: loading-dot 1.2s ease-in-out infinite;
}

.loading-deck-stack i:nth-of-type(1) {
  bottom: 0;
  left: 20px;
}

.loading-deck-stack i:nth-of-type(2) {
  bottom: 0;
  left: 53px;
  animation-delay: .16s;
}

.loading-deck-stack i:nth-of-type(3) {
  right: 20px;
  bottom: 0;
  animation-delay: .32s;
}

.loading-progress {
  height: 14px;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: white;
  box-shadow: 2px 2px 0 var(--ink);
}

.loading-progress span {
  width: 14%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange), var(--sky), var(--lime));
  transition: width .25s ease;
}

.loading-progress.indeterminate span {
  width: 38%;
  animation: loading-progress 1.25s ease-in-out infinite;
}

.floating-publish {
  position: fixed;
  z-index: 29;
  right: max(24px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  min-height: 54px;
  padding: 14px 20px;
  box-shadow: 5px 5px 0 var(--ink);
  font-size: 13px;
}

.floating-publish > span {
  margin-right: 7px;
  font-size: 18px;
  line-height: 1;
}

.floating-publish:not(:disabled) {
  animation: floating-publish-ready .35s ease-out;
}

@keyframes loading-card-left {
  0%, 100% { transform: rotate(-8deg) translateX(-7px); }
  50% { transform: rotate(-18deg) translateX(-15px) translateY(-4px); }
}

@keyframes loading-card-center {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes loading-card-right {
  0%, 100% { transform: rotate(8deg) translateX(7px); }
  50% { transform: rotate(18deg) translateX(15px) translateY(-4px); }
}

@keyframes loading-dot {
  0%, 100% { transform: translateY(0); background: var(--purple); }
  50% { transform: translateY(-7px); background: var(--sky); }
}

@keyframes loading-progress {
  from { transform: translateX(-110%); }
  to { transform: translateX(270%); }
}

@keyframes floating-publish-ready {
  from { transform: translateY(18px) scale(.94); }
  to { transform: translateY(0) scale(1); }
}

.hero-panel {
  min-height: 260px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  margin-bottom: 28px;
  padding: 42px 48px;
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: 28px;
  background: var(--blue);
  color: white;
  box-shadow: 8px 8px 0 var(--ink);
}

.hero-panel h1,
.panel-heading h2,
dialog h2,
.remote-card h1 {
  margin: 0;
  font-weight: 950;
  letter-spacing: -.055em;
  line-height: .92;
  text-transform: uppercase;
}

.hero-panel h1 {
  font-size: clamp(46px, 5vw, 72px);
}

.hero-panel h1 em {
  color: var(--lime);
  font-style: normal;
}

.hero-panel > div > p:last-child {
  max-width: 680px;
  margin: 22px 0 0;
  color: #e8edff;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.55;
}

.hero-panel .button:not(.primary) {
  background: white;
  color: var(--ink);
}

.eyebrow,
.kicker {
  margin: 0 0 14px;
  color: var(--orange);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}

.hero-panel .eyebrow {
  color: var(--lime);
}

.notice-area {
  display: grid;
  gap: 10px;
  margin: 24px 0;
  max-height: min(42vh, 160px);
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
}

.notice {
  position: relative;
  padding: 14px 48px 14px 16px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: white;
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 13px;
  line-height: 1.5;
}

.notice.error {
  background: #ffe1dd;
}

.notice.warning {
  background: #fff0b8;
}

.notice.success {
  background: var(--lime);
}

.notice button.notice-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
  font-size: 20px;
}

.notice ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.notice .button {
  margin-top: 10px;
}

.inline-warning {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.inline-warning .button {
  flex-shrink: 0;
}

.duplicates-list {
  display: grid;
  gap: 14px;
  max-height: min(60vh, 640px);
  overflow-y: auto;
  padding-right: 4px;
  margin-top: 12px;
}

.duplicate-group {
  padding: 14px;
  border: 2px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, .8);
}

.duplicate-group > header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.duplicate-group strong {
  display: block;
  font-size: 15px;
}

.duplicate-group small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.duplicate-card-list {
  display: grid;
  gap: 10px;
}

.duplicate-card-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--paper);
}

.duplicate-card-row .card-copy {
  min-width: 0;
}

.duplicate-card-row .card-copy strong,
.duplicate-card-row .card-copy small {
  display: block;
}

.duplicate-card-row .card-copy small {
  margin-top: 3px;
  color: var(--muted);
}

.duplicate-card-row .card-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tabs {
  position: sticky;
  z-index: 20;
  top: 104px;
  display: flex;
  gap: 8px;
  margin: 34px 0 28px;
  padding: 9px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  box-shadow: 4px 4px 0 var(--ink);
}

.tab {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.tab span {
  min-width: 23px;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(23, 35, 29, .1);
  font-size: 9px;
}

.tab.active {
  background: var(--ink);
  color: white;
}

.tab.active span {
  background: var(--orange);
  color: var(--ink);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.panel-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 26px;
}

.panel-heading h2,
dialog h2 {
  font-size: clamp(34px, 4vw, 54px);
}

.pack-list {
  display: grid;
  gap: 22px;
}

.pack-section {
  min-width: 0;
  border: 2px solid var(--ink);
  border-radius: 18px;
  background: rgba(255, 255, 255, .48);
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}

.pack-section.dragging {
  opacity: .45;
  transform: scale(.99);
}

.pack-section.pack-drag-before {
  box-shadow: 0 -8px 0 var(--sky), 4px 4px 0 var(--ink);
}

.pack-section.pack-drag-after {
  box-shadow: 0 8px 0 var(--orange), 4px 4px 0 var(--ink);
}

.pack-header {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  background: linear-gradient(100deg, #fff, #eeeafc);
}

.pack-drag-handle {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  background: white;
  box-shadow: 2px 2px 0 var(--ink);
  cursor: grab;
  font-weight: 950;
}

.pack-drag-handle[draggable="false"] {
  cursor: not-allowed;
  opacity: .45;
}

.pack-toggle {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.pack-toggle:hover {
  color: #4930c8;
}

.pack-toggle > span:last-child {
  min-width: 0;
}

.pack-toggle strong,
.pack-toggle small {
  display: block;
}

.pack-toggle strong {
  overflow: hidden;
  font-size: 22px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pack-toggle small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.bundle-description {
  max-width: 62ch;
  margin-top: 5px;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.pack-chevron {
  font-size: 24px;
  line-height: 1;
  transition: transform .16s ease;
}

.pack-section.collapsed .pack-chevron {
  transform: rotate(-90deg);
}

.pack-header-meta {
  display: flex;
  align-items: center;
}

.pack-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.pack-actions .mini-button {
  min-height: 32px;
  padding: 5px 8px;
  font-size: 9px;
}

.pack-content {
  padding: 16px;
  border-top: 2px solid var(--ink);
}

.pack-deck-grid {
  min-height: 80px;
  transition: background .16s ease, outline-color .16s ease;
}

.pack-deck-grid.pack-drop-target {
  outline: 3px dashed var(--purple);
  outline-offset: 5px;
  background: rgba(134, 92, 255, .1);
}

.pack-deck-grid.empty-pack {
  display: block;
}

.pack-empty {
  padding: 24px;
  border: 2px dashed #9a9589;
  border-radius: 14px;
  text-align: center;
}

.pack-empty p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, min(100%, 185px));
  justify-content: center;
  gap: 16px;
}

.deck-library {
  display: grid;
  gap: 28px;
}

.deck-order-section {
  display: grid;
  gap: 12px;
}

.deck-order-section > header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding-bottom: 9px;
  border-bottom: 2px solid var(--ink);
}

.deck-section-add {
  flex: 0 0 auto;
}

.deck-section-toggle {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 4px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.deck-section-toggle:hover {
  color: #4930c8;
}

.deck-section-toggle strong,
.deck-section-toggle small {
  display: block;
}

.deck-section-toggle strong {
  font-size: 20px;
}

.deck-section-toggle small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.deck-order-section.collapsed .pack-chevron {
  transform: rotate(-90deg);
}

.section-count {
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--lime);
  font-size: 10px;
  font-weight: 950;
}

.deck-order-grid.empty-order {
  display: block;
}

.deck-order-section[data-order-scope="paid"] {
  padding: 18px;
  border: 2px solid var(--ink);
  border-radius: 18px;
  background: #fff2d9;
  box-shadow: 4px 4px 0 var(--ink);
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
}

.deck-tile {
  position: relative;
  width: 100%;
  max-width: 275px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 2px solid var(--ink);
  border-radius: 16px;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}

.deck-tile.dragging {
  opacity: 1;
  transform: none;
  border: 2px dashed var(--purple);
  background: rgba(134, 92, 255, .08);
  box-shadow: none;
}

.deck-tile.dragging > * {
  visibility: hidden;
}

.deck-tile.deck-drag-preview {
  position: fixed;
  inset: 0 auto auto 0;
  z-index: 10000;
  margin: 0;
  pointer-events: none;
  opacity: .98;
  transform: translate3d(0, 0, 0);
  transition: none;
  box-shadow: 9px 12px 0 rgba(28, 27, 24, .32);
  cursor: grabbing;
  will-change: transform;
}

.deck-tile.deck-drag-preview > * {
  visibility: visible;
}

.deck-tile.deck-drag-preview .deck-cover {
  cursor: grabbing;
}

.deck-tile.compact .deck-actions {
  grid-template-columns: 1fr;
}

.deck-tile.drag-before {
  box-shadow: 0 -7px 0 var(--sky), 3px 3px 0 var(--ink);
  transform: translateY(5px);
}

.deck-tile.drag-after {
  box-shadow: 0 7px 0 var(--orange), 3px 3px 0 var(--ink);
  transform: translateY(-5px);
}

body.deck-dragging .deck-tile {
  cursor: grabbing;
}

body.deck-dragging {
  cursor: grabbing;
  user-select: none;
}

.deck-cover {
  position: relative;
  aspect-ratio: 275 / 413;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-bottom: 2px solid var(--ink);
  background: linear-gradient(145deg, var(--sky), var(--purple));
  cursor: grab;
  max-height: 160px;
}

.deck-cover:active {
  cursor: grabbing;
}

.deck-cover > * {
  pointer-events: none;
}

.deck-cover img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.cover-placeholder {
  max-width: 120px;
  padding: 16px;
  border: 2px dashed var(--ink);
  border-radius: 50%;
  background: rgba(255, 255, 255, .45);
  text-align: center;
  font-size: 11px;
  font-weight: 950;
}

.drag-handle {
  position: absolute;
  z-index: 2;
  top: 8px;
  left: 8px;
  pointer-events: none;
  padding: 5px 8px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: white;
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 9px;
  font-weight: 950;
  cursor: grab;
}

.deck-order {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--lime);
  font-size: 9px;
  font-weight: 950;
}

.deck-info {
  flex: 1;
  padding: 12px;
}

.deck-info h3 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -.4px;
}

.deck-info p {
  min-height: 34px;
  margin: 6px 0 10px;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.deck-meta,
.image-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.deck-meta span,
.image-meta span {
  padding: 4px 6px;
  border-radius: 999px;
  background: #e8e5dc;
  font-size: 8px;
  font-weight: 850;
}

.deck-actions,
.image-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
  padding: 0 14px 14px;
}

.deck-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 5px;
  padding: 0 10px 10px;
}

.image-deck-assign {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 7px 10px;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-size: 10px;
  font-weight: 850;
}

.image-actions .mini-button.danger:last-child {
  grid-column: 1 / -1;
}

.deck-actions .mini-button {
  min-height: 32px;
  padding: 5px;
  font-size: 16px;
}

.pack-badge {
  background: #dfe8ff !important;
}

.access-badge {
  background: var(--lime) !important;
}

.access-badge.paid {
  background: #ffd38a !important;
}

.mini-button {
  min-height: 36px;
  padding: 7px 9px;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  background: white;
  font-size: 10px;
  font-weight: 900;
}

.icon-button {
  width: 40px;
  min-width: 40px;
  min-height: 40px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  line-height: 1;
  font-size: 18px;
}

.mini-button.icon-button {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  font-size: 16px;
}

.mini-button:hover {
  background: var(--lime);
}

.mini-button.danger:hover {
  background: #ffccc7;
}

.empty-state {
  min-height: 260px;
  place-items: center;
  padding: 45px;
  border: 3px dashed var(--line);
  border-radius: 22px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  display: block;
  color: var(--ink);
  font-size: 18px;
}

.empty-state p {
  max-width: 520px;
  margin: 8px auto 0;
  line-height: 1.5;
}

.filter-row {
  display: grid;
  grid-template-columns: minmax(220px, .45fr) minmax(280px, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.pack-search-row {
  grid-template-columns: minmax(240px, 1fr) auto;
  align-items: center;
}

.filter-count,
.panel-context {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.filter-count {
  white-space: nowrap;
}

.panel-context {
  max-width: 520px;
  margin: 7px 0 0;
  line-height: 1.4;
}

.filter-row input,
.filter-row select,
.form-grid input,
.form-grid textarea,
.form-grid select,
dialog > form > label input,
dialog > form > label textarea,
.import-options input,
.import-options select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 10px 12px;
  border: 2px solid var(--ink);
  border-radius: 11px;
  background: white;
}

textarea {
  resize: vertical;
}

.card-list {
  display: grid;
  gap: 10px;
}

.card-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(110px, .25fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: 3px 3px 0 var(--ink);
}

.card-copy strong,
.card-copy small {
  display: block;
}

.card-copy,
.card-id {
  min-width: 0;
  overflow-wrap: anywhere;
}

.card-copy strong {
  font-size: 14px;
  line-height: 1.4;
}

.card-copy small,
.card-id {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.card-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.inline-warning {
  margin-bottom: 16px;
  padding: 11px 13px;
  border: 2px solid #9b7418;
  border-radius: 10px;
  background: #fff0b8;
  font-size: 12px;
  font-weight: 800;
}

.upload-button {
  position: relative;
  overflow: hidden;
}

.upload-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.image-grid {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.image-tile {
  border: 2px solid var(--ink);
  border-radius: 18px;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 4px 4px 0 var(--ink);
}

.image-preview {
  aspect-ratio: 16 / 11;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-bottom: 2px solid var(--ink);
  background: #dedbd2;
}

.image-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.image-info {
  padding: 14px;
}

.image-info strong {
  display: block;
  overflow: hidden;
  font-family: Consolas, Monaco, monospace;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-info p {
  margin: 7px 0 10px;
  color: var(--muted);
  font-size: 10px;
}

.orphan-badge,
.missing-badge {
  background: #fff0b8 !important;
}

.pending-strip {
  margin-bottom: 20px;
  padding: 14px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: #e7e2ff;
  font-size: 12px;
}

.pending-strip strong {
  display: block;
  margin-bottom: 8px;
}

.pending-strip ul {
  margin: 0;
  padding-left: 19px;
}

.backup-list {
  display: grid;
  gap: 12px;
}

.backup-row {
  display: grid;
  grid-template-columns: minmax(180px, .4fr) minmax(260px, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 16px 18px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: 3px 3px 0 var(--ink);
}

.backup-row strong,
.backup-row small {
  display: block;
}

.backup-row small {
  margin-top: 4px;
  color: var(--muted);
  font-family: Consolas, Monaco, monospace;
  font-size: 9px;
}

.backup-summary {
  color: var(--muted);
  font-size: 12px;
}

dialog {
  width: min(640px, calc(100vw - 28px));
  max-width: calc(100vw - 28px);
  max-height: calc(100vh - 28px);
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  border: 3px solid var(--ink);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: 9px 9px 0 var(--ink);
}

dialog::backdrop {
  background: rgba(23, 35, 29, .7);
  backdrop-filter: blur(4px);
}

dialog:focus {
  outline: none;
}

.dialog-card {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: grid;
  gap: 16px;
  padding: 32px;
  overflow-wrap: anywhere;
}

dialog.wide {
  width: min(900px, calc(100vw - 28px));
}

.dialog-card.wide {
  width: 100%;
}

.dialog-card > * {
  max-width: 100%;
  min-width: 0;
}

.dialog-card h2 {
  padding-right: 48px;
  overflow-wrap: anywhere;
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: white;
  font-size: 22px;
  font-weight: 900;
}

.dialog-card > label,
.form-grid label,
.import-options label {
  display: grid;
  gap: 6px;
  font-size: 11px;
  font-weight: 900;
}

.dialog-card label small {
  color: var(--muted);
  font-weight: 600;
}

.field-help,
.warning-copy {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.folder-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px;
  border: 2px dashed var(--line);
  border-radius: 13px;
  background: #f3f0e7;
}

.folder-picker strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: Consolas, Monaco, monospace;
  font-size: 11px;
}

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

.form-grid .full {
  grid-column: 1 / -1;
}

.cover-field {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 10px;
  padding: 14px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #f3f0e7;
}

.cover-field > small,
.deck-cover-preview {
  grid-column: 1 / -1;
}

.cover-drop-zone {
  position: relative;
  min-height: 116px;
  display: grid;
  place-content: center;
  gap: 3px;
  padding: 16px;
  border: 2px dashed var(--ink);
  border-radius: 13px;
  background: #fff;
  text-align: center;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

.cover-drop-zone:hover,
.cover-drop-zone:focus-visible,
.cover-drop-zone.drag-over {
  border-color: var(--purple);
  background: #eee8ff;
  outline: none;
}

.cover-drop-zone.drag-over {
  transform: scale(1.015);
}

.cover-drop-zone span,
.cover-drop-zone small {
  font-size: 11px;
}

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

.deck-cover-preview {
  width: min(180px, 100%);
  aspect-ratio: 275 / 413;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 13px;
  background: linear-gradient(145deg, var(--sky), var(--purple));
  text-align: center;
  font-size: 11px;
  font-weight: 900;
}

.deck-cover-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bundle-deck-picker {
  max-height: min(58vh, 620px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  overflow-y: auto;
  padding: 3px;
}

.bundle-deck-option {
  min-width: 0;
  display: grid;
  grid-template-columns: auto 52px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 9px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: white;
  cursor: pointer;
}

.bundle-deck-option:has(input:checked) {
  border-color: var(--purple);
  background: #f0eaff;
  box-shadow: 2px 2px 0 var(--ink);
}

.bundle-deck-option input {
  width: 18px;
  min-height: 18px;
  margin: 0;
}

.bundle-deck-option strong,
.bundle-deck-option small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bundle-deck-option small {
  margin-top: 3px;
  color: var(--muted);
}

.bundle-deck-thumb {
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border: 1.5px solid var(--ink);
  border-radius: 7px;
  background: linear-gradient(145deg, var(--sky), var(--purple));
}

.bundle-deck-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.advanced-field {
  padding: 12px;
  border: 1.5px dashed #b28a23;
  border-radius: 12px;
  background: #fff9dc;
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 8px;
}

.dialog-actions > *,
.folder-picker > * {
  max-width: 100%;
  white-space: normal;
}

.connection-preview,
.import-preview,
.save-preview {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 12px;
  background: #efede5;
  font-size: 11px;
  line-height: 1.45;
}

.connection-preview:empty,
.import-preview:empty {
  display: none;
}

.resolved-path {
  display: grid;
  grid-template-columns: minmax(0, 105px) minmax(0, 1fr);
  gap: 8px;
}

.resolved-path > *,
.resolved-path code,
.save-path code,
.dialog-card code {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

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

.import-options .check {
  display: flex;
  align-items: center;
  align-self: end;
  min-height: 46px;
}

.import-options .check input {
  width: 18px;
  min-height: 0;
  margin: 0 8px 0 0;
}

.preview-table {
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  background: white;
}

.preview-table th,
.preview-table td {
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: left;
  vertical-align: top;
}

.preview-scroll {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

.dialog-card ul {
  min-width: 0;
  margin: 6px 0;
  padding-left: 20px;
}

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

.save-grid span {
  padding: 9px 10px;
  border-radius: 8px;
  background: white;
}

.save-path {
  overflow-wrap: anywhere;
}

.remote-guard {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background: linear-gradient(135deg, var(--blue), var(--purple));
}

.remote-card {
  max-width: 720px;
  padding: 48px;
  border: 3px solid var(--ink);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: 10px 10px 0 var(--ink);
}

.remote-card h1 {
  margin-top: 20px;
  font-size: clamp(42px, 7vw, 72px);
}

.remote-card p {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.brand-chip {
  display: inline-flex;
  padding: 8px 11px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--lime);
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 11px;
  font-weight: 950;
}

@media (max-width: 1180px) {
  .connection-bar {
    grid-template-columns: auto 1fr auto;
  }

  .connection-paths {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .connection-actions {
    max-width: none;
  }

  .tabs {
    top: 156px;
  }
}

@media (max-width: 820px) {
  .connection-bar {
    position: relative;
    grid-template-columns: 1fr auto;
  }

  .connection-status {
    justify-items: end;
  }

  .connection-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .tabs {
    top: 0;
  }

  .hero-panel {
    align-items: flex-start;
    flex-direction: column;
    padding: 34px 28px;
  }

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

  .pack-header {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .pack-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .card-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .card-id {
    grid-column: 1;
  }

  .card-row-actions {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .backup-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .bundle-deck-picker,
  .cover-field {
    grid-template-columns: 1fr;
  }

  .cover-field > * {
    grid-column: 1;
  }

  .connection-paths {
    grid-template-columns: 1fr;
  }

  .deck-cover {
    max-height: 260px;
  }

  .workspace {
    padding: 24px 14px 110px;
  }

  .floating-publish {
    right: max(14px, env(safe-area-inset-right));
    bottom: max(14px, env(safe-area-inset-bottom));
    min-height: 50px;
    padding: 12px 16px;
  }

  .hero-panel {
    min-height: 0;
    padding: 30px 20px;
    border-radius: 22px;
    box-shadow: 6px 6px 0 var(--ink);
  }

  .tabs {
    overflow-x: auto;
    border-radius: 16px;
  }

  .tab {
    min-width: 100px;
  }

  .deck-grid,
  .image-grid {
    grid-template-columns: 1fr;
  }

  .deck-grid {
    justify-items: center;
    grid-template-columns: repeat(auto-fill, min(100%, 275px));
  }

  .deck-tile {
    max-width: min(275px, 100%);
  }

  .pack-content {
    padding: 12px;
  }

  .filter-row,
  .form-grid,
  .import-options,
  .save-grid {
    grid-template-columns: 1fr;
  }

  .pack-header {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .pack-header-meta {
    grid-column: 2;
  }

  .pack-actions {
    display: flex;
  }

  .mini-button.icon-button {
    width: 40px;
    min-width: 40px;
    min-height: 40px;
  }

  .form-grid .full {
    grid-column: auto;
  }

  .dialog-card {
    padding: 28px 18px 20px;
  }

  dialog,
  dialog.wide {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
  }

  .resolved-path {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-deck-stack span,
  .loading-deck-stack i,
  .loading-progress.indeterminate span,
  .floating-publish:not(:disabled) {
    animation: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
