*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --cream:      #f5f0e8;
  --card:       #fffdf7;
  --sand:       #e8dcc8;
  --accent:     #c8922a;
  --accent2:    #e4a93c;
  --deep:       #9b3d1c;
  --dark:       #6b3f1e;
  --ink:        #1a1209;
  --muted:      #7a6a52;
  --night-bg:   #1a1108;
  --night-card: #241a0c;
  --night-sand: #3a2e1c;
  --night-muted:#a08060;
}

html, body { height: 100%; }

body {
  min-height: 100%;
  font-family: 'Gowun Batang', serif;
  background: var(--cream);
  color: var(--ink);
  display: flex; flex-direction: column;
  align-items: center;
  padding: 48px 20px;
  position: relative; overflow-x: hidden;
  transition: background 0.7s ease, color 0.7s ease;
  cursor: none;
}

/* ── Paw trail cursor ── */
#pawCursor {
  position: fixed; pointer-events: none; z-index: 9999;
  font-size: 20px; transform: translate(-50%,-50%);
  transition: transform 0.08s ease;
}
.paw-trail {
  position: fixed; pointer-events: none; z-index: 9998;
  font-size: 14px; opacity: 0.55;
  animation: pawFade 0.7s ease-out forwards;
}
@keyframes pawFade {
  from { opacity: 0.55; transform: translate(-50%,-50%) scale(1); }
  to   { opacity: 0;    transform: translate(-50%,-50%) scale(0.4); }
}

