:root {
  color-scheme: dark;
  --cream: #fff4d7;
  --ink: #17201d;
  --mint: #a6f4c5;
  --coral: #ff836d;
  --blue: #77b8ff;
  --line: rgba(255, 244, 215, .17);
}

*, *::before, *::after { box-sizing: border-box; }
html { min-height: 100%; background: #0d1513; }
body { min-height: 100%; margin: 0; overflow-x: hidden; color: var(--cream); background: radial-gradient(circle at 70% 0, #25463a 0, #12211c 40%, #0d1513 76%); font-family: "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif; }
button, input { font: inherit; }
button { min-height: 44px; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--mint); outline-offset: 2px; }

.codemate-shell { width: min(100%, 760px); margin: 0 auto; padding: clamp(20px, 5vw, 50px) clamp(12px, 4vw, 30px) 36px; }
header { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.mode { margin: 0 0 8px; color: var(--mint); font: 800 .68rem/1.3 ui-monospace, monospace; letter-spacing: .18em; }
h1 { margin: 0; font-size: clamp(2.7rem, 9vw, 5.2rem); line-height: .86; letter-spacing: -.07em; }
h1 span { display: block; margin-top: 10px; color: #b7c7c1; font: 700 .24em/1 ui-monospace, monospace; letter-spacing: .16em; }
.browser-badge { padding: 8px 11px; border: 1px solid var(--mint); border-radius: 999px; color: var(--mint); font-size: .72rem; white-space: nowrap; }
.honesty-note { margin: 20px 0 14px; max-width: 620px; color: #aebdb7; font-size: .84rem; line-height: 1.7; }

.pet-stage { position: relative; width: 100%; height: clamp(330px, 58vw, 430px); overflow: hidden; border: 1px solid var(--line); border-radius: 28px; background: linear-gradient(150deg, rgba(255,255,255,.055), rgba(0,0,0,.12)); box-shadow: inset 0 1px rgba(255,255,255,.06), 0 35px 80px rgba(0,0,0,.28); touch-action: none; }
.stage-grid { position: absolute; inset: 0; opacity: .35; background: linear-gradient(rgba(166,244,197,.09) 1px, transparent 1px), linear-gradient(90deg, rgba(166,244,197,.09) 1px, transparent 1px); background-size: 38px 38px; mask-image: linear-gradient(transparent, black 32%); }
.pet-shell { position: absolute; left: 0; top: 0; width: clamp(150px, 32vw, 210px); aspect-ratio: 1; cursor: grab; user-select: none; touch-action: none; will-change: transform; }
.pet-shell:active { cursor: grabbing; }
#pet-canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.pet-name { position: absolute; left: 50%; bottom: 4px; translate: -50% 0; max-width: 90%; overflow: hidden; padding: 5px 9px; border: 1px solid rgba(255,244,215,.14); border-radius: 999px; color: var(--cream); background: rgba(13,21,19,.78); font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
.drag-hint { position: absolute; right: 14px; bottom: 10px; margin: 0; color: #75867f; font: 700 .62rem/1 ui-monospace, monospace; letter-spacing: .09em; }

.control-deck { margin-top: 12px; padding: 17px; border: 1px solid var(--line); border-radius: 20px; background: rgba(10,18,15,.66); }
.name-control label { display: block; margin-bottom: 7px; color: #aebdb7; font-size: .76rem; }
.name-control > div { display: grid; grid-template-columns: 1fr auto; gap: 7px; }
input { min-width: 0; height: 46px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; color: var(--cream); background: #0c1713; }
.name-control button { padding: 0 17px; border: 0; border-radius: 10px; color: var(--ink); background: var(--mint); font-weight: 800; }
.mood-controls { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-top: 14px; }
.mood-controls button { padding: 8px 3px; border: 1px solid var(--line); border-radius: 10px; color: var(--cream); background: rgba(255,255,255,.035); font: 800 .66rem/1.1 ui-monospace, monospace; }
.mood-controls button span { color: #8ea198; font: 400 .68rem/1.5 system-ui, sans-serif; }
.mood-controls button:hover { border-color: var(--blue); }
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
#petStatus { margin: 0; color: var(--mint); font-size: .78rem; }
.reset-button { min-height: 36px; padding: 0 12px; border: 1px solid rgba(255,131,109,.5); border-radius: 8px; color: var(--coral); background: transparent; font-size: .72rem; }
.storage-notice { margin: 8px 0 0; color: #72877e; font-size: .7rem; }

@media (max-width: 500px) {
  header { align-items: flex-start; }
  .browser-badge { font-size: .62rem; }
  .control-deck { padding: 12px; }
  .name-control > div { grid-template-columns: 1fr; }
  .mood-controls { grid-template-columns: repeat(2, 1fr); }
}

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