/* TryLab — 人生の天秤 (scale.css) */

.scale-main {
  padding-top: 24px;
  padding-bottom: 60px;
}

.scale-stage {
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 840px;
  margin: 0 auto;
}

.scale-stage.hidden,
.collapse-overlay.hidden,
.hidden,
[hidden] {
  display: none !important;
}

/* キャパシティゲージ */
.capacity-gauge-wrap {
  background: rgba(22, 28, 42, 0.85);
  border: 1px solid #2a374f;
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.gauge-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  margin-bottom: 10px;
  color: #e2e8f0;
}

.capacity-num {
  font-size: 1.15rem;
  font-family: ui-monospace, monospace;
  color: #38bdf8;
  transition: color 0.3s ease;
}

.capacity-num.danger {
  color: #ef4444;
  font-weight: 700;
  animation: pulse-danger 1s infinite alternate;
}

@keyframes pulse-danger {
  0% { transform: scale(1); }
  100% { transform: scale(1.08); text-shadow: 0 0 8px rgba(239, 68, 68, 0.6); }
}

.gauge-bar-track {
  width: 100%;
  height: 12px;
  background: #0f172a;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  border: 1px solid #1e293b;
}

.gauge-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #10b981);
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s;
}

.gauge-bar-fill.warning {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.gauge-bar-fill.overflow {
  background: #ef4444;
  box-shadow: 0 0 12px #ef4444;
}

.capacity-warning-msg {
  min-height: 22px;
  margin-top: 8px;
  font-size: 0.85rem;
  text-align: right;
  color: #94a3b8;
}

.capacity-warning-msg.danger {
  color: #f87171;
  font-weight: 600;
}

/* 天秤ビジュアルステージ */
.scale-stage-visual {
  position: relative;
  background: radial-gradient(circle at 50% 30%, #1e293b 0%, #0a0f1d 85%);
  border: 1px solid #233149;
  border-radius: 16px;
  padding: 40px 20px 20px;
  min-height: 320px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.scale-device {
  position: relative;
  width: 100%;
  max-width: 580px;
  height: 250px;
  transition: transform 0.4s ease;
}

/* 崩壊時のアニメーション */
.scale-device.collapsed {
  animation: collapse-shake 0.5s ease forwards;
}

@keyframes collapse-shake {
  0% { transform: translate(0, 0) rotate(0deg); }
  20% { transform: translate(-6px, 8px) rotate(-4deg); }
  40% { transform: translate(8px, 14px) rotate(5deg); }
  60% { transform: translate(-8px, 20px) rotate(-7deg); }
  80% { transform: translate(4px, 26px) rotate(3deg); }
  100% { transform: translate(0, 32px) rotate(0deg); opacity: 0.4; }
}

/* 支柱 */
.scale-fulcrum {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 28px solid transparent;
  border-right: 28px solid transparent;
  border-bottom: 160px solid #475569;
  z-index: 1;
}

.scale-fulcrum::after {
  content: '';
  position: absolute;
  bottom: -160px;
  left: -20px;
  width: 40px;
  height: 40px;
  background: #334155;
  border-radius: 50%;
}

/* 天秤のビーム（横棒） */
.scale-beam {
  position: absolute;
  top: 90px;
  left: 10%;
  width: 80%;
  height: 10px;
  background: linear-gradient(180deg, #cbd5e1, #64748b);
  border-radius: 5px;
  transform-origin: 50% 50%;
  transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
  z-index: 2;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.scale-beam::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 24px;
  background: #e2e8f0;
  border-radius: 50%;
  border: 4px solid #334155;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

/* 左右の皿 */
.scale-pan {
  position: absolute;
  top: 5px;
  width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

.pan-left {
  left: 0;
  transform-origin: top center;
}

.pan-right {
  right: 0;
  transform-origin: top center;
}

.pan-strings {
  width: 110px;
  height: 55px;
  border-left: 2px solid #94a3b8;
  border-right: 2px solid #94a3b8;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  border-top: none;
  background: rgba(148, 163, 184, 0.1);
}

.pan-plate {
  width: 100%;
  background: #1e293b;
  border: 2px solid #64748b;
  border-radius: 0 0 40px 40px;
  padding: 8px 6px 12px;
  box-shadow: inset 0 -4px 10px rgba(0, 0, 0, 0.5), 0 6px 15px rgba(0, 0, 0, 0.4);
  text-align: center;
}

.pan-label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.pan-weights-slot {
  min-height: 48px;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 4px;
}

/* 乗せられた重りブロックのミニ表示 */
.mini-weight-tag {
  background: #334155;
  border: 1px solid #475569;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.75rem;
  color: #f1f5f9;
  white-space: nowrap;
  animation: drop-in 0.25s ease-out;
  display: flex;
  align-items: center;
  gap: 4px;
}

.mini-weight-tag.type-ambition {
  background: #1e3a5f;
  border-color: #38bdf8;
  color: #bae6fd;
}

.mini-weight-tag.type-peace {
  background: #1e3e3b;
  border-color: #34d399;
  color: #a7f3d0;
}

@keyframes drop-in {
  0% { transform: translateY(-16px) scale(0.9); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* 崩壊オーバーレイ */
.collapse-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.92);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  text-align: center;
  z-index: 10;
  backdrop-filter: blur(4px);
  animation: fade-in 0.3s ease;
}

.collapse-content {
  max-width: 420px;
}

.collapse-icon {
  font-size: 3.5rem;
  display: block;
  margin-bottom: 8px;
}

.collapse-content h3 {
  color: #ef4444;
  font-size: 1.3rem;
  margin-bottom: 8px;
}

.collapse-content p {
  color: #cbd5e1;
  font-size: 0.95rem;
  margin-bottom: 20px;
  line-height: 1.6;
}

/* 重りトレイ */
.weights-tray-wrap {
  background: rgba(22, 28, 42, 0.7);
  border: 1px solid #28354c;
  border-radius: 14px;
  padding: 24px 20px;
}

.tray-header {
  text-align: center;
  margin-bottom: 20px;
}

.tray-header h2 {
  font-size: 1.15rem;
  color: #f1f5f9;
  margin-bottom: 4px;
}

.tray-sub {
  font-size: 0.85rem;
  color: #94a3b8;
}

.weights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

/* 重りカード */
.weight-card {
  background: #182234;
  border: 1.5px solid #2d3d57;
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  user-select: none;
  position: relative;
}

.weight-card:hover {
  border-color: #4f688e;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.weight-card.active {
  background: #1e2e49;
  border-color: #38bdf8;
  box-shadow: 0 0 0 1px #38bdf8, 0 4px 14px rgba(56, 189, 248, 0.2);
}

.weight-card.active.type-peace {
  border-color: #34d399;
  box-shadow: 0 0 0 1px #34d399, 0 4px 14px rgba(52, 211, 153, 0.2);
}

.weight-card-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.weight-icon {
  font-size: 1.4rem;
}

.weight-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: #f8fafc;
}

.weight-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: #0f172a;
  color: #94a3b8;
  white-space: nowrap;
}

.weight-card.active .weight-badge {
  background: #0284c7;
  color: #fff;
}

.weight-card.active.type-peace .weight-badge {
  background: #059669;
  color: #fff;
}

/* アクションボタン */
.action-footer {
  text-align: center;
  padding: 10px 0;
}

.scale-btn {
  font-family: inherit;
  font-weight: 600;
  font-size: 1rem;
  padding: 12px 28px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.scale-btn.primary {
  background: linear-gradient(135deg, #38bdf8, #2563eb);
  color: #fff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.scale-btn.primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.6);
}

.scale-btn.primary:disabled {
  background: #334155;
  color: #64748b;
  cursor: not-allowed;
  box-shadow: none;
}

.scale-btn.secondary {
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid #475569;
}

.scale-btn.secondary:hover {
  background: #334155;
}

.scale-btn.tertiary {
  background: transparent;
  color: #94a3b8;
  text-decoration: underline;
}

.scale-btn.tertiary:hover {
  color: #f1f5f9;
}

/* 結果画面 */
.result-container {
  display: flex;
  flex-direction: column;
  gap: 28px;
  background: rgba(17, 24, 39, 0.85);
  border: 1px solid #2d3748;
  border-radius: 16px;
  padding: 32px 24px;
}

.result-header {
  text-align: center;
}

.result-badge {
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  color: #38bdf8;
  font-weight: 700;
}

.result-title {
  font-size: 1.8rem;
  color: #f8fafc;
  margin: 8px 0;
}

.result-lead {
  font-size: 1.05rem;
  color: #cbd5e1;
  max-width: 620px;
  margin: 0 auto;
  line-height: 1.6;
}

.result-card-visual {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 10px 0;
}

#result-canvas {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  background: #0b1120;
  border: 1px solid #1e293b;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.tradeoff-analysis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 640px) {
  .tradeoff-analysis-grid {
    grid-template-columns: 1fr;
  }
}

.tradeoff-col {
  background: #111827;
  border-radius: 10px;
  padding: 18px 20px;
  border: 1px solid #1f2937;
}

.keep-col {
  border-top: 3px solid #38bdf8;
}

.drop-col {
  border-top: 3px solid #f43f5e;
}

.tradeoff-col h3 {
  font-size: 0.95rem;
  color: #e2e8f0;
  margin-bottom: 12px;
}

.tradeoff-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tradeoff-list li {
  font-size: 0.88rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 6px;
}

.result-insights {
  background: rgba(30, 41, 59, 0.5);
  border-radius: 10px;
  padding: 20px;
  color: #cbd5e1;
  font-size: 0.95rem;
  line-height: 1.7;
  border-left: 4px solid #38bdf8;
}

.result-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
}

/* English labels and compact phones. */
html[lang="en"] .scale-intro p{color:#cbd5e1;margin:8px 0}
html[lang="en"] .scale-intro .scale-note{font-size:12px;color:#94a3b8}
html[lang="en"] .weights-grid{grid-template-columns:repeat(auto-fill,minmax(min(100%,240px),1fr))}
html[lang="en"] .weight-card{min-width:0;flex-direction:column;align-items:flex-start}
html[lang="en"] .weight-card-info{min-width:0}
html[lang="en"] .weight-title{overflow-wrap:anywhere}
html[lang="en"] .mini-weight-tag{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis}
@media(max-width:600px){
 html[lang="en"] .gauge-label{flex-wrap:wrap;gap:8px}
 html[lang="en"] .scale-stage-visual{min-height:400px}
 html[lang="en"] .scale-pan{width:100px}
 html[lang="en"] .pan-strings{width:85px}
 html[lang="en"] .collapse-overlay{padding:16px}
 html[lang="en"] .collapse-icon{font-size:2.5rem;margin-bottom:0}
 html[lang="en"] .collapse-content h3{font-size:1.1rem}
 html[lang="en"] .collapse-content p{font-size:.85rem}
 html[lang="en"] .result-container{padding:24px 16px}
 html[lang="en"] .scale-btn{padding:12px 18px}
}
