/* ============================================================
   Pawflow · Understanding You — Premium Mobile UI
   Warm cozy palette from design mockups
   ============================================================ */
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css');

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

:root {
  /* Bright cozy palette (design mockup) */
  --cream: #faf6f1;
  --cream-dark: #f0e6db;
  --sand: #e5d5c3;
  --warm-bg: #f5efe8;
  --warm-surface: #ffffff;
  --warm-elevated: #fff9f3;
  --warm-border: rgba(90, 60, 40, 0.1);
  --primary: #e08955;
  --primary-soft: rgba(224, 137, 85, 0.14);
  --primary-deep: #c46a35;
  --accent: #3d9b8f;
  --accent-soft: rgba(61, 155, 143, 0.12);
  --success: #4a9b6a;
  --warning: #d4a03c;
  --danger: #d45a55;
  --text: #3a2e26;
  --text-secondary: #6b5a4e;
  --text-muted: #9a8778;
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 24px;
  --radius-full: 999px;
  --shadow: 0 10px 40px rgba(90, 50, 20, 0.12);
  --shadow-soft: 0 4px 16px rgba(90, 50, 20, 0.08);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --hud-h: auto;
  --action-h: 88px;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--warm-bg);
  color: var(--text);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ---------- Screens ---------- */
.screen {
  display: none;
  flex-direction: column;
  height: 100%;
  opacity: 0;
}
.screen.active {
  display: flex;
  animation: screenIn 0.4s var(--ease) forwards;
}
@keyframes screenIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* ============================================================
   LOGIN
   ============================================================ */
#login-screen {
  justify-content: center;
  align-items: center;
  padding: 32px 24px;
  background:
    radial-gradient(ellipse 90% 55% at 50% -10%, rgba(224, 137, 85, 0.18) 0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 100%, rgba(61, 155, 143, 0.1) 0%, transparent 45%),
    linear-gradient(180deg, #fff9f3 0%, var(--warm-bg) 100%);
  text-align: center;
}

.login-hero {
  margin-bottom: 40px;
}
.logo-wrap {
  width: 108px;
  height: 108px;
  margin: 0 auto 22px;
  border-radius: 36px;
  background: linear-gradient(160deg, #fff 0%, #fff3e8 100%);
  border: 1px solid rgba(224, 137, 85, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.4rem;
  box-shadow: 0 12px 40px rgba(224, 137, 85, 0.2), inset 0 1px 0 #fff;
  animation: floatLogo 3.5s ease-in-out infinite;
}
@keyframes floatLogo {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.login-title {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 10px;
  color: var(--text);
}
.login-sub {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 280px;
  margin: 0 auto;
}

.login-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 320px;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 16px 24px;
  border: 1.5px solid rgba(0,0,0,0.08);
  border-radius: var(--radius-full);
  background: #fff;
  color: #222;
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  transition: transform 0.15s var(--ease), box-shadow 0.15s, border-color 0.15s;
}
.btn-google:hover { border-color: rgba(224,137,85,0.4); box-shadow: 0 6px 20px rgba(224,137,85,0.15); }
.btn-google:active { transform: scale(0.97); }
.btn-google svg { flex-shrink: 0; }

.btn-ghost {
  width: 100%;
  padding: 14px;
  border: 1.5px solid var(--warm-border);
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.6);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 650;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary-deep); }
.btn-ghost:active { background: #fff; color: var(--text); }

.login-note {
  margin-top: 28px;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
  opacity: 0.8;
}

/* ============================================================
   BREED SELECT
   ============================================================ */
#breed-screen {
  background: linear-gradient(180deg, #fff9f3 0%, var(--warm-bg) 30%);
}

.top-bar {
  padding: 12px 16px;
  padding-top: calc(12px + var(--safe-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.top-bar h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.top-bar .hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.breed-grid {
  flex: 1;
  overflow-y: auto;
  padding: 8px 14px 100px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  -webkit-overflow-scrolling: touch;
  align-content: start;
}
@media (min-width: 480px) {
  .breed-grid { grid-template-columns: repeat(3, 1fr); max-width: 560px; margin: 0 auto; width: 100%; }
}

.breed-card {
  position: relative;
  background: #fff;
  border-radius: var(--radius);
  padding: 18px 12px 14px;
  text-align: center;
  cursor: pointer;
  border: 2px solid rgba(90,60,40,0.06);
  transition: border-color 0.2s, transform 0.15s var(--ease), background 0.2s, box-shadow 0.2s;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(90,50,20,0.05);
}
.breed-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, var(--primary-soft) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}
.breed-card:active { transform: scale(0.96); }
.breed-card.selected {
  border-color: var(--primary);
  background: #fffaf5;
  box-shadow: 0 0 0 1px var(--primary), 0 10px 28px rgba(224, 137, 85, 0.2);
}
.breed-card.selected::before { opacity: 1; }

.breed-card .emoji {
  font-size: 2.8rem;
  display: block;
  margin-bottom: 8px;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.25));
  position: relative;
  transition: transform 0.3s var(--ease);
}
.breed-card.selected .emoji { transform: scale(1.08); }
.breed-card .name {
  font-weight: 750;
  font-size: 0.92rem;
  position: relative;
  margin-bottom: 2px;
}
.breed-card .name-en {
  font-size: 0.7rem;
  color: var(--text-muted);
  position: relative;
}
.breed-card .stats {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
  position: relative;
}
.stat-pill {
  background: rgba(90,60,40,0.08);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
}

.bottom-sheet-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  background: linear-gradient(180deg, transparent, #f5efe8ee 25%);
  z-index: 20;
}
.btn-primary {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  display: block;
  padding: 16px 24px;
  border: none;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #f0a06a 0%, var(--primary) 45%, var(--primary-deep) 100%);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 800;
  font-family: var(--font);
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(196, 106, 53, 0.35), inset 0 1px 0 rgba(255,255,255,0.25);
  transition: transform 0.15s var(--ease), opacity 0.2s, box-shadow 0.2s;
  letter-spacing: -0.01em;
}
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
  filter: grayscale(0.3);
}
.btn-primary:not(:disabled):hover {
  box-shadow: 0 10px 32px rgba(196, 106, 53, 0.45);
}
.btn-primary:not(:disabled):active {
  transform: scale(0.97);
  box-shadow: 0 4px 14px rgba(196, 106, 53, 0.3);
}

