:root{color-scheme:light;--bg:#eeede9;--ink:#323936;--muted:#737873;--accent:#cfdfd0;--line:#d4d6cf;font-family:-apple-system,BlinkMacSystemFont,"PingFang TC","Noto Sans TC","Microsoft JhengHei",sans-serif;color:var(--ink);background:var(--bg)}
*{box-sizing:border-box}body{margin:0}button,a,input{-webkit-tap-highlight-color:transparent}button,input{font:inherit}button,a{touch-action:manipulation}button{cursor:pointer}button:disabled{cursor:wait;opacity:.6}button:focus-visible,a:focus-visible,input:focus-visible{outline:3px solid #758a72;outline-offset:5px}button,a{transition:background .18s,transform .18s}button:hover:not(:disabled){filter:brightness(.97)}button:active:not(:disabled),.pet-tools a:active{transform:scale(.95)}[hidden]{display:none!important}
#game{height:100vh;height:100dvh;min-height:360px;overflow:hidden;position:relative;isolation:isolate}.wordmark{position:absolute;top:32px;left:38px;font-size:14px;letter-spacing:.15em}.wordmark span{color:var(--muted);font-size:11px;letter-spacing:.12em}.heading{position:absolute;top:9%;left:50%;transform:translateX(-50%);width:min(92%,760px);text-align:center;z-index:2;pointer-events:none}.heading button,.heading a{pointer-events:auto}.eyebrow{font-size:11px;letter-spacing:.23em;color:var(--muted);margin:0 0 16px}h1{font-size:clamp(28px,3.9vw,52px);font-weight:400;letter-spacing:-.045em;margin:0;line-height:1.2}h1 span{font-weight:300;letter-spacing:-.045em}.subtitle{font-size:15px;letter-spacing:.08em;margin:18px 0 0;color:#686e68}.controls{margin-top:28px;min-height:68px}.primary,.secondary{min-height:47px;min-width:142px;padding:12px 24px;border-radius:6px;font-size:15px;letter-spacing:.08em;border:1px solid transparent;color:var(--ink)}.primary{background:var(--accent)}.primary span{margin-left:8px}.secondary{background:#f7f6f1;border-color:var(--line)}.secondary span{margin-left:8px}.hint{font-size:12px;line-height:1.5;color:var(--muted);margin:11px 0 0}.result{margin:0 0 17px;font-size:19px;animation:fade-in .25s ease both}.result-actions{display:flex;justify-content:center;gap:10px}.card-link{display:inline-block;margin-top:17px;font-size:14px;text-decoration:none;color:var(--ink);border-bottom:1px solid #a3afa0;padding-bottom:4px}.card-link span{margin-left:8px}.stage{position:absolute;bottom:-4px;left:50%;transform:translateX(-50%);width:min(78dvh,660px);height:min(78dvh,660px);z-index:0}.stage canvas{display:block;width:100%;height:100%;user-select:none}#game[data-state="playing"] .stage,#game[data-state="paused"] .stage{cursor:pointer;touch-action:manipulation}.stage.tap-feedback canvas{animation:stage-tap .12s ease-out}.pet-tools{position:absolute;right:36px;bottom:38px;display:flex;flex-direction:column;gap:15px;z-index:3}.pet-tools button,.pet-tools a{width:54px;height:54px;border-radius:50%;border:1px solid #fff;background:#f5f4f0;display:grid;place-items:center;padding:0;position:relative}.pet-tools button.selected{outline:1px solid #899e87;outline-offset:5px}.avatar{overflow:hidden}.avatar img{width:100%;height:125%;object-fit:cover;object-position:top;transform:scale(1.32);transform-origin:50% 18%}.upload-button svg{width:22px;height:22px;fill:none;stroke:var(--ink);stroke-width:1.35;stroke-linecap:round;stroke-linejoin:round}.pet-tools .logo-button{margin-top:10px;background:#f5cabc}.logo-button img{width:39px;height:39px}.footer-note{position:absolute;left:38px;bottom:31px;font-size:12px;letter-spacing:.1em;color:#777e75;margin:0}.notice{position:absolute;bottom:18px;left:50%;transform:translateX(-50%);background:#343c35;color:#fff;border-radius:8px;padding:12px 18px;font-size:14px;z-index:5;max-width:85%;text-align:center}#countdown{font-size:48px;font-weight:300;line-height:1.1;animation:count .65s ease both}
dialog{padding:25px;width:min(490px,calc(100vw - 28px));border:1px solid var(--line);border-radius:16px;background:#f5f4ef;color:var(--ink);max-height:calc(100dvh - 24px);overflow:auto}dialog::backdrop{background:#343a3359;backdrop-filter:blur(5px)}.editor-header{display:flex;align-items:center;justify-content:space-between}.editor-header .eyebrow{margin:0}.close{border:0;background:none;font-size:27px;width:36px;height:36px;color:var(--muted)}h2{font-size:20px;font-weight:500;margin:9px 0 17px}.edit-stage{width:min(100%,43dvh);aspect-ratio:1;margin:auto;background:#e3e3dd;border-radius:9px;overflow:hidden;touch-action:none}.edit-stage canvas{width:100%;height:100%;display:block;cursor:grab;touch-action:none}.edit-stage canvas:active{cursor:grabbing}.zoom-label{display:flex;gap:14px;align-items:center;font-size:12px;margin:20px 0}.zoom-label input{flex:1;width:30px;accent-color:#71876e;min-height:28px}.edit-actions{display:flex;gap:8px;align-items:center;justify-content:space-between}.edit-actions .primary{min-width:110px;padding:12px 17px}.text-button{background:none;border:0;color:#616e60;font-size:14px;padding:12px 3px}.privacy{font-size:12px;line-height:1.7;color:var(--muted);margin:17px 0 0;text-align:center}
@keyframes pop{50%{transform:scale(1.025)}100%{transform:scale(1)}}@keyframes fade-in{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:translateY(0)}}@keyframes count{0%{opacity:0;transform:scale(.88)}30%,75%{opacity:1;transform:scale(1)}100%{opacity:0}}
@media(max-width:600px){.wordmark{top:max(24px,env(safe-area-inset-top));left:23px;font-size:12px}.wordmark span{font-size:10px}.heading{top:10%;width:calc(100% - 30px)}.eyebrow{font-size:10px;letter-spacing:.17em;margin-bottom:15px}h1{font-size:clamp(25px,6.6vw,38px);white-space:nowrap}.subtitle{font-size:13px;letter-spacing:.02em;margin-top:14px}.controls{margin-top:24px}.stage{left:calc(50% - 24px);width:min(112vw,65dvh);height:min(112vw,65dvh)}.pet-tools{right:17px;bottom:max(24px,env(safe-area-inset-bottom));gap:14px}.pet-tools button,.pet-tools a{width:45px;height:45px}.logo-button img{width:33px;height:33px}.footer-note{display:none}.result{font-size:17px;margin-bottom:14px}.primary,.secondary{min-width:127px;font-size:14px;padding:11px 17px}.hint{font-size:11px}.card-link{font-size:13px;margin-top:14px}.pet-tools .logo-button{margin-top:4px}dialog{padding:19px}h2{font-size:18px}}
@media(max-height:660px){.heading{top:10%}.wordmark{top:19px}.eyebrow{display:none}.controls{margin-top:17px}.subtitle{margin-top:11px}.result{margin-bottom:10px}.card-link{margin-top:10px}.stage{width:min(100vw,63dvh);height:min(100vw,63dvh)}.pet-tools{gap:10px;bottom:20px}.pet-tools button,.pet-tools a{width:43px;height:43px}.hint{margin-top:6px}}
@media(max-height:460px) and (min-width:601px){.heading{left:28%;top:17%;width:50%}h1{font-size:27px}.subtitle{font-size:12px}.stage{left:72%;width:85dvh;height:85dvh}.pet-tools{right:14px;gap:9px}.wordmark{font-size:12px}.footer-note{display:none}.result{font-size:16px}.controls{margin-top:15px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important}}
/* Reserve space for result controls above even the tallest hairstyle. */
@media(min-width:601px) and (min-height:461px){.stage{width:min(60dvh,560px,calc(100dvh - 330px));height:min(60dvh,560px,calc(100dvh - 330px))}#game[data-state="paused"] .heading{top:9%}}
#game[data-state="paused"] .heading>.eyebrow,#game[data-state="paused"] .subtitle{display:none}
@media(max-width:600px) and (max-height:740px){.stage{width:min(112vw,calc(100dvh - 300px));height:min(112vw,calc(100dvh - 300px))}}
.speed-control{position:absolute;left:30px;top:46%;z-index:3;display:flex;flex-direction:column;align-items:center;gap:12px;color:var(--muted);font-size:12px;user-select:none}.speed-control label{font-size:13px;margin-bottom:4px}.speed-control input{writing-mode:vertical-lr;direction:ltr;width:36px;height:150px;margin:0;accent-color:#879d84;cursor:ns-resize;touch-action:none}
@media(max-width:600px){.speed-control{left:8px;top:43%;gap:8px}.speed-control input{width:30px;height:112px}.speed-control label{font-size:12px}}
@media(max-height:660px){.speed-control{top:44%;gap:6px}.speed-control input{height:90px}}
@media(max-height:460px) and (min-width:601px){.speed-control{left:12px;top:33%;gap:4px}.speed-control input{height:90px}}
/* Compact phone controls leave more room for the falling accessories. */
@media(max-width:600px){.wordmark{display:none}.heading{top:max(18px,calc(env(safe-area-inset-top) + 10px));width:calc(100% - 28px)}h1{font-size:clamp(22px,5.9vw,30px)}.subtitle{font-size:12px;margin-top:9px}.controls{margin-top:15px;min-height:48px}.primary,.secondary{min-height:40px;min-width:118px;padding:9px 15px;font-size:13px}.result{font-size:15px;margin-bottom:11px}.card-link{font-size:12px;margin-top:11px}.hint{font-size:10px;margin-top:7px}.stage{width:min(130vw,calc(100dvh - 210px));height:min(130vw,calc(100dvh - 210px))}#countdown{font-size:38px}}
.wordmark{color:inherit;text-decoration:none}.wordmark:hover{opacity:.8}
.browser-notice{display:none}
@media(max-width:600px){.stage{left:50%;transform:translateX(calc(-50% + var(--face-shift,0%)))}#game[data-character="custom"] .stage{left:calc(50% - 24px);transform:translateX(-50%)}.pet-tools{right:max(17px,env(safe-area-inset-right))}.browser-notice{display:flex;align-items:flex-start;gap:9px;margin:0 16px;padding:calc(10px + env(safe-area-inset-top)) 12px 10px;background:#fff3ce;color:#50534c;border-radius:12px;font-size:12px;line-height:1.55}.browser-notice p{margin:0;flex:1}.browser-notice button{border:0;background:none;color:inherit;padding:0;width:24px;min-height:24px;font-size:22px;line-height:1;flex-shrink:0}#game{height:calc(100dvh - var(--browser-notice-height,0px))}.stage{width:min(130vw,calc(100dvh - var(--browser-notice-height,0px) - 210px));height:min(130vw,calc(100dvh - var(--browser-notice-height,0px) - 210px))}}
.upload-tip{position:fixed;z-index:4;box-sizing:border-box;width:270px;padding:13px 30px 13px 15px;border:1px solid #e3ddcc;border-radius:12px;background:#fffaf0;color:var(--ink);box-shadow:0 4px 18px #343a3314;font-size:12px;line-height:1.55;cursor:default}.upload-tip::after{content:"";position:absolute;right:-7px;top:calc(var(--arrow-top,12px) - 6px);width:12px;height:12px;background:#fffaf0;border-top:1px solid #e3ddcc;border-right:1px solid #e3ddcc;transform:rotate(45deg)}.upload-tip strong{display:block;font-size:14px;font-weight:600;margin-bottom:4px}.upload-tip p{margin:0}.upload-tip button{position:absolute;right:5px;top:5px;border:0;background:transparent;color:#737873;font-size:20px;line-height:1;width:24px;height:24px;padding:0}.upload-tooltip{position:fixed;z-index:5;pointer-events:none;background:#fffaf0;border:1px solid #e3ddcc;border-radius:6px;padding:5px 9px;font-size:12px;color:var(--ink);white-space:nowrap}.upload-pulse{animation:upload-pulse .8s ease-in-out 2}@keyframes upload-pulse{50%{box-shadow:0 0 0 5px #9fb49d38;transform:scale(1.04)}}
.upload-tip.extended-arrow::before{content:"";position:absolute;right:0;top:calc(-1 * var(--arrow-rise));height:var(--arrow-rise);border-right:1px solid #d4c8aa;pointer-events:none}
@media(max-width:600px) and (max-height:660px){.upload-tip{font-size:11px;line-height:1.3;padding:7px 26px 7px 11px}.upload-tip strong{font-size:13px;margin-bottom:2px}}
.upload-tip.extended-arrow::after{width:0;height:0;right:-8px;top:calc(var(--arrow-top) - 6px);border:0;border-left:8px solid #e3ddcc;border-top:6px solid transparent;border-bottom:6px solid transparent;background:none;transform:none}

.stage-hint{position:absolute;top:3%;left:50%;transform:translateX(-50%);white-space:nowrap;pointer-events:none;background:#faf8f0ed;color:var(--ink);border-radius:20px;padding:8px 14px;font-size:13px;animation:stage-hint var(--hint-duration,1800ms) ease both}.stage:focus-visible{outline:1px solid #899e87;outline-offset:-4px}@keyframes stage-tap{50%{opacity:.92}}@keyframes stage-hint{0%{opacity:0}12%,80%{opacity:1}100%{opacity:0}}

.heading .controls{min-height:0;margin-top:14px}
#game[data-state="playing"] .controls{margin-top:0}
.result-actions{flex-wrap:nowrap;align-items:stretch}
.result-actions .card-link{display:inline-flex;align-items:center;justify-content:center;margin:0;text-decoration:none;border:1px solid var(--line);font-size:15px;line-height:normal;letter-spacing:.08em;padding:12px 24px}
@media(max-width:600px){.result-actions{gap:8px}.result-actions .secondary{min-width:0;white-space:nowrap;font-size:13px;padding:9px 12px}.heading .controls{margin-top:12px}#game[data-state="playing"] .controls{margin-top:0}}


/* ===== 2026-09-29 final layout: preserve original pet size + tall accessory runway ===== */
/* Header stays at its original top position in every state. */
#game[data-state] .heading{
  position:absolute;
  top:9%;
  left:50%;
  bottom:auto;
  transform:translateX(-50%);
  width:min(92%,760px);
  margin:0;
  display:block;
}
/* Reserve one fixed control area so PLAYING/PAUSED never moves the stage. */
.heading .controls{
  position:relative;
  height:122px;
  min-height:122px;
  margin-top:14px;
}
.heading .controls>div{
  position:absolute;
  inset:0;
  width:100%;
}
#result-panel[hidden]{display:block!important;visibility:hidden;pointer-events:none}
#game[data-state="paused"] .subtitle{visibility:hidden}
#game[data-state="playing"] .controls{margin-top:14px}

/* IMPORTANT: .stage is now only the interaction/fall runway.
   Its width remains the ORIGINAL game width. The canvas itself stays square,
   bottom-aligned, so pets keep exactly their original visual size. */
#game .stage{
  visibility:hidden;
  position:absolute;
  left:50%;
  top:var(--stage-top,300px);
  bottom:-4px;
  width:min(60dvh,560px,calc(100dvh - 330px));
  height:auto;
  margin:0;
  transform:translateX(-50%);
  z-index:0;
  overflow:visible;
}
#game[data-layout-ready] .stage{visibility:visible}
#game .stage canvas{
  position:absolute;
  left:0;
  bottom:0;
  width:100%;
  height:auto;
  aspect-ratio:1/1;
}
.falling-accessory{
  width:1px;
  height:1px;
  will-change:transform;
  position:absolute;
  left:0;
  top:0;
  display:block;
  pointer-events:none;
  user-select:none;
  z-index:2;
  max-width:none;
}
.stage-hint{z-index:4}

@media(max-width:600px){
  #game[data-state] .heading{
    top:max(18px,calc(env(safe-area-inset-top) + 10px));
    width:calc(100% - 28px);
  }
  .heading .controls{
    height:100px;
    min-height:100px;
    margin-top:12px;
  }
  #game[data-state="playing"] .controls{margin-top:12px}
  #game .stage{
    left:50%;
    width:min(130vw,calc(100dvh - var(--browser-notice-height,0px) - 210px));
    transform:translateX(calc(-50% + var(--face-shift,0%)));
  }
  #game[data-character="custom"] .stage{
    left:calc(50% - 24px);
    transform:translateX(-50%);
  }
}
@media(max-width:600px) and (max-height:740px){
  #game .stage{
    width:min(112vw,calc(100dvh - var(--browser-notice-height,0px) - 300px));
  }
}
@media(max-height:660px){
  #game .stage{width:min(100vw,63dvh)}
}
@media(max-height:460px) and (min-width:601px){
  #game[data-state] .heading{left:28%;top:17%;width:50%;transform:translateX(-50%)}
  .heading .controls{height:96px;min-height:96px}
  #game .stage{left:72%;width:85dvh;transform:translateX(-50%)}
}
/* Keep heading geometry identical when paused: hide subtitle visually, not structurally. */
#game[data-state="paused"] .subtitle{
  display:block!important;
  visibility:hidden!important;
}

/* Android Chrome / WebView: do not paint the default blue tap highlight over the large tappable game stage. */
#game .stage{
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

/* Brand and driving-exam links share a compact corner navigation. */
.brand-links{position:absolute;top:24px;left:38px;z-index:3;display:flex;flex-direction:column;align-items:flex-start;gap:0}
.brand-links .wordmark{position:static;display:block;padding:8px 0;line-height:20px}
.driver-exam-link{display:inline-flex;align-items:center;gap:6px;min-height:36px;color:#52694f;font-size:14px;line-height:20px;text-decoration:underline;text-decoration-color:#a3afa0;text-underline-offset:4px}
.driver-exam-link:hover{color:#323936}
@media(max-width:900px){
  .brand-links{top:10px;left:23px}
  #game[data-state] .heading{top:max(92px,9%)}
}
@media(max-width:600px){
  .brand-links{top:max(8px,env(safe-area-inset-top));left:20px}
  .brand-links .wordmark{font-size:12px;padding:4px 0;line-height:18px}
  .driver-exam-link{min-height:40px;font-size:13px}
  #game[data-state] .heading{top:max(88px,calc(env(safe-area-inset-top) + 80px))}
}
@media(max-height:460px) and (min-width:601px){
  .brand-links{top:8px}
  #game[data-state] .heading{top:92px}
}

/* Hide the corner navigation on phones; keep the desktop links and layout. */
@media(max-width:600px), (max-width:950px) and (max-height:600px) and (hover:none) and (pointer:coarse){
  .brand-links{display:none}
}
