:root {
  --bg-deep: #0d141c;
  --bg-elevated: #233044;
  --border: #2c3c54;
  --text-main: #eaf1fb;
  --text-sub: #94a6c2;
  --accent: #4ade80;
  --accent-strong: #16a34a;
  --sky-accent: #38bdf8;
  --warning: #fbbf24;
  --font-sans: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-sans);
  overflow: hidden;
}

.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
}

.viewport-pane {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #5da9e9 0%, #8ecae6 48%, #b8e1ff 100%);
}

.hud-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 48px;
  flex: 0 0 48px;
  padding: 0 14px;
  background: rgba(16, 24, 36, 0.92);
  border-bottom: 1px solid var(--border);
  flex-wrap: nowrap;
  overflow: hidden;
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex-wrap: nowrap;
  overflow: hidden;
}

.app-title {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(74, 222, 128, 0.16);
  color: var(--accent);
  border: 1px solid rgba(74, 222, 128, 0.4);
}

.stat-group {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.stat {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.stat-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-sub);
  letter-spacing: 0.04em;
}

.stat-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
}

#hud-fps {
  display: inline-block;
  width: 46px;
  color: var(--accent);
}

#hud-time {
  display: inline-block;
  width: 68px;
  color: var(--warning);
}

#hud-pos {
  display: inline-block;
  width: 112px;
}

#hud-ground {
  display: inline-block;
  width: 78px;
}

#hud-biome {
  display: inline-block;
  width: 68px;
  color: var(--sky-accent);
}

.hud-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  white-space: nowrap;
}

.btn {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-torch {
  background: #b45309;
  color: #fef3c7;
  border-color: #f59e0b;
}

.btn-torch:hover {
  background: #d97706;
}

.btn-primary {
  background: var(--accent-strong);
  color: #fff;
}

.btn-primary:hover {
  background: #22c55e;
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-main);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: #2d3e58;
}

.btn-github {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  background: #0f1724;
  color: var(--text-main);
  border-color: #3a4d6a;
}

.btn-github:hover {
  background: #1c293e;
  border-color: #5b769e;
}

.github-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.canvas-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#world-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#world-canvas:active {
  cursor: grabbing;
}

.controls-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 8px 16px;
  font-size: 12px;
  color: var(--text-sub);
  background: rgba(14, 21, 32, 0.95);
  border-top: 1px solid var(--border);
}

kbd {
  display: inline-block;
  padding: 1px 5px;
  margin: 0 1px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-main);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
}