/* ============================================================
   GAME SCREEN
   ============================================================ */
#game-screen {
  background: linear-gradient(180deg, #fff9f3 0%, #f5efe8 40%, #efe6db 100%);
  position: relative;
}

/* HUD */
.hud {
  padding: 10px 14px 8px;
  padding-top: calc(10px + var(--safe-top));
  flex-shrink: 0;
  z-index: 15;
  background: linear-gradient(180deg, #fff9f3ee 70%, transparent);
}

.hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.dog-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.dog-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.55rem;
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(224, 137, 85, 0.25);
}
.dog-identity .info { min-width: 0; }
.dog-identity .name {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dog-identity .meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.hud-chips {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.chip {
  background: #fff;
  border: 1px solid rgba(90,60,40,0.08);
  padding: 5px 11px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 1px 4px rgba(90,50,20,0.05);
}

/* Status meters */
.meters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
}
.meter {
  display: flex;
  align-items: center;
  gap: 6px;
}
.meter .ico {
  font-size: 0.9rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.meter .lbl {
  font-size: 0.65rem;
  font-weight: 650;
  color: var(--text-muted);
  width: 40px;
  flex-shrink: 0;
}
.meter-track {
  flex: 1;
  height: 7px;
  background: rgba(90,60,40,0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}
.meter-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.5s var(--ease);
  position: relative;
}
.meter-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2));
  border-radius: inherit;
}
.meter-fill.stress { background: linear-gradient(90deg, #8fbc8f, #e8c07a, #e07a7a); }
.meter-fill.energy { background: linear-gradient(90deg, #7eb8b0, #5a9e96); }
.meter-fill.trust { background: linear-gradient(90deg, #e8a87c, #c47d52); }
.meter-fill.hunger { background: linear-gradient(90deg, #c5d86d, #9ab04a); }

/* ---------- Viewport ---------- */
.viewport {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
}

.room {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 55% at 50% 90%, rgba(224, 137, 85, 0.12) 0%, transparent 55%),
    radial-gradient(ellipse 45% 35% at 15% 15%, rgba(61, 155, 143, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 40% 30% at 85% 25%, rgba(232, 168, 124, 0.1) 0%, transparent 45%);
  pointer-events: none;
}
.room::after {
  content: '';
  position: absolute;
  bottom: 0; left: -10%; right: -10%;
  height: 28%;
  background: linear-gradient(180deg, transparent, rgba(229, 213, 195, 0.55));
  border-radius: 50% 50% 0 0 / 25%;
}

/* Mentor card */
.mentor {
  position: absolute;
  top: 8px;
  left: 12px;
  right: 12px;
  display: none;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(61, 155, 143, 0.25);
  border-radius: var(--radius);
  z-index: 25;
  box-shadow: var(--shadow);
  animation: mentorIn 0.35s var(--ease);
}
.mentor.show { display: flex; }
@keyframes mentorIn {
  from { opacity: 0; transform: translateY(-16px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
.mentor-face {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #5a9e96);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}
.mentor-body { flex: 1; min-width: 0; }
.mentor-who {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 3px;
  letter-spacing: 0.02em;
}
.mentor-msg {
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--text);
}
.mentor-x {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
}

/* Dog stage */
.stage {
  position: relative;
  width: min(280px, 72vw);
  height: min(280px, 72vw);
  display: flex;
  align-items: center;
  justify-content: center;
}
.stage-glow {
  position: absolute;
  width: 70%;
  height: 70%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--primary-soft) 0%, transparent 70%);
  filter: blur(20px);
  animation: glowPulse 4s ease-in-out infinite;
}
@keyframes glowPulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.08); }
}

.dog-video-wrap {
  position: absolute;
  inset: 8%;
  border-radius: 24px;
  overflow: hidden;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.45s;
  pointer-events: none;
  background: #000;
}
.dog-video-wrap.active { opacity: 1; pointer-events: auto; }
.dog-video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dog-emoji {
  font-size: clamp(5.5rem, 26vw, 8.5rem);
  line-height: 1;
  z-index: 2;
  position: relative;
  filter: drop-shadow(0 12px 24px rgba(90,50,20,0.2));
  transition: transform 0.35s var(--ease), opacity 0.35s, filter 0.35s;
  will-change: transform;
}
.dog-emoji.hidden-by-video { opacity: 0; pointer-events: none; }

/* calm: gentle breathing */
.dog-emoji.calm { animation: dogBreathe 2.8s ease-in-out infinite; }
/* curious: head tilt + scan */
.dog-emoji.curious { animation: dogCurious 2.4s ease-in-out infinite; }
/* anxious: micro-shake + tension */
.dog-emoji.anxious { animation: dogAnxious 0.55s ease-in-out infinite; }
/* stressed: freeze + red pulse shadow */
.dog-emoji.stressed { animation: dogStressed 1.6s ease-in-out infinite; }
/* excited: bounce + wiggle */
.dog-emoji.excited { animation: dogExcited 0.5s ease-in-out infinite; }
/* tired: sink + slow sway */
.dog-emoji.tired { animation: dogTired 3.5s ease-in-out infinite; opacity: 0.88; }

@keyframes dogBreathe {
  0%, 100% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.04) translateY(-4px); }
}
@keyframes dogCurious {
  0%, 100% { transform: rotate(0deg) translateY(0) scale(1); }
  20% { transform: rotate(-10deg) translateY(-2px) scale(1.02); }
  50% { transform: rotate(8deg) translateY(-6px) scale(1.03); }
  75% { transform: rotate(-4deg) translateY(-2px) scale(1.01); }
}
@keyframes dogAnxious {
  0%, 100% { transform: translate(0, 0) rotate(0deg) scale(1); }
  15% { transform: translate(-2px, 1px) rotate(-2deg) scale(0.99); }
  30% { transform: translate(3px, -1px) rotate(2deg) scale(1.01); }
  45% { transform: translate(-2px, 0) rotate(-1deg); }
  60% { transform: translate(2px, 1px) rotate(1.5deg); }
  80% { transform: translate(-1px, -1px) rotate(-0.5deg); }
}
@keyframes dogStressed {
  0%, 100% {
    transform: scale(0.96) translateY(2px);
    filter: drop-shadow(0 12px 24px rgba(212, 90, 85, 0.25));
  }
  40% {
    transform: scale(0.94) translateY(3px);
    filter: drop-shadow(0 8px 20px rgba(212, 90, 85, 0.4));
  }
  70% {
    transform: scale(0.97) translateY(1px);
    filter: drop-shadow(0 14px 28px rgba(212, 90, 85, 0.2));
  }
}
@keyframes dogExcited {
  0% { transform: translateY(0) rotate(0deg) scale(1); }
  25% { transform: translateY(-16px) rotate(-6deg) scale(1.06); }
  50% { transform: translateY(-4px) rotate(4deg) scale(1.03); }
  75% { transform: translateY(-20px) rotate(-3deg) scale(1.07); }
  100% { transform: translateY(0) rotate(0deg) scale(1); }
}
@keyframes dogTired {
  0%, 100% { transform: scale(0.94) translateY(6px) rotate(-2deg); }
  50% { transform: scale(0.95) translateY(8px) rotate(2deg); }
}

/* shadow under dog for depth */
.stage::after {
  content: '';
  position: absolute;
  bottom: 12%;
  left: 50%;
  width: 45%;
  height: 10px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse, rgba(90,50,20,0.18) 0%, transparent 70%);
  border-radius: 50%;
  z-index: 0;
  pointer-events: none;
}

/* Floating signals */
.signal-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}
.signal-icon {
  position: absolute;
  font-size: 1.85rem;
  animation: floatSignal 2.6s var(--ease) forwards;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,0.5));
}
@keyframes floatSignal {
  0% { opacity: 0; transform: scale(0.2) translateY(20px); }
  12% { opacity: 1; transform: scale(1.25) translateY(0); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: scale(0.7) translateY(-72px); }
}

