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

:root {
  --sepia: #f4e4c1;
  --cream: #faf6eb;
  --burgundy: #722f37;
  --burgundy-dark: #4a1f24;
  --forest: #2d4a3e;
  --brown: #5c4033;
  --ink: #1a1a1a;
  --paper-shadow: rgba(92, 64, 51, 0.3);
}

body {
  font-family: 'Source Serif 4', Georgia, serif;
  background: linear-gradient(135deg, #d4c4a8 0%, #c9b896 50%, #bfab84 100%);
  min-height: 100vh;
  color: var(--ink);
}

/* Welcome Screen */
.welcome-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: 
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23000000' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(135deg, #d4c4a8 0%, #c9b896 50%, #bfab84 100%);
}

.welcome-content {
  text-align: center;
  max-width: 600px;
}

.masthead-welcome {
  margin-bottom: 30px;
}

.paper-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 900;
  color: var(--ink);
  letter-spacing: 0.05em;
  text-shadow: 2px 2px 0 var(--sepia);
  border-bottom: 3px double var(--ink);
  padding-bottom: 10px;
}

.paper-subtitle {
  font-style: italic;
  color: var(--brown);
  margin-top: 8px;
  font-size: 0.9rem;
}

.welcome-box {
  background: var(--cream);
  padding: 40px 30px;
  border: 2px solid var(--brown);
  box-shadow: 
    4px 4px 0 var(--paper-shadow),
    inset 0 0 60px rgba(139, 119, 89, 0.1);
  position: relative;
}

.welcome-box::before {
  content: '';
  position: absolute;
  top: 10px;
  right: 10px;
  width: 50px;
  height: 50px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='45' fill='none' stroke='%23722f37' stroke-width='3' opacity='0.3'/%3E%3C/svg%3E");
  opacity: 0.5;
}

.classified-stamp {
  font-family: 'Special Elite', monospace;
  color: var(--burgundy);
  font-size: 1.5rem;
  letter-spacing: 0.3em;
  margin-bottom: 20px;
}

.welcome-text {
  font-size: 1.1rem;
  line-height: 1.8;
  margin-bottom: 30px;
  color: var(--brown);
}

.name-input-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  align-items: center;
}

.input-label {
  font-family: 'Special Elite', monospace;
  color: var(--forest);
}

.name-input {
  font-family: 'Special Elite', monospace;
  font-size: 1.2rem;
  padding: 12px 20px;
  border: 2px solid var(--brown);
  background: var(--sepia);
  width: 100%;
  max-width: 300px;
  text-align: center;
}

.name-input:focus {
  outline: none;
  border-color: var(--burgundy);
  box-shadow: 0 0 0 3px rgba(114, 47, 55, 0.2);
}

.start-btn {
  font-family: 'Special Elite', monospace;
  font-size: 1rem;
  padding: 15px 40px;
  background: var(--burgundy);
  color: var(--cream);
  border: none;
  cursor: pointer;
  letter-spacing: 0.1em;
  transition: all 0.3s;
  box-shadow: 3px 3px 0 var(--burgundy-dark);
}

.start-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--burgundy-dark);
}

.footer-credit {
  margin-top: 30px;
  font-size: 0.85rem;
  color: var(--brown);
  opacity: 0.7;
}

.footer-credit a {
  color: var(--burgundy);
  text-decoration: none;
}

/* Main Game */
.game-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Notification */
.notification {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 15px 30px;
  background: var(--cream);
  border: 2px solid var(--brown);
  font-family: 'Special Elite', monospace;
  z-index: 1000;
  box-shadow: 4px 4px 0 var(--paper-shadow);
  animation: slideDown 0.3s ease;
}

.notification.success {
  border-color: var(--forest);
}

.notification.error {
  border-color: var(--burgundy);
}

