@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap');

:root {
  --green: #00aa00;
  --green-dim: #008800;
  --green-dark: #004400;
  --amber: #ffff55;
  --red: #ff5555;
  --bg: #000000;
  --bg-panel: #000022;
  --bg-panel-border: #0000aa;
  --text: #ffffff;
  --text-dim: #aaaaaa;
  --crt-glow: none;
  --accent: #5555ff;
  --accent-dim: #0000aa;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  background: #000000;
  color: #ffffff;
  font-family: 'VT323', monospace;
  font-size: 18px;
  overflow-x: hidden;
}

/* No CRT effects - clean DOS look */

/* Screen transitions */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes glowPulse {
  0%, 100% { text-shadow: 0 0 10px rgba(85, 85, 255, 0.3); }
  50% { text-shadow: 0 0 20px rgba(85, 85, 255, 0.6), 0 0 40px rgba(85, 85, 255, 0.2); }
}

/* Phosphor text glow */
.panel, .title-screen, .gameover-screen, .travel-screen {
  animation: fadeSlideIn 0.4s ease-out;
}

#app {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
}

/* Message overlay */
.message {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #220000;
  border: 1px solid var(--red);
  color: var(--red);
  padding: 12px 28px;
  border-radius: 4px;
  z-index: 1000;
  font-family: 'VT323', monospace;
  font-size: 20px;
  text-shadow: none;
  display: none;
  animation: messageSlide 0.3s ease-out;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

@keyframes messageSlide {
  from { transform: translateX(-50%) translateY(-20px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* Event toast notifications */
.event-toast {
  position: fixed;
  right: 20px;
  padding: 10px 16px;
  border-radius: 4px;
  font-family: 'VT323', monospace;
  font-size: 18px;
  z-index: 999;
  animation: toastSlide 0.4s ease-out, toastFade 0.5s ease-in 2.5s forwards;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  max-width: 350px;
  pointer-events: none;
}

@keyframes toastSlide {
  from { transform: translateX(100px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toastFade {
  to { opacity: 0; transform: translateY(-10px); }
}

.event-toast.toast-weather { background: #1a1a2a; border-left: 3px solid #6688ff; color: #aaddff; }
.event-toast.toast-disease { background: #2a1a1a; border-left: 3px solid var(--red); color: #ffaaaa; }
.event-toast.toast-death { background: #2a0a0a; border-left: 3px solid #ff2222; color: #ff6666; }
.event-toast.toast-breakdown { background: #2a2a1a; border-left: 3px solid var(--amber); color: #ffdd88; }
.event-toast.toast-thief { background: #2a1a2a; border-left: 3px solid #cc66cc; color: #eeccee; }
.event-toast.toast-find { background: #1a2a1a; border-left: 3px solid var(--green); color: #aaffaa; }
.event-toast.toast-trade { background: #1a2a1a; border-left: 3px solid var(--green); color: #aaffaa; }
.event-toast.toast-oxen { background: #2a2a1a; border-left: 3px solid var(--amber); color: #ffdd88; }
.event-toast.toast-lost { background: #2a2a1a; border-left: 3px solid var(--amber); color: #ffdd88; }

/* Title Screen */
.title-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  text-align: center;
}

.ascii-art {
  color: var(--amber);
  font-size: 8px;
  line-height: 1.2;
  margin-bottom: 10px;
  overflow: hidden;
  animation: fadeSlideIn 0.8s ease-out;
}

.game-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 32px;
  color: #ffffff;
  margin-bottom: 8px;
  animation: fadeSlideIn 1s ease-out;
}

.subtitle {
  color: var(--text-dim);
  font-size: 16px;
  margin-bottom: 30px;
  animation: fadeSlideIn 1.2s ease-out;
}

.title-info {
  max-width: 600px;
  margin-bottom: 30px;
  line-height: 1.6;
  animation: fadeSlideIn 1.4s ease-out;
}

.title-info p {
  margin-bottom: 10px;
}

/* Panels */
.panel {
  background: var(--bg-panel);
  border: 2px solid var(--accent);
  border-radius: 0;
  padding: 20px;
  margin-bottom: 16px;
}

.panel h2 {
  font-family: 'Press Start 2P', monospace;
  font-size: 16px;
  color: var(--amber);
  margin-bottom: 16px;
}

.panel h3 {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: var(--amber);
  margin-bottom: 10px;
  margin-top: 16px;
}

.center {
  text-align: center;
}

/* Buttons */
button, .card {
  font-family: 'VT323', monospace;
  font-size: 20px;
  padding: 10px 20px;
  border: 2px solid var(--accent);
  background: var(--accent-dim);
  color: #ffffff;
  cursor: pointer;
  border-radius: 0;
  transition: all 0.15s;
}

button:hover, .card:hover {
  background: var(--accent);
  color: #ffffff;
}

button:active, .card:active {
  background: #0000ff;
}

button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  box-shadow: none;
}

button:disabled:hover {
  background: var(--green-dark);
  color: var(--green);
  box-shadow: none;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  font-weight: bold;
}

.btn-primary:hover {
  background: #5555ff;
}

.btn-secondary {
  background: #222222;
  border-color: #555555;
  color: #aaaaaa;
}

.btn-secondary:hover {
  background: #555555;
  color: #ffffff;
}

.btn-warn {
  background: #553300;
  border-color: #ffaa00;
  color: #ffaa00;
}

.btn-warn:hover {
  background: #aa5500;
  color: #ffffff;
}

.btn-small {
  padding: 5px 10px;
  font-size: 16px;
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 5px rgba(85, 85, 255, 0.3); }
  50% { box-shadow: 0 0 20px rgba(85, 85, 255, 0.6); }
}

/* Form elements */
.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  color: var(--green-dim);
  margin-bottom: 4px;
  font-size: 16px;
}

input[type="text"], input[type="number"], select {
  font-family: 'VT323', monospace;
  font-size: 20px;
  padding: 8px 12px;
  background: #000000;
  border: 2px solid var(--accent);
  color: #ffffff;
  border-radius: 0;
  outline: none;
  width: 100%;
  max-width: 300px;
}

input:focus, select:focus {
  border-color: #5555ff;
  background: #000022;
}

select {
  max-width: 280px;
}

/* Occupation cards */
.occupation-cards, .month-cards {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.card {
  flex: 1;
  min-width: 150px;
  max-width: 250px;
  text-align: center;
  padding: 20px;
}

.card h3 {
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  margin-bottom: 10px;
}

.card p {
  font-size: 16px;
  color: var(--text-dim);
}

/* Store */
.money-display {
  font-size: 24px;
  color: var(--amber);
  margin-bottom: 16px;
}

.store-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.store-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid var(--bg-panel-border);
  flex-wrap: wrap;
  gap: 8px;
}

.store-item-info {
  flex: 1;
  min-width: 200px;
}

.store-item-info small {
  display: block;
  color: var(--text-dim);
  font-size: 14px;
}

.store-item-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.item-price {
  color: var(--amber);
  white-space: nowrap;
}

.store-item-controls input {
  width: 80px;
  text-align: center;
}

.store-total {
  font-size: 24px;
  margin-top: 16px;
  text-align: right;
  color: var(--green);
}

/* Travel screen */
.status-bar {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  background: var(--accent-dim);
  border: 2px solid var(--accent);
  border-radius: 0;
  margin-bottom: 16px;
}

.status-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
  padding: 4px 8px;
  border-radius: 3px;
  transition: background 0.3s;
}

.status-item:hover {
  background: rgba(85, 85, 255, 0.08);
}

.status-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: 'Press Start 2P', monospace;
}

.status-value {
  font-size: 20px;
  color: #ffffff;
  margin-top: 2px;
}

.health-good .status-value { color: #55ff55; }
.health-warn .status-value { color: #ffff55; }
.health-danger .status-value { color: #ff5555; animation: healthDanger 1s infinite; }

@keyframes healthDanger {
  0%, 100% { color: #ff5555; }
  50% { color: #ff0000; }
}

/* Trail progress bar */
.trail-progress {
  margin-bottom: 16px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
}

.trail-bar {
  position: relative;
  height: 20px;
  background: #1a1a1a;
  border: 1px solid var(--green-dark);
  border-radius: 10px;
  overflow: visible;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.trail-fill {
  height: 100%;
  background: linear-gradient(90deg, #004400, #00aa00, #55ff55);
  border-radius: 10px;
  transition: width 1s ease-out;
}

.trail-wagon {
  position: absolute;
  top: -8px;
  font-size: 22px;
  transform: translateX(-50%);
  transition: left 1s ease-out;
  filter: none;
}

.trail-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 14px;
  color: var(--text-dim);
}

/* Travel grid */
.travel-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 16px;
}

@media (max-width: 768px) {
  .travel-grid {
    grid-template-columns: 1fr;
  }
  .ascii-art {
    font-size: 5px;
  }
  .game-title {
    font-size: 20px;
  }
}

/* Party table */
.party-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

.party-table th {
  text-align: left;
  color: var(--text-dim);
  border-bottom: 1px solid var(--bg-panel-border);
  padding: 4px 8px;
  font-size: 14px;
}

.party-table td {
  padding: 4px 8px;
  border-bottom: 1px solid #1a1a1a;
}

.health-good td { color: #55ff55; }
.health-warn td { color: #ffff55; }
.health-danger td { color: #ff5555; }
.health-dead td { color: #555555; text-decoration: line-through; }

/* Supply grid */
.supply-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  font-size: 16px;
  color: var(--text-dim);
}

/* Controls */
.controls-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-group label {
  color: var(--text-dim);
  font-size: 16px;
  min-width: 60px;
}

.control-group select {
  flex: 1;
  max-width: 240px;
}

/* River crossing panel */
.river-panel {
  margin-top: 16px;
  padding: 12px;
  background: #0a0a1a;
  border: 1px solid #334;
  border-radius: 4px;
}

.river-panel h3 {
  color: #55ffff;
}

/* Landmark store */
.landmark-store {
  margin-top: 16px;
  padding: 12px;
  background: #1a1a0a;
  border: 1px solid #443;
  border-radius: 4px;
}

.store-row-mini {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 16px;
}

.store-row-mini input {
  width: 60px;
  text-align: center;
}

/* Log */
.log-box {
  max-height: 200px;
  overflow-y: auto;
  padding: 10px;
  background: #050505;
  border: 1px solid #1a1a1a;
  border-radius: 3px;
  font-size: 15px;
  line-height: 1.5;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5);
}

.log-box p {
  margin-bottom: 3px;
  color: var(--text-dim);
  padding: 2px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  transition: color 0.2s;
}

.log-box p:first-child {
  color: #ffffff;
}

.log-box p:nth-child(2) {
  color: #cccccc;
}

.log-box p:nth-child(3) {
  color: #bbbbbb;
}

.final-log {
  max-height: 400px;
}

/* Game Over */
.gameover-screen {
  max-width: 600px;
  margin: 0 auto;
  animation: fadeSlideIn 0.6s ease-out;
}

.win-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 20px;
  color: #55ff55;
  margin-bottom: 16px;
  animation: winCelebrate 2s ease-in-out infinite;
}

@keyframes winCelebrate {
  0%, 100% { color: #55ff55; }
  50% { color: #ffff55; }
}

.lose-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 20px;
  color: #ff5555;
  margin-bottom: 16px;
}

.gameover-reason {
  font-size: 22px;
  margin-bottom: 20px;
  animation: fadeSlideIn 0.8s ease-out;
}

.gameover-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin-bottom: 20px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-panel);
  border: 2px solid var(--accent);
  border-radius: 0;
  min-width: 100px;
  animation: fadeSlideIn 1s ease-out;
}

.stat:nth-child(2) { animation-delay: 0.1s; }
.stat:nth-child(3) { animation-delay: 0.2s; }
.stat:nth-child(4) { animation-delay: 0.3s; }

.stat-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: 'Press Start 2P', monospace;
}

.stat-value {
  font-size: 22px;
  color: #ffffff;
  margin-top: 4px;
}

.score {
  font-family: 'Press Start 2P', monospace;
  font-size: 18px;
  color: #ffff55;
  margin: 16px 0;
  animation: scoreReveal 1.5s ease-out;
}

@keyframes scoreReveal {
  from { opacity: 0; transform: scale(0.5); }
  50% { transform: scale(1.1); }
  to { opacity: 1; transform: scale(1); }
}

/* Win confetti */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 100vh;
  pointer-events: none;
  z-index: 100;
  overflow: hidden;
}

.confetti {
  position: absolute;
  width: 8px;
  height: 8px;
  opacity: 0.8;
  animation: confettiFall 3s ease-in infinite;
}

.confetti.c1 { left: 10%; background: var(--green); animation-delay: 0s; }
.confetti.c2 { left: 25%; background: var(--amber); animation-delay: 0.5s; width: 6px; }
.confetti.c3 { left: 40%; background: #ff6666; animation-delay: 1s; height: 6px; }
.confetti.c4 { left: 55%; background: var(--green); animation-delay: 0.3s; }
.confetti.c5 { left: 70%; background: var(--amber); animation-delay: 0.8s; width: 6px; height: 10px; }
.confetti.c6 { left: 85%; background: #6688ff; animation-delay: 1.2s; }

@keyframes confettiFall {
  0% { top: -10px; transform: rotate(0deg) translateX(0); opacity: 1; }
  100% { top: 100vh; transform: rotate(720deg) translateX(50px); opacity: 0; }
}

/* Landmark arrival banner */
.landmark-arrival {
  background: var(--bg-panel);
  border: 2px solid var(--accent);
  border-radius: 0;
  padding: 12px 16px;
  margin: 12px 0;
  text-align: center;
  animation: fadeSlideIn 0.6s ease-out;
}

.landmark-arrival-text {
  font-size: 20px;
  color: #ffff55;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: #000022;
}
::-webkit-scrollbar-thumb {
  background: var(--accent-dim);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* =====================
   Joke of the Day
   ===================== */
#joke-overlay {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.78);
  color: #f5e642;
  border: 2px solid #f5e642;
  border-radius: 6px;
  padding: 0.75rem 1.25rem;
  max-width: 420px;
  width: 90%;
  text-align: center;
  font-size: 0.95rem;
  font-style: italic;
  z-index: 9999;
  pointer-events: none;
  opacity: 1;
  transition: opacity 1s ease;
}

#joke-overlay.joke-hidden {
  opacity: 0;
}

#joke-overlay .joke-label {
  display: block;
  font-size: 0.7rem;
  font-style: normal;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #aaa;
  margin-bottom: 0.35rem;
}
