* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: radial-gradient(circle at top, #334155 0%, #0f172a 50%, #020617 100%);
  color: #e2e8f0;
}

.game-screen {
  width: 100vw;
  height: 100vh;
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: background 0.18s ease;
}

.game-screen.dir-left {
  background: radial-gradient(circle at 18% 58%, rgba(37, 99, 235, 0.24), transparent 45%),
    radial-gradient(circle at top, #334155 0%, #0f172a 50%, #020617 100%);
}

.game-screen.dir-right {
  background: radial-gradient(circle at 82% 58%, rgba(16, 185, 129, 0.24), transparent 45%),
    radial-gradient(circle at top, #334155 0%, #0f172a 50%, #020617 100%);
}

.game-screen.fx-good {
  animation: screenFlashGood 0.55s ease-out;
}

.game-screen.fx-bad {
  animation: screenFlashBad 0.55s ease-out;
}

.game-screen.fx-risk {
  animation: screenFlashRisk 0.65s ease-out;
}

.game-screen.fx-shake {
  animation: screenShake 0.38s ease-out;
}

@keyframes screenFlashGood {
  0% {
    box-shadow: inset 0 0 0 0 transparent;
    filter: brightness(1);
  }
  35% {
    box-shadow: inset 0 0 120px rgba(16, 185, 129, 0.35);
    filter: brightness(1.06);
  }
  100% {
    box-shadow: inset 0 0 0 0 transparent;
    filter: brightness(1);
  }
}

@keyframes screenFlashBad {
  0% {
    box-shadow: inset 0 0 0 0 transparent;
    filter: brightness(1);
  }
  35% {
    box-shadow: inset 0 0 120px rgba(248, 113, 113, 0.38);
    filter: brightness(0.96);
  }
  100% {
    box-shadow: inset 0 0 0 0 transparent;
    filter: brightness(1);
  }
}

@keyframes screenFlashRisk {
  0% {
    box-shadow: inset 0 0 0 0 transparent;
  }
  25% {
    box-shadow: inset 0 0 100px rgba(250, 204, 21, 0.28);
  }
  100% {
    box-shadow: inset 0 0 0 0 transparent;
  }
}

@keyframes screenShake {
  0%,
  100% {
    transform: translate(0, 0);
  }
  20% {
    transform: translate(-6px, 2px);
  }
  40% {
    transform: translate(7px, -1px);
  }
  60% {
    transform: translate(-4px, 1px);
  }
  80% {
    transform: translate(4px, -2px);
  }
}

.hud {
  position: absolute;
  min-width: 220px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  padding: 10px 14px;
  backdrop-filter: blur(4px);
}

.top-left { top: 20px; left: 20px; }
.top-center {
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  min-width: 200px;
}

.risk-buff-hint {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #fde68a;
  letter-spacing: 0.2px;
  animation: buffPulse 2.2s ease-in-out infinite;
}

@keyframes buffPulse {
  0%,
  100% {
    opacity: 0.75;
  }
  50% {
    opacity: 1;
  }
}
.top-right { top: 20px; right: 20px; text-align: right; }

.label {
  color: #94a3b8;
  font-size: 12px;
  margin-bottom: 3px;
}

.value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.event-stage {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -38%);
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: center;
}

.choice-card,
.center-card {
  min-height: 320px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.72);
}

.choice-card {
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  padding: 20px;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: min(300px, 26vw);
  transition: all 0.16s ease;
  border: none;
  background: transparent;
  box-shadow: none;
}

.left-choice { text-align: left; left: 14px; }
.right-choice { text-align: right; right: 14px; }

.choice-title {
  color: #94a3b8;
  font-size: 14px;
}

.choice-glyph {
  display: inline-block;
  color: #64748b;
  font-size: 12px;
  vertical-align: middle;
}

.choice-label {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.3;
  color: #cbd5e1;
}

.choice-card.active {
  border-color: rgba(250, 204, 21, 0.8);
  box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.25) inset;
}

.left-choice.active .choice-label {
  color: #60a5fa;
}

.right-choice.active .choice-label {
  color: #34d399;
}

.center-card {
  width: min(520px, 42vw);
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  padding: 24px;
  user-select: none;
  touch-action: pan-y;
  transition: transform 0.12s linear;
  cursor: grab;
}

.center-card.swipe-left { transform: translateX(-12px); }
.center-card.swipe-right { transform: translateX(12px); }

.center-card.dragging {
  cursor: grabbing;
}

