/* ==========================================================================
   🐾 뽁파크 작은 방 기록 (/dog & /cat) — Analog Picture-Book & Felt UI Styles
   Strict Palette: No #FFFFFF, No #000000, No cold glassmorphism.
   Warm Oatmeal (#F5F0E6), Kraft Paper (#E8DEC8), Deep Charcoal Brown (#3A322C),
   4PM Sunlight Gold (#F3C677).
   ========================================================================== */

:root {
  --bg-desk: #E3D7C1;
  --bg-oatmeal: #F5F0E6;
  --bg-kraft: #E8DEC8;
  --bg-kraft-deep: #DDD0B5;
  --bg-linen: #EFE8DA;
  --ink-charcoal: #3A322C;
  --ink-walnut: #5E5045;
  --ink-muted: #87786B;
  --ink-faint: #ABA093;
  --sun-gold: #F3C677;
  --sun-amber: #E0A44C;
  --terracotta: #CF7E61;
  --sage-felt: #889A7B;
  --dusk-bg: #2E282B;
  --night-bg: #242129;
  --paper-line: rgba(58, 50, 44, 0.14);
  --paper-shadow: rgba(58, 50, 44, 0.12);
  --haptic-scale: 1;
  --font-serif: 'Gowun Batang', 'Apple SD Gothic Neo', 'Nanum Myeongjo', Georgia, serif;
  --font-round: 'Gowun Dodum', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

input, textarea {
  user-select: text;
  -webkit-user-select: text;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  background-color: var(--bg-desk);
  color: var(--ink-charcoal);
  font-family: var(--font-serif);
  -webkit-font-smoothing: antialiased;
}

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Outer frame: full-bleed 100vw x 100dvh 3D cozy picture-book world on both mobile & desktop */
.app-shell {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  background-color: var(--bg-oatmeal);
  overflow: hidden;
  touch-action: none;
  transform: scale(var(--haptic-scale));
  transition: transform 0.09s ease-out, background-color 0.8s ease;
}

.app-shell.theme-dark {
  color: #EAE2D3;
}

/* 3D Cozy Picture-Book WebGL Layer */
.webgl-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  touch-action: none;
}

.webgl-container canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Fixed SVG Paper Grain Texture Overlay (opacity 0.06) */
.paper-grain-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 90;
  opacity: 0.055;
  mix-blend-mode: multiply;
}

.app-shell.theme-dark .paper-grain-overlay {
  mix-blend-mode: soft-light;
  opacity: 0.075;
}

/* 2D Animal Vision, Particles & Horizontal Eyelid Overlay Canvas */
#scene-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 8;
  pointer-events: none;
}

/* Boiling-line SVG Foreground Layer (1st-person Ears & Paws) */
.pov-silhouette-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 12;
  filter: url(#crayon-boil);
}

.pov-silhouette-layer.hidden {
  display: none;
}

/* Top Sketchbook Header */
.top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 10px 4px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  z-index: 35;
  pointer-events: none;
}

.top-bar > * {
  pointer-events: auto;
}

.top-left-group {
  display: contents;
}

.top-right-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  margin-left: auto;
}

.felt-icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 5px 9px;
  background-color: rgba(232, 222, 200, 0.92);
  color: var(--ink-charcoal);
  border: 1.5px solid rgba(58, 50, 44, 0.26);
  border-radius: 20px 14px 18px 15px / 15px 18px 14px 20px;
  font-family: var(--font-round);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 1px 2px 0 rgba(58, 50, 44, 0.12);
  transition: transform 0.14s ease, background-color 0.25s ease;
}

.felt-icon-btn.hidden {
  display: none;
}

.felt-icon-btn.active-toggle,
.felt-icon-btn.active-mode {
  background-color: var(--sun-gold);
  color: var(--ink-charcoal);
  border-color: var(--ink-charcoal);
}

.felt-icon-btn:active {
  transform: translateY(1.5px) scale(0.97);
}

.app-shell.theme-dark .felt-icon-btn {
  background-color: rgba(58, 51, 55, 0.92);
  color: #EAE2D3;
  border-color: rgba(234, 226, 211, 0.22);
}

.app-shell.theme-dark .felt-icon-btn.active-toggle,
.app-shell.theme-dark .felt-icon-btn.active-mode {
  background-color: var(--sun-gold);
  color: var(--ink-charcoal);
}

