/* ==========================================================================
   CORE SPEC — AI Learning & Production Environment Total Investment Simulator
   Standalone + Embeddable CSS (Zero Global Side Effects)
   ========================================================================== */

.cs-cost-sim {
  --sim-bg-card: rgba(15, 23, 42, 0.72);
  --sim-bg-inner: rgba(255, 255, 255, 0.035);
  --sim-border: rgba(255, 255, 255, 0.11);
  --sim-border-cyan: rgba(34, 211, 238, 0.45);
  --sim-cyan: #22d3ee;
  --sim-emerald: #34d399;
  --sim-amber: #fbbf24;
  --sim-purple: #c084fc;
  --sim-rose: #fb7185;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  font-style: normal;
  color: #f8fafc;
}

.cs-cost-sim *,
.cs-cost-sim *::before,
.cs-cost-sim *::after {
  box-sizing: border-box;
  font-style: normal;
}

.cs-cost-sim__notice {
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-left: 3px solid var(--sim-cyan);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 0.8rem;
  line-height: 1.65;
  color: #cbd5e1;
}

.cs-cost-sim__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

@media (min-width: 1024px) {
  .cs-cost-sim:not(.cs-cost-sim--compact) .cs-cost-sim__grid {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: 28px;
  }
  .cs-cost-sim:not(.cs-cost-sim--compact) .cs-cost-sim__summary-col {
    position: sticky;
    top: 96px;
  }
}

.cs-cost-sim__panel {
  background: var(--sim-bg-card);
  border: 1px solid var(--sim-border);
  border-radius: 18px;
  padding: 20px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.32);
  min-width: 0;
}

@media (min-width: 640px) {
  .cs-cost-sim__panel {
    padding: 24px;
  }
}

.cs-cost-sim__panel + .cs-cost-sim__panel {
  margin-top: 20px;
}

.cs-cost-sim__step-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.cs-cost-sim__step-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.cs-cost-sim__step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: rgba(34, 211, 238, 0.16);
  border: 1px solid rgba(34, 211, 238, 0.4);
  color: var(--sim-cyan);
  flex-shrink: 0;
}

.cs-cost-sim__step-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.4;
}

.cs-cost-sim__tag-noneligible {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(244, 63, 94, 0.14);
  border: 1px solid rgba(251, 113, 133, 0.35);
  color: #fda4af;
}

.cs-cost-sim__tag-eligible {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: #6ee7b7;
}

.cs-cost-sim__presets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.cs-cost-sim__preset-btn {
  appearance: none;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 11px;
  padding: 10px 12px;
  text-align: left;
  color: #e2e8f0;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.cs-cost-sim__preset-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(34, 211, 238, 0.4);
}

.cs-cost-sim__preset-btn.is-active {
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.26), rgba(88, 28, 135, 0.22));
  border-color: var(--sim-cyan);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.25);
}

.cs-cost-sim__preset-btn:focus-visible {
  outline: 2px solid var(--sim-cyan);
  outline-offset: 2px;
}

.cs-cost-sim__preset-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.35;
}

.cs-cost-sim__preset-sub {
  font-size: 0.7rem;
  color: #94a3b8;
  line-height: 1.3;
}

.cs-cost-sim__field-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

@media (min-width: 640px) {
  .cs-cost-sim__field-grid--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.cs-cost-sim__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.cs-cost-sim__label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #e2e8f0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.cs-cost-sim__hint {
  font-size: 0.72rem;
  font-weight: 400;
  color: #94a3b8;
  line-height: 1.5;
  margin: 0;
}

.cs-cost-sim__input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.cs-cost-sim__input,
.cs-cost-sim__select {
  width: 100%;
  min-width: 0;
  background: rgba(2, 6, 23, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 10px;
  padding: 10px 42px 10px 12px;
  color: #ffffff;
  font-family: 'Inter', 'Noto Sans JP', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.4;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.cs-cost-sim__select {
  padding-right: 34px;
  font-size: 0.86rem;
  cursor: pointer;
}

.cs-cost-sim__input:focus,
.cs-cost-sim__select:focus {
  outline: none;
  border-color: var(--sim-cyan);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.16);
}

.cs-cost-sim__unit {
  position: absolute;
  right: 12px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #94a3b8;
  pointer-events: none;
}

.cs-cost-sim__segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  background: rgba(2, 6, 23, 0.65);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.cs-cost-sim__seg-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: #cbd5e1;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.cs-cost-sim__seg-btn.is-active {
  background: rgba(34, 211, 238, 0.18);
  border-color: rgba(34, 211, 238, 0.45);
  color: #ffffff;
}

