/* Interactive American Mahjong 152 vs. 166 Tile Count & Missing-Tile Box Auditor */

.guide-content,
.guide-section {
  min-width: 0;
}

.hero-actions,
.mf-share-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
}

.toc a {
  display: block;
  padding: 4px 0;
}

.vs-matrix-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.tc-card {
  background: var(--sheet);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0 24px;
  box-shadow: var(--shadow-card);
}

.tc-label {
  display: block;
  font: 700 11.5px/1.3 var(--sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.tc-preset-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 15px;
}

.tc-preset-btn {
  appearance: none;
  min-height: 54px;
  padding: 9px 10px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: var(--surface-hover);
  color: var(--ink-pine);
  font: 700 12.5px/1.25 var(--sans);
  text-align: left;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 140ms cubic-bezier(0.22, 1, 0.36, 1);
}

.tc-preset-btn small {
  display: block;
  font: 500 10.5px/1.25 var(--sans);
  opacity: 0.84;
  margin-top: 3px;
}

.tc-preset-btn:hover:not([aria-pressed="true"]) {
  background: var(--parchment);
  border-color: var(--green);
  transform: translateY(-1px);
}

.tc-preset-btn[aria-pressed="true"],
.tc-preset-btn[aria-pressed="true"]:hover {
  background: var(--green);
  border-color: var(--green);
  color: #fffdf8;
}

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

.tc-counter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 15px;
}

.tc-group-box {
  padding: 10px 11px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: var(--parchment);
  transition: border-color 160ms ease, background 160ms ease;
}

.tc-group-box.is-short {
  border-color: #dc2626;
  background: rgba(254, 226, 226, 0.45);
}

.tc-group-box.is-extra {
  border-color: #d97706;
  background: rgba(254, 243, 199, 0.45);
}

html[data-salon-theme="baize"] .tc-group-box {
  background: rgba(255, 255, 255, 0.04);
}

html[data-salon-theme="baize"] .tc-group-box.is-short {
  background: rgba(127, 29, 29, 0.34);
  border-color: #f87171;
}

html[data-salon-theme="baize"] .tc-group-box.is-extra {
  background: rgba(146, 64, 14, 0.3);
  border-color: #fbbf24;
}

.tc-group-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 7px;
}

.tc-group-top strong {
  font: 700 12px/1.2 var(--sans);
  color: var(--ink-pine);
}

.tc-target {
  font: 700 10px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
}

.tc-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.tc-step-btn {
  appearance: none;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
  background: var(--sheet);
  color: var(--ink-pine);
  font: 800 16px/1 var(--sans);
  cursor: pointer;
}

.tc-step-btn:hover {
  border-color: var(--green);
}

.tc-step-val {
  font: 800 18px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink-pine);
  min-width: 28px;
  text-align: center;
}

/* Emerald Felt Wall Stage */
.tc-felt-stage {
  border-radius: 11px;
  background: linear-gradient(180deg, #163327 0%, #0d2219 100%);
  border: 1px solid #2b5844;
  padding: 15px;
  color: #f6f0e3;
  margin-bottom: 14px;
}

.tc-stage-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 12px;
}

.tc-total-badge {
  padding: 4px 10px;
  border-radius: 6px;
  background: #fffdf7;
  color: #163024;
  font: 800 12.5px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
}

@keyframes tcShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.tc-status-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font: 800 10.5px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tc-status-pill.ready {
  background: #a7f3d0;
  color: #06281b;
}

.tc-status-pill.extras {
  background: #fde68a;
  color: #78350f;
}

.tc-status-pill.short {
  background: #fecaca;
  color: #7f1d1d;
  animation: tcShake 340ms ease;
}

.tc-wall-meter {
  margin-bottom: 12px;
}

.tc-wall-bar {
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.tc-wall-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: repeating-linear-gradient(
    90deg,
    #6ee7b7 0 11px,
    #34d399 11px 13px
  );
  transition: width 320ms cubic-bezier(0.22, 1, 0.36, 1), background-color 200ms ease;
}

.tc-wall-bar span.is-short {
  background: #f87171;
}

.tc-wall-bar span.is-extras {
  background: #fbbf24;
}

.tc-wall-captions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font: 600 11.5px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #cce3d6;
}

.tc-trim-btn {
  appearance: none;
  min-height: 34px;
  padding: 0 11px;
  border-radius: 7px;
  border: 1px solid rgba(253, 230, 138, 0.55);
  background: rgba(253, 230, 138, 0.16);
  color: #fde68a;
  font: 700 11.5px/1 var(--sans);
  cursor: pointer;
}

.tc-trim-btn[hidden] {
  display: none;
}

.tc-verdict-box {
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.tc-verdict-box h3 {
  margin: 0 0 5px;
  font: 800 15px/1.3 var(--sans);
  color: #ffffff;
}

.tc-verdict-box p {
  margin: 0;
  font: 400 13.5px/1.52 var(--sans);
  color: #e2efe8;
}

@media (prefers-reduced-motion: reduce) {
  .tc-wall-bar span,
  .tc-preset-btn,
  .tc-group-box {
    transition: none !important;
  }

  .tc-status-pill.short {
    animation: none !important;
  }
}

@media (max-width: 820px) {
  .tc-preset-grid,
  .tc-counter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .tc-preset-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.tc-rank-card {
  margin-top: 18px;
}

.tc-rank-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.tc-rank-sub {
  margin: 4px 0 0;
  font-size: 0.85rem;
  opacity: 0.82;
}

.tc-rank-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tc-rank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 7px;
  margin-bottom: 12px;
}

.tc-rank-chip {
  padding: 8px 9px;
  border-radius: 8px;
  border: 1px solid rgba(15, 61, 46, 0.22);
  background: rgba(255, 255, 255, 0.72);
  color: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}

.tc-rank-chip[aria-pressed="true"] {
  background: #14532d;
  color: #ffffff;
  border-color: #14532d;
}

html[data-salon-theme="baize"] .tc-rank-chip {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
}

html[data-salon-theme="baize"] .tc-rank-chip[aria-pressed="true"] {
  background: #10b981;
  color: #052e16;
  border-color: #10b981;
}

.tc-rank-tip {
  margin: 0;
  font-size: 0.84rem;
}

@media print {
  .guide-header,
  .guide-subbar,
  .toc,
  .mf-result-cta,
  .guide-cta,
  .guide-footer {
    display: none !important;
  }
  .guide-body {
    display: block !important;
  }
}
