:root {
  --amber: #F28803;
  --amber-deep: #d97700;
  --black: #0a0a0a;
  --ink: #111111;
  --muted: rgba(0,0,0,.55);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  background: var(--amber);
  color: var(--black);
  font-family: "Noto Sans TC", "PingFang HK", "PingFang TC", "Microsoft JhengHei",
    system-ui, -apple-system, sans-serif;
}

body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
}

#app {
  height: 100%;
  height: 100dvh;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  background: var(--amber);
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.screen.active { display: flex; }

/* ---- ink decorations (sumi-e style, abstract, no readable text) ---- */
.ink {
  position: absolute;
  pointer-events: none;
  z-index: 0;
  background: var(--black);
}
.ink-blot-1 {
  width: 58%; height: 34%;
  top: -10%; left: -18%;
  border-radius: 48% 52% 42% 58% / 55% 38% 62% 45%;
  transform: rotate(-22deg);
  opacity: .95;
  filter: blur(.2px);
  box-shadow:
    28px 36px 0 -8px rgba(0,0,0,.9),
    52px 18px 0 -16px rgba(0,0,0,.75),
    12px 70px 0 -20px rgba(0,0,0,.55),
    70px 55px 0 -24px rgba(0,0,0,.4);
}
.ink-blot-1::before,
.ink-blot-1::after,
.ink-blot-2::before,
.ink-blot-2::after,
.ink-slash::before {
  content: "";
  position: absolute;
  background: var(--black);
  border-radius: 50%;
}
.ink-blot-1::before {
  width: 34%; height: 28%;
  right: -8%; bottom: -18%;
  border-radius: 60% 40% 55% 45%;
  opacity: .85;
}
.ink-blot-1::after {
  width: 14%; height: 12%;
  right: 18%; top: 55%;
  opacity: .7;
  box-shadow: 24px 10px 0 rgba(0,0,0,.65), 40px -6px 0 -2px rgba(0,0,0,.45);
}
.ink-blot-2 {
  width: 42%; height: 26%;
  bottom: 14%; left: -14%;
  border-radius: 58% 42% 50% 50% / 40% 60% 40% 60%;
  transform: rotate(18deg);
  opacity: .9;
  box-shadow:
    36px -12px 0 -10px rgba(0,0,0,.8),
    18px 28px 0 -14px rgba(0,0,0,.55),
    55px 20px 0 -18px rgba(0,0,0,.35);
}
.ink-blot-2::before {
  width: 26%; height: 30%;
  right: -6%; top: -20%;
  opacity: .75;
}
.ink-blot-2::after {
  width: 10%; height: 9%;
  right: 30%; bottom: -10%;
  opacity: .6;
  box-shadow: -16px 8px 0 rgba(0,0,0,.5), 12px 14px 0 -1px rgba(0,0,0,.4);
}
.ink-blot-3 {
  width: 18%; height: 12%;
  top: 38%; left: 26%;
  border-radius: 50% 50% 45% 55%;
  opacity: .28;
  transform: rotate(-8deg);
  box-shadow: 20px 8px 0 -4px rgba(0,0,0,.22);
}
.ink-slash {
  width: 78%; height: 18px;
  top: 11%; left: -14%;
  transform: rotate(-14deg);
  border-radius: 40% 60% 50% 50%;
  opacity: .22;
  filter: blur(.4px);
}
.ink-slash::before {
  width: 40%; height: 10px;
  left: 35%; top: 22px;
  transform: rotate(6deg);
  opacity: .55;
  border-radius: 8px;
}

