* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: #FFF8F0;
  font-family: 'Nunito', sans-serif;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  user-select: none;
}

#header {
  background: linear-gradient(135deg, #FF8C1A 0%, #FFBF00 50%, #FF8C1A 100%);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  box-shadow: 0 3px 12px rgba(255,140,26,0.4);
  position: relative;
  z-index: 10;
  flex-shrink: 0;
  min-height: 48px;
}

#title-area {
  flex-shrink: 0;
}

#title-area h1 {
  font-family: 'Lilita One', cursive;
  color: #fff;
  font-size: 1.3rem;
  text-shadow: 2px 2px 0 #c96600, -1px -1px 0 #c96600;
  line-height: 1.1;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

#version-badge {
  background: #fff;
  color: #FF8C1A;
  font-size: 0.55rem;
  padding: 2px 7px;
  border-radius: 12px;
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  animation: sparkle 2s ease-in-out infinite;
  display: inline-block;
}

@keyframes sparkle {
  0%, 100% { transform: scale(1); box-shadow: 0 0 4px rgba(255,191,0,0.5); }
  50% { transform: scale(1.15); box-shadow: 0 0 12px rgba(255,191,0,1); }
}

#subtitle {
  color: rgba(255,255,255,0.85);
  font-size: 0.6rem;
  font-weight: 700;
  font-style: italic;
}

#stats-display {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex-shrink: 1;
  min-width: 0;
}

.stat {
  background: rgba(255,255,255,0.25);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
}

#canvas-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

#mood-indicator {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(255,255,255,0.92);
  border: 2px solid #FF8C1A;
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 900;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  pointer-events: none;
}

#mood-emoji {
  font-size: 1rem;
}

#canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
  touch-action: none;
}

#controls {
  background: linear-gradient(180deg, #FFE8CC 0%, #FFD699 100%);
  padding: 8px 6px;
  display: flex;
  justify-content: center;
  gap: 5px;
  border-top: 3px solid #FF8C1A;
  z-index: 10;
  flex-shrink: 0;
}

.ctrl-btn {
  background: #fff;
  border: 2.5px solid #FF8C1A;
  border-radius: 14px;
  padding: 6px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  transition: all 0.15s ease;
  min-width: 48px;
  min-height: 48px;
  justify-content: center;
}

.ctrl-btn:hover, .ctrl-btn:active {
  background: #FF8C1A;
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(255,140,26,0.4);
}

.ctrl-btn:hover .btn-label, .ctrl-btn:active .btn-label {
  color: #fff;
}

.ctrl-btn.fight-btn {
  border-color: #E53935;
  background: #FFEBEE;
}

.ctrl-btn.fight-btn:hover, .ctrl-btn.fight-btn:active {
  background: #E53935;
}

.btn-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.btn-label {
  font-size: 0.5rem;
  font-weight: 900;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#app-footer {
  background: #333;
  color: #aaa;
  text-align: center;
  padding: 6px 8px;
  font-size: 0.58rem;
  flex-shrink: 0;
  line-height: 1.4;
}

#app-footer a {
  color: #FFBF00;
  text-decoration: none;
  font-weight: 700;
}

#app-footer a:hover {
  text-decoration: underline;
}

/* Mobile optimizations */
@media (max-width: 500px) {
  #header {
    padding: 6px 8px;
    min-height: 44px;
    flex-wrap: wrap;
  }
  #title-area h1 { font-size: 1rem; }
  #subtitle { font-size: 0.5rem; }
  #stats-display {
    gap: 3px;
    width: 100%;
    justify-content: flex-start;
  }
  .stat { font-size: 0.5rem; padding: 1px 5px; }
  .ctrl-btn {
    padding: 5px 6px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 12px;
  }
  .btn-icon { font-size: 1.1rem; }
  .btn-label { font-size: 0.45rem; }
  #mood-indicator { font-size: 0.62rem; padding: 3px 8px; }
  #mood-emoji { font-size: 0.9rem; }
  #app-footer { font-size: 0.5rem; padding: 5px 6px; }
}

@media (max-width: 360px) {
  #controls { gap: 3px; padding: 6px 4px; }
  .ctrl-btn { min-width: 40px; min-height: 40px; padding: 4px 5px; }
  .btn-icon { font-size: 1rem; }
  .btn-label { font-size: 0.4rem; }
}