:root {
  --bg: #F7F5F0;
  --paper: #FFFDF8;
  --paper-alt: #EFECE4;
  --ink: #1A1A1A;
  --ink-secondary: #46433D;
  --good: #2E6F40;
  --good-bg: #E6F2EA;
  --bad: #C84B31;
  --bad-bg: #FCEBE7;
  --accent: #E09F3E;
  --accent-bg: #FDF4E3;
  --shell: #2B2623;

  --font-serif: "Newsreader", Georgia, "Times New Roman", serif;
  --font-sans: "DM Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "Space Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --border: 1.5px solid var(--ink);
  --shadow: 3px 3px 0px var(--ink);
  --shadow-active: 1px 1px 0px var(--ink);
  --cell-size: clamp(38px, 12.2vw, 62px);
  --cell-gap: 2px;
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12px 14px 42px;
}

.hidden {
  display: none !important;
}

kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 4px;
  border: 1px solid var(--ink);
  background: var(--paper);
}

.svg-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.app-shell {
  width: 100%;
  max-width: 920px;
  min-width: 0;
}

/* Newspaper Masthead (Compact Editorial Hairlines) */
.masthead {
  border-top: 3px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
  padding: 6px 0 8px;
  margin-bottom: 10px;
}

.masthead-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(26, 26, 26, 0.25);
}

.edition-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.meta-sep {
  color: var(--ink-secondary);
}

.route-label {
  color: var(--good);
}

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

.mode-switch {
  display: inline-flex;
  border: var(--border);
  background: var(--paper);
  box-shadow: 2px 2px 0px var(--ink);
  min-height: 38px;
}

.mode-btn {
  border: none;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0 14px;
  min-height: 35px;
  cursor: pointer;
  color: var(--ink-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease, color 0.12s ease;
}

.mode-btn + .mode-btn {
  border-left: var(--border);
}

.mode-btn:hover:not(.active) {
  background: var(--paper-alt);
  color: var(--ink);
}

.mode-btn.active {
  background: var(--ink);
  color: var(--paper);
}

.streak-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 38px;
  padding: 0 10px;
  border: var(--border);
  background: var(--accent-bg);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.streak-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-secondary);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border: var(--border);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 2px 2px 0px var(--ink);
  transition: transform 0.07s ease, box-shadow 0.07s ease, background 0.12s ease;
}

.icon-btn:hover {
  background: var(--paper-alt);
}

.icon-btn:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.icon-btn.muted {
  background: var(--paper-alt);
  color: var(--ink-secondary);
}

.masthead-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 6px;
}

.masthead-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}

.masthead-subtitle {
  margin: 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-secondary);
}

/* Tactile Pressable Buttons */
.btn {
  min-height: 40px;
  border: var(--border);
  box-shadow: 2px 2px 0px var(--ink);
  padding: 8px 13px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--paper);
  color: var(--ink);
  white-space: nowrap;
  transition: transform 0.07s ease, box-shadow 0.07s ease, background 0.12s ease;
}

.btn:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.btn:disabled {
  background: var(--paper-alt);
  color: var(--ink-secondary);
  cursor: not-allowed;
  border-color: rgba(26, 26, 26, 0.35);
  box-shadow: none;
}

.btn-primary {
  background: var(--good);
  color: var(--paper);
}

.btn-primary:hover:not(:disabled) {
  background: #255a33;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--paper-alt);
}

.btn-accent {
  background: var(--accent);
  color: var(--ink);
}

.btn-accent:hover:not(:disabled) {
  background: #d3912f;
}

.btn-quiet {
  background: var(--bg);
  color: var(--ink-secondary);
  box-shadow: none;
  border-style: dashed;
}

.btn-quiet:hover:not(:disabled) {
  background: var(--paper-alt);
  color: var(--ink);
}

.btn-rotate {
  min-height: 44px;
  background: var(--paper-alt);
  color: var(--ink);
  font-size: 13px;
  padding: 9px 16px;
}

.btn-rotate:hover:not(:disabled) {
  background: var(--accent-bg);
}

.btn-sm {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 11px;
}

/* Clue Strip */
.clue-banner {
  background: var(--accent-bg);
  border: var(--border);
  padding: 10px 14px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.clue-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.clue-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--accent);
  color: var(--ink);
  border: 1.5px solid var(--ink);
  padding: 1px 6px;
  flex-shrink: 0;
}

