:root {
  --bg-dark: #121212;
  --bg-panel: #1e1e1e;
  --bg-card: #e0d8c0;
  --text-main: #d4d4d4;
  --text-muted: #888;
  --accent-red: #8b0000;
  --accent-olive: #4b5320;
  --border-color: #333;
  --card-red: #c0392b;
  --card-black: #2c3e50;

  --font-display: 'Oswald', sans-serif;
  --font-body: 'Courier Prime', monospace;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  height: 100vh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  background-image:
    radial-gradient(circle at center, transparent 0%, rgba(0,0,0,0.8) 100%),
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.8" numOctaves="4" stitchTiles="stitch"/></filter><rect width="100" height="100" filter="url(%23noise)" opacity="0.05"/></svg>');
}

.app-container {
  width: 100%;
  max-width: 1200px;
  height: 95vh;
  display: flex;
  flex-direction: column;
  background-color: rgba(20, 20, 20, 0.9);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

/* Header & Status Bar */
.status-bar, .resources-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-panel);
}

.resources-bar {
  background-color: rgba(30, 30, 30, 0.95);
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 1px;
}

.stat-group, .time-tracker {
  display: flex;
  gap: 20px;
  align-items: center;
}

.stat-item {
  font-size: 1.5rem;
  font-family: var(--font-display);
  display: flex;
  align-items: center;
  gap: 5px;
}

.time-tracker {
  flex-direction: column;
  gap: 2px;
  text-align: center;
  font-family: var(--font-display);
}

#day-counter {
  font-size: 1.8rem;
  font-weight: 700;
}

#time-of-day {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.daytime { color: #f39c12; }
.nighttime { color: #8e44ad; }

/* Main Game Area */
.game-area {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.raids-panel, .log-panel {
  width: 250px;
  background-color: var(--bg-panel);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}
.log-panel {
  border-right: none;
  border-left: 1px solid var(--border-color);
}

.raids-panel h3, .log-panel h3 {
  font-family: var(--font-display);
  padding: 15px;
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
  letter-spacing: 1px;
  background-color: rgba(0,0,0,0.2);
}

.log-content {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.log-entry {
  padding-bottom: 10px;
  border-bottom: 1px dashed rgba(255,255,255,0.1);
}
.log-entry.system { color: var(--text-muted); }
.log-entry.good { color: #2ecc71; }
.log-entry.bad { color: var(--accent-red); }
.log-entry.neutral { color: #3498db; }

#raids-list {
  list-style: none;
  padding: 15px;
  overflow-y: auto;
}

.raid-item {
  background-color: rgba(139, 0, 0, 0.1);
  border: 1px solid var(--accent-red);
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 4px;
}
.raid-item.imminent {
  animation: pulse-red 2s infinite;
}

/* Card Section */
.card-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 30px;
  position: relative;
}

.card-container {
  perspective: 1000px;
  width: 200px;
  height: 280px;
}

.card {
  width: 100%;
  height: 100%;
  background-color: var(--bg-card);
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.4), inset 0 0 10px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 15px;
  font-family: var(--font-display);
  font-weight: 700;
  transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform-style: preserve-3d;
  position: absolute;
}

.card-back {
  background-color: #2c3e50;
  background-image: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(0,0,0,0.1) 10px, rgba(0,0,0,0.1) 20px);
  border: 5px solid white;
}

.card.flip {
  transform: rotateY(180deg);
}
.card.drawn {
  animation: drawCard 0.5s ease-out forwards;
}

.card-value { font-size: 2rem; }
.card-suit { font-size: 4rem; text-align: center; }
.suit-red { color: var(--card-red); }
.suit-black { color: var(--card-black); }

.card-top { display: flex; flex-direction: column; line-height: 1; }
.card-bottom { display: flex; flex-direction: column; line-height: 1; transform: rotate(180deg); }

.dice-result {
  font-family: var(--font-display);
  font-size: 2.5rem;
  background: var(--bg-panel);
  padding: 10px 30px;
  border-radius: 5px;
  border: 1px solid var(--border-color);
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.action-controls {
  display: flex;
  flex-direction: column;
  gap: 15px;
  align-items: center;
}

.action-group {
  display: flex;
  gap: 15px;
}

button {
  font-family: var(--font-display);
  font-size: 1.1rem;
  text-transform: uppercase;
  padding: 10px 20px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
  letter-spacing: 1px;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.primary-btn {
  background-color: var(--accent-olive);
  color: white;
  border: 1px solid #7cb342;
}
.primary-btn:hover:not(:disabled) {
  background-color: #5d6728;
  box-shadow: 0 0 10px rgba(124, 179, 66, 0.5);
}

.secondary-btn {
  background-color: transparent;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}
.secondary-btn:hover:not(:disabled) {
  background-color: rgba(255,255,255,0.1);
}

.hidden { display: none !important; }

/* Footer */
.game-footer {
  padding: 15px 20px;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-panel);
  display: flex;
  gap: 30px;
  align-items: center;
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc;
  transition: .4s;
}
.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
}
input:checked + .slider { background-color: var(--accent-olive); }
input:checked + .slider:before { transform: translateX(26px); }
.slider.round { border-radius: 24px; }
.slider.round:before { border-radius: 50%; }
.toggle-label { font-family: var(--font-display); font-size: 1.1rem; margin-left: 10px; }

/* Modal */
.modal {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}
.modal-content {
  background: var(--bg-panel);
  padding: 40px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  text-align: center;
  font-family: var(--font-display);
}
.modal-content h2 { font-size: 3rem; margin-bottom: 20px; color: var(--accent-red); }
.modal-content p { font-size: 1.2rem; margin-bottom: 30px; }

/* Animations */
@keyframes drawCard {
  0% { transform: translateY(-50px) scale(0.9); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes popIn {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes pulse-red {
  0% { box-shadow: 0 0 0 0 rgba(139, 0, 0, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(139, 0, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(139, 0, 0, 0); }
}