/* ── Night mode ── */
body.night { background: var(--night-bg); color: #d4b896; }
body.night .card          { background: var(--night-card); border-color: var(--night-sand); }
body.night .bubble        { background: #1e1508; border-color: var(--night-sand); }
body.night .bubble::after  { border-bottom-color: #1e1508; }
body.night .bubble::before { border-bottom-color: var(--night-sand); }
body.night .meta-tag      { background: var(--night-sand); color: #c8a06a; }
body.night .btn           { background: #2e1f0a; border-color: var(--accent); color: #f5e8c8; }
body.night .stats         { border-color: var(--night-sand); }
body.night .stat + .stat  { border-color: var(--night-sand); }
body.night #purrLabel     { background: var(--night-card); border-color: var(--night-sand); }
body.night .header-sub    { color: var(--night-muted); }
body.night .stat-lbl      { color: var(--night-muted); }
body.night #stateBadge    { color: var(--night-muted); }
body.night .pet-hint      { color: var(--night-muted); }
body.night .fact-text     { color: #d4b896; }
body.night .btn-copy, body.night .btn-back, body.night .btn-share { color: var(--night-muted); border-color: var(--night-sand); }
body.night .fav-item      { border-color: var(--night-sand); background: var(--night-card); }
body.night #favPanel      { border-color: var(--night-sand); }
body.night #achievementsPanel { border-color: var(--night-sand); }
body.night .achievement   { border-color: var(--night-sand); }
body.night .commentary    { color: var(--night-muted); }
body.night .switcher-btn  { background: var(--night-card); border-color: var(--night-sand); color: var(--night-muted); }
body.night .switcher-btn.active { background: var(--night-card); border-color: var(--accent); color: var(--accent); }
body.night #animalSwitcher { border-color: var(--night-sand); }

body::before {
  content: ''; position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  pointer-events: none; z-index: 0;
}
body::after {
  content: ''; position: fixed;
  top: 20px; left: 20px; right: 20px; bottom: 20px;
  border: 1px solid rgba(200,146,42,0.22);
  pointer-events: none; z-index: 99;
  transition: border-color 0.7s ease;
}
body.night::after { border-color: rgba(200,146,42,0.12); }

.doodles { position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.doodle  { position: absolute; opacity: 0; animation: floatDoodle linear infinite; }
@keyframes floatDoodle {
  0%   { opacity: 0; transform: translateY(10px) rotate(-8deg); }
  15%  { opacity: 0.5; } 85% { opacity: 0.5; }
  100% { opacity: 0; transform: translateY(-80px) rotate(8deg); }
}

#nightToggle {
  position: fixed; top: 36px; right: 36px; z-index: 98;
  font-family: 'Gaegu', cursive; font-size: 11px;
  letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--muted); background: none; border: 1px solid var(--sand);
  padding: 4px 12px; border-radius: 999px; cursor: pointer;
  transition: all 0.3s ease;
}
#nightToggle:hover { border-color: var(--accent); color: var(--accent); }
body.night #nightToggle { color: var(--night-muted); border-color: var(--night-sand); }

/* ── Header ── */
.header {
  position: relative; z-index: 2; text-align: center;
  margin-bottom: 16px; animation: riseIn 0.7s ease both;
  width: 100%; max-width: 640px;
}
.header-eyebrow {
  font-family: 'Gaegu', cursive; font-size: 13px;
  color: var(--accent); letter-spacing: 0.2em; text-transform: uppercase; margin-bottom: 6px;
}
.header-title {
  font-family: 'Gaegu', cursive; font-size: clamp(2.4rem, 7vw, 3.8rem);
  font-weight: 700; color: var(--ink); line-height: 1;
  display: inline-block; position: relative; transition: color 0.7s ease;
}
body.night .header-title { color: #e8c898; }
.header-title::after {
  content: ''; display: block; height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent) 20%, var(--accent2) 50%, var(--accent) 80%, transparent);
  border-radius: 2px; margin-top: 4px; animation: shimmer 3s ease-in-out infinite;
  transition: background 0.7s ease;
}
@keyframes shimmer {
  0%,100% { opacity: 0.6; transform: scaleX(0.9); }
  50%      { opacity: 1;   transform: scaleX(1); }
}
.header-sub { font-family: 'Gaegu', cursive; font-size: 15px; color: var(--muted); margin-top: 8px; transition: color 0.7s; }

/* ── Animal Switcher ── */
#animalSwitcher {
  display: flex; gap: 8px; justify-content: center; align-items: center;
  position: relative; z-index: 2;
  margin-bottom: 20px;
  padding: 6px 10px;
  border: 1px solid var(--sand); border-radius: 999px;
  background: rgba(255,255,255,0.5);
  backdrop-filter: blur(4px);
  animation: riseIn 0.75s ease 0.05s both;
  transition: border-color 0.7s ease, background 0.7s ease;
}

.switcher-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 14px; border-radius: 999px;
  background: none; border: 1.5px solid transparent;
  cursor: pointer; transition: all 0.25s ease;
  font-family: 'Gaegu', cursive;
}
.switcher-btn:hover {
  border-color: var(--accent); background: rgba(200,146,42,0.06);
}
.switcher-btn.active {
  border-color: var(--accent); background: var(--card);
  box-shadow: 2px 2px 0 var(--sand);
}
.switcher-emoji { font-size: 22px; line-height: 1; display: block; }
.switcher-name  {
  font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); line-height: 1; display: block;
  transition: color 0.25s;
}
.switcher-btn.active .switcher-name { color: var(--accent); }
.switcher-btn:hover .switcher-name  { color: var(--accent); }

/* ── Card ── */
.card {
  position: relative; z-index: 2; max-width: 640px; width: 100%;
  background: var(--card); border: 1.5px solid var(--sand); border-radius: 4px;
  padding: 36px 52px 44px;
  box-shadow: 5px 5px 0 var(--sand), 10px 10px 0 rgba(200,146,42,0.08);
  animation: riseIn 0.8s ease 0.1s both;
  transition: background 0.7s ease, border-color 0.7s ease;
  box-sizing: border-box;
}
.corner { position: absolute; width: 22px; height: 22px; }
.corner-tl { top:-1px; left:-1px;   border-top:2.5px solid var(--accent); border-left:2.5px solid var(--accent); }
.corner-tr { top:-1px; right:-1px;  border-top:2.5px solid var(--accent); border-right:2.5px solid var(--accent); }
.corner-bl { bottom:-1px; left:-1px;  border-bottom:2.5px solid var(--accent); border-left:2.5px solid var(--accent); }
.corner-br { bottom:-1px; right:-1px; border-bottom:2.5px solid var(--accent); border-right:2.5px solid var(--accent); }

/* ── Creature section ── */
.cat-section {
  display: flex; flex-direction: column; align-items: center;
  margin-bottom: 4px; position: relative;
  padding-top: 32px;
}
.pet-hint {
  font-family: 'Gaegu', cursive; font-size: 12px; color: var(--muted);
  letter-spacing: 0.12em; margin-bottom: 2px;
  transition: opacity 0.8s ease, color 0.7s ease;
}
.pet-hint.gone { opacity: 0; pointer-events: none; }

@keyframes hiss {
  0%,100% { transform: translateX(0); }
  15%  { transform: translateX(-6px) rotate(-2deg); }
  35%  { transform: translateX(6px)  rotate(2deg); }
  55%  { transform: translateX(-5px) rotate(-1.5deg); }
  75%  { transform: translateX(5px)  rotate(1.5deg); }
}
.hissing { animation: hiss 0.45s ease both; }

#catWrap {
  position: relative; width: 260px; height: 260px;
  cursor: none; user-select: none; overflow: visible;
}
#lottieContainer { width: 100%; height: 100%; }