.center-card.card-swap {
  transition: none;
  animation: cardSwapIn 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes cardSwapIn {
  0% {
    opacity: 0.35;
    transform: translateY(14px) scale(0.98);
    filter: blur(1px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.event-icon-wrap {
  margin-bottom: 10px;
}

.event-icon-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(51, 65, 85, 0.9), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  animation: iconPop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.event-icon-slot svg {
  width: 34px;
  height: 34px;
  color: #e2e8f0;
}

@keyframes iconPop {
  0% {
    transform: scale(0.86) rotate(-6deg);
    opacity: 0.5;
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

.event-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.event-note {
  font-size: 15px;
  color: #cbd5e1;
  margin-bottom: 18px;
}

.money-label {
  font-size: 13px;
  color: #94a3b8;
}

.fund-card {
  width: min(320px, 85%);
  margin: 0 auto;
  padding: 16px 14px;
  border-radius: 14px;
  border: 1px solid rgba(250, 204, 21, 0.4);
  background: linear-gradient(180deg, rgba(250, 204, 21, 0.14), rgba(30, 41, 59, 0.25));
  position: relative;
  overflow: hidden;
}

.fund-card::after {
  content: "";
  position: absolute;
  inset: -40% -20%;
  background: linear-gradient(
    115deg,
    transparent 30%,
    rgba(250, 204, 21, 0.12) 45%,
    transparent 60%
  );
  animation: fundSheen 3.2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes fundSheen {
  0% {
    transform: translateX(-18%) translateY(8%);
  }
  100% {
    transform: translateX(18%) translateY(-8%);
  }
}

.invest-amount {
  margin-top: 6px;
  font-size: 44px;
  font-weight: 800;
  color: #facc15;
  transition: color 0.2s ease, transform 0.2s ease;
}

.invest-amount.pulse {
  animation: moneyPulse 0.45s ease-out;
}

@keyframes moneyPulse {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.06);
  }
  100% {
    transform: scale(1);
  }
}

.value.asset-tick {
  animation: assetTick 0.5s ease-out;
}

@keyframes assetTick {
  0% {
    transform: scale(1);
    color: #e2e8f0;
  }
  40% {
    transform: scale(1.04);
    color: #f8fafc;
  }
  100% {
    transform: scale(1);
    color: #e2e8f0;
  }
}

.risk-toast {
  position: absolute;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  max-width: min(520px, 92vw);
  padding: 12px 18px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(250, 204, 21, 0.45);
  color: #fde68a;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  z-index: 10;
  animation: toastIn 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

.risk-toast.hide {
  animation: toastOut 0.28s ease-in forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, 16px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translate(-50%, 10px);
  }
}

.setup-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(2, 6, 23, 0.82);
  backdrop-filter: blur(8px);
}

.setup-panel {
  width: min(520px, 100%);
  max-height: min(88vh, 720px);
  overflow: auto;
  padding: 28px 26px 30px;
  border-radius: 18px;
  background: linear-gradient(165deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.98));
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55);
}

.setup-kicker {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #94a3b8;
}

.setup-title {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 700;
  color: #f1f5f9;
}

.setup-desc {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.55;
  color: #cbd5e1;
}

.setup-picked {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(51, 65, 85, 0.55);
  border: 1px solid rgba(100, 116, 139, 0.35);
  font-size: 14px;
  color: #e2e8f0;
}

.setup-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.setup-grid--career {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 520px) {
  .setup-grid--career {
    grid-template-columns: 1fr;
  }
}

.setup-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(71, 85, 105, 0.65);
  background: rgba(15, 23, 42, 0.65);
  color: #e2e8f0;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.setup-option:hover {
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(30, 58, 138, 0.28);
}

.setup-option:active {
  transform: scale(0.99);
}

.setup-option-title {
  font-size: 16px;
  font-weight: 650;
  color: #f8fafc;
}

.setup-option-meta {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.35;
}

@media (max-width: 1000px) {
  .event-stage {
    width: 100vw;
    transform: translate(-50%, -30%);
  }
  .center-card {
    min-height: 180px;
    width: min(720px, 92vw);
  }
  .choice-card {
    width: auto;
    top: auto;
    transform: none;
    min-height: auto;
    bottom: -92px;
    background: rgba(15, 23, 42, 0.45);
    border-radius: 10px;
    padding: 10px 14px;
  }
  .left-choice { left: 18px; }
  .right-choice { right: 18px; }
  .choice-label { font-size: 22px; }
  .invest-amount { font-size: 36px; }
  .event-icon-slot {
    width: 56px;
    height: 56px;
  }
  .event-icon-slot svg {
    width: 30px;
    height: 30px;
  }
  .risk-toast {
    bottom: 18px;
    font-size: 13px;
    padding: 10px 14px;
  }
}
