:root {
  --bg-cream: #FFF5E1;
  --bg-white: #FFFFFF;
  --bg-black: #000000;
  --text-dark: #1A1A1A;
  --text-muted: #555555;
  --border: #000000;
  --yellow: #FFD600;
  --pink: #FF4D8D;
  --blue: #5B7FFF;
  --orange: #FF6B35;
  --teal: #00C2A8;
  --green: #2ECC71;
  --red: #E74C3C;
  --shadow: 4px 4px 0 #000;
  --shadow-lg: 8px 8px 0 #000;
  --radius: 6px;
  --font-title: 'Montserrat', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-body: 'Inter', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg-cream);
  color: var(--text-dark);
  line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  font-weight: 800;
  margin: 0 0 0.5em;
  letter-spacing: -0.02em;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: 3px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--border);
  transition: transform 0.1s, box-shadow 0.1s;
  background: var(--bg-white);
  color: var(--text-dark);
  text-transform: none;
}

.btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--border);
}

.btn-primary { background: var(--yellow); }
.btn-pink { background: var(--pink); color: white; }
.btn-blue { background: var(--blue); color: white; }
.btn-orange { background: var(--orange); color: white; }
.btn-teal { background: var(--teal); color: white; }
.btn-green { background: var(--green); color: white; }
.btn-red { background: var(--red); color: white; }
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.card {
  background: var(--bg-white);
  border: 4px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}

.card-cream { background: var(--bg-cream); }
.card-yellow { background: var(--yellow); }
.card-pink { background: var(--pink); color: white; }
.card-blue { background: var(--blue); color: white; }
.card-orange { background: var(--orange); color: white; }
.card-teal { background: var(--teal); color: white; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 2px solid var(--border);
  border-radius: 20px;
  font-weight: 700;
  font-size: 12px;
  background: var(--bg-white);
}

input, select, textarea {
  border: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-family: var(--font-body);
  font-size: 14px;
  box-shadow: 2px 2px 0 var(--border);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  box-shadow: 2px 2px 0 var(--border), 0 0 0 3px rgba(91,127,255,0.3);
}

.grid-map {
  display: grid;
  grid-template-columns: repeat(20, 1fr);
  gap: 2px;
  background: #87CEEB;
  border: 4px solid var(--border);
  padding: 4px;
  border-radius: var(--radius);
}

.grid-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid rgba(0,0,0,0.1);
  cursor: pointer;
  position: relative;
  transition: transform 0.1s;
}

.grid-cell:hover { transform: scale(1.15); z-index: 2; }
.grid-cell.empty { background: rgba(255,255,255,0.3); color: rgba(0,0,0,0.3); }
.grid-cell.resource { background: var(--cell-color, #fff); color: #000; border-color: #000; }
.grid-cell.selected { outline: 3px solid var(--yellow); outline-offset: -2px; }
.grid-cell .amount { font-size: 8px; position: absolute; bottom: 1px; right: 2px; font-family: var(--font-mono); font-weight: 900; }
.grid-cell .cell-coord { font-size: 7px; position: absolute; top: 1px; left: 2px; opacity: 0.7; font-family: var(--font-mono); }

.resource-red { --cell-color: #E74C3C; color: white !important; }
.resource-yellow { --cell-color: #FFD600; }
.resource-green { --cell-color: #2ECC71; }
.resource-blue { --cell-color: #3498DB; color: white !important; }
.resource-black { --cell-color: #1A1A1A; color: white !important; }
.resource-white { --cell-color: #FFFFFF; }

.stat-card {
  text-align: center;
  padding: 12px;
  border: 3px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 3px 3px 0 var(--border);
  background: var(--bg-white);
}

.stat-card .value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 800;
  display: block;
}

.stat-card .label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 4px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 16px;
}

.tab {
  padding: 8px 16px;
  border: 3px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-white);
  font-weight: 700;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--border);
}

.tab.active { background: var(--yellow); }

.log-entry {
  padding: 8px 12px;
  border-left: 4px solid var(--border);
  margin-bottom: 6px;
  background: var(--bg-white);
  font-size: 13px;
}

.pulse { animation: pulse 1.5s infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@media (max-width: 768px) {
  .grid-map { grid-template-columns: repeat(10, 1fr); }
  .grid-cell { font-size: 8px; }
}