#purrLabel {
  font-family: 'Gaegu', cursive; font-size: 13px; color: var(--accent);
  background: var(--card); border: 1px solid var(--sand); border-radius: 10px;
  padding: 2px 12px; white-space: nowrap; box-shadow: 2px 2px 0 var(--sand);
  position: absolute; top: -28px; left: 50%; transform: translateX(-50%);
  opacity: 0; pointer-events: none; z-index: 10;
  transition: background 0.7s ease, border-color 0.7s ease, color 0.7s ease;
}
#sleepLabel {
  font-family: 'Gaegu', cursive; font-size: 13px; color: var(--muted);
  position: absolute; top: -24px; right: 0;
  opacity: 0; pointer-events: none; z-index: 10; letter-spacing: 0.1em;
}

/* ── CSS CREATURES ── */
.css-creature {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  position: absolute; top: 0; left: 0;
}

/* —— FROG GIF —— */
.frog-gif {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 220px; height: 220px;
  object-fit: contain;
  /* blend white background into card */
  mix-blend-mode: multiply;
  transition: opacity 0.15s ease;
  pointer-events: none;
  user-select: none;
}
body.night .frog-gif {
  /* in night mode multiply is too dark — use screen or lighten */
  mix-blend-mode: luminosity;
  opacity: 0.92;
}