/* ---- LOGIN (mock-locked 720×1280) ---- */
#screen-login {
  background: var(--amber);
  align-items: center;
  justify-content: center;
}
.login-stage {
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  width: min(100%, calc(100dvh * 720 / 1280));
  aspect-ratio: 720 / 1280;
  max-height: 100%;
  max-width: 100%;
  height: auto;
  overflow: hidden;
  background: var(--amber);
}
.login-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  object-position: center;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  z-index: 0;
}
.login-hit {
  position: absolute;
  inset: 0;
  z-index: 2;
  margin: 0;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
.hit {
  position: absolute;
  box-sizing: border-box;
  font-family: inherit;
}
.hit-email,
.hit-password {
  left: 6.1%;
  width: 52.1%;
  height: 5.9%;
  border: none;
  outline: none;
  border-radius: 12px;
  background: #000;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  padding: 0 4.5%;
  -webkit-appearance: none;
  appearance: none;
}
.hit-email { top: 42.4%; }
.hit-password { top: 49.9%; }
.hit-email::placeholder,
.hit-password::placeholder {
  color: rgba(255,255,255,.92);
  font-weight: 600;
}
.hit-email:focus::placeholder,
.hit-password:focus::placeholder {
  color: rgba(255,255,255,.35);
}
.hit-error {
  left: 6.1%;
  top: 55.9%;
  width: 52.1%;
  height: 1.6%;
  font-size: clamp(10px, 2.4vw, 12px);
  font-weight: 700;
  color: #8b0000;
  display: flex;
  align-items: center;
  pointer-events: none;
}
.hit-submit {
  left: 6.1%;
  top: 57.7%;
  width: 52.1%;
  height: 6.5%;
  border: none;
  border-radius: 12px;
  background: #000;
  color: var(--amber);
  font-weight: 800;
  font-size: clamp(1rem, 4.2vw, 1.15rem);
  cursor: pointer;
  padding: 0;
}
.hit-submit:active { transform: scale(.98); }
.hit-register,
.hit-forgot {
  top: 64.5%;
  height: 2.8%;
  width: 22%;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  opacity: 0;
}
.hit-register { left: 7%; }
.hit-forgot { left: 36%; }
.hit-google {
  left: 14.4%;
  top: 72.6%;
  width: 38.2%;
  height: 4.9%;
  border: none;
  border-radius: 10px;
  background: transparent;
  cursor: not-allowed;
  opacity: 0;
  padding: 0;
}
.login-hit .quick-accounts {
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 2.2%;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  z-index: 3;
}
.login-hit .chip {
  border: 1.5px solid rgba(0,0,0,.55);
  background: rgba(242,136,3,.82);
  color: #000;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: .68rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
}
.login-hit .chip:active { transform: scale(.97); background: rgba(0,0,0,.16); }

/* ---- HOME (mock-locked 720×1280) ---- */
#screen-home {
  background: var(--amber);
  align-items: center;
  justify-content: center;
  padding: 0;
}
.home-stage {
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  width: min(100%, calc(100dvh * 720 / 1280));
  aspect-ratio: 720 / 1280;
  max-height: 100%;
  max-width: 100%;
  height: auto;
  overflow: hidden;
  background: var(--amber);
}
.home-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  object-position: center;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  z-index: 0;
}
.home-hit {
  position: absolute;
  inset: 0;
  z-index: 2;
  margin: 0;
}
.hit-avatar {
  left: 83.2%;
  top: 2.7%;
  width: 11.2%;
  height: 6.3%;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  padding: 0;
  opacity: 0;
}
.hit-game {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  opacity: 0;
  border-radius: 18px;
}
.hit-game:active { opacity: .08; background: #000; }
.hit-game-tl { left: 5.6%; top: 20.5%; width: 43.0%; height: 30.3%; }
.hit-game-tr { left: 51.1%; top: 20.5%; width: 43.0%; height: 30.3%; }
.hit-game-bl { left: 5.6%; top: 54.0%; width: 43.0%; height: 30.5%; }
.hit-game-br { left: 51.1%; top: 54.0%; width: 43.0%; height: 30.5%; }
.hit-nav {
  top: 95.2%;
  height: 4.8%;
  width: 25%;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  opacity: 0;
}
.hit-nav:disabled { cursor: default; }
.hit-nav-home { left: 0; }
.hit-nav-lib { left: 25%; }
.hit-nav-store { left: 50%; }
.hit-nav-me { left: 75%; }

.me-panel {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  background: rgba(242, 136, 3, .96);
}
.me-panel[hidden] { display: none !important; }
.me-panel h2 { font-size: 1.4rem; font-weight: 900; }
.me-panel p { opacity: .75; font-weight: 600; word-break: break-all; }
.btn-primary {
  border: none;
  background: #000;
  color: var(--amber);
  font-weight: 800;
  border-radius: 12px;
  padding: 12px 28px;
  font-family: inherit;
  cursor: pointer;
  font-size: .95rem;
  max-width: 220px;
}
.btn-ghost {
  border: 1.5px solid #000;
  background: transparent;
  color: #000;
  font-weight: 800;
  border-radius: 12px;
  padding: 10px 24px;
  font-family: inherit;
  cursor: pointer;
  font-size: .9rem;
}

/* ---- GAME SHELL ---- */
#screen-game {
  background: #050505;
  color: #fff;
}
.game-topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + var(--safe-top)) 12px 10px;
  background: rgba(0,0,0,.85);
  border-bottom: 1px solid rgba(249,157,28,.35);
  z-index: 2;
}
.btn-back {
  border: none;
  background: var(--amber);
  color: var(--black);
  font-weight: 800;
  border-radius: 10px;
  padding: 8px 12px;
  font-family: inherit;
  cursor: pointer;
  font-size: .85rem;
}
.game-title {
  font-weight: 800;
  font-size: 1rem;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.game-stage {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #1a1208 0%, #050505 70%);
}
.game-stage canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.game-hint {
  position: absolute;
  bottom: calc(20px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  font-size: .8rem;
  color: rgba(249,157,28,.85);
  font-weight: 600;
  pointer-events: none;
  text-align: center;
  width: 90%;
}

/* stub tabs */
.stub-panel {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
}
.stub-panel h2 { font-size: 1.4rem; font-weight: 900; }
.stub-panel p { opacity: .7; font-weight: 600; }

.quick-accounts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}
.chip {
  border: 1.5px solid var(--black);
  background: rgba(0,0,0,.08);
  color: var(--black);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: .72rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
}
.chip:active { transform: scale(.97); background: rgba(0,0,0,.16); }

.ink-img {
  position: absolute;
  z-index: 0;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.ink-tl {
  top: -6%;
  left: -22%;
  width: 78%;
  max-width: 360px;
  opacity: .92;
  transform: rotate(-8deg);
}
.ink-bl {
  bottom: 8%;
  left: -18%;
  width: 62%;
  max-width: 280px;
  opacity: .88;
  transform: rotate(12deg);
}
.ink-br {
  right: -20%;
  left: auto;
  bottom: 18%;
  width: 58%;
  max-width: 260px;
  opacity: .55;
  transform: scaleX(-1) rotate(-18deg);
}
.home-ink.ink-tl {
  opacity: .7;
  width: 70%;
  top: -8%;
  left: -18%;
}