/* Physical Baggage Claim Tag Summary */
.claim-tag {
  background: var(--paper);
  border: var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.claim-tag-head {
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.claim-tag-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.claim-hole {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  border: 2.5px solid var(--accent);
  flex-shrink: 0;
}

.claim-airline {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.claim-route-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
  margin-top: 2px;
}

.claim-tag-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.claim-barcode {
  color: var(--paper);
  opacity: 0.9;
}

/* Angled Rubber Stamp */
.claim-rubber-stamp {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border: 2px solid var(--accent);
  color: var(--accent);
  background: transparent;
  transform: rotate(-3deg);
}

.claim-rubber-stamp.win {
  border-color: #8CD790;
  color: #8CD790;
}

.claim-rubber-stamp.gold {
  border-color: #F4C44E;
  color: #F4C44E;
  background: rgba(244, 196, 78, 0.14);
}

.claim-tag-body {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.result-pct-box {
  border: var(--border);
  background: var(--paper-alt);
  color: var(--ink);
  padding: 10px 14px;
  text-align: center;
  min-width: 102px;
}

.result-pct-box.won {
  background: var(--good);
  color: var(--paper);
}

.result-pct-box.gold-perfect {
  background: var(--accent);
  color: var(--ink);
  box-shadow: inset 0 0 0 2px #FFFDF8;
}

.result-pct {
  display: block;
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.result-pct-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.result-copy {
  flex: 1;
  min-width: min(220px, 100%);
  max-width: 100%;
}

.score-ratio-line {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}

.result-summary {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 15px;
}

.missed-synergies {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #8A5A00;
  font-weight: 700;
}

.triggered-penalties {
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--bad);
  font-weight: 700;
}

.local-countdown {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-secondary);
  font-weight: 700;
}

.streak-note {
  margin-top: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-secondary);
  font-weight: 700;
}

.perforation-note {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-secondary);
  font-weight: 700;
}

