/* Visual comparison, tactile tile inspector, animated Joker swap & live box audit */
.vs-code {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--parchment);
  border: 1px solid var(--line);
  color: var(--ink-pine);
  font: 700 13px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.02em;
}

/* Streamlined single-bar sub-navigation */
.vs-subbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 10px 0 14px;
  border-bottom: 1px solid var(--line);
}

.vs-subbar .guide-nav {
  padding-block: 0 !important;
  border: 0 !important;
  margin: 0 !important;
  flex: 1 1 auto;
}

.vs-subbar-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: var(--sheet);
  color: var(--ink-pine);
  font: 650 13.5px/1.2 var(--sans);
  text-decoration: none;
  white-space: nowrap;
}

.vs-subbar-cta:hover {
  background: var(--parchment);
  border-color: var(--green);
}

.guide-page .guide-hero {
  padding-top: 28px;
}

/* 8-Rule Side-by-Side Comparison Matrix */
.vs-table-wrap {
  margin: 24px 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--sheet);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.vs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.48;
}

.vs-table th,
.vs-table td {
  padding: 14px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.vs-table tr:last-child th,
.vs-table tr:last-child td {
  border-bottom: 0;
}

.vs-table thead th {
  background: var(--parchment);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-pine);
}

.vs-table tbody th {
  width: 24%;
  font-weight: 700;
  color: var(--ink-pine);
  background: var(--surface-hover);
}

.vs-col-am {
  width: 38%;
  color: var(--ink);
}

.vs-col-cn {
  width: 38%;
  color: var(--muted);
}

/* Side-by-Side Tactile Tile Face Spotter */
.vs-tile-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 20px 0 14px;
}

.vs-tile-card {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  box-shadow: var(--shadow-card);
  margin: 0;
}

.vs-tile-card .tile-line {
  padding: 18px 10px 22px !important;
  gap: 6px !important;
  justify-content: center;
  border-radius: 8px;
  background: var(--walnut-rack);
  box-shadow: var(--shadow-felt);
}

/* Interactive tactile tile buttons */
.vs-tile-btn {
  appearance: none;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  position: relative;
  display: inline-flex;
  min-width: 44px;
  min-height: 60px;
  align-items: center;
  justify-content: center;
  transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1), filter 200ms ease;
}

.vs-tile-btn .tile-face {
  width: 44px;
  height: 60px;
  pointer-events: none;
  transition: box-shadow 220ms ease, border-color 220ms ease;
}

.vs-tile-btn:hover {
  transform: translateY(-4px);
}

.vs-tile-btn[aria-pressed="true"],
.vs-tile-btn.is-wave {
  transform: translateY(-8px);
}

.vs-tile-btn[aria-pressed="true"] .tile-face,
.vs-tile-btn.is-wave .tile-face {
  border-color: #ebc26b !important;
  box-shadow: 0 0 0 2px #ebc26b, 0 8px 14px rgba(5, 18, 13, 0.42) !important;
}

.vs-tile-ghost {
  background: rgba(255, 252, 245, 0.14) !important;
  border: 1.5px dashed rgba(255, 240, 220, 0.62) !important;
  box-shadow: none !important;
}

.vs-tile-ghost svg text {
  fill: #ffd8cf !important;
}

.vs-tile-ghost svg line {
  stroke: #ff9c88 !important;
}

.vs-bonus-num {
  left: auto !important;
  right: 3px !important;
  color: #a63e2a !important;
}

/* Synchronized Dual-Tradition Tile Inspector Bar */
.vs-tile-inspector {
  background: var(--sheet);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
  transition: border-color 220ms ease;
}

.vs-tile-inspector.is-flash {
  border-color: var(--green);
}

.vs-inspector-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 10px;
}

.vs-inspector-title {
  margin: 0;
  font: 700 15.5px/1.3 var(--sans);
  color: var(--ink-pine);
}

.vs-tour-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface-hover);
  color: var(--ink-pine);
  font: 650 12.5px/1.2 var(--sans);
  cursor: pointer;
}

.vs-tour-btn:hover {
  background: var(--parchment);
  border-color: var(--green);
}

.vs-tour-btn[aria-pressed="true"] {
  background: var(--green);
  border-color: var(--green);
  color: #fffdf8;
}

html[data-salon-theme="baize"] .vs-tour-btn[aria-pressed="true"] {
  color: #14251d;
}

.vs-inspector-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.vs-inspector-cell {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-hover);
  border: 1px solid var(--line);
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink);
}

.vs-inspector-cell > strong {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  margin-bottom: 6px;
}

.vs-inspector-cell.am > strong {
  background: var(--sage);
  color: var(--ink-pine);
}

.vs-inspector-cell.cn > strong {
  background: var(--warn-bg);
  color: var(--warn-ink);
}

.vs-inspector-cell p {
  margin: 0 !important;
  color: var(--muted);
}

.vs-inspector-cell p strong {
  color: var(--ink-pine);
  font-weight: 700;
}