/* State pill under dog */
.state-pill {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid rgba(90,60,40,0.1);
  padding: 7px 18px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 7px;
  z-index: 4;
  box-shadow: 0 4px 16px rgba(90,50,20,0.1);
  white-space: nowrap;
}
.state-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: dotPulse 1.5s infinite;
}
@keyframes dotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.4); }
}

/* Behavior caption */
.caption {
  margin-top: 28px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #fff;
  border: 1px solid rgba(90,60,40,0.08);
  border-radius: var(--radius-sm);
  max-width: 90%;
  box-shadow: 0 2px 12px rgba(90,50,20,0.06);
}
.caption .ico {
  font-size: 1.35rem;
  flex-shrink: 0;
  opacity: 0.7;
}
.caption .txt { min-width: 0; }
.caption .label {
  font-size: 0.84rem;
  font-weight: 650;
  color: var(--text);
  margin-bottom: 1px;
}
.caption .key {
  font-size: 0.68rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Observe mode */
.observe-mode .stage {
  outline: 2px dashed var(--accent);
  outline-offset: 16px;
  border-radius: 50%;
}
.observe-hint {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-soft);
  border: 1px solid rgba(126, 184, 176, 0.4);
  color: var(--accent);
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 650;
  z-index: 15;
  display: none;
  white-space: nowrap;
  animation: screenIn 0.3s var(--ease);
}
.observe-mode .observe-hint { display: block; }

