/* Act 3 — The Breathing Suitcase
 * Heirloom stitched-leather trunk, brass corner clasps, warm wooden Floor Tray,
 * and mobile-first tactile polyomino packing surface.
 */

/* ---------- Page Header ---------- */
.suitcase-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px 20px;
  margin-bottom: 18px;
}

.suitcase-header-copy h1 {
  font-size: clamp(28px, 4.2vw, 42px);
  line-height: 1.08;
  margin-top: 4px;
}

.suitcase-header-copy h1 em {
  font-style: italic;
  color: var(--present);
}

.suitcase-header-copy .lead {
  font-size: 15px;
  margin-top: 6px;
}

.suitcase-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Shared link restored banner */
.shared-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(21, 128, 61, 0.10), rgba(29, 78, 216, 0.08));
  border: 1.5px solid rgba(21, 128, 61, 0.30);
  font-size: 13.5px;
  color: var(--ink);
}

.shared-banner.visible {
  display: flex;
}

.shared-banner strong {
  color: var(--present);
}

/* ---------- Inline Rename Songs Drawer ---------- */
.rename-drawer {
  display: none;
  padding: 18px 20px;
  margin-bottom: 18px;
}

.rename-drawer.open {
  display: block;
}

.rename-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.rename-drawer-head h2 {
  font-size: 20px;
}

.rename-drawer-sub {
  font-size: 13px;
  color: var(--muted);
  margin: 2px 0 0;
}

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

.rename-item {
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.rename-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.rename-shape-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 999px;
}

.rename-shape-tag.past { background: var(--past-soft); color: var(--past); }
.rename-shape-tag.present { background: var(--present-soft); color: var(--present); }
.rename-shape-tag.future { background: var(--future-soft); color: var(--future); }

.rename-listen-links {
  display: inline-flex;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.rename-listen-links a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dotted var(--border-strong);
}

.rename-listen-links a:hover {
  color: var(--ink);
}

.rename-item input[type="text"] {
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 16px; /* iOS Safari anti-zoom */
}

.rename-item .rename-artist {
  font-size: 16px;
  color: var(--ink-soft);
}

/* ---------- Main Two-Column Workbench ---------- */
.suitcase-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 24px;
  align-items: start;
}

.trunk-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.side-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---------- Heirloom Leather Suitcase ---------- */
.trunk-wrapper {
  position: relative;
  padding-top: 26px; /* room for leather handle */
}

/* Stitched Leather Top Carry Handle */
.trunk-handle {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 146px;
  height: 36px;
  border-radius: 18px 18px 4px 4px;
  background: linear-gradient(180deg, #6B3619 0%, #4A230E 100%);
  border: 2px solid #351708;
  box-shadow: 0 6px 14px rgba(45, 22, 10, 0.25), inset 0 2px 2px rgba(255, 224, 185, 0.2);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1;
}

.trunk-handle::before {
  content: "";
  width: 96px;
  height: 15px;
  border-radius: 10px 10px 0 0;
  background: var(--bg);
  border: 2px solid #351708;
  border-bottom: none;
  margin-bottom: -2px;
}

.trunk-handle::after {
  content: "";
  position: absolute;
  inset: 4px 10px 4px 10px;
  border-radius: 14px 14px 2px 2px;
  border: 1px dashed rgba(246, 211, 152, 0.35);
  pointer-events: none;
}

/* Outer Leather Suitcase Case */
.leather-suitcase {
  position: relative;
  z-index: 2;
  padding: 22px;
  border-radius: 26px;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 225, 184, 0.14), transparent 52%),
    linear-gradient(155deg, #6F3A1E 0%, #582B14 48%, #43200E 100%);
  border: 2.5px solid #2F1508;
  box-shadow:
    0 20px 46px rgba(42, 20, 8, 0.22),
    0 4px 12px rgba(42, 20, 8, 0.16),
    inset 0 2px 1px rgba(255, 225, 184, 0.24),
    inset 0 -3px 8px rgba(24, 10, 4, 0.36);
  transition: box-shadow 0.35s ease, border-color 0.35s ease;
}