/* Animated Joker Swap Micro-Stage */
.vs-swap-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0;
  padding: 14px 14px 20px;
  border-radius: 8px;
  background: var(--walnut-rack);
  box-shadow: var(--shadow-felt);
  overflow: hidden;
}

.vs-swap-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.vs-swap-slots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.vs-swap-slot-wrap {
  position: relative;
  flex: none;
  width: 44px;
  min-width: 44px;
  height: 61px;
}

.vs-swap-slot-wrap .tile-face {
  position: absolute;
  inset: 0;
  transition: transform 560ms cubic-bezier(0.22, 1, 0.36, 1), opacity 420ms ease, box-shadow 320ms ease;
}

/* Before swap: Joker sits in exposed Kong slot; real 7m sits in hand slot */
.vs-swap-stage[data-swap-state="before"] .vs-kong-real7 {
  opacity: 0;
  transform: translateY(58px) scale(0.92);
  pointer-events: none;
}

.vs-swap-stage[data-swap-state="before"] .vs-kong-joker {
  opacity: 1;
  transform: translateY(0) scale(1);
  box-shadow: 0 0 0 2px #ebc26b, 0 3px 0 #d8d2bf;
}

.vs-swap-stage[data-swap-state="before"] .vs-hand-real7 {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.vs-swap-stage[data-swap-state="before"] .vs-hand-joker {
  opacity: 0;
  transform: translateY(-58px) scale(0.92);
  pointer-events: none;
}

/* After swap: real 7m glides up into exposed Kong; Joker glides down into player's hand */
.vs-swap-stage[data-swap-state="after"] .vs-kong-joker {
  opacity: 0;
  transform: translateY(58px) scale(0.92);
  pointer-events: none;
}

.vs-swap-stage[data-swap-state="after"] .vs-kong-real7 {
  opacity: 1;
  transform: translateY(0) scale(1);
  box-shadow: 0 0 0 2px #7bd3a6, 0 3px 0 #d8d2bf;
}

.vs-swap-stage[data-swap-state="after"] .vs-hand-real7 {
  opacity: 0;
  transform: translateY(-58px) scale(0.92);
  pointer-events: none;
}

.vs-swap-stage[data-swap-state="after"] .vs-hand-joker {
  opacity: 1;
  transform: translateY(0) scale(1);
  box-shadow: 0 0 0 2px #ebc26b, 0 3px 0 #d8d2bf;
}

.vs-swap-hand-bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(255, 245, 220, 0.22);
}

.vs-swap-hand-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.vs-swap-caption {
  flex: 1 1 0;
  min-width: 0;
  font: 650 12.5px/1.4 var(--sans);
  color: #ebf3ee;
}

.vs-swap-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 44px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid rgba(235, 194, 107, 0.72);
  background: rgba(15, 38, 28, 0.78);
  color: #f9e6b3;
  font: 700 12.5px/1.2 var(--sans);
  cursor: pointer;
  white-space: nowrap;
}

.vs-swap-btn:hover {
  background: rgba(25, 62, 46, 0.95);
  border-color: #f3cf82;
}

/* Full 14-Tile Winning Hand Showcase */
.vs-full-hands {
  display: grid;
  gap: 18px;
  margin: 24px 0 8px;
}

.vs-rack-card {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-card);
}

.vs-rack-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 12px;
  margin-bottom: 10px;
}

.vs-rack-head h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
}

.vs-rack-formula {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.vs-rack-tray {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px 12px;
  padding: 14px 14px 22px;
  border-radius: 8px;
  background: var(--walnut-rack);
  box-shadow: var(--shadow-felt);
}

.vs-meld-group {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.vs-meld-cluster {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 3px;
}

.vs-meld-cluster .tile-face {
  width: 38px;
  height: 53px;
}

.vs-meld-tag {
  font: 650 11px/1.2 var(--sans);
  letter-spacing: 0.03em;
  color: #e8f1eb;
  background: rgba(8, 24, 18, 0.48);
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

.vs-rack-note {
  margin: 12px 0 0 !important;
  font-size: 14px;
  line-height: 1.48;
  color: var(--muted);
}

.vs-rack-note strong {
  color: var(--ink-pine);
}

/* Visual 152 vs. 144 Stacked Composition Bars */
.vs-comp-bars {
  display: grid;
  gap: 12px;
  margin: 18px 0 22px;
  padding: 16px;
  border-radius: 10px;
  background: var(--surface-hover);
  border: 1px solid var(--line);
}

.vs-comp-row {
  display: grid;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background 220ms ease, border-color 220ms ease;
}

.vs-comp-row.is-highlighted {
  background: var(--sheet);
  border-color: var(--line-strong);
}

.vs-comp-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 13.5px;
}

.vs-comp-meta strong {
  color: var(--ink-pine);
}

.vs-comp-meta span {
  color: var(--muted);
  font-size: 12.5px;
}

.vs-comp-track {
  display: flex;
  height: 26px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: var(--parchment);
  font: 700 11px/26px var(--sans);
}

.vs-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
  padding: 0 4px;
  transition: width 420ms cubic-bezier(0.22, 1, 0.36, 1), opacity 280ms ease;
}

.vs-seg.core {
  background: #1a543d;
  color: #fffdf8;
}

.vs-seg.flowers {
  background: #c96a4b;
  color: #fffdf8;
}

.vs-seg.jokers {
  background: #d89b2b;
  color: #1c1613;
}

.vs-seg.spares {
  background: repeating-linear-gradient(
    -45deg,
    rgba(120, 110, 96, 0.18),
    rgba(120, 110, 96, 0.18) 5px,
    rgba(120, 110, 96, 0.06) 5px,
    rgba(120, 110, 96, 0.06) 10px
  );
  color: var(--muted);
  font-weight: 600;
}

.vs-comp-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 12px;
  color: var(--muted);
  padding-top: 2px;
}