/* —— WHALE —— */
.css-whale {
  align-items: flex-end;
  padding-bottom: 20px;
}
.css-whale .whale-body {
  width: 200px; height: 90px;
  background: var(--accent);
  border-radius: 50% 42% 40% 45% / 60% 55% 50% 55%;
  position: relative;
  box-shadow: inset 0 -10px 0 rgba(0,0,0,0.1), 0 8px 28px rgba(0,0,0,0.18);
  animation: whaleFloat 4s ease-in-out infinite;
}
@keyframes whaleFloat {
  0%,100% { transform: translateY(0) rotate(-1deg); }
  50%     { transform: translateY(-10px) rotate(1deg); }
}
.css-whale.creature-awake .whale-body { animation: whaleSplash 0.5s ease; }
@keyframes whaleSplash {
  0%   { transform: translateY(0) rotate(-1deg); }
  25%  { transform: translateY(-18px) rotate(3deg) scaleX(0.94); }
  60%  { transform: translateY(4px) rotate(-2deg) scaleX(1.04); }
  100% { transform: translateY(0) rotate(-1deg) scaleX(1); }
}
.whale-eye {
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 2.5px solid rgba(0,0,0,0.18);
  position: absolute; top: 16px; left: 30px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.whale-pupil {
  width: 10px; height: 10px; border-radius: 50%;
  background: #091828;
  box-shadow: inset -2px -2px 3px rgba(255,255,255,0.3);
}
.css-whale.creature-sleeping .whale-pupil { height: 3px; border-radius: 2px; }
.whale-belly {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  width: 110px; height: 36px;
  background: rgba(255,255,255,0.18); border-radius: 50%;
}
.whale-mouth {
  position: absolute; top: 42px; left: 18px;
  width: 26px; height: 8px;
  border-bottom: 2.5px solid rgba(0,0,0,0.15);
  border-radius: 0 0 50% 50%;
}
.whale-tail {
  position: absolute; right: -36px; top: 50%; transform: translateY(-50%);
  width: 0; height: 0;
  border-left: 38px solid var(--accent);
  border-top: 22px solid transparent;
  border-bottom: 22px solid transparent;
  filter: drop-shadow(2px 0 0 rgba(0,0,0,0.1));
}
.whale-fin {
  position: absolute; top: -18px; left: 60px;
  width: 0; height: 0;
  border-bottom: 26px solid var(--accent);
  border-left: 14px solid transparent;
  border-right: 8px solid transparent;
  filter: drop-shadow(0 -2px 0 rgba(0,0,0,0.08));
}
.whale-spout {
  position: absolute; top: -44px; left: 52px;
  width: 30px; height: 36px;
  background: rgba(255,255,255,0.55);
  border-radius: 50% 50% 30% 30%;
  opacity: 0;
  animation: whaleSpout 4s ease-in-out infinite 1s;
}
@keyframes whaleSpout {
  0%,85%,100% { opacity: 0; transform: scaleY(0.3) translateY(10px); }
  88%         { opacity: 0.7; transform: scaleY(1.1) translateY(0); }
  94%         { opacity: 0.4; transform: scaleY(0.9) translateY(-4px); }
}
.css-whale.creature-sleeping .whale-spout { animation-duration: 6s; }

/* Deep sleep state */
.css-creature.creature-deep-sleep { opacity: 0.7; filter: saturate(0.7); }

/* Dream bubbles */
.dream-bubble {
  position: absolute; pointer-events: none; z-index: 15;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.12));
}

/* Cat commentary */
.commentary {
  font-family: 'Gaegu', cursive; font-size: 11px; color: var(--muted);
  letter-spacing: 0.1em; text-align: center; margin-top: 2px; margin-bottom: 4px;
  min-height: 16px; font-style: italic; transition: color 0.7s ease;
}

/* Snore overlay */
#snoreOverlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(26,18,9,0); pointer-events: none;
  transition: background 2s ease;
}
#snoreOverlay.active { background: rgba(26,18,9,0.55); pointer-events: all; }
#snoreMsg {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  font-family: 'Gaegu', cursive; font-size: 1.1rem; color: #f5e8c8;
  letter-spacing: 0.15em; text-transform: uppercase; text-align: center;
  opacity: 0; z-index: 51; pointer-events: none; line-height: 2;
}

#stateBadge {
  font-family: 'Gaegu', cursive; font-size: 11px;
  color: var(--muted); letter-spacing: 0.15em;
  text-transform: uppercase; text-align: center;
  margin-top: 6px; margin-bottom: 2px; height: 16px;
  transition: color 0.7s ease;
}

.heart-particle {
  position: absolute; pointer-events: none;
  font-family: 'Gaegu', cursive; opacity: 0; top: 60px; left: 50%;
}

/* Achievement toast */
#achievementToast {
  position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%);
  font-family: 'Gaegu', cursive; font-size: 14px;
  background: var(--ink); color: var(--cream);
  border: 1.5px solid var(--accent); border-radius: 4px;
  padding: 10px 22px; box-shadow: 3px 3px 0 var(--accent);
  opacity: 0; pointer-events: none; z-index: 200;
  white-space: nowrap; letter-spacing: 0.1em;
  transition: border-color 0.7s, box-shadow 0.7s;
}