/* Stitched Leather Inset Seam */
.leather-suitcase::before {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 19px;
  border: 1.5px dashed rgba(245, 208, 148, 0.36);
  pointer-events: none;
  z-index: 2;
}

.leather-suitcase.all-locked {
  border-color: #B47B1B;
  box-shadow:
    0 22px 52px rgba(180, 123, 27, 0.26),
    0 0 0 4px rgba(217, 159, 43, 0.22),
    inset 0 2px 2px rgba(254, 240, 199, 0.40);
}

/* 4 Brass Corner Clasps */
.corner-clasp {
  position: absolute;
  width: 44px;
  height: 44px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #6E6256 0%, #4A4036 100%);
  border: 2px solid #2F261F;
  color: #FFFDF8;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.2);
  transition: all 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  user-select: none;
}

.corner-clasp.tl { top: -8px; left: -8px; border-radius: 18px 10px 14px 10px; }
.corner-clasp.tr { top: -8px; right: -8px; border-radius: 10px 18px 10px 14px; }
.corner-clasp.bl { bottom: -8px; left: -8px; border-radius: 10px 14px 10px 18px; }
.corner-clasp.br { bottom: -8px; right: -8px; border-radius: 14px 10px 18px 10px; }

.corner-clasp .clasp-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.04em;
  color: #FFFDF8;
  opacity: 1;
}

.corner-clasp.locked .clasp-num {
  color: #2B1704;
}

.corner-clasp .clasp-icon {
  font-size: 14px;
  line-height: 1.1;
  font-weight: 800;
}

.corner-clasp.locked {
  background: linear-gradient(145deg, #FDE68A 0%, #D99B26 48%, #9A630D 100%);
  border-color: #FEF3C7;
  color: #2B1704;
  box-shadow:
    0 5px 14px rgba(217, 155, 38, 0.48),
    0 0 0 3px rgba(253, 230, 138, 0.28),
    inset 0 1px 2px rgba(255, 255, 255, 0.72);
  transform: scale(1.06);
}

.corner-clasp.warning {
  background: linear-gradient(145deg, #DC2626 0%, #991B1B 100%);
  border-color: #FCA5A5;
  color: #FFFDF8;
  animation: claspAlertPulse 1.6s ease-in-out infinite;
}

@keyframes claspAlertPulse {
  0%, 100% { box-shadow: 0 3px 10px rgba(220, 38, 38, 0.45), 0 0 0 0 rgba(239, 68, 68, 0.45); }
  50% { box-shadow: 0 3px 14px rgba(220, 38, 38, 0.65), 0 0 0 6px rgba(239, 68, 68, 0); }
}

/* Interior Linen Compartment Bed */
.suitcase-interior {
  position: relative;
  z-index: 3;
  background:
    repeating-linear-gradient(45deg, rgba(120, 80, 45, 0.025) 0 4px, transparent 4px 8px),
    linear-gradient(180deg, #F7F1E3 0%, #EFE6D3 100%);
  border-radius: 15px;
  padding: 8px;
  border: 2px solid #35190A;
  box-shadow: inset 0 4px 12px rgba(45, 22, 10, 0.22);
}

/* Status ribbon inside top of trunk interior */
.interior-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 4px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: #6B4D35;
}

.interior-header-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.air-readout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.22s ease;
}

.air-readout.suffocating {
  background: rgba(185, 28, 28, 0.14);
  color: #B91C1C;
  border: 1px solid rgba(185, 28, 28, 0.35);
}

.air-readout.breathing {
  background: rgba(21, 128, 61, 0.14);
  color: #15803D;
  border: 1px solid rgba(21, 128, 61, 0.36);
}

.air-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.air-readout.suffocating .air-dot {
  animation: dotPulse 1.1s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.45); opacity: 0.45; }
}