.claim-perforation {
  position: relative;
  border-top: 2px dashed var(--ink);
  background: var(--paper-alt);
  padding: 11px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.claim-perforation::before,
.claim-perforation::after {
  content: "";
  position: absolute;
  top: -8px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: var(--border);
}

.claim-perforation::before { left: -8px; }
.claim-perforation::after { right: -8px; }

.view-toggle {
  display: inline-flex;
  border: var(--border);
  background: var(--paper);
  box-shadow: 2px 2px 0px var(--ink);
  min-height: 40px;
}

.view-btn {
  border: none;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  padding: 0 13px;
  min-height: 37px;
  cursor: pointer;
  color: var(--ink-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.view-btn + .view-btn {
  border-left: var(--border);
}

.view-btn.active {
  background: var(--ink);
  color: var(--paper);
}

.result-cta-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Two-Column Spread */
.workspace-spread {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.left-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 416px;
  min-width: 0;
}

.right-column {
  min-width: 0;
}

/* Diegetic Luggage Scale Strip attached above Suitcase */
.suitcase-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.luggage-scale {
  width: 100%;
  border-top: 2px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
  padding: 10px 0;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.scale-readouts {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.metric {
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-secondary);
  font-weight: 700;
}

.metric-val {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.metric-val.positive { color: var(--good); }
.metric-val.negative { color: var(--bad); }
.metric-val.neutral { color: var(--ink-secondary); }

.scale-actions {
  display: flex;
  gap: 8px;
  width: 100%;
}

.scale-actions #btn-submit {
  flex: 1;
}

.post-view-bar {
  width: 100%;
  display: flex;
  justify-content: center;
}

.post-view-bar .view-toggle {
  width: 100%;
}

.post-view-bar .view-btn {
  flex: 1;
}

.suitcase-hardware-wrap {
  line-height: 0;
  margin-bottom: -1px;
}

.suitcase-hardware-svg {
  max-width: 100%;
  height: auto;
}

/* Open Vintage Hard-Shell Suitcase */
.suitcase-shell {
  background: var(--shell);
  border: 2px solid var(--ink);
  border-radius: 6px;
  box-shadow: 4px 4px 0px var(--ink);
  padding: 11px;
  position: relative;
}

.corner-patch {
  position: absolute;
  width: 18px;
  height: 18px;
  background: #8C5E3C;
  border: 1.5px solid var(--ink);
  z-index: 3;
  pointer-events: none;
}

.corner-patch.tl { top: -2px; left: -2px; border-radius: 5px 0 3px 0; }
.corner-patch.tr { top: -2px; right: -2px; border-radius: 0 5px 0 3px; }
.corner-patch.bl { bottom: -2px; left: -2px; border-radius: 0 3px 0 5px; }
.corner-patch.br { bottom: -2px; right: -2px; border-radius: 3px 0 5px 0; }

.suitcase-lining {
  background: var(--paper);
  border: 1.5px solid var(--ink);
  padding: 9px;
  position: relative;
}

.suitcase-lining::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px dashed rgba(26, 26, 26, 0.45);
  pointer-events: none;
}

.board-stage {
  position: relative;
  width: calc(var(--cell-size) * 6 + var(--cell-gap) * 5);
  height: calc(var(--cell-size) * 5 + var(--cell-gap) * 4);
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(6, var(--cell-size));
  grid-template-rows: repeat(5, var(--cell-size));
  gap: var(--cell-gap);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  outline: none;
}

.board-grid.flash-invalid {
  animation: invalidBoardFlash 360ms ease-out;
}

@keyframes invalidBoardFlash {
  0% {
    box-shadow: 0 0 0 3px var(--bad);
    background-color: rgba(200, 75, 49, 0.16);
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
    background-color: transparent;
  }
}

.board-cell {
  width: var(--cell-size);
  height: var(--cell-size);
  background-color: var(--paper-alt);
  background-image:
    repeating-linear-gradient(0deg, rgba(26, 26, 26, 0.035) 0px, rgba(26, 26, 26, 0.035) 1px, transparent 1px, transparent 6px),
    repeating-linear-gradient(90deg, rgba(26, 26, 26, 0.035) 0px, rgba(26, 26, 26, 0.035) 1px, transparent 1px, transparent 6px);
  border: 1px solid rgba(26, 26, 26, 0.25);
  position: relative;
  cursor: pointer;
}

.board-cell.blocked {
  background-color: #2B2623;
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(255, 253, 248, 0.14) 0px,
    rgba(255, 253, 248, 0.14) 2px,
    transparent 2px,
    transparent 7px
  );
  border: 1.5px solid var(--ink);
  cursor: not-allowed;
}

.board-cell.blocked::after {
  content: "✕";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 13px;
  color: rgba(255, 253, 248, 0.55);
}

.board-cell.corner-hint::after {
  content: "★";
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 11px;
  color: var(--ink);
  pointer-events: none;
}

.board-cell.center-hint {
  box-shadow: inset 0 0 0 1px rgba(46, 111, 64, 0.45);
}

.board-cell.clue-hint {
  background: rgba(224, 159, 62, 0.26) !important;
  border: 2px dashed var(--ink) !important;
}

/* Continuous SVG Polyomino Silhouette Layer */
.pieces-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  overflow: visible;
}

.piece-poly {
  transition: transform 120ms cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

.piece-poly.just-placed {
  animation: clunkSnap 120ms cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

.piece-poly.partner-pulse {
  animation: partnerPulse 650ms ease-in-out infinite alternate;
}

@keyframes clunkSnap {
  0% { transform: scale(1.03); }
  70% { transform: scale(0.985); }
  100% { transform: scale(1); }
}

@keyframes partnerPulse {
  0% { filter: brightness(1); }
  100% { filter: brightness(1.16); }
}

.pieces-badges {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.piece-emblem {
  position: absolute;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  padding: 2px 5px;
  box-shadow: 1px 1px 0px var(--ink);
}

.piece-emblem-price {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--ink);
}

.piece-solo-tag {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 4px;
  background: var(--bg);
  border: 1.5px solid var(--ink);
  box-shadow: 1px 1px 0px var(--ink);
  color: var(--good);
  animation: tagPop 120ms ease-out;
}

/* Shared Seam Layer */
.seams-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}

.seam-line {
  position: absolute;
  border-radius: 2px;
}

.seam-line.good {
  background: var(--good);
  box-shadow: 0 0 0 1px var(--paper);
}

.seam-line.bad {
  background: var(--bad);
  box-shadow: 0 0 0 1px var(--paper);
}

.seam-tag {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  background: var(--bg);
  border: 1.5px solid var(--ink);
  box-shadow: 1px 1px 0px var(--ink);
  animation: tagPop 120ms ease-out;
}

.seam-tag.good { color: var(--good); }
.seam-tag.bad { color: var(--bad); }

@keyframes tagPop {
  0% { transform: translate(-50%, -50%) scale(0.75); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

/* Hover Preview & Keyboard Cursor Layer */
.hover-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.hover-cell {
  position: absolute;
  width: var(--cell-size);
  height: var(--cell-size);
}

.hover-cell.valid {
  background: rgba(46, 111, 64, 0.18);
}

.hover-cell.invalid {
  background: rgba(200, 75, 49, 0.24);
}

.kb-cursor {
  position: absolute;
  width: var(--cell-size);
  height: var(--cell-size);
  border: 2px solid var(--accent);
}

/* Fixed-height hover callout prevents layout jump */
.hover-callout {
  margin-top: 8px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border: var(--border);
  background: var(--bg);
}

.hover-callout.is-empty {
  visibility: hidden;
}

.hover-callout.good {
  background: var(--good-bg);
  color: var(--good);
}

.hover-callout.bad {
  background: var(--bad-bg);
  color: var(--bad);
}

.interaction-hint {
  margin: 6px 0 0;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-secondary);
  text-align: center;
}

/* Unified Piece Control Bar */
.piece-bar {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin-top: 8px;
  border: var(--border);
  background: var(--paper);
  box-shadow: var(--shadow);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.piece-chips {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.piece-chip {
  border: 1.5px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  padding: 4px 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  min-height: 34px;
  min-width: 0;
}

.chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid var(--ink);
  flex-shrink: 0;
}

.chip-check {
  color: var(--good);
  font-weight: 700;
  font-size: 11px;
  line-height: 1;
}

.piece-chip.selected {
  background: var(--accent-bg);
  border: 2px solid var(--ink);
  box-shadow: 1.5px 1.5px 0px var(--ink);
}

.piece-chip.packed {
  background: var(--paper-alt);
  border-color: rgba(26, 26, 26, 0.35);
  color: var(--ink-secondary);
}

.piece-chip.packed .chip-dot,
.piece-chip.packed .svg-icon,
.piece-chip.packed .chip-price {
  opacity: 0.55;
}

.piece-chip.excluded {
  background: var(--bad-bg);
  color: var(--bad);
  border-color: rgba(200, 75, 49, 0.5);
  text-decoration: line-through;
}

.piece-bar-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.piece-bar-info {
  flex: 1;
  min-width: 135px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.piece-bar-meta {
  min-width: 0;
}

.piece-bar-name {
  font-family: var(--font-serif);
  font-weight: 800;
  font-size: 15px;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.piece-bar-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-secondary);
  font-weight: 700;
}

.piece-bar-empty {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-secondary);
  font-weight: 700;
}

.piece-bar-actions {
  display: flex;
  gap: 6px;
  flex: 1.4;
  min-width: 0;
  flex-wrap: wrap;
}

.piece-bar-actions .btn {
  flex: 1;
  min-height: 42px;
  padding: 8px 10px;
}

/* Editorial Chrome Sections (Hairline Dividers, Open Paper) */
.editorial-section {
  border-top: 2px solid var(--ink);
  padding-top: 10px;
  min-width: 0;
  max-width: 100%;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 8px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(26, 26, 26, 0.22);
}

.section-header h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 800;
}

.section-sub,
.tray-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-secondary);
  font-weight: 700;
}