/* ── Bubble ── */
.bubble-section { position: relative; margin-bottom: 16px; }
.bubble-label {
  font-family: 'Gaegu', cursive; font-size: 11px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--accent); text-align: center;
  margin-bottom: 16px; display: flex; align-items: center; gap: 10px;
  transition: color 0.7s;
}
.bubble-label::before, .bubble-label::after { content: ''; flex: 1; height: 1px; background: var(--sand); transition: background 0.7s; }
body.night .bubble-label::before, body.night .bubble-label::after { background: var(--night-sand); }

.bubble {
  background: var(--cream); border: 1.5px solid var(--sand); border-radius: 18px;
  padding: 22px 28px; position: relative;
  min-height: 110px; display: flex; align-items: center; justify-content: center;
  transition: background 0.7s ease, border-color 0.7s ease, min-height 0.4s ease;
}
.bubble::before {
  content: ''; position: absolute; top: -13px; left: 50%; transform: translateX(-50%);
  border: 8px solid transparent; border-bottom-color: var(--sand);
}
.bubble::after {
  content: ''; position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  border: 7px solid transparent; border-bottom-color: var(--cream);
  transition: border-bottom-color 0.7s ease;
}

.bubble-actions {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px;
}
.btn-copy, .btn-fav, .btn-back, .btn-share {
  font-family: 'Gaegu', cursive; font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted);
  background: none; border: 1px solid var(--sand); border-radius: 999px;
  padding: 3px 12px; cursor: pointer;
  transition: color 0.2s, border-color 0.2s, opacity 0.3s;
}
.btn-copy:hover, .btn-fav:hover, .btn-back:hover:not(:disabled), .btn-share:hover {
  color: var(--accent); border-color: var(--accent);
}
.btn-copy.copied, .btn-fav.saved, .btn-share.copied { color: var(--accent); border-color: var(--accent); }
.btn-back:disabled { cursor: default; }

.fact-keyword { color: var(--accent); font-weight: 700; }

.fact-text {
  font-family: 'Gowun Batang', serif; font-size: clamp(0.95rem, 2.2vw, 1.1rem);
  line-height: 1.75; text-align: center; color: var(--ink);
  transition: opacity 0.22s ease, transform 0.22s ease, color 0.7s ease;
  min-height: 3.5em;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
}
.fact-text.loading  { opacity: 0.2; transform: scale(0.97); }
.fact-text.revealed { animation: popIn 0.38s cubic-bezier(.34,1.46,.64,1) forwards; }
@keyframes popIn {
  from { opacity: 0; transform: scale(0.94) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Meta ── */
.meta-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px; font-family: 'Gaegu', cursive; font-size: 12px;
  color: var(--muted); letter-spacing: 0.1em;
}
.meta-tag {
  background: var(--sand); color: var(--dark); padding: 3px 12px;
  border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  transition: background 0.7s ease, color 0.7s ease;
}

/* ── Button ── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 15px 32px;
  border: 1.5px solid var(--ink); border-radius: 2px;
  background: var(--ink); color: var(--cream);
  font-family: 'Gaegu', cursive; font-size: 1.15rem; letter-spacing: 0.12em;
  cursor: pointer; box-shadow: 4px 4px 0 var(--accent);
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.7s ease, box-shadow 0.3s ease;
}
.btn:hover:not(:disabled) { transform: translate(-2px,-2px); box-shadow: 6px 6px 0 var(--accent); }
.btn:active:not(:disabled) { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--accent); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-icon { font-size: 1.3rem; transition: transform 0.35s cubic-bezier(.34,1.56,.64,1); display: inline-block; }
.btn:hover .btn-icon { transform: rotate(-18deg) scale(1.25); }
.btn-spinner {
  width: 16px; height: 16px; border: 2.5px solid rgba(245,240,232,0.3);
  border-top-color: var(--cream); border-radius: 50%;
  animation: spin 0.65s linear infinite; display: none;
}
.btn.fetching .btn-icon { display: none; }
.btn.fetching .btn-spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Stats ── */
.stats {
  display: flex; margin-top: 22px;
  border-top: 1px solid var(--sand); padding-top: 18px;
  transition: border-color 0.7s ease;
}
.stat { flex: 1; text-align: center; padding: 0 8px; }
.stat + .stat { border-left: 1px solid var(--sand); transition: border-color 0.7s ease; }
.stat-val {
  font-family: 'Gaegu', cursive; font-size: 1.6rem;
  font-weight: 700; color: var(--accent); line-height: 1; transition: color 0.7s;
}
.stat-lbl {
  font-family: 'Gaegu', cursive; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-top: 2px;
  transition: color 0.7s ease;
}

/* Mood decay bar */
.mood-decay-bar {
  height: 2px; width: 0%; margin: 5px auto 0;
  background: var(--accent); border-radius: 999px;
  opacity: 0; max-width: 48px;
}

/* ── Favourites panel ── */
#favBtn, #achievementsBtn {
  font-family: 'Gaegu', cursive; font-size: 11px; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--muted);
  background: none; border: none; cursor: pointer;
  display: inline-block; transition: color 0.2s;
  padding: 0 8px;
}
#favBtn:hover, #achievementsBtn:hover { color: var(--accent); }
.panel-btns {
  margin-top: 14px; display: flex; justify-content: center;
  gap: 4px; align-items: center;
}
.panel-btns span { color: var(--sand); font-size: 12px; }