/* 6x6 Grid Stage */
.grid-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: visible;
  user-select: none;
  -webkit-user-select: none;
}

.grid-cells {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid rgba(120, 74, 34, 0.26);
  background: rgba(255, 252, 244, 0.55);
}

.grid-cell {
  position: relative;
  border-right: 1px dashed rgba(120, 74, 34, 0.18);
  border-bottom: 1px dashed rgba(120, 74, 34, 0.18);
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: background 0.14s ease, box-shadow 0.14s ease;
  -webkit-tap-highlight-color: transparent;
}

.grid-cell:nth-child(6n) { border-right: none; }
.grid-cell:nth-child(n+31) { border-bottom: none; }

/* Breathing empty cells adjacent to Present */
.grid-cell.air-halo {
  background: radial-gradient(circle at center, rgba(21, 128, 61, 0.15) 0%, rgba(21, 128, 61, 0.04) 72%);
}

.grid-cell.air-halo::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(21, 128, 61, 0.45);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: breathFloat 2.4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes breathFloat {
  0%, 100% { transform: translate(-50%, -50%) scale(0.85); opacity: 0.42; }
  50% { transform: translate(-50%, -50%) scale(1.25); opacity: 0.85; }
}

/* Valid tap-to-place hint on empty cells when a piece is selected */
.grid-cell.valid-target {
  background: rgba(180, 123, 27, 0.08);
}

.grid-cell.valid-target::before {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(180, 123, 27, 0.35);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.grid-cell.valid-target.future-target {
  background: rgba(29, 78, 216, 0.09);
}

.grid-cell.valid-target.future-target::before {
  background: rgba(29, 78, 216, 0.40);
}

.grid-cell.valid-target.present-target {
  background: rgba(21, 128, 61, 0.09);
}

.grid-cell.valid-target.present-target::before {
  background: rgba(21, 128, 61, 0.42);
}

/* Live hover / drag footprint preview */
.grid-cell.preview-valid {
  background: rgba(21, 128, 61, 0.24) !important;
  box-shadow: inset 0 0 0 2px rgba(21, 128, 61, 0.72);
}

.grid-cell.preview-invalid {
  background: rgba(185, 28, 28, 0.24) !important;
  box-shadow: inset 0 0 0 2px rgba(185, 28, 28, 0.72);
}

.grid-cell.flash-error {
  animation: cellFlashError 0.42s ease;
}

@keyframes cellFlashError {
  0%, 100% { background: transparent; }
  30% { background: rgba(185, 28, 28, 0.34); }
}

/* ---------- Polyomino Pieces Layer ---------- */
.pieces-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}

.piece-group {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, filter 0.16s ease;
}

.piece-group.dragging-source {
  opacity: 0.26;
}

.piece-group.selected {
  z-index: 12;
  filter: drop-shadow(0 0 0 rgba(0, 0, 0, 0)) drop-shadow(0 6px 14px rgba(24, 24, 27, 0.22));
}

.piece-group.shake {
  animation: pieceShake 0.34s ease;
}

@keyframes pieceShake {
  0%, 100% { transform: translateX(0); }
  22% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  78% { transform: translateX(-3px); }
}

