/* ============================================================
   VIZ 1.2 EXTRAS — Merit Order, Welfare, Uniform Pricing
   + "▶ see it" trigger buttons next to H3 titles
   ============================================================ */

/* ====== "▶ see it" trigger button ====== */
.viz-see-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 10px;
  padding: 3px 10px;
  background: rgba(63, 169, 196, 0.12);
  color: #3FA9C4;
  border: 1px solid rgba(63, 169, 196, 0.4);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  vertical-align: middle;
  letter-spacing: 0.3px;
  transition: all 0.2s;
  animation: viz-see-pulse 2s ease-in-out infinite;
}
.viz-see-btn:hover {
  background: #3FA9C4;
  color: #fff;
  animation: none;
  transform: scale(1.05);
}
.viz-see-btn i {
  font-size: 11px;
}
@keyframes viz-see-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(63, 169, 196, 0.4);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(63, 169, 196, 0);
  }
}

/* ====== Shared container for the 3 animations ====== */
.viz12x {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
  gap: 10px;
  position: relative;
}
.viz12x-back {
  position: absolute;
  top: 12px;
  left: 16px;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  color: var(--text-soft);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
  z-index: 5;
}
.viz12x-back:hover {
  color: var(--text);
  border-color: #3FA9C4;
}
.viz12x-back i { font-size: 12px; }

.viz12x-header {
  text-align: center;
  padding-top: 26px;
}
.viz12x-eyebrow {
  font-size: 11px;
  color: #3FA9C4;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 4px;
}
.viz12x-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
  margin: 0;
}

.viz12x-story {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-soft);
  text-align: center;
  padding: 6px 12px;
  font-style: italic;
  min-height: 40px;
}

.viz12x-replay {
  align-self: center;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  color: var(--text-soft);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s;
}
.viz12x-replay:hover {
  color: var(--text);
  border-color: #3FA9C4;
}
.viz12x-replay i { font-size: 12px; }

/* ====================================================
   ANIMATION 1 — MERIT ORDER (sorting cards)
   ==================================================== */
.viz12x-merit .viz12x-stage {
  position: relative;
  flex: 1;
  min-height: 130px;
  margin: 12px 0 8px;
}
.viz12x-card {
  position: absolute;
  top: 30px;
  width: 14%;
  height: 80px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #1a2436;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(26, 36, 54, 0.18);
  transition: left 0.85s cubic-bezier(0.65, 0, 0.35, 1), transform 0.4s ease;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}
.viz12x-card.swapping {
  transform: scale(1.12);
  box-shadow: 0 8px 24px rgba(63, 169, 196, 0.4);
  z-index: 3;
}
.viz12x-card.done {
  animation: viz12x-card-done 0.6s ease-out;
}
@keyframes viz12x-card-done {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.08); }
  100% { transform: scale(1); }
}
.viz12x-card-name {
  font-size: 14px;
  line-height: 1;
  margin-bottom: 4px;
}
.viz12x-card-price {
  font-size: 16px;
  font-weight: 800;
}
.viz12x-axis-line {
  height: 2px;
  background: linear-gradient(to right, transparent, var(--rule), var(--rule), transparent);
  margin: 4px 16px;
}
.viz12x-axis-labels {
  display: flex;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 10px;
  color: var(--text-mute);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-weight: 600;
}
.viz12x-axis-labels i {
  font-size: 12px;
  vertical-align: middle;
}

/* ====================================================
   ANIMATION 2 — SOCIAL WELFARE (vases / surpluses)
   ==================================================== */