@keyframes slideDown {
  from { transform: translateX(-50%) translateY(-100%); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* Masthead */
.masthead {
  background: var(--cream);
  border-bottom: 4px double var(--ink);
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

.paper-title-main {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 900;
  letter-spacing: 0.05em;
}

.paper-tagline {
  font-style: italic;
  font-size: 0.8rem;
  color: var(--brown);
}

.masthead-right {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.ceo-plate {
  background: var(--forest);
  color: var(--cream);
  padding: 8px 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: 'Special Elite', monospace;
}

.ceo-label {
  font-size: 0.6rem;
  letter-spacing: 0.2em;
}

.ceo-name {
  font-size: 1rem;
}

.stats-row {
  display: flex;
  gap: 15px;
}

.stat-box {
  background: var(--sepia);
  border: 1px solid var(--brown);
  padding: 5px 15px;
  text-align: center;
  font-family: 'Special Elite', monospace;
}

.stat-box.budget {
  background: var(--forest);
  color: var(--cream);
}

.stat-label {
  display: block;
  font-size: 0.6rem;
  letter-spacing: 0.15em;
}

.stat-value {
  font-size: 1.2rem;
  font-weight: bold;
}

/* Gossip Ticker */
.gossip-ticker {
  background: var(--ink);
  color: var(--sepia);
  padding: 8px 20px;
  font-family: 'Special Elite', monospace;
  font-size: 0.9rem;
  display: flex;
  gap: 15px;
  overflow: hidden;
}

.ticker-label {
  white-space: nowrap;
  font-weight: bold;
}

.ticker-text {
  animation: tickerScroll 20s linear infinite;
}

@keyframes tickerScroll {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Dashboard */
.dashboard {
  flex: 1;
  display: grid;
  grid-template-columns: 280px 1fr 300px;
  gap: 15px;
  padding: 15px;
}

@media (max-width: 1024px) {
  .dashboard {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--cream);
  border: 2px solid var(--brown);
  box-shadow: 4px 4px 0 var(--paper-shadow);
  overflow: hidden;
}

.panel-title {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  background: var(--brown);
  color: var(--cream);
  padding: 10px 15px;
  letter-spacing: 0.1em;
}

/* Staff Panel */
.staff-panel {
  display: flex;
  flex-direction: column;
}

.staff-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  max-height: 400px;
}

.staff-card {
  background: var(--sepia);
  border: 1px solid var(--brown);
  padding: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s;
  display: grid;
  grid-template-columns: 50px 1fr;
  gap: 10px;
}

.staff-card:hover {
  transform: translateX(3px);
  box-shadow: -3px 0 0 var(--burgundy);
}

.staff-card.undercover {
  opacity: 0.7;
  border-left: 3px solid var(--forest);
}

.staff-avatar {
  width: 50px;
  height: 50px;
  border: 2px solid var(--brown);
  overflow: hidden;
}

.staff-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

.staff-name {
  font-weight: bold;
  font-size: 0.9rem;
}

.staff-codename {
  font-family: 'Special Elite', monospace;
  font-size: 0.7rem;
  color: var(--burgundy);
}

.staff-role {
  font-size: 0.75rem;
  color: var(--brown);
}

.staff-status {
  font-family: 'Special Elite', monospace;
  font-size: 0.7rem;
}

.staff-status.available {
  color: var(--forest);
}

.staff-status.undercover {
  color: var(--burgundy);
}

.staff-skills {
  grid-column: span 2;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-top: 5px;
}

.skill {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 0.7rem;
}

.skill-bar {
  flex: 1;
  height: 6px;
  background: var(--cream);
  border: 1px solid var(--brown);
}

.skill-fill {
  height: 100%;
  background: var(--forest);
}

.hire-btn {
  margin: 10px;
  padding: 12px;
  font-family: 'Special Elite', monospace;
  background: var(--burgundy);
  color: var(--cream);
  border: none;
  cursor: pointer;
  letter-spacing: 0.1em;
  transition: all 0.2s;
}

.hire-btn:hover {
  background: var(--burgundy-dark);
}

/* Map Panel */
.map-panel {
  display: flex;
  flex-direction: column;
}

.town-map {
  flex: 1;
  position: relative;
  min-height: 300px;
  background: 
    url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h100v100H0z' fill='%23c9b896'/%3E%3Cpath d='M20 20h60v60H20z' fill='none' stroke='%238b7759' stroke-width='0.5' stroke-dasharray='2,2'/%3E%3C/svg%3E"),
    linear-gradient(to bottom right, #c9d4a8, #b8c396);
  border-bottom: 1px solid var(--brown);
}

.map-bg {
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(circle at 30% 40%, rgba(139, 119, 89, 0.2) 0%, transparent 50%),
    radial-gradient(circle at 70% 60%, rgba(139, 119, 89, 0.15) 0%, transparent 40%);
}

.map-location {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
  padding: 5px;
}

.map-location.unlocked:hover {
  transform: translate(-50%, -50%) scale(1.1);
}

.map-location.locked {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(1);
}

.location-icon {
  font-size: 1.5rem;
  filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.3));
}

.location-name {
  font-family: 'Special Elite', monospace;
  font-size: 0.6rem;
  background: var(--cream);
  padding: 2px 5px;
  border: 1px solid var(--brown);
  white-space: nowrap;
  margin-top: 3px;
}

.case-indicator {
  position: absolute;
  top: -5px;
  right: -5px;
  animation: pulse 1.5s infinite;
}

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

.suspicion-meter {
  padding: 10px 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--sepia);
}

.suspicion-label {
  font-family: 'Special Elite', monospace;
  font-size: 0.8rem;
  white-space: nowrap;
}

.suspicion-bar {
  flex: 1;
  height: 12px;
  background: var(--cream);
  border: 1px solid var(--brown);
}

.suspicion-fill {
  height: 100%;
  background: linear-gradient(to right, var(--forest), #c4a000, var(--burgundy));
  transition: width 0.5s;
}

.suspicion-value {
  font-family: 'Special Elite', monospace;
  font-size: 0.8rem;
  min-width: 35px;
}

/* Cases Panel */
.cases-panel {
  display: flex;
  flex-direction: column;
}

.cases-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  max-height: 450px;
}

.case-file {
  background: #f5ead6;
  border: 1px solid var(--brown);
  padding: 15px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.case-file:hover {
  box-shadow: 3px 3px 0 var(--paper-shadow);
}

.case-stamp {
  position: absolute;
  top: 5px;
  right: 5px;
  font-family: 'Special Elite', monospace;
  font-size: 0.5rem;
  color: var(--burgundy);
  border: 1px solid var(--burgundy);
  padding: 2px 5px;
  transform: rotate(5deg);
  opacity: 0.7;
}

.case-header {
  margin-bottom: 10px;
}

.case-name {
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem;
  margin-bottom: 3px;
}

.case-target {
  font-size: 0.75rem;
  color: var(--brown);
}

.case-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--cream);
  border: 1px solid var(--brown);
}

.progress-fill {
  height: 100%;
  background: var(--forest);
  transition: width 0.3s;
}

.progress-text {
  font-family: 'Special Elite', monospace;
  font-size: 0.7rem;
  min-width: 50px;
}

.case-details {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--brown);
}