/* Rules List */
.rules-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
}

.rule-pill {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 8px;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
}

.rule-pill .rule-delta {
  font-family: var(--font-mono);
  font-weight: 700;
}

.rule-pill.positive .rule-delta { color: var(--good); }
.rule-pill.negative .rule-delta { color: var(--bad); }

.rule-pill.related {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.rule-pill.active.positive {
  background: var(--good-bg);
  border-color: var(--good);
  color: var(--good);
}

.rule-pill.active.negative {
  background: var(--bad-bg);
  border-color: var(--bad);
  color: var(--bad);
}

/* Tactile Manifest Cards (Physical Objects Keep Shadows) */
.item-tray {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.item-card {
  border: var(--border);
  box-shadow: var(--shadow);
  background: var(--paper);
  padding: 10px;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  position: relative;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.12s ease;
}

.item-card:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: var(--shadow-active);
}

.item-card.selected {
  background: var(--accent-bg);
  outline: 2px solid var(--ink);
  outline-offset: -4px;
}

.item-card.placed {
  background: var(--paper-alt);
  box-shadow: 1px 1px 0px var(--ink);
  cursor: pointer;
}

.item-card.eliminated {
  background-color: var(--bad-bg);
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(200, 75, 49, 0.11) 0px,
    rgba(200, 75, 49, 0.11) 2px,
    transparent 2px,
    transparent 8px
  );
  box-shadow: 1px 1px 0px var(--ink);
}

.item-card.eliminated .item-title-text {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--bad);
}

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

.item-title-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-serif);
  font-weight: 800;
  font-size: 15px;
  line-height: 1.15;
}

.item-key {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 0 4px;
  border: 1px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  flex-shrink: 0;
}

.item-meta {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-secondary);
  font-weight: 700;
}