/* Clicker feedback */
.clicker-fx {
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  pointer-events: none;
  z-index: 30;
  opacity: 0;
  text-shadow: 0 4px 24px rgba(0,0,0,0.6);
}
.clicker-fx.show { animation: fxPop 0.85s var(--ease) forwards; }
@keyframes fxPop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
  25% { opacity: 1; transform: translate(-50%, -50%) scale(1.3); }
  100% { opacity: 0; transform: translate(-50%, -90%) scale(1); }
}
.clicker-fx.perfect { color: var(--success); }
.clicker-fx.good { color: var(--warning); }
.clicker-fx.miss { color: var(--danger); }

/* Walk overlay */
.walk-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #e8f0ea 0%, #d5e5d9 100%);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 30;
  animation: screenIn 0.3s var(--ease);
}
.walk-overlay.active { display: flex; }
.walk-scene {
  font-size: 3.5rem;
  margin-bottom: 16px;
  animation: walkBob 1.2s ease-in-out infinite;
}
@keyframes walkBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
.walk-info {
  text-align: center;
  color: var(--text);
  font-size: 0.9rem;
  margin-bottom: 20px;
  line-height: 1.5;
}
.walk-info strong { color: var(--text); font-weight: 700; }
.walk-progress-bar {
  width: 180px;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 0 auto 20px;
}
.walk-progress-bar i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  border-radius: inherit;
  transition: width 0.4s var(--ease);
}
.btn-cancel-walk {
  padding: 10px 22px;
  border-radius: var(--radius-full);
  border: 1px solid var(--warm-border);
  background: var(--warm-surface);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 650;
  font-family: var(--font);
  cursor: pointer;
}

