@import url('data:text/css,');

:root {
  --ink: #3c3540;
  --muted: #827781;
  --cream: #fff9ed;
  --paper: #fffdf8;
  --pink: #ed9da7;
  --pink-dark: #ca6f80;
  --screen: #d8dfb0;
  --screen-ink: #33423a;
  --shadow: rgba(92, 60, 65, .17);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background:
    radial-gradient(circle at 18% 8%, rgba(255,255,255,.78) 0 3px, transparent 4px),
    radial-gradient(circle at 86% 24%, rgba(255,255,255,.58) 0 2px, transparent 3px),
    linear-gradient(145deg, #f9e9dc 0%, #f8d9d8 52%, #eac7d3 100%);
  background-size: 110px 110px, 80px 80px, auto;
}

body::before, body::after {
  content: "";
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(2px);
  opacity: .45;
}
body::before { width: 260px; height: 260px; left: -90px; top: 22%; background: #fff6c7; }
body::after { width: 300px; height: 300px; right: -130px; bottom: 8%; background: #d7dff2; }

button, input { font: inherit; }
button { color: inherit; }

.game-shell { width: min(94vw, 740px); margin: 0 auto; padding: 36px 0 24px; }
.brand { text-align: center; margin-bottom: 18px; }
.brand h1 { margin: -2px 0 2px; font-size: clamp(30px, 6vw, 44px); letter-spacing: .13em; text-indent: .13em; }
.eyebrow { margin: 0; color: var(--pink-dark); font: 700 11px/1.4 ui-monospace, monospace; letter-spacing: .35em; }
.subtitle { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.device {
  position: relative;
  width: min(100%, 540px);
  margin: auto;
  padding: 35px 48px 42px;
  border: 2px solid rgba(123, 74, 83, .2);
  border-radius: 48% 48% 42% 42% / 18% 18% 14% 14%;
  background: linear-gradient(145deg, #f8b7bb 0%, var(--pink) 62%, #df8997 100%);
  box-shadow: inset 9px 9px 15px rgba(255,255,255,.25), inset -8px -10px 18px rgba(127,63,76,.14), 0 22px 50px var(--shadow);
}

.device::before { content: ""; position: absolute; inset: 13px 18px; border: 1px solid rgba(255,255,255,.28); border-radius: inherit; pointer-events: none; }
.speaker { position: absolute; right: 26px; top: 44px; display: grid; grid-template-columns: repeat(2, 5px); gap: 6px; opacity: .45; }
.speaker i { width: 5px; height: 5px; border-radius: 50%; background: #7e4c59; }

.screen-frame { position: relative; z-index: 1; padding: 14px 16px 12px; border: 7px solid #655663; border-radius: 29px; background: #f7e2cf; box-shadow: inset 0 0 0 3px #c89ca1, 0 5px 0 rgba(125,64,76,.18); }
.screen-topbar { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 8px; color: #685e68; font: 700 11px/1.2 ui-monospace, monospace; }
.icon-button { width: 25px; height: 22px; padding: 0; border: 0; border-radius: 6px; background: #ead1be; cursor: pointer; font-weight: 900; }
.icon-button.off { opacity: .45; text-decoration: line-through; }
.screen { position: relative; height: 245px; overflow: hidden; border: 3px solid #687064; border-radius: 12px; background: var(--screen); image-rendering: pixelated; box-shadow: inset 0 0 20px rgba(58,72,54,.12); }
.screen::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .08; background: repeating-linear-gradient(0deg, #304236 0 1px, transparent 1px 4px); }
#petCanvas { position: absolute; z-index: 2; bottom: 19px; left: 50%; width: 240px; height: 180px; transform: translateX(-50%); image-rendering: pixelated; }
.ground { position: absolute; z-index: 1; left: 10%; right: 10%; bottom: 26px; height: 3px; background: var(--screen-ink); box-shadow: 8px 6px 0 -1px var(--screen-ink), 40px 6px 0 -1px var(--screen-ink), 154px 6px 0 -1px var(--screen-ink), 188px 6px 0 -1px var(--screen-ink); opacity: .6; }
.weather { position: absolute; top: 10px; right: 16px; color: var(--screen-ink); font-size: 25px; animation: twinkle 2s steps(2) infinite; }
.thought { position: absolute; z-index: 4; left: 12px; top: 10px; max-width: 145px; padding: 7px 10px; border: 2px solid var(--screen-ink); border-radius: 8px; background: #edf0c9; color: var(--screen-ink); font: 700 12px/1.25 ui-monospace, monospace; box-shadow: 3px 3px 0 rgba(51,66,58,.25); opacity: 0; transform: translateY(-5px); transition: .18s ease; }
.thought.show { opacity: 1; transform: translateY(0); }
.thought::after { content: ""; position: absolute; left: 28px; bottom: -7px; width: 8px; height: 8px; border-right: 2px solid var(--screen-ink); border-bottom: 2px solid var(--screen-ink); background: #edf0c9; transform: rotate(45deg); }
.poop { position: absolute; z-index: 3; right: 24px; bottom: 38px; color: var(--screen-ink); font-size: 33px; transform: rotate(180deg); }
.sleep-shade { position: absolute; z-index: 5; inset: 0; background: rgba(52,64,57,.2); }
.sleep-shade span { position: absolute; color: var(--screen-ink); font: 900 18px ui-monospace, monospace; animation: floatZ 2s infinite; }
.sleep-shade span:nth-child(1) { left: 57%; top: 48%; }
.sleep-shade span:nth-child(2) { left: 65%; top: 35%; animation-delay: .5s; }
.sleep-shade span:nth-child(3) { left: 72%; top: 22%; animation-delay: 1s; }
.pet-label { display: flex; justify-content: center; gap: 9px; align-items: baseline; padding-top: 9px; }
.pet-label strong { font-size: 18px; }
.pet-label span { padding: 2px 7px; border-radius: 99px; color: #fff; background: #7d7179; font-size: 10px; }

.controls { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; margin-top: 22px; }
.care-button { min-width: 0; padding: 10px 3px 8px; border: 0; border-bottom: 4px solid rgba(95,56,65,.25); border-radius: 15px; background: #fff4e7; cursor: pointer; font-weight: 800; font-size: 12px; box-shadow: 0 4px 10px rgba(99,54,64,.12); transition: transform .12s, filter .12s; }
.care-button span { display: block; margin-bottom: 3px; font-size: 23px; filter: saturate(.75); }
.care-button small { display: block; margin-top: 2px; color: #97848a; font-size: 8px; font-weight: 500; white-space: nowrap; }
.care-button:hover { transform: translateY(-2px); filter: brightness(1.03); }
.care-button:active { transform: translateY(2px); border-bottom-width: 2px; }
.care-button:disabled { cursor: not-allowed; filter: grayscale(.8); opacity: .5; }
.care-button.adventure { color: #4e5368; background: #f0eefb; }

.expedition-overlay { position: absolute; z-index: 6; inset: 0; overflow: hidden; color: var(--screen-ink); background: var(--screen); font: 700 11px ui-monospace, monospace; --scene-bg: #d8dfb0; --scene-mid: #718368; --scene-ink: #33423a; --panel: #edf0c9; }
.expedition-overlay[hidden] { display: none; }
.expedition-overlay.color-mode { color: #29243a; background: #b9e4ff; --scene-bg: #b9e4ff; --scene-mid: #65a96f; --scene-ink: #332d46; --panel: #fff6d8; }
#adventureCanvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.adventure-hud { position: absolute; z-index: 2; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; left: 8px; right: 8px; top: 7px; padding: 5px 7px; border: 2px solid var(--scene-ink); border-radius: 4px; color: var(--scene-ink); background: color-mix(in srgb, var(--panel) 90%, transparent); box-shadow: 2px 2px 0 rgba(41,45,42,.22); }
.adventure-hud span:nth-child(2) { letter-spacing: .18em; }
.adventure-hud span:last-child { text-align: right; }
.travel-message { position: absolute; z-index: 3; left: 50%; bottom: 18px; width: max-content; padding: 7px 10px; border: 2px solid var(--scene-ink); color: var(--scene-ink); background: var(--panel); transform: translateX(-50%); box-shadow: 3px 3px 0 rgba(40,48,43,.28); animation: travelBlink 1s steps(2) infinite; }
.screen-event { position: absolute; z-index: 4; left: 7px; right: 7px; bottom: 7px; padding: 8px; border: 2px solid var(--scene-ink); border-radius: 5px; color: var(--scene-ink); background: var(--panel); box-shadow: 3px 3px 0 rgba(40,48,43,.3); }
.screen-event[hidden], .travel-message[hidden], .outcome-toast[hidden] { display: none; }
.event-copy { display: flex; align-items: center; gap: 7px; min-height: 35px; }
.event-copy > span { display: grid; flex: 0 0 30px; height: 30px; place-items: center; border: 2px solid currentColor; border-radius: 3px; font-size: 18px; }
.expedition-overlay:not(.color-mode) .event-copy > span { filter: grayscale(1) contrast(1.8); }
.event-copy p { margin: 0; font-size: 10px; line-height: 1.35; }
.event-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 7px; }
.event-choice { min-width: 0; padding: 6px 4px; border: 2px solid var(--scene-ink); border-radius: 3px; color: var(--scene-ink); background: transparent; cursor: pointer; font-size: 9px; font-weight: 800; }
.event-choice:hover, .event-choice:focus-visible { color: var(--panel); background: var(--scene-ink); outline: none; }
.outcome-toast { position: absolute; z-index: 5; left: 50%; top: 50%; width: max-content; max-width: 88%; padding: 9px 12px; border: 3px double var(--scene-ink); color: var(--scene-ink); background: var(--panel); text-align: center; transform: translate(-50%, -50%); box-shadow: 4px 4px 0 rgba(40,48,43,.3); animation: resultPop .3s ease both; }

.status-card { width: min(100%, 600px); margin: 18px auto 0; padding: 18px 22px 20px; border: 1px solid rgba(99,64,71,.12); border-radius: 22px; background: rgba(255,253,248,.84); box-shadow: 0 12px 30px rgba(101,65,73,.09); backdrop-filter: blur(10px); }
.status-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; font-size: 13px; }
.status-heading > div { display: flex; align-items: center; gap: 7px; }
.status-heading > span { color: var(--muted); font-size: 11px; }
.online-dot { width: 8px; height: 8px; border-radius: 50%; background: #78a97d; box-shadow: 0 0 0 3px #deedde; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 24px; }
.stat.wide { grid-column: 1 / -1; }
.stat-copy { display: flex; justify-content: space-between; margin-bottom: 5px; color: #766a73; font-size: 11px; }
.stat-copy b { color: var(--ink); font: 700 11px ui-monospace, monospace; }
.meter { height: 8px; overflow: hidden; border-radius: 20px; background: #ede5dc; }
.meter i { display: block; width: 80%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #e8949f, #efb482); transition: width .45s ease, background .3s; }
.meter i.low { background: #d96e6e; animation: pulse 1.2s infinite; }

.collection { margin-top: 17px; padding-top: 14px; border-top: 1px dashed #dfd1c8; }
.collection-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 11px; }
.collection-title span { color: var(--muted); font-size: 10px; font-weight: 500; }
.collection-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; min-height: 25px; }
.collection-chip { display: inline-flex; align-items: center; gap: 3px; padding: 4px 7px; border: 1px solid #e6d8cf; border-radius: 99px; background: #fffaf3; font-size: 10px; }
.collection-chip b { color: var(--pink-dark); font: 700 9px ui-monospace, monospace; }
.empty-collection { color: #aa9da3; font-size: 10px; font-style: italic; }

footer { display: flex; align-items: center; justify-content: center; gap: 20px; margin: 14px auto 0; color: rgba(70,60,68,.5); font-size: 10px; }
.text-button { padding: 3px; border: 0; border-bottom: 1px dotted #a08b91; background: none; cursor: pointer; color: #766b72; font-size: 10px; }
.text-button.danger { color: #a76870; }
.text-button.debug-toggle { color: #59677b; border-color: #8591a2; }

dialog { width: min(90vw, 380px); padding: 0; border: 0; border-radius: 24px; color: var(--ink); background: var(--paper); box-shadow: 0 25px 80px rgba(61,40,47,.3); }
dialog::backdrop { background: rgba(57,39,48,.45); backdrop-filter: blur(4px); }
dialog form { padding: 28px; }
dialog h2 { margin: 0 0 8px; text-align: center; font-size: 22px; }
dialog p { margin: 0 0 20px; color: var(--muted); text-align: center; font-size: 12px; }
.egg-mark { width: 48px; height: 58px; margin: 0 auto 12px; padding-top: 24px; border-radius: 50% 50% 46% 46%; color: #d27f8c; background: #f4aab2; text-align: center; box-shadow: inset 6px 2px 0 rgba(255,255,255,.28); }
dialog label { display: grid; gap: 7px; color: #685f65; font-size: 12px; font-weight: 700; }
dialog input { width: 100%; padding: 12px 14px; outline: none; border: 2px solid #e5d7cd; border-radius: 12px; background: #fff; }
dialog input:focus { border-color: var(--pink); }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.dialog-actions button { padding: 11px; border: 0; border-radius: 12px; color: #fff; background: var(--pink-dark); cursor: pointer; font-weight: 700; }
.dialog-actions .secondary { color: #746970; background: #eee7e1; }
.dialog-actions .danger-fill { background: #b65e67; }

.adventure-dialog { width: min(92vw, 520px); }
.dialog-kicker { margin-bottom: 5px; color: var(--pink-dark); font: 800 9px ui-monospace, monospace; letter-spacing: .25em; }
.adventure-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.destination { position: relative; display: flex; min-width: 0; flex-direction: column; align-items: center; padding: 15px 7px 12px; border: 2px solid transparent; border-radius: 16px; background: #f5f0e8; cursor: pointer; transition: .15s ease; }
.destination:hover { transform: translateY(-3px); border-color: #d5a3a9; }
.destination:disabled { cursor: not-allowed; filter: grayscale(1); opacity: .4; transform: none; }
.destination-icon { font-size: 30px; }
.destination strong { margin-top: 7px; font-size: 12px; }
.destination small { margin-top: 4px; color: #8d8087; font-size: 8px; white-space: nowrap; }
.destination em { margin-top: 8px; padding: 2px 7px; border-radius: 9px; color: #fff; background: #7ca482; font-size: 8px; font-style: normal; }
.destination.forest em { background: #b18a54; }
.destination.cave em { background: #ae6977; }
.close-adventure { display: block; width: 100%; margin-top: 12px; padding: 9px; border: 0; border-radius: 11px; cursor: pointer; }
.adventure-result { text-align: center; }
.result-icon { display: block; margin-bottom: 8px; font-size: 52px; animation: resultPop .45s ease both; }
.result-reward { margin: 16px 0; padding: 12px; border: 1px dashed #d5b4ad; border-radius: 14px; background: #fff7e8; color: #655760; font-size: 13px; font-weight: 700; }
.adventure-result > button { width: 100%; padding: 11px; border: 0; border-radius: 12px; color: #fff; background: var(--pink-dark); cursor: pointer; font-weight: 700; }

@keyframes twinkle { 50% { opacity: .35; transform: scale(.8); } }
@keyframes floatZ { from { opacity: 0; transform: translateY(8px); } 50% { opacity: 1; } to { opacity: 0; transform: translateY(-8px); } }
@keyframes pulse { 50% { opacity: .55; } }
@keyframes travelBlink { 50% { transform: translateX(-50%) translateY(-2px); } }
@keyframes resultPop { from { opacity: 0; transform: scale(.4) rotate(-12deg); } to { opacity: 1; transform: scale(1); } }

@media (max-width: 580px) {
  .game-shell { padding-top: 22px; }
  .device { padding: 30px 20px 32px; border-radius: 38px; }
  .speaker { display: none; }
  .screen { height: 225px; }
  .controls { grid-template-columns: repeat(3, 1fr); gap: 7px; }
  .care-button { font-size: 10px; }
  .care-button small { display: none; }
  .care-button span { font-size: 21px; }
  .status-card { padding: 16px; }
  .stats { gap: 12px 18px; }
  .adventure-grid { grid-template-columns: 1fr; }
  .destination { display: grid; grid-template-columns: 42px 1fr auto; text-align: left; }
  .destination-icon { grid-row: 1 / 4; }
  .destination strong, .destination small, .destination em { margin: 0; }
  .destination em { grid-column: 3; grid-row: 1 / 3; align-self: center; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