#favPanel, #achievementsPanel {
  margin-top: 12px; display: none;
  border-top: 1px solid var(--sand); padding-top: 14px;
  transition: border-color 0.7s;
}
#favPanel.open, #achievementsPanel.open { display: block; }

.fav-list { display: flex; flex-direction: column; gap: 8px; max-height: 220px; overflow-y: auto; }
.fav-item {
  font-family: 'Gowun Batang', serif; font-size: 0.88rem; color: var(--ink);
  border: 1px solid var(--sand); border-radius: 10px; padding: 10px 14px;
  background: var(--cream); position: relative; line-height: 1.5;
  transition: background 0.7s, border-color 0.7s, color 0.7s;
}
.fav-item .fav-remove {
  position: absolute; top: 6px; right: 10px;
  font-family: 'Gaegu', cursive; font-size: 10px; color: var(--muted);
  background: none; border: none; cursor: pointer; letter-spacing: 0.1em;
}
.fav-item .fav-remove:hover { color: var(--deep); }
.fav-empty {
  font-family: 'Gaegu', cursive; font-size: 12px; color: var(--muted);
  text-align: center; letter-spacing: 0.12em; padding: 12px 0;
}

/* Achievements */
.achievement-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px;
}
.achievement {
  text-align: center; padding: 10px 6px; border: 1px solid var(--sand);
  border-radius: 8px; opacity: 0.3; transition: opacity 0.4s, border-color 0.4s;
}
.achievement.unlocked { opacity: 1; border-color: var(--accent); }
.achievement-icon { font-size: 1.5rem; }
.achievement-name {
  font-family: 'Gaegu', cursive; font-size: 10px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted); margin-top: 4px;
  transition: color 0.7s;
}
.achievement.unlocked .achievement-name { color: var(--accent); }

/* ── Gegee secret overlay ── */
#gegeeOverlay {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  opacity: 0; pointer-events: none;
  transition: opacity 0.4s ease, background 0.4s ease;
}
#gegeeOverlay.active { opacity: 1; background: rgba(26,18,9,0.65); pointer-events: all; }
#gegeeCard {
  position: relative; max-width: 340px; width: 90%;
  background: var(--card); border: 1.5px solid var(--sand); border-radius: 4px;
  padding: 36px 40px; text-align: center;
  box-shadow: 5px 5px 0 var(--sand), 10px 10px 0 rgba(200,146,42,0.1);
  opacity: 0; transform: scale(0.88) translateY(16px);
  transition: opacity 0.4s ease 0.15s, transform 0.4s cubic-bezier(0.34,1.56,0.64,1) 0.15s,
              background 0.7s, border-color 0.7s;
}
#gegeeOverlay.active #gegeeCard { opacity: 1; transform: none; }
.gegee-eyebrow {
  font-family: 'Gaegu', cursive; font-size: 12px;
  color: var(--accent); letter-spacing: 0.2em; text-transform: uppercase;
  margin-bottom: 20px; transition: color 0.7s;
}
.gegee-msg {
  font-family: 'Gaegu', cursive; font-size: 1.1rem;
  color: var(--ink); line-height: 2.1; margin-bottom: 28px;
  transition: color 0.7s;
}
#gegeeClose {
  font-family: 'Gaegu', cursive; font-size: 12px; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--muted);
  background: none; border: 1px solid var(--sand); border-radius: 999px;
  padding: 5px 20px; cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