/* ---------- Action dock ---------- */
.dock {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 10px 8px calc(10px + var(--safe-bottom));
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(90,60,40,0.08);
  box-shadow: 0 -4px 24px rgba(90,50,20,0.06);
  flex-shrink: 0;
  z-index: 15;
}
.dock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.62rem;
  font-weight: 600;
  padding: 6px 2px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
  -webkit-user-select: none;
}
.dock-btn:active { background: rgba(255,255,255,0.05); }
.dock-btn .ico {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  border-radius: 16px;
  background: linear-gradient(180deg, #fff 0%, #faf4ed 100%);
  border: 1px solid rgba(90,60,40,0.07);
  box-shadow: 0 2px 6px rgba(90,50,20,0.05);
  transition: background 0.2s, box-shadow 0.2s, transform 0.15s var(--ease), border-color 0.2s;
}
.dock-btn:active .ico { transform: scale(0.9); }
.dock-btn.active .ico,
.dock-btn:active .ico {
  background: linear-gradient(180deg, #f5b07a 0%, var(--primary) 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 16px rgba(224, 137, 85, 0.4);
}
.dock-btn .lbl {
  color: var(--text-muted);
  letter-spacing: -0.01em;
  margin-top: 1px;
}
.dock-btn.active .lbl { color: var(--primary-deep); font-weight: 700; }
.dock-btn.highlight .ico {
  animation: ringPulse 1.3s infinite;
  border-color: var(--primary);
}
@keyframes ringPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 137, 85, 0.45); }
  50% { box-shadow: 0 0 0 10px rgba(224, 137, 85, 0); }
}

/* Toast */
.toast {
  position: fixed;
  bottom: calc(var(--action-h) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #fff;
  border: 1px solid rgba(90,60,40,0.1);
  color: var(--text);
  padding: 12px 22px;
  border-radius: var(--radius-full);
  font-size: 0.86rem;
  font-weight: 650;
  z-index: 60;
  opacity: 0;
  transition: all 0.3s var(--ease);
  pointer-events: none;
  max-width: 88%;
  text-align: center;
  box-shadow: 0 8px 28px rgba(90,50,20,0.12);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Modal bottom sheet */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: none;
  align-items: flex-end;
  z-index: 100;
  animation: fadeIn 0.2s;
}
.sheet-backdrop.show { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  background: #fff;
  width: 100%;
  max-height: 82vh;
  border-radius: 24px 24px 0 0;
  padding: 12px 20px calc(20px + var(--safe-bottom));
  overflow-y: auto;
  animation: sheetUp 0.35s var(--ease);
}
@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: none; }
}
.sheet-handle {
  width: 40px;
  height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  margin: 0 auto 16px;
}
.sheet-emoji {
  text-align: center;
  font-size: 3.2rem;
  margin-bottom: 8px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}
.sheet h2 {
  text-align: center;
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 2px;
}
.sheet .en {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 14px;
}
.sheet p {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.section-label {
  font-size: 0.75rem;
  font-weight: 750;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 14px 0 8px;
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}
.tag {
  background: rgba(90,60,40,0.08);
  border: 1px solid var(--warm-border);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 550;
  color: var(--text-secondary);
}
.habit-list {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.75;
}

/* Responsive desktop */
@media (min-width: 640px) {
  .dock { max-width: 480px; margin: 0 auto; border-radius: 20px 20px 0 0; }
  .hud { max-width: 560px; margin: 0 auto; width: 100%; }
  .viewport { max-width: 560px; margin: 0 auto; }
}
@media (min-width: 900px) {
  #game-screen { flex-direction: row; }
  .hud {
    width: 280px;
    height: 100%;
    border-right: 1px solid var(--warm-border);
    flex-direction: column;
    justify-content: flex-start;
  }
  .meters { grid-template-columns: 1fr; }
  .dock {
    width: 280px;
    grid-template-columns: 1fr;
    height: auto;
    border-radius: 0;
    border-top: none;
    border-left: 1px solid var(--warm-border);
  }
  .dock-btn {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 12px 14px;
  }
  .dock-btn .lbl { font-size: 0.88rem; }
}

/* ============================================================
   LANGUAGE PICKER
   ============================================================ */
.lang-select {
  padding: 6px 28px 6px 12px;
  border: 1.5px solid var(--warm-border);
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.75) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E") no-repeat right 11px center;
  color: var(--text-secondary);
  font: 600 0.8rem var(--font);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.lang-select:focus { outline: none; border-color: var(--primary); }
.login-lang {
  position: absolute;
  top: calc(14px + var(--safe-top));
  right: 16px;
}
#login-screen { position: relative; }
.top-bar { gap: 10px; }
.top-bar .hint { margin-left: auto; }
.top-bar h1 { white-space: nowrap; }
@media (max-width: 480px) {
  .top-bar .hint { display: none; }
  .top-bar .lang-select { margin-left: auto; }
}