.publish-btn {
  width: 100%;
  margin-top: 10px;
  padding: 8px;
  font-family: 'Special Elite', monospace;
  font-size: 0.8rem;
  background: var(--forest);
  color: var(--cream);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.publish-btn:hover {
  background: #1a3028;
}

/* Bottom Panel */
.bottom-panel {
  background: var(--cream);
  border-top: 4px double var(--ink);
  padding: 15px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.edition-preview {
  display: flex;
  gap: 15px;
}

.mini-paper {
  background: var(--sepia);
  border: 1px solid var(--brown);
  padding: 10px 20px;
  text-align: center;
  box-shadow: 2px 2px 0 var(--paper-shadow);
}

.mini-paper h4 {
  font-family: 'Playfair Display', serif;
  font-size: 0.7rem;
  border-bottom: 1px solid var(--brown);
  margin-bottom: 5px;
}

.mini-paper p {
  font-size: 0.65rem;
}

.mini-headline {
  font-family: 'Special Elite', monospace;
  font-style: italic;
}

.advance-day-btn {
  font-family: 'Special Elite', monospace;
  font-size: 1.1rem;
  padding: 15px 30px;
  background: var(--forest);
  color: var(--cream);
  border: none;
  cursor: pointer;
  letter-spacing: 0.1em;
  box-shadow: 3px 3px 0 #1a3028;
  transition: all 0.2s;
}

.advance-day-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 #1a3028;
}

.game-footer {
  font-size: 0.75rem;
  color: var(--brown);
}

.game-footer a {
  color: var(--burgundy);
  text-decoration: none;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 26, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal {
  background: var(--cream);
  border: 3px solid var(--brown);
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 8px 8px 0 var(--paper-shadow);
}

.modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  background: var(--brown);
  color: var(--cream);
  padding: 15px 20px;
}

.modal-subtitle {
  padding: 10px 20px;
  font-style: italic;
  border-bottom: 1px dashed var(--brown);
  color: var(--brown);
}

.close-modal-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 1.5rem;
  background: none;
  border: none;
  color: var(--cream);
  cursor: pointer;
}