/* Individual cell of a polyomino block (seamless outer borders & rounded corners) */
.piece-cell {
  position: absolute;
  pointer-events: auto;
  cursor: grab;
  touch-action: none; /* allows smooth pointer drag on mobile without scrolling grid */
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.piece-cell:active {
  cursor: grabbing;
}

/* Past (Heavy Brass Block — unified multi-cell brushed gradient, >= 6.15:1 AA with #FFFDF8) */
.piece-group.type-past .piece-cell {
  background-color: #8A4108;
  background-image: linear-gradient(135deg, #9A4A0A, #7A3806);
  background-repeat: no-repeat;
}

.piece-group.type-past.selected .piece-cell {
  background-color: #9A4A0A;
  background-image: linear-gradient(135deg, #9A4A0A, #7A3806);
}

/* Present (1x1 Breathing / Suffocating Tile) */
.piece-group.type-present.breathing .piece-cell {
  background: linear-gradient(145deg, #22A055 0%, #15803D 58%, #0F632E 100%);
  box-shadow:
    0 0 0 3px rgba(21, 128, 61, 0.24),
    0 0 20px rgba(34, 197, 94, 0.36),
    inset 0 1px 2px rgba(220, 252, 231, 0.55);
  animation: presentBreathe 2.8s ease-in-out infinite;
}

@keyframes presentBreathe {
  0%, 100% { box-shadow: 0 0 0 2px rgba(21, 128, 61, 0.22), 0 0 14px rgba(34, 197, 94, 0.26), inset 0 1px 2px rgba(220, 252, 231, 0.55); }
  50% { box-shadow: 0 0 0 5px rgba(21, 128, 61, 0.34), 0 0 24px rgba(34, 197, 94, 0.48), inset 0 1px 2px rgba(220, 252, 231, 0.65); }
}

.piece-group.type-present.suffocating .piece-cell {
  background: linear-gradient(145deg, #DC2626 0%, #B91C1C 62%, #881313 100%);
  box-shadow:
    0 0 0 3px rgba(220, 38, 38, 0.34),
    0 0 18px rgba(220, 38, 38, 0.44),
    inset 0 1px 2px rgba(254, 202, 202, 0.45);
  animation: presentSuffocate 1.2s ease-in-out infinite;
}

@keyframes presentSuffocate {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(0.955); }
}

/* Future (2027 Horizon Seed 1x2 — unified gradient) */
.piece-group.type-future .piece-cell {
  background-image: linear-gradient(145deg, #2563EB 0%, #1D4ED8 58%, #1E3A8A 100%);
  background-repeat: no-repeat;
}

/* Selected glow ring per cell edge */
.piece-group.selected .piece-cell {
  filter: brightness(1.08);
}

.piece-group.selected .piece-cell::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  box-shadow: inset 0 0 0 2.5px #FEF08A;
  pointer-events: none;
}

/* Piece Label Overlay (strictly inside occupied cells) */
.piece-label {
  position: absolute;
  pointer-events: none;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3px 5px;
  overflow: hidden;
  color: #FFFDF8;
  text-shadow: 0 1px 2px rgba(24, 15, 6, 0.45);
}

.piece-label.vertical-bar .piece-title {
  font-size: 9.5px;
  line-height: 1.1;
}

.piece-label .piece-tag {
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #FFFDF8;
  opacity: 1;
  line-height: 1;
  margin-bottom: 2px;
}

.piece-label .piece-title {
  font-family: var(--font-display);
  font-size: clamp(10px, 1.45vw, 12.5px);
  font-weight: 700;
  line-height: 1.12;
  color: #FFFDF8;
  max-width: 100%;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.piece-label .piece-artist {
  font-size: 9.5px;
  color: #FFFDF8;
  opacity: 0.96;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  margin-top: 1px;
}

.piece-label.compact-1x1 {
  padding: 2px;
}

.piece-label.compact-1x1 .piece-title {
  font-size: clamp(8.5px, 1.15vw, 10.5px);
  -webkit-line-clamp: 2;
}

.piece-label.compact-1x1 .piece-air-pill {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 999px;
  background: rgba(24, 24, 27, 0.34);
  letter-spacing: 0.02em;
}

/* Directional air pips around Present tile */
.present-side-pip {
  position: absolute;
  pointer-events: none;
  z-index: 7;
  border-radius: 999px;
}

.present-side-pip.air {
  background: #86EFAC;
  box-shadow: 0 0 6px rgba(134, 239, 172, 0.9);
}

.present-side-pip.blocked {
  background: #FCA5A5;
  opacity: 0.9;
}

.present-side-pip.wall {
  background: #57534E;
  opacity: 0.7;
}

/* ---------- Selected Piece Controls Strip ---------- */
.controls-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 14px rgba(24, 24, 27, 0.05);
}

.controls-status {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 160px;
  flex: 1;
}

.controls-status-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.controls-status-main {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--ink);
  overflow-wrap: anywhere;
  word-break: break-word;
}

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

/* ---------- 4-Clasp Checklist Card ---------- */
.clasps-card {
  padding: 16px 18px;
}

.clasps-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.clasps-card-head h2 {
  font-size: 19px;
}

.clasp-count-pill {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-deep);
  border: 1px solid var(--border-strong);
  color: var(--ink);
}

.clasp-count-pill.complete {
  background: linear-gradient(135deg, #FEF3C7, #FDE68A);
  border-color: #D97706;
  color: #78350F;
}

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

.clasp-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 11px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-tint);
  transition: all 0.2s ease;
}

.clasp-row.locked {
  background: rgba(254, 243, 199, 0.45);
  border-color: rgba(217, 119, 6, 0.36);
}

.clasp-row.alert {
  background: rgba(254, 226, 226, 0.55);
  border-color: rgba(185, 28, 28, 0.38);
}

.clasp-badge {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  background: var(--bg-deep);
  color: var(--muted);
  border: 1px solid var(--border-strong);
}

.clasp-row.locked .clasp-badge {
  background: linear-gradient(145deg, #FDE68A, #D99B26);
  border-color: #B45309;
  color: #2B1704;
}

.clasp-row.alert .clasp-badge {
  background: #DC2626;
  border-color: #991B1B;
  color: #FFFDF8;
}

.clasp-row-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.clasp-row-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.clasp-row-detail {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.clasp-row.alert .clasp-row-detail {
  color: #B91C1C;
  font-weight: 600;
}

/* ---------- 2027 Staging Shelf ---------- */
.shelf-card {
  padding: 15px 18px;
  background: linear-gradient(180deg, #F8FAFF 0%, #EEF3FF 100%);
  border: 1.5px solid rgba(29, 78, 216, 0.24);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.shelf-card.drop-hover {
  border-color: var(--future);
  box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.16);
}

.shelf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.shelf-head h2,
.shelf-head h3 {
  font-size: 17px;
  color: #1E3A8A;
}

.shelf-slot {
  min-height: 76px;
  border-radius: 12px;
  border: 1.5px dashed rgba(29, 78, 216, 0.28);
  background: rgba(255, 255, 255, 0.62);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.shelf-empty-note {
  font-size: 13px;
  color: #1E40AF;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Tray / Shelf Piece Token */
.tray-piece-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 9px 13px;
  border-radius: 12px;
  border: 2px solid transparent;
  cursor: grab;
  text-align: left;
  font-family: var(--font-sans);
  touch-action: none;
  transition: transform 0.15s ease, box-shadow 0.16s ease, opacity 0.16s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  min-height: 54px;
}

.tray-piece-btn:active { cursor: grabbing; }

.tray-piece-btn.type-future {
  background: linear-gradient(145deg, #2563EB 0%, #1D4ED8 65%, #1E3A8A 100%);
  color: #FFFDF8;
  border-color: #1E3A8A;
  box-shadow: 0 6px 16px rgba(29, 78, 216, 0.24);
  width: 100%;
  justify-content: space-between;
}

.tray-piece-btn.type-future.locked {
  background: linear-gradient(145deg, #CBD5E1 0%, #94A3B8 100%);
  border-color: #64748B;
  color: #1E293B;
  box-shadow: none;
  cursor: not-allowed;
}

.tray-piece-btn.type-past {
  background: linear-gradient(135deg, #9A4A0A, #7A3806);
  color: #FFFDF8;
  border-color: #78350F;
  box-shadow: 0 5px 14px rgba(122, 56, 6, 0.28);
}

.tray-piece-btn.selected {
  box-shadow: 0 0 0 3px #FEF08A, 0 8px 20px rgba(24, 24, 27, 0.24);
  transform: translateY(-2px);
}

.tray-piece-btn.shake {
  animation: pieceShake 0.34s ease;
}

.tray-piece-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.tray-piece-title {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.15;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.tray-piece-sub {
  font-size: 12px;
  opacity: 0.88;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.mini-poly {
  display: grid;
  gap: 2px;
  flex-shrink: 0;
}

.mini-poly-sq {
  width: 11px;
  height: 11px;
  border-radius: 2.5px;
  background: rgba(255, 253, 248, 0.88);
}

.tray-piece-btn.locked .mini-poly-sq {
  background: rgba(30, 41, 59, 0.45);
}

.mini-poly-empty {
  width: 11px;
  height: 11px;
}

.lock-reason {
  font-size: 12.5px;
  color: #475569;
  font-weight: 600;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ---------- Warm Dashed-Border Wooden Floor Tray ---------- */
.floor-tray {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background:
    repeating-linear-gradient(90deg, rgba(120, 53, 15, 0.04) 0 18px, rgba(120, 53, 15, 0.015) 18px 36px),
    linear-gradient(180deg, #EEDFC8 0%, #E5D1B3 100%);
  border: 2.5px dashed #9A6030;
  box-shadow: inset 0 2px 10px rgba(120, 53, 15, 0.12);
  transition: all 0.2s ease;
  cursor: pointer;
}

.floor-tray.can-drop {
  border-color: #B45309;
  background:
    repeating-linear-gradient(90deg, rgba(180, 83, 9, 0.07) 0 18px, rgba(180, 83, 9, 0.02) 18px 36px),
    linear-gradient(180deg, #F5E6CE 0%, #ECD6B6 100%);
  box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.20), inset 0 2px 10px rgba(120, 53, 15, 0.14);
}

.floor-tray.drop-hover {
  border-style: solid;
  border-color: #B45309;
  box-shadow: 0 0 0 5px rgba(180, 83, 9, 0.28);
  transform: scale(1.01);
}

.floor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.floor-head h2,
.floor-head h3 {
  font-size: 18px;
  color: #5C2D0C;
}

.floor-pieces {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 62px;
  align-items: center;
}

.floor-empty-prompt {
  font-size: 13.5px;
  color: #78421B;
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.floor-empty-prompt strong {
  color: #4A230B;
}

/* Farewell Tag Card inside Floor Tray */
.farewell-box {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(120, 53, 15, 0.30);
  display: none;
  flex-direction: column;
  gap: 7px;
  cursor: default;
}

.farewell-box.visible {
  display: flex;
}

.farewell-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: #5C2D0C;
}

.farewell-counter {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #78421B;
}

.farewell-box input[type="text"] {
  background: #FFFDF8;
  border-color: rgba(120, 53, 15, 0.36);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 16px;
}

.farewell-box input[type="text"]:focus {
  border-color: #B45309;
  box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.18);
}

/* ---------- Latch & Export Panel ---------- */
.latch-card {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.latch-cta {
  width: 100%;
  min-height: 50px;
  font-size: 15.5px;
}

.latch-cta.ready {
  background: linear-gradient(135deg, #D99B26 0%, #B45309 100%);
  border-color: #92400E;
  color: #FFFDF8;
  box-shadow: 0 10px 24px rgba(180, 83, 9, 0.28);
}

.latch-cta.ready:hover:not(:disabled) {
  background: linear-gradient(135deg, #E5A932 0%, #9A3412 100%);
}

/* Export Folio (expands once latched) */
.export-folio {
  display: none;
  margin-top: 22px;
  padding: 24px;
  border: 2px solid rgba(217, 155, 38, 0.48);
  background: linear-gradient(180deg, #FFFDF8 0%, #FBF5E6 100%);
}

.export-folio.open {
  display: block;
}

.export-folio-grid {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 24px;
  align-items: center;
}

.poster-preview-wrap {
  background: var(--bg-deep);
  border: 1.5px solid var(--border-strong);
  border-radius: 16px;
  padding: 8px;
  box-shadow: var(--shadow-card);
}

.poster-preview-wrap canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
}

.export-folio-copy {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.export-folio-copy h2 {
  font-size: 28px;
  line-height: 1.12;
}

.export-manifest {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.manifest-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}

.manifest-stat-k {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
}

.manifest-stat-v {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-top: 2px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.export-actions .btn {
  flex: 1 1 180px;
}

/* ---------- Floating Pointer Drag Ghost ---------- */
.drag-ghost {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 9990;
  transform: translate3d(-9999px, -9999px, 0) rotate(-1.5deg) scale(1.03);
  filter: drop-shadow(0 18px 28px rgba(24, 24, 27, 0.34));
  will-change: transform;
}

.drag-ghost-cell {
  position: absolute;
  border-radius: 8px;
  box-sizing: border-box;
}

.drag-ghost.type-past .drag-ghost-cell {
  background: linear-gradient(135deg, #9A4A0A, #7A3806);
  border: 2px solid #FEF3C7;
}

.drag-ghost.type-present .drag-ghost-cell {
  background: linear-gradient(145deg, #22A055 0%, #15803D 100%);
  border: 2px solid #DCFCE7;
}

.drag-ghost.type-future .drag-ghost-cell {
  background: linear-gradient(145deg, #2563EB 0%, #1D4ED8 100%);
  border: 2px solid #DBEAFE;
}

.drag-ghost-label {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #FFFDF8;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  padding: 4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

/* ---------- Responsive Mobile Polish (390x844 & <= 900px) ---------- */
@media (max-width: 920px) {
  .suitcase-workbench {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .rename-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .export-folio-grid {
    grid-template-columns: 1fr;
  }
  .poster-preview-wrap {
    max-width: 240px;
    margin: 0 auto;
  }
}

@media (max-width: 560px) {
  .suitcase-header {
    margin-bottom: 14px;
  }
  .suitcase-header-actions {
    width: 100%;
  }
  .suitcase-header-actions .btn {
    flex: 1 1 auto;
    padding: 8px 10px;
    font-size: 13px;
  }
  .leather-suitcase {
    padding: 15px;
    border-radius: 22px;
  }
  .leather-suitcase::before {
    inset: 7px;
    border-radius: 16px;
  }
  .corner-clasp {
    width: 38px;
    height: 38px;
  }
  .corner-clasp.tl { top: -6px; left: -6px; }
  .corner-clasp.tr { top: -6px; right: -6px; }
  .corner-clasp.bl { bottom: -6px; left: -6px; }
  .corner-clasp.br { bottom: -6px; right: -6px; }
  .corner-clasp .clasp-num { font-size: 11px; }
  .corner-clasp .clasp-icon { font-size: 12px; }
  .suitcase-interior {
    padding: 6px;
  }
  .interior-header {
    font-size: 9.5px;
    gap: 6px;
  }
  .air-readout {
    font-size: 10px;
    padding: 3px 8px;
  }
  .piece-label .piece-artist {
    display: none;
  }
  .piece-label .piece-title {
    font-size: 10px;
  }
  .piece-label.compact-1x1 .piece-title {
    font-size: 8.5px;
  }
  .controls-strip {
    padding: 10px 12px;
  }
  .controls-btns {
    width: 100%;
  }
  .controls-btns .btn {
    flex: 1 1 auto;
  }
  .clasp-list {
    grid-template-columns: 1fr;
  }
  .rename-grid {
    grid-template-columns: 1fr;
  }
  .export-manifest {
    grid-template-columns: 1fr;
  }
  .export-folio {
    padding: 16px;
  }
}