.viz12x-welfare .viz12x-balance {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  margin: auto 0;
  flex: 0 1 auto;
}
.viz12x-vase {
  flex: 1;
  max-width: 130px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.viz12x-vase-label {
  font-size: 11px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  text-align: center;
  min-height: 28px;
  display: flex;
  align-items: center;
  text-align: center;
}
.viz12x-vase-tube {
  width: 36px;
  height: 130px;
  background: rgba(26, 36, 54, 0.06);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--rule);
}
body.theme-dark .viz12x-vase-tube {
  background: rgba(255, 255, 255, 0.06);
}
.viz12x-vase-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, #2c7cb8, #85B7EB);
  border-radius: 0 0 8px 8px;
  transition: height 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.viz12x-vase-fill-producer {
  background: linear-gradient(to top, #C25C5C, #EF9F27);
}
.viz12x-vase-fill-total {
  background: linear-gradient(to top, #5DCAA5, #3FA9C4);
}
.viz12x-vase-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.viz12x-vase-sub {
  font-size: 10px;
  color: var(--text-mute);
  text-align: center;
  line-height: 1.3;
  min-height: 26px;
}
.viz12x-vase-plus {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-mute);
  align-self: center;
  margin: 0 2px;
  padding-bottom: 56px;
}

/* ====================================================
   ANIMATION 3 — UNIFORM PRICING (actors with payouts)
   ==================================================== */
.viz12x-uniform .viz12x-clearing-banner {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 8px 0 12px;
  padding: 8px 16px;
  background: rgba(63, 169, 196, 0.08);
  border: 1px solid rgba(63, 169, 196, 0.25);
  border-radius: 8px;
  align-self: center;
}
.viz12x-clearing-label {
  font-size: 12px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.viz12x-clearing-price {
  font-size: 22px;
  font-weight: 800;
  color: #3FA9C4;
}
.viz12x-actors {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 12px;
  min-height: 0;
  margin: 8px 0;
}
.viz12x-actor {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.4s ease;
  position: relative;
}
.viz12x-actor.paid {
  border-color: #3FA9C4;
  box-shadow: 0 4px 16px rgba(63, 169, 196, 0.2);
  transform: translateY(-3px);
}
.viz12x-actor-marginal::after {
  content: 'Marginal';
  position: absolute;
  top: -8px;
  right: 6px;
  background: #EF9F27;
  color: #fff;
  font-size: 9px;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.viz12x-actor-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: #1a2436;
  margin-bottom: 4px;
}
.viz12x-actor-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.viz12x-actor-bid {
  font-size: 11px;
  color: var(--text-mute);
  margin-top: 2px;
}
.viz12x-actor-paid {
  font-size: 11px;
  color: var(--text-mute);
  margin-top: 4px;
}
.viz12x-actor-paid .viz12x-paid-value {
  font-weight: 700;
  color: var(--text);
}
.viz12x-actor-paid .viz12x-paid-value.highlight {
  color: #3FA9C4;
  font-size: 14px;
  animation: viz12x-flash 0.5s ease-out;
}
@keyframes viz12x-flash {
  0%   { transform: scale(0.6); opacity: 0; }
  60%  { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}
.viz12x-actor-surplus {
  font-size: 11px;
  color: var(--text-mute);
  margin-top: 2px;
}
.viz12x-actor-surplus .viz12x-surplus-value {
  font-weight: 700;
}
.viz12x-actor-surplus .viz12x-surplus-value.positive {
  color: #5DCAA5;
}
.viz12x-actor-surplus .viz12x-surplus-value.zero {
  color: var(--text-mute);
}

/* ====================================================
   RESPONSIVE
   ==================================================== */
@media (max-width: 900px) {
  .viz12x { padding: 12px; }
  .viz12x-title { font-size: 14px; }
  .viz12x-card { width: 16%; height: 60px; }
  .viz12x-card-name { font-size: 12px; }
  .viz12x-card-price { font-size: 14px; }
  .viz12x-vase-tube { height: 100px; width: 30px; }
  .viz12x-vase-value { font-size: 16px; }
  .viz12x-actor-avatar { width: 36px; height: 36px; font-size: 16px; }
}

/* ====================================================
   WELFARE — internal tabs (Area on chart / Surplus breakdown)
   ==================================================== */
.viz12x-tabs {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin: 4px 0 8px;
}
.viz12x-tab {
  background: rgba(26, 36, 54, 0.06);
  border: none;
  color: var(--text-soft);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s;
}
body.theme-dark .viz12x-tab {
  background: rgba(255, 255, 255, 0.06);
}
.viz12x-tab:hover { color: var(--text); }
.viz12x-tab.active {
  background: #3FA9C4;
  color: #fff;
}
.viz12x-tab i { font-size: 13px; }

.viz12x-wpane {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.viz12x-wpane.active {
  display: flex;
}

.viz12x-chart-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
.viz12x-welfare-svg {
  width: 100%;
  height: auto;
  max-height: 240px;
  font-family: "Lato", -apple-system, sans-serif;
}
body.theme-dark .viz12x-welfare-svg line[stroke="#1a2436"] { stroke: #b8bacc; }
body.theme-dark .viz12x-welfare-svg text[fill="#1a2436"] { fill: #e8e8ef; }
body.theme-dark .viz12x-welfare-svg text[fill="#4a5670"] { fill: #b8bacc; }
body.theme-dark .viz12x-welfare-svg circle[fill="#1a2436"] { fill: #e8e8ef; }
body.theme-dark .viz12x-welfare-svg circle[stroke="#fff"] { stroke: #232639; }



/* ====================================================
   WELFARE — interactive editor (+/- buttons)
   ==================================================== */
.viz12x-editor {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 6px 0;
}
.viz12x-ed-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.viz12x-ed-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
  margin-bottom: 2px;
}
.viz12x-ed-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.viz12x-ed-name {
  font-size: 11px;
  font-weight: 700;
  width: 56px;
  text-align: right;
}
.viz12x-ed-field {
  display: flex;
  align-items: center;
  gap: 3px;
}
.viz12x-ed-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--bg-card);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.15s;
}
.viz12x-ed-btn:hover {
  background: #3FA9C4;
  color: #fff;
  border-color: #3FA9C4;
}
.viz12x-ed-val {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  min-width: 48px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.viz12x-ed-val small {
  font-size: 8px;
  color: var(--text-mute);
  margin-left: 1px;
}
@media (max-width: 900px) {
  .viz12x-editor { gap: 10px; }
  .viz12x-ed-name { width: 44px; font-size: 10px; }
  .viz12x-ed-val { min-width: 40px; font-size: 10px; }
}