.cs-cost-sim__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.cs-cost-sim__chip {
  appearance: none;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cs-cost-sim__chip:hover,
.cs-cost-sim__chip.is-active {
  background: rgba(34, 211, 238, 0.16);
  border-color: rgba(34, 211, 238, 0.45);
  color: #ffffff;
}

/* Summary Output Column */
.cs-cost-sim__summary-card {
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.92), rgba(17, 24, 39, 0.88));
  border: 1px solid rgba(34, 211, 238, 0.35);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45), 0 0 28px rgba(8, 145, 178, 0.12);
}

@media (min-width: 640px) {
  .cs-cost-sim__summary-card {
    padding: 24px;
  }
}

.cs-cost-sim__kpi-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

.cs-cost-sim__kpi {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 14px 16px;
}

.cs-cost-sim__kpi--highlight {
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.2), rgba(16, 185, 129, 0.12));
  border-color: rgba(34, 211, 238, 0.5);
}

.cs-cost-sim__kpi-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}

.cs-cost-sim__kpi-val {
  font-family: 'Inter', 'Noto Sans JP', sans-serif;
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #ffffff;
  line-height: 1.25;
}

.cs-cost-sim__kpi--highlight .cs-cost-sim__kpi-val {
  color: #67e8f9;
  font-size: 1.75rem;
}

.cs-cost-sim__kpi-sub {
  font-size: 0.72rem;
  color: #cbd5e1;
  margin-top: 5px;
  line-height: 1.45;
}

.cs-cost-sim__timing-box {
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-left: 3px solid var(--sim-emerald);
  border-radius: 11px;
  padding: 10px 12px;
  margin-bottom: 16px;
  font-size: 0.73rem;
  line-height: 1.55;
  color: #e2e8f0;
}

.cs-cost-sim__timing-label {
  display: block;
  font-size: 0.69rem;
  font-weight: 800;
  color: #6ee7b7;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}

.cs-cost-sim__tier-timing {
  font-size: 0.7rem;
  font-weight: 600;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 6px 8px;
  margin-top: 6px;
  line-height: 1.45;
}

/* Stacked Visual Cost Bar */
.cs-cost-sim__bar-wrap {
  margin: 16px 0;
}

.cs-cost-sim__bar-track {
  display: flex;
  width: 100%;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.cs-cost-sim__bar-seg {
  height: 100%;
  transition: width 0.25s ease;
}

.cs-cost-sim__bar-seg--school { background: #22d3ee; }
.cs-cost-sim__bar-seg--pc { background: #a855f7; }
.cs-cost-sim__bar-seg--tools { background: #f59e0b; }
.cs-cost-sim__bar-seg--refund { background: rgba(52, 211, 153, 0.32); }

.cs-cost-sim__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 8px;
  font-size: 0.71rem;
  color: #cbd5e1;
}

.cs-cost-sim__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.cs-cost-sim__dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

/* 3-Stage Comparison Matrix */
.cs-cost-sim__tier-section {
  margin-top: 24px;
}

.cs-cost-sim__tier-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

@media (min-width: 768px) {
  .cs-cost-sim__tier-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.cs-cost-sim__tier-card {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
  text-align: left;
  color: inherit;
  min-width: 0;
}

.cs-cost-sim__tier-card:hover {
  border-color: rgba(34, 211, 238, 0.4);
}

.cs-cost-sim__tier-card.is-selected {
  background: linear-gradient(155deg, rgba(8, 145, 178, 0.22), rgba(15, 23, 42, 0.9));
  border-color: var(--sim-cyan);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.3);
}

.cs-cost-sim__tier-card[aria-disabled="true"] {
  opacity: 0.55;
  cursor: default;
}

.cs-cost-sim__tier-badge {
  display: inline-block;
  width: fit-content;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  color: #e2e8f0;
  margin-bottom: 4px;
}

.cs-cost-sim__tier-card.is-selected .cs-cost-sim__tier-badge {
  background: var(--sim-cyan);
  color: #020617;
}

.cs-cost-sim__tier-net {
  font-family: 'Inter', 'Noto Sans JP', sans-serif;
  font-size: 1.35rem;
  font-weight: 900;
  color: #ffffff;
}

.cs-cost-sim__tier-refund {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--sim-emerald);
}

.cs-cost-sim__tier-cond {
  font-size: 0.72rem;
  color: #94a3b8;
  line-height: 1.5;
  margin: 0;
}

.cs-cost-sim__alert-list {
  margin: 14px 0 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cs-cost-sim__alert-item {
  font-size: 0.75rem;
  line-height: 1.55;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  color: #fde68a;
}

.cs-cost-sim__alert-item--info {
  background: rgba(34, 211, 238, 0.08);
  border-color: rgba(34, 211, 238, 0.28);
  color: #cffafe;
}

.cs-cost-sim__reset-btn {
  appearance: none;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #cbd5e1;
  border-radius: 9px;
  padding: 7px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cs-cost-sim__reset-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}