#gegeeClose:hover { color: var(--accent); border-color: var(--accent); }

body.night #gegeeCard  { background: var(--night-card); border-color: var(--night-sand); }
body.night .gegee-msg  { color: #e8c898; }
body.night #gegeeClose { color: var(--night-muted); border-color: var(--night-sand); }

/* ── Footer ── */
.footer {
  margin-top: 24px; font-family: 'Gaegu', cursive; font-size: 13px;
  color: var(--muted); letter-spacing: 0.1em; text-align: center;
  position: relative; z-index: 2; animation: riseIn 0.8s ease 0.3s both;
}

/* ── Burst ── */
.burst {
  position: fixed; pointer-events: none; z-index: 9997; font-size: 20px;
  animation: burstAnim 0.65s ease-out forwards;
}
@keyframes burstAnim {
  0%   { opacity: 1; transform: translate(-50%,-50%) scale(0.4); }
  55%  { opacity: 1; transform: translate(-50%,-50%) scale(1.3); }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(1.7); }
}
@keyframes riseIn {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Mobile ── */
@media (max-width: 600px) {
  .card { padding: 24px 16px 28px; }
  .bubble { padding: 16px 14px; }
  body::after { top: 10px; left: 10px; right: 10px; bottom: 10px; }
  #nightToggle { top: 18px; right: 18px; font-size: 10px; padding: 3px 9px; }

  .cat-section { margin-bottom: 2px; }
  #catWrap { width: 200px; height: 200px; }
  .pet-hint { font-size: 10px; margin-bottom: 1px; }
  #purrLabel { font-size: 11px; padding: 1px 8px; top: 4px; }
  #sleepLabel { font-size: 11px; top: 4px; right: 8px; }
  #stateBadge { font-size: 10px; margin-top: 1px; margin-bottom: 1px; }
  .commentary { font-size: 10px; margin-top: 1px; }

  .bubble-section { margin-bottom: 12px; }
  .bubble-label { margin-bottom: 10px; font-size: 10px; }
  .bubble-actions { flex-direction: row; flex-wrap: wrap; gap: 5px; justify-content: center; }
  .btn-copy, .btn-fav, .btn-back, .btn-share { font-size: 10px; padding: 2px 8px; }

  .meta-row { margin-bottom: 16px; font-size: 10px; }
  .meta-tag { font-size: 10px; padding: 2px 10px; }
  .btn { padding: 13px 20px; font-size: 1rem; }

  .stats { padding-top: 14px; margin-top: 16px; }
  .stat-val { font-size: 1.3rem; }
  .stat-lbl { font-size: 10px; }

  .panel-btns { font-size: 10px; gap: 2px; }
  #favBtn, #achievementsBtn { font-size: 10px; }

  .achievement-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 6px; }
  .achievement { padding: 7px 4px; }
  .achievement-icon { font-size: 1.2rem; }
  .achievement-name { font-size: 9px; }

  #achievementToast { font-size: 12px; padding: 8px 16px; bottom: 24px; }
  .footer { font-size: 11px; margin-top: 18px; }

  /* Switcher on mobile */
  #animalSwitcher { gap: 4px; padding: 4px 6px; }
  .switcher-btn { padding: 4px 10px; }
  .switcher-emoji { font-size: 18px; }
  .switcher-name { font-size: 8px; }

  .dream-bubble { font-size: 12px !important; }
}