*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --sky-top: #87ceeb;
  --sky-bottom: #b8e6ff;
  --grass: #6bcB4f;
  --grass-dark: #4a9e3a;
  --panel: #fff8e7;
  --accent: #ff8c42;
  --accent-dark: #e86a1a;
  --text: #2d3436;
  --text-soft: #636e72;
}

html,
body {
  min-height: 100%;
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", "Segoe UI", sans-serif;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 55%, var(--grass) 55%, var(--grass-dark) 100%);
  color: var(--text);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.sky-deco {
  position: fixed;
  inset: 0 0 45%;
  pointer-events: none;
  z-index: 0;
}

.cloud {
  position: absolute;
  font-size: 2.5rem;
  opacity: 0.85;
  animation: drift 18s linear infinite;
}

.c1 { top: 8%; left: -10%; }
.c2 { top: 18%; left: -20%; font-size: 3rem; animation-duration: 24s; animation-delay: -8s; }
.c3 { top: 5%; left: -15%; font-size: 2rem; animation-duration: 20s; animation-delay: -4s; }

@keyframes drift {
  from { transform: translateX(0); }
  to { transform: translateX(120vw); }
}

.app {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
  padding: 0.75rem 1rem 1.5rem;
}

.header {
  text-align: center;
  padding: 0.25rem 0 0.5rem;
}

.header h1 {
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  color: #fff;
  text-shadow: 0 2px 0 #e17055, 0 4px 8px rgba(0, 0, 0, 0.15);
}

.subtitle {
  margin-top: 0.4rem;
  font-size: clamp(0.95rem, 3.5vw, 1.1rem);
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  line-height: 1.5;
}

.subtitle strong {
  color: #ffeaa7;
}

.top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: var(--panel);
  border-radius: 20px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 4px 0 #f0d9b5, 0 8px 20px rgba(0, 0, 0, 0.1);
  border: 3px solid #ffd93d;
}

.stat.big {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.stat-label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-soft);
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--accent-dark);
  line-height: 1;
}

.stat-unit {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}

.cheer {
  flex: 1;
  min-width: 140px;
  text-align: right;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent-dark);
}

.play-wrap {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 6px 0 #3d8b32, 0 12px 28px rgba(0, 0, 0, 0.2);
  border: 4px solid #fff;
  background: #7dce82;
  touch-action: none;
}

#game {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  cursor: grab;
}

#game:active {
  cursor: grabbing;
}

.start-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.35);
  pointer-events: none;
  transition: opacity 0.3s;
}

.start-hint.hidden {
  opacity: 0;
}

.start-hint p {
  background: #fff;
  border: 4px solid #ffd93d;
  border-radius: 20px;
  padding: 1rem 1.5rem;
  font-size: clamp(1.1rem, 4vw, 1.35rem);
  font-weight: 800;
  text-align: center;
  color: var(--accent-dark);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  line-height: 1.4;
  animation: bounce 1s ease infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.collection {
  margin-top: 1rem;
  background: var(--panel);
  border-radius: 20px;
  padding: 0.75rem 1rem 1rem;
  border: 3px solid #a8e6cf;
  box-shadow: 0 4px 0 #d4f5e9;
}

.collection h2 {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.collection-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-height: 56px;
  align-items: center;
}

.empty-msg {
  color: var(--text-soft);
  font-size: 0.95rem;
}

.dino-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 72px;
  background: #fff;
  border-radius: 14px;
  border: 2px solid #dfe6e9;
  animation: badge-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dino-badge .emoji {
  font-size: 2rem;
  line-height: 1;
}

.dino-badge .name {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-soft);
  margin-top: 2px;
  text-align: center;
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes badge-pop {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1rem;
}

.btn {
  border: none;
  border-radius: 16px;
  font-family: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.big-btn {
  padding: 1rem 1.5rem;
  font-size: 1.35rem;
  background: linear-gradient(180deg, #ff9f43, var(--accent-dark));
  color: #fff;
  box-shadow: 0 5px 0 #c44d0a, 0 8px 16px rgba(0, 0, 0, 0.15);
}

.soft-btn {
  padding: 0.75rem 1rem;
  font-size: 1rem;
  background: #dfe6e9;
  color: var(--text);
  box-shadow: 0 3px 0 #b2bec3;
}

.pop {
  position: fixed;
  pointer-events: none;
  z-index: 200;
  font-size: 3rem;
  transform: translate(-50%, -50%);
  animation: pop-float 0.7s ease forwards;
}

.pop .pop-name {
  display: block;
  font-size: 1rem;
  font-weight: 800;
  color: var(--accent-dark);
  text-align: center;
  text-shadow: 0 1px 0 #fff;
}

@keyframes pop-float {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 1; }
  50% { transform: translate(-50%, -80%) scale(1.2); opacity: 1; }
  100% { transform: translate(-50%, -120%) scale(1); opacity: 0; }
}

.pop.hidden {
  display: none;
}