/* Time-of-Day Chapter Selector */
.time-chip-bar {
  order: 3;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 3px 4px;
  background-color: rgba(232, 222, 200, 0.88);
  border: 1px solid rgba(58, 50, 44, 0.2);
  border-radius: 18px;
}

@media (min-width: 720px) {
  .top-left-group {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .time-chip-bar {
    order: 0;
    width: auto;
    display: inline-flex;
  }
}

.time-chip-bar.hidden {
  display: none;
}

.app-shell.theme-dark .time-chip-bar {
  background-color: rgba(46, 40, 43, 0.86);
  border-color: rgba(234, 226, 211, 0.2);
}

.time-chip {
  padding: 4px 8px;
  border: none;
  border-radius: 13px;
  background: transparent;
  color: var(--ink-walnut);
  font-family: var(--font-round);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.app-shell.theme-dark .time-chip {
  color: #D8CFC0;
}

.time-chip.active,
.app-shell.theme-dark .time-chip.active {
  background-color: var(--sun-gold);
  color: var(--ink-charcoal);
  box-shadow: 0 1px 3px rgba(58, 50, 44, 0.18);
}

.sr-stage-dots {
  display: none;
}

/* Pet Body & Instinct Gauges Strip */
.pet-needs-bar {
  position: absolute;
  top: calc(75px + env(safe-area-inset-top, 0px));
  left: 10px;
  right: 10px;
  z-index: 32;
  display: flex;
  justify-content: center;
  gap: 5px;
  pointer-events: none;
}

@media (min-width: 720px) {
  .pet-needs-bar {
    top: calc(46px + env(safe-area-inset-top, 0px));
  }
}

.pet-needs-bar.hidden {
  display: none;
}

.need-pill {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  background-color: rgba(245, 240, 230, 0.86);
  border: 1px solid rgba(58, 50, 44, 0.18);
  border-radius: 14px;
  font-size: 11.5px;
  box-shadow: 0 2px 6px rgba(58, 50, 44, 0.08);
}

.app-shell.theme-dark .need-pill {
  background-color: rgba(46, 40, 44, 0.86);
  border-color: rgba(234, 226, 211, 0.18);
}

.need-pill.urgent {
  border-color: var(--terracotta);
  background-color: rgba(243, 198, 119, 0.94);
  animation: gentleBob 0.9s ease-in-out infinite;
}

.need-track {
  width: 34px;
  height: 6px;
  border-radius: 4px;
  background-color: rgba(58, 50, 44, 0.15);
  overflow: hidden;
}

.app-shell.theme-dark .need-track {
  background-color: rgba(234, 226, 211, 0.18);
}

.need-fill {
  height: 100%;
  width: 30%;
  border-radius: 4px;
  background-color: var(--sage-felt);
  transition: width 0.35s ease, background-color 0.35s ease;
}

.need-fill.warn {
  background-color: var(--terracotta);
}

.need-fill.warm {
  background-color: var(--sun-amber);
}

/* Poetic Sensory Monologue Box (Compact so 3D world stays wide open) */
.monologue-wrap {
  position: absolute;
  top: calc(104px + env(safe-area-inset-top, 0px));
  left: 14px;
  right: 14px;
  z-index: 25;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: opacity 0.45s ease, transform 0.35s ease;
}

@media (min-width: 720px) {
  .monologue-wrap {
    top: calc(76px + env(safe-area-inset-top, 0px));
  }
}

.monologue-wrap.faded .monologue-box {
  opacity: 0.42;
}

.monologue-wrap.hidden {
  opacity: 0;
  transform: translateY(-6px);
  visibility: hidden;
}

.chapter-tag {
  font-family: var(--font-round);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--ink-walnut);
  background-color: rgba(232, 222, 200, 0.88);
  padding: 2px 10px;
  border-radius: 12px 15px 12px 14px;
  border: 1px solid rgba(58, 50, 44, 0.15);
  margin-bottom: 5px;
  transition: opacity 0.4s ease;
}

.app-shell.theme-dark .chapter-tag {
  background-color: rgba(58, 51, 55, 0.85);
  color: #D8CFC0;
  border-color: rgba(234, 226, 211, 0.18);
}

.monologue-box {
  max-width: 390px;
  min-height: 40px;
  padding: 8px 15px;
  background-color: rgba(245, 240, 230, 0.84);
  border: 1.5px solid rgba(58, 50, 44, 0.18);
  border-radius: 18px 13px 20px 14px / 14px 20px 13px 18px;
  box-shadow: 2px 4px 12px rgba(58, 50, 44, 0.08);
  transition: background-color 0.5s ease, opacity 0.5s ease;
}

.app-shell.theme-dark .monologue-box {
  background-color: rgba(42, 37, 41, 0.84);
  border-color: rgba(234, 226, 211, 0.18);
  box-shadow: 2px 4px 14px rgba(20, 17, 19, 0.35);
}

.monologue-line {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 13.5px;
  line-height: 1.5;
  font-weight: 400;
  color: var(--ink-charcoal);
  word-break: keep-all;
}

.app-shell.theme-dark .monologue-line {
  color: #EFE8DA;
}

/* Tactile Hint Prompt & Next Stage Button */
.gesture-hint {
  position: absolute;
  bottom: calc(188px + env(safe-area-inset-bottom, 0px));
  left: 12px;
  right: 12px;
  z-index: 26;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.gesture-hint.hidden {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

.gesture-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  word-break: keep-all;
  gap: 5px;
  padding: 5px 11px;
  background-color: rgba(232, 222, 200, 0.88);
  color: var(--ink-charcoal);
  border: 1.5px dashed rgba(58, 50, 44, 0.28);
  border-radius: 18px;
  font-family: var(--font-round);
  font-size: 11px;
  box-shadow: 0 2px 8px rgba(58, 50, 44, 0.08);
}

.app-shell.theme-dark .gesture-pill {
  background-color: rgba(56, 49, 53, 0.9);
  color: #EFE8DA;
  border-color: rgba(243, 198, 119, 0.42);
}

@keyframes gentleBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

/* Next Chapter Floating Button */
.next-stage-btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  background-color: var(--sun-gold);
  color: var(--ink-charcoal);
  border: 1.8px solid var(--ink-charcoal);
  border-radius: 22px 15px 20px 16px / 16px 20px 15px 22px;
  font-family: var(--font-serif);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 2px 2.5px 0 var(--ink-charcoal);
  transition: transform 0.15s ease, opacity 0.3s ease;
}

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

.next-stage-btn.hidden {
  display: none;
}

/* Animal Instinct / Emote Strip (6 Expressive Actions — fits 100% on 360px+ mobile with zero overlap) */
.emote-bar {
  position: absolute;
  bottom: calc(148px + env(safe-area-inset-bottom, 0px));
  left: 6px;
  right: 6px;
  z-index: 30;
  display: flex;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 3px;
  overflow-x: auto;
  scrollbar-width: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

@media (max-width: 389px) {
  .emote-bar {
    justify-content: flex-start;
    padding: 0 4px;
  }
}

.emote-bar::-webkit-scrollbar {
  display: none;
}

.emote-bar.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px);
}