.item-meta strong {
  color: var(--ink);
}

.item-stamp {
  display: inline-block;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 1px 6px;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
}

.item-stamp.packed {
  background: var(--ink);
  color: var(--paper);
  transform: rotate(-2deg);
}

.item-stamp.excluded {
  background: var(--bad);
  color: var(--paper);
}

.item-stamp.anchor {
  background: var(--accent);
  color: var(--ink);
}

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

.mini-cell {
  width: 11px;
  height: 11px;
  border: 1px solid var(--ink);
}

.mini-cell.empty {
  border-color: transparent;
  background: transparent;
}

/* Drag Ghost */
.drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 80;
  transform: translate(-50%, -50%) rotate(-2deg);
  filter: drop-shadow(3px 3px 0px var(--ink));
}

/* Share Preview */
.share-preview {
  margin: 0;
  background: var(--paper);
  border: var(--border);
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* 3-Panel Visual Help Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 26, 0.58);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.modal-card {
  background: var(--paper);
  border: var(--border);
  box-shadow: 5px 5px 0px var(--ink);
  max-width: 560px;
  width: 100%;
  padding: 18px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: var(--border);
  margin-bottom: 14px;
}

.modal-head h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 800;
}

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

.guide-panel {
  border: 1px solid rgba(26, 26, 26, 0.25);
  background: var(--bg);
  padding: 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.guide-panel strong {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
}

.guide-panel p {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-secondary);
}

.modal-foot {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

.modal-foot-split {
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.feedback-link {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-secondary);
  text-decoration: underline;
}

.feedback-link:hover {
  color: var(--ink);
}

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  border: var(--border);
  padding: 9px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  box-shadow: var(--shadow);
  z-index: 60;
}

.manifest-toggle-btn {
  display: none;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  cursor: pointer;
}

@media (max-width: 840px) {
  .workspace-spread {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .left-column {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .manifest-toggle-btn {
    display: inline-flex;
    align-items: center;
  }

  .manifest-desktop-sub {
    display: none;
  }

  .item-tray.mobile-collapsed {
    display: none;
  }
}

@media (hover: none) {
  .btn {
    min-height: 44px;
  }

  .mode-switch,
  .view-toggle {
    min-height: 42px;
  }

  .mode-btn,
  .view-btn {
    min-height: 39px;
  }

  .streak-pill {
    height: 42px;
  }

  .icon-btn {
    width: 42px;
    height: 42px;
  }

  .item-card {
    cursor: pointer;
  }

  kbd {
    display: none;
  }
}

@media (max-width: 560px) {
  .masthead {
    padding: 4px 0 6px;
    margin-bottom: 6px;
  }

  .masthead-top {
    gap: 6px;
    padding-bottom: 5px;
  }

  .masthead-controls {
    width: 100%;
    gap: 6px;
  }

  .mode-switch {
    flex: 1;
    min-height: 34px;
  }

  .mode-btn {
    flex: 1;
    min-height: 31px;
    padding: 0 8px;
    font-size: 11px;
  }

  .streak-pill {
    height: 34px;
    padding: 0 8px;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
  }

  .masthead-title-row {
    padding-top: 4px;
  }

  .masthead-title {
    font-size: 22px;
  }

  .masthead-subtitle {
    display: none;
  }

  .visual-guide {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  body {
    padding: 6px 10px 32px;
  }

  .edition-meta {
    font-size: 11px;
    gap: 5px;
  }

  .luggage-scale {
    gap: 5px;
    padding: 5px 0;
    margin-bottom: 4px;
  }

  .metric-val {
    font-size: 15px;
  }

  .scale-readouts {
    gap: 12px;
  }

  .scale-actions .btn {
    min-height: 38px;
    padding: 6px 9px;
    font-size: 11px;
  }

  .suitcase-shell {
    padding: 9px;
  }

  .suitcase-lining {
    padding: 7px;
  }

  .hover-callout {
    margin-top: 4px;
    min-height: 22px;
    padding: 2px 8px;
    font-size: 10px;
  }

  .piece-bar {
    margin-top: 5px;
    padding: 6px;
    gap: 6px;
  }

  .piece-chip {
    min-height: 34px;
    padding: 3px 4px;
    font-size: 10.5px;
  }

  .rule-pill {
    font-size: 11px;
    line-height: 1.3;
    padding: 4px 7px;
  }

  .item-tray {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .item-card {
    padding: 8px;
  }

  .item-title-row {
    font-size: 13px;
  }

  .item-key {
    display: none;
  }
}