.vs-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  margin-right: 5px;
  vertical-align: middle;
}

.vs-dot.core { background: #1a543d; }
.vs-dot.flowers { background: #c96a4b; }
.vs-dot.jokers { background: #d89b2b; }
.vs-dot.spares { background: #9c9283; }

/* Interactive Box Audit & Equipment Checkboxes */
.vs-checker {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  margin: 24px 0;
  box-shadow: var(--shadow-card);
}

.vs-preset-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px !important;
}

.vs-checker-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 16px;
}

.vs-tab-btn {
  appearance: none;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-hover);
  color: var(--ink-pine);
  font: 600 13.5px/1.3 var(--sans);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.vs-tab-btn:hover {
  background: var(--parchment);
}

.vs-tab-btn[aria-pressed="true"] {
  background: var(--green);
  border-color: var(--green);
  color: #fffdf8;
}

html[data-salon-theme="baize"] .vs-tab-btn[aria-pressed="true"] {
  color: #14251d;
}

.vs-check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}

.vs-check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-hover);
  font: 600 13.5px/1.35 var(--sans);
  color: var(--ink-pine);
  cursor: pointer;
}

.vs-check-item:hover {
  border-color: var(--green);
}

.vs-check-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex: none;
  accent-color: #165b42;
  cursor: pointer;
}

.vs-audit-result {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.vs-verdict-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.vs-verdict {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.vs-verdict.warn {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--warn-ink);
}

.vs-verdict.good {
  background: var(--sage);
  border: 1px solid var(--sage-border);
  color: var(--ink-pine);
}

.vs-pack-callout {
  background: var(--surface-stage);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 24px;
  margin: 28px 0;
}

.vs-pack-callout h3 {
  font-size: 21px;
  line-height: 1.3;
  margin-bottom: 8px;
}

.vs-pack-callout p {
  color: var(--muted);
  margin-bottom: 16px;
}

.vs-pack-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Keep felt tray padding generous above the walnut rack bottom rail and tap targets >= 44px */
.guide-page #hands .comparison .tile-line {
  padding: 14px 14px 22px !important;
  row-gap: 10px;
}

.guide-page [data-salon-theme-toggle],
.guide-page [data-salon-sound-toggle] {
  min-height: 44px;
}

.guide-page .guide-nav a {
  min-height: 44px !important;
  display: inline-flex !important;
  align-items: center !important;
}

@media (prefers-reduced-motion: reduce) {
  .vs-tile-btn,
  .vs-swap-slot-wrap .tile-face,
  .vs-seg {
    transition: none !important;
  }
}

@media (max-width: 860px) {
  .vs-tile-compare {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .vs-checker-tabs,
  .vs-check-grid,
  .vs-inspector-cols {
    grid-template-columns: 1fr;
  }
  .vs-table thead {
    display: none;
  }
  .vs-table,
  .vs-table tbody,
  .vs-table tr,
  .vs-table th,
  .vs-table td {
    display: block;
    width: 100%;
  }
  .vs-table tr {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
  }
  .vs-table tbody th {
    padding: 0 0 8px;
    border: 0;
    background: transparent;
    font-size: 16px;
  }
  .vs-table td {
    padding: 6px 0;
    border: 0;
  }
  .vs-table td::before {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 999px;
    margin-right: 6px;
  }
  .vs-table td.vs-col-am::before {
    content: "American (152)";
    background: var(--sage);
    color: var(--ink-pine);
  }
  .vs-table td.vs-col-cn::before {
    content: "Chinese (144)";
    background: var(--warn-bg);
    color: var(--warn-ink);
  }
  .vs-pack-actions {
    flex-direction: column;
  }
  .vs-pack-actions .button {
    width: 100%;
  }
  .vs-subbar-cta {
    width: 100%;
  }
}

@media (max-width: 440px) {
  .vs-tile-card {
    padding: 12px;
  }
  .vs-tile-card .tile-line {
    padding: 16px 6px 20px !important;
    gap: 5px !important;
  }
  .vs-meld-cluster .tile-face {
    width: 34px;
    height: 48px;
  }
  .vs-rack-tray {
    padding: 12px 10px 20px;
    gap: 10px 8px;
  }
  .vs-swap-hand-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .vs-swap-btn {
    width: 100%;
  }
}