.emote-chip {
  flex: 0 0 auto;
  padding: 4.5px 7px;
  background-color: rgba(245, 240, 230, 0.92);
  color: var(--ink-charcoal);
  border: 1.5px solid rgba(58, 50, 44, 0.26);
  border-radius: 14px 10px 15px 11px / 11px 15px 10px 14px;
  font-family: var(--font-round);
  font-size: 10.8px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 1px 2px 0 rgba(58, 50, 44, 0.12);
  transition: transform 0.12s ease, background-color 0.2s ease;
}

@media (min-width: 720px) {
  .emote-bar {
    gap: 7px;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    left: 180px;
    right: 220px;
  }
  .emote-chip {
    padding: 7px 12px;
    font-size: 12.5px;
  }
  .gesture-hint {
    bottom: calc(74px + env(safe-area-inset-bottom, 0px));
  }
}

.emote-chip:active, .emote-chip.active-emote {
  transform: translateY(1.5px) scale(0.96);
  background-color: var(--sun-gold);
}

.app-shell.theme-dark .emote-chip {
  background-color: rgba(54, 48, 52, 0.9);
  color: #EAE2D3;
  border-color: rgba(234, 226, 211, 0.24);
}

.app-shell.theme-dark .emote-chip:active,
.app-shell.theme-dark .emote-chip.active-emote {
  background-color: #C99649;
  color: #26211E;
}