/* Hiring Modal */
.candidates-list {
  padding: 15px;
}

.candidate-card {
  display: flex;
  gap: 15px;
  padding: 15px;
  background: var(--sepia);
  border: 1px solid var(--brown);
  margin-bottom: 10px;
  align-items: center;
}

.candidate-avatar {
  width: 60px;
  height: 60px;
  border: 2px solid var(--brown);
  overflow: hidden;
  flex-shrink: 0;
}

.candidate-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

.candidate-info {
  flex: 1;
}

.candidate-info h3 {
  font-family: 'Playfair Display', serif;
  margin-bottom: 3px;
}

.candidate-role {
  font-size: 0.85rem;
  color: var(--brown);
}

.candidate-code {
  font-family: 'Special Elite', monospace;
  font-size: 0.75rem;
  color: var(--burgundy);
}

.candidate-stats {
  display: flex;
  gap: 10px;
  font-size: 0.8rem;
  margin: 5px 0;
}

.candidate-cost {
  font-family: 'Special Elite', monospace;
  font-size: 0.75rem;
  color: var(--forest);
}

.hire-candidate-btn {
  padding: 10px 20px;
  font-family: 'Special Elite', monospace;
  background: var(--burgundy);
  color: var(--cream);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.hire-candidate-btn:hover {
  background: var(--burgundy-dark);
}

/* Case Modal */
.case-modal {
  max-width: 500px;
}

.case-file-header {
  background: var(--brown);
  color: var(--cream);
  padding: 20px;
  position: relative;
}

.classified-stamp-modal {
  position: absolute;
  top: 10px;
  right: 15px;
  font-family: 'Special Elite', monospace;
  font-size: 0.7rem;
  color: #ff6b6b;
  border: 1px solid #ff6b6b;
  padding: 3px 8px;
  transform: rotate(5deg);
}

.case-content {
  padding: 20px;
}

.case-section {
  margin-bottom: 20px;
}

.case-section h3 {
  font-family: 'Special Elite', monospace;
  font-size: 0.85rem;
  color: var(--burgundy);
  margin-bottom: 8px;
  letter-spacing: 0.1em;
}

.typewriter-text {
  font-family: 'Special Elite', monospace;
  line-height: 1.6;
  color: var(--brown);
}

.evidence-list {
  list-style: none;
  font-family: 'Special Elite', monospace;
  font-size: 0.9rem;
}

.evidence-list li {
  padding: 5px 0;
  border-bottom: 1px dotted var(--brown);
}

.no-evidence {
  font-style: italic;
  color: var(--brown);
  opacity: 0.7;
}

.assign-section {
  border-top: 2px dashed var(--brown);
  padding-top: 15px;
}

.available-operatives {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.assign-op-btn {
  padding: 10px 15px;
  font-family: 'Special Elite', monospace;
  background: var(--forest);
  color: var(--cream);
  border: none;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.assign-op-btn:hover {
  background: #1a3028;
  padding-left: 20px;
}

/* Location Modal */
.location-modal {
  max-width: 400px;
}

.location-modal h2 {
  background: var(--forest);
  color: var(--cream);
  padding: 15px 20px;
  font-family: 'Playfair Display', serif;
}

.location-description {
  padding: 15px 20px;
  font-style: italic;
  border-bottom: 1px dashed var(--brown);
  color: var(--brown);
}

.location-cases {
  padding: 15px;
}

.location-case {
  background: var(--sepia);
  padding: 10px;
  border: 1px solid var(--brown);
  margin-bottom: 10px;
}

.location-case h4 {
  font-family: 'Playfair Display', serif;
  margin-bottom: 5px;
}

.location-case p {
  font-size: 0.85rem;
  color: var(--brown);
  margin-bottom: 10px;
}

.location-case button {
  width: 100%;
  padding: 8px;
  font-family: 'Special Elite', monospace;
  background: var(--burgundy);
  color: var(--cream);
  border: none;
  cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
  .masthead {
    flex-direction: column;
    text-align: center;
  }
  
  .masthead-right {
    justify-content: center;
  }
  
  .bottom-panel {
    flex-direction: column;
    text-align: center;
  }
  
  .staff-skills {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .candidate-card {
    flex-direction: column;
    text-align: center;
  }
}