:root {
  --bg: #121212;
  --panel: #1e1e1e;
  --panel-alt: rgba(30, 30, 30, 0.92);
  --muted: #687085;
  --accent: #e8d900;
  --accent-2: #f5e53b;
  --accent-soft: rgba(232, 217, 0, 0.18);
  --success: #16a34a;
  --danger: #dc2626;
  --border-soft: rgba(142, 192, 255, 0.22);
  --surface-shadow: 0 24px 65px rgba(5, 14, 27, 0.55);
  --text-primary: #e6eef8;
  --text-muted: rgba(230, 238, 248, 0.65);
}

html, body { height: auto; margin: 0; }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  font-family: 'Titillium Web', sans-serif;
  color: var(--text-primary);
  line-height: 1.55;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 36px 18px 52px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  box-sizing: border-box;
  width: min(1080px, 100%);
  margin: 0 auto;
  background: transparent;
  padding: 0;
}

.back-link {
  display: inline-block;
  color: #aaa;
  text-decoration: none;
  margin: 4px 0 18px;
}

.back-link:hover {
  color: var(--accent);
}

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

.logo {
  max-width: 120px;
  margin-bottom: 6px;
}

.tool-header h1 {
  font-size: 2.2rem;
  font-weight: 700;
  margin: 0 0 2px;
  color: var(--text-primary);
}

.tool-header h1 span {
  color: var(--accent);
}

.tool-header .subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0;
}

/* Game area - ships side by side */
.game-area {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: start;
  padding: 20px 0;
  min-height: 320px;
  width: 100%;
}

.vs-divider {
  font-size: 32px;
  font-weight: 700;
  color: var(--muted);
  opacity: 0.5;
  align-self: center;
  padding: 20px 0;
}

/* Ship cards */
.ship-card {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 0;
}

.ship-card:hover {
  border-color: var(--accent-soft);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.ship-card:active {
  transform: translateY(0);
}

.ship-card.reveal-high {
  border-color: var(--success);
  box-shadow: 0 0 24px rgba(22, 163, 74, 0.2);
}

.ship-card.reveal-low {
  border-color: rgba(220, 38, 38, 0.4);
  opacity: 0.6;
}

.ship-image-wrap {
  width: 100%;
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  background: rgba(0,0,0,0.3);
  border-radius: 6px;
  overflow: hidden;
}

.ship-image-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.ship-image-wrap .fallback-icon {
  font-size: 48px;
  opacity: 0.3;
}

.ship-name {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 2px;
  color: var(--text-primary);
}

.ship-class {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.ship-race {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.price-display {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  padding: 6px 14px;
  border-radius: 6px;
  background: var(--accent-soft);
  display: inline-block;
  min-width: 120px;
}

.price-display.hidden {
  color: var(--muted);
  background: transparent;
  opacity: 0.5;
}

.price-display.reveal-high-price {
  color: var(--success);
  background: rgba(22, 163, 74, 0.1);
}

.price-display.reveal-low-price {
  color: var(--danger);
  background: rgba(220, 38, 38, 0.1);
}

/* Feedback message */
.feedback {
  text-align: center;
  padding: 8px 0;
  font-size: 1.1rem;
  font-weight: 600;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.feedback.correct {
  color: var(--success);
}

.feedback.correct .fb-price {
  color: var(--text-primary);
  background: rgba(22, 163, 74, 0.1);
  padding: 2px 14px;
  border-radius: 6px;
  border: 1px solid rgba(22, 163, 74, 0.2);
}

.feedback.correct .fb-reward {
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 14px;
  border-radius: 6px;
  font-weight: 700;
  animation: pulse-reward 0.4s ease 2;
}

@keyframes pulse-reward {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.feedback.wrong {
  color: var(--danger);
}

/* Buttons */
.guess-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 8px;
  min-height: 52px;
}

.guess-btn {
  padding: 10px 28px;
  font-family: 'Titillium Web', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  border: 2px solid var(--accent);
  background: transparent;
  color: var(--accent);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.guess-btn:hover {
  background: var(--accent);
  color: #111;
  box-shadow: 0 0 24px rgba(232, 217, 0, 0.15);
}

.guess-btn:active {
  transform: translateY(1px);
}

.countdown-area {
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.countdown-number {
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--accent);
  animation: pulse-count 0.5s ease;
  min-width: 60px;
}

@keyframes pulse-count {
  0% { transform: scale(1.6); opacity: 0.6; }
  100% { transform: scale(1); opacity: 1; }
}

.guess-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  box-shadow: none;
}

/* Game over panel */
.game-over-panel {
  text-align: center;
  padding: 20px;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  background: var(--panel);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
}

.go-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.go-title.lose { color: var(--danger); }
.go-title.win {
  color: var(--accent);
  text-shadow: 0 0 20px rgba(232, 217, 0, 0.5), 0 0 40px rgba(232, 217, 0, 0.3);
}

.go-streak {
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--accent);
  margin: 4px 0;
}

.go-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 14px;
}

.go-history {
  text-align: left;
  max-height: 140px;
  overflow-y: auto;
  margin-bottom: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px;
  padding: 2px 0;
}

.history-item {
  display: flex;
  justify-content: space-between;
  padding: 4px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 0.85rem;
}

.history-item:last-child {
  border-bottom: none;
}

.history-item .h-name {
  color: var(--text-primary);
}

.history-item .h-price {
  color: var(--accent);
  font-weight: 600;
}

.result-btn {
  padding: 10px 36px;
  font-family: 'Titillium Web', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  background: var(--accent);
  color: #111;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.result-btn:hover {
  background: var(--accent-2);
  box-shadow: 0 0 24px rgba(232, 217, 0, 0.2);
  transform: translateY(-1px);
}

/* Header stats */
.header-stats {
  text-align: center;
  margin-bottom: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  font-size: 0.95rem;
}

.header-stats span {
  color: var(--text-muted);
}

.header-stats strong {
  color: var(--text-primary);
}

.reward-bar {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  padding: 6px 0 10px;
  letter-spacing: 1px;
}

.reward-bar #reward-total {
  color: var(--accent);
  font-size: 2rem;
}

.streak-badge {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 4px 14px;
  border-radius: 6px;
  font-weight: 700;
  border: 1px solid rgba(232, 217, 0, 0.15);
}

.streak-badge.fire {
  box-shadow: 0 0 16px rgba(232, 217, 0, 0.2);
}

.lives-display {
  color: #ff4466;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255, 68, 102, 0.1);
  border: 1px solid rgba(255, 68, 102, 0.2);
  min-width: 40px;
  text-align: center;
  display: inline-block;
}

.feedback.life-saved {
  color: #ff6688;
}

.feedback.life-saved .fb-life-saved {
  color: #ff4466;
  background: rgba(255, 68, 102, 0.1);
  padding: 2px 14px;
  border-radius: 6px;
  border: 1px solid rgba(255, 68, 102, 0.2);
  font-weight: 700;
}

.feedback.correct .fb-life {
  color: #ff4466;
  font-weight: 700;
  font-size: 0.85rem;
}

.life-saved-area {
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.next-round-msg {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.buy-life-btn {
  color: #16a34a;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 6px;
  background: rgba(22, 163, 74, 0.1);
  border: 1px solid rgba(22, 163, 74, 0.3);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  display: inline-block;
  user-select: none;
}

.buy-life-btn:hover {
  background: rgba(22, 163, 74, 0.25);
  box-shadow: 0 0 12px rgba(22, 163, 74, 0.2);
}

.buy-life-btn:active {
  transform: scale(0.95);
}

.buy-life-btn.btn-locked {
  color: #555;
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  cursor: default;
}

.buy-life-btn.btn-locked:hover {
  background: rgba(255, 255, 255, 0.04);
  box-shadow: none;
}

/* Loading animation */
.loading,
.error-msg {
  grid-column: 1 / -1;
  text-align: center;
  padding: 50px 20px;
  color: var(--text-muted);
}

.load-ring {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
}

.load-ring .ring {
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-top-color: var(--accent);
  border-right-color: rgba(232, 217, 0, 0.3);
  border-radius: 50%;
  animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.load-ring .ring:nth-child(2) {
  inset: 8px;
  border-top-color: rgba(232, 217, 0, 0.5);
  border-right-color: transparent;
  animation-duration: 1.8s;
  animation-direction: reverse;
}

.load-ring .ring:nth-child(3) {
  inset: 16px;
  border-top-color: var(--accent);
  border-right-color: rgba(232, 217, 0, 0.2);
  animation-duration: 0.9s;
}

.load-ring .center-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 16px rgba(232, 217, 0, 0.5);
  animation: pulse-dot 1.5s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 8px rgba(232, 217, 0, 0.3); }
  50% { box-shadow: 0 0 24px rgba(232, 217, 0, 0.7); }
}

.load-progress {
  width: 200px;
  height: 3px;
  background: rgba(232, 217, 0, 0.1);
  border-radius: 2px;
  margin: 12px auto 8px;
  overflow: hidden;
}

.load-progress .bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width 0.3s ease;
  box-shadow: 0 0 8px rgba(232, 217, 0, 0.3);
}

.load-text {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.load-count {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}

.error-msg {
  color: var(--danger);
}

.error-msg .retry-btn {
  margin-top: 12px;
  padding: 8px 20px;
  font-family: 'Titillium Web', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  border: 2px solid var(--danger);
  background: transparent;
  color: var(--danger);
  border-radius: 6px;
  cursor: pointer;
}

/* Footer */
.footer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 0.78rem;
  color: var(--muted);
}

/* Animation */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.ship-card {
  animation: fadeInUp 0.25s ease;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.ship-card.reveal-high .price-display {
  animation: pulse 0.4s ease 2;
}

/* Responsive */
@media (max-width: 768px) {
  body { padding: 20px 12px 36px; }
  .game-area { gap: 8px; }
  .vs-divider { font-size: 20px; }
  .ship-card { padding: 12px; }
  .ship-image-wrap { margin-bottom: 8px; }
  .ship-name { font-size: 1rem; }
  .ship-class { font-size: 0.72rem; }
  .price-display { font-size: 1rem; min-width: 80px; padding: 4px 10px; }
  .guess-btn { padding: 8px 18px; font-size: 0.85rem; }
  .header-stats { gap: 12px; font-size: 0.85rem; }
  .tool-header h1 { font-size: 1.6rem; }
  .feedback { font-size: 0.95rem; }
}

@media (max-width: 500px) {
  .game-area { gap: 4px; }
  .ship-card { padding: 6px; }
  .ship-name { font-size: 0.85rem; }
  .price-display { font-size: 0.82rem; min-width: 50px; padding: 3px 6px; }
  .vs-divider { font-size: 14px; }
  .guess-buttons { gap: 8px; }
  .guess-btn { padding: 6px 12px; font-size: 0.75rem; }
  .header-stats { gap: 8px; font-size: 0.78rem; }
  .streak-badge { font-size: 0.78rem; padding: 2px 10px; }
}