.emote-chip .e-ico {
  font-size: 13.5px;
  line-height: 1;
}

/* ==========================================================================
   🕹️ Free-Roam 3D Controls (Left Analog Thumbstick + Right Jump/Sprint/Interact)
   ========================================================================== */
.free-roam-hud {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 32;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  pointer-events: none;
}

.free-roam-hud.hidden {
  display: none;
}

.joystick-zone {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  touch-action: none;
}

.joystick-base {
  position: relative;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background-color: rgba(232, 222, 200, 0.68);
  border: 2px dashed rgba(58, 50, 44, 0.34);
  box-shadow: inset 0 2px 8px rgba(58, 50, 44, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-shell.theme-dark .joystick-base {
  background-color: rgba(46, 40, 44, 0.68);
  border-color: rgba(234, 226, 211, 0.28);
}

.joystick-knob {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background-color: var(--bg-oatmeal);
  border: 2px solid var(--ink-charcoal);
  box-shadow: 1px 3px 0 rgba(58, 50, 44, 0.24);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: transform 0.04s linear;
  pointer-events: none;
}

.app-shell.theme-dark .joystick-knob {
  background-color: #4A4044;
  border-color: #EAE2D3;
}

.ctrl-hint-label {
  font-family: var(--font-round);
  font-size: 10.5px;
  color: var(--ink-walnut);
  background-color: rgba(245, 240, 230, 0.8);
  padding: 2px 8px;
  border-radius: 10px;
}

.app-shell.theme-dark .ctrl-hint-label {
  color: #D8CFC0;
  background-color: rgba(42, 37, 41, 0.8);
}

.action-cluster {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.interact-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 15px;
  background-color: var(--sun-gold);
  color: var(--ink-charcoal);
  border: 2px solid var(--ink-charcoal);
  border-radius: 22px 15px 20px 16px / 16px 20px 15px 22px;
  font-family: var(--font-round);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 2px 3px 0 var(--ink-charcoal);
  animation: gentleBob 1.2s ease-in-out infinite;
}

.interact-action-btn.hidden {
  display: none;
}

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

.action-btn-row {
  display: flex;
  align-items: flex-end;
  gap: 9px;
}

.ctrl-btn {
  position: relative;
  border: 2px solid var(--ink-charcoal);
  font-family: var(--font-round);
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 2px 3px 0 rgba(58, 50, 44, 0.3);
  transition: transform 0.1s ease, background-color 0.2s ease;
}

.ctrl-btn:active {
  transform: translate(1px, 2px) scale(0.96);
}

.sprint-btn {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background-color: rgba(245, 240, 230, 0.94);
  color: var(--ink-charcoal);
  font-size: 11.5px;
}

.sprint-btn.active {
  background-color: var(--terracotta);
  color: var(--bg-oatmeal);
}

.app-shell.theme-dark .sprint-btn {
  background-color: rgba(58, 51, 55, 0.94);
  color: #EAE2D3;
  border-color: rgba(234, 226, 211, 0.45);
}

.app-shell.theme-dark .sprint-btn.active {
  background-color: var(--terracotta);
  color: var(--bg-oatmeal);
}

.jump-btn {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  background-color: var(--sun-gold);
  color: var(--ink-charcoal);
  font-size: 12.5px;
}

.ctrl-btn .c-ico {
  font-size: 20px;
  line-height: 1;
}

.key-badge {
  font-size: 9.5px;
  padding: 1px 5px;
  border-radius: 6px;
  background-color: rgba(58, 50, 44, 0.14);
  color: inherit;
}

.pc-only {
  display: none;
}

@media (min-width: 768px) {
  .pc-only {
    display: inline-block;
  }
  .emote-bar {
    bottom: 18px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    max-width: calc(100vw - 440px);
  }
  .emote-bar.hidden {
    transform: translate(-50%, 14px);
  }
  .gesture-hint {
    bottom: 72px;
  }
}

/* ==========================================================================
   Scene 0: 3-Second Picture-Book Onboarding Panel
   ========================================================================== */
.onboarding-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: calc(54px + env(safe-area-inset-top, 0px)) 20px calc(110px + env(safe-area-inset-bottom, 0px));
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.onboarding-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.book-card {
  width: 100%;
  max-width: 370px;
  background-color: var(--bg-oatmeal);
  border: 2px solid var(--ink-charcoal);
  border-radius: 24px 16px 26px 18px / 18px 26px 16px 24px;
  padding: 22px 20px 20px;
  box-shadow: 4px 6px 0 rgba(58, 50, 44, 0.16);
  position: relative;
}

.species-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.species-tab {
  flex: 1;
  padding: 9px 10px;
  border-radius: 15px 12px 16px 12px;
  border: 1.5px solid rgba(58, 50, 44, 0.28);
  background-color: var(--bg-kraft);
  color: var(--ink-walnut);
  font-family: var(--font-round);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.species-tab.active {
  background-color: var(--sun-gold);
  color: var(--ink-charcoal);
  border-color: var(--ink-charcoal);
  box-shadow: 1px 2px 0 var(--ink-charcoal);
}

.book-title {
  margin: 0 0 4px;
  font-size: 21px;
  font-weight: 700;
  color: var(--ink-charcoal);
  letter-spacing: -0.02em;
}

.book-sub {
  margin: 0 0 16px;
  font-family: var(--font-round);
  font-size: 12.5px;
  color: var(--ink-walnut);
  line-height: 1.45;
  word-break: keep-all;
}

.field-label {
  display: block;
  font-family: var(--font-round);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-walnut);
  margin-bottom: 6px;
}

.pet-name-input {
  width: 100%;
  padding: 10px 13px;
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--ink-charcoal);
  background-color: var(--bg-linen);
  border: 1.5px solid rgba(58, 50, 44, 0.35);
  border-radius: 12px 15px 13px 14px;
  outline: none;
  transition: border-color 0.2s ease;
}

.pet-name-input:focus {
  border-color: var(--terracotta);
  background-color: var(--bg-oatmeal);
}

.quick-names {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 7px 0 15px;
}

.quick-name-btn {
  padding: 3px 9px;
  font-family: var(--font-round);
  font-size: 11.5px;
  color: var(--ink-walnut);
  background-color: var(--bg-kraft);
  border: 1px solid rgba(58, 50, 44, 0.2);
  border-radius: 11px;
  cursor: pointer;
}

.quick-name-btn:active {
  background-color: var(--sun-gold);
}

/* 5 Watercolor Coat Swatches */
.coat-swatches {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 18px;
}

.coat-btn {
  flex: 1;
  padding: 8px 4px 7px;
  background-color: var(--bg-linen);
  border: 1.5px solid rgba(58, 50, 44, 0.22);
  border-radius: 14px 11px 15px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.coat-btn.selected {
  background-color: var(--bg-kraft);
  border: 2px solid var(--ink-charcoal);
  transform: translateY(-2px);
  box-shadow: 1px 2px 0 var(--ink-charcoal);
}

.coat-blob {
  width: 28px;
  height: 26px;
  border-radius: 54% 46% 48% 52% / 47% 55% 45% 53%;
  border: 1.5px solid rgba(58, 50, 44, 0.35);
  box-shadow: inset -3px -3px 0 rgba(58, 50, 44, 0.14);
}

.coat-name {
  font-family: var(--font-round);
  font-size: 11.5px;
  color: var(--ink-charcoal);
  font-weight: 600;
}

.start-story-btn {
  width: 100%;
  padding: 13px 18px;
  background-color: var(--sun-gold);
  color: var(--ink-charcoal);
  border: 2px solid var(--ink-charcoal);
  border-radius: 22px 15px 24px 16px / 16px 24px 15px 22px;
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 2px 4px 0 var(--ink-charcoal);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

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

/* ==========================================================================
   Scene 2: Panoramic Room Navigation & Instinct Checklist Badges
   ========================================================================== */
.room-hud {
  margin-top: 9px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  pointer-events: none;
}

.room-hud.hidden {
  display: none;
}

.instinct-badge {
  padding: 4px 9px;
  font-family: var(--font-round);
  font-size: 11px;
  background-color: rgba(232, 222, 200, 0.85);
  color: var(--ink-walnut);
  border: 1px solid rgba(58, 50, 44, 0.2);
  border-radius: 12px;
  transition: all 0.3s ease;
}

.instinct-badge.completed {
  background-color: #D7E2CE;
  color: #36452C;
  border-color: rgba(54, 69, 44, 0.35);
}

/* ==========================================================================
   Scene 6: Observation Diary Card Result View
   ========================================================================== */
.diary-overlay {
  position: absolute;
  inset: 0;
  z-index: 45;
  background-color: rgba(232, 222, 200, 0.96);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: calc(50px + env(safe-area-inset-top, 0px)) 16px calc(14px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  touch-action: pan-y;
  transition: opacity 0.5s ease;
}

.diary-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.diary-card-preview-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 4px 0 10px;
}

#diary-card-img {
  max-height: 100%;
  max-width: 100%;
  height: auto;
  width: auto;
  aspect-ratio: 9 / 16;
  object-fit: contain;
  border-radius: 14px;
  border: 2px solid var(--ink-charcoal);
  box-shadow: 3px 6px 18px rgba(58, 50, 44, 0.2);
}

.diary-actions {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.diary-btn-row {
  display: flex;
  gap: 8px;
}

.diary-btn {
  flex: 1;
  padding: 11px 12px;
  border-radius: 18px 13px 19px 14px;
  border: 1.8px solid var(--ink-charcoal);
  font-family: var(--font-round);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 1.5px 2.5px 0 var(--ink-charcoal);
}

.diary-btn.primary {
  background-color: var(--sun-gold);
  color: var(--ink-charcoal);
}

.diary-btn.secondary {
  background-color: var(--bg-oatmeal);
  color: var(--ink-charcoal);
}

.diary-btn.cross-species {
  background-color: #DFE7D8;
  color: var(--ink-charcoal);
  font-size: 13px;
}

.diary-btn:active {
  transform: translate(1px, 1.5px);
  box-shadow: 0.5px 1px 0 var(--ink-charcoal);
}

/* ==========================================================================
   Signal Field Notebook Drawer (반려동물 행동학 신호 수첩)
   ========================================================================== */
.notebook-modal {
  position: absolute;
  inset: 0;
  z-index: 60;
  background-color: rgba(58, 50, 44, 0.52);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transition: opacity 0.25s ease;
}

.notebook-modal.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.notebook-sheet {
  width: 100%;
  max-height: 80dvh;
  background-color: var(--bg-oatmeal);
  color: var(--ink-charcoal);
  border-top: 2.5px solid var(--ink-charcoal);
  border-radius: 24px 24px 0 0;
  padding: 18px 18px calc(22px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  touch-action: pan-y;
}

.notebook-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1.5px dashed rgba(58, 50, 44, 0.22);
}

.notebook-header h3 {
  margin: 0;
  font-size: 17px;
  color: var(--ink-charcoal);
}

.signal-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.signal-item {
  padding: 12px 14px;
  background-color: var(--bg-kraft);
  border: 1.5px solid rgba(58, 50, 44, 0.2);
  border-radius: 15px 12px 16px 13px;
}

.signal-item.locked {
  background-color: var(--bg-linen);
  opacity: 0.65;
  border-style: dashed;
}

.signal-item-title {
  font-family: var(--font-round);
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--ink-charcoal);
}

.signal-item-desc {
  font-family: var(--font-round);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-walnut);
}

/* Soft Analog Toast */
.analog-toast {
  position: absolute;
  top: calc(196px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100vw - 28px);
  z-index: 80;
  background-color: rgba(58, 50, 44, 0.92);
  color: var(--bg-oatmeal);
  padding: 7px 14px;
  border-radius: 20px;
  font-family: var(--font-round);
  font-size: 11.5px;
  text-align: center;
  box-shadow: 0 4px 14px rgba(58, 50, 44, 0.24);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.analog-toast.hidden {
  opacity: 0;
  transform: translate(-50%, -8px);
}

/* In-app browser long-press image save modal */
.save-help-modal {
  position: absolute;
  inset: 0;
  z-index: 75;
  background-color: rgba(42, 36, 33, 0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  gap: 12px;
}

.save-help-modal.hidden {
  display: none;
}

.save-help-modal img {
  max-height: 72dvh;
  max-width: 88vw;
  border-radius: 12px;
  border: 2px solid var(--bg-oatmeal);
  -webkit-touch-callout: default;
  user-select: auto;
}

.save-help-caption {
  color: var(--bg-oatmeal);
  font-family: var(--font-round);
  font-size: 13.5px;
  text-align: center;
}
