:root {
  --bg: #fdf4e3;
  --fg: #3a2f2a;
  --panel: #fff8ec;
  --accent: #7fb069;
  --ink: #3a2f2a;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--fg); font-family: "Jua", -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif; overflow: hidden; }
#stage { width: 100vw; height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
#game {
  /* 1280x720 비율을 유지하며 화면에 맞춤 */
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
  display: block;
  background: #cfeaf7;
}
#toast {
  position: fixed; left: 50%; bottom: 20%; transform: translateX(-50%);
  background: var(--panel); color: var(--fg); padding: 10px 18px; border-radius: 14px;
  border: 3px solid var(--ink); font-size: 18px; opacity: 0; transition: opacity .2s; pointer-events: none;
  box-shadow: 0 5px 0 rgba(58,47,42,.18);
}
#toast.show { opacity: 1; }

/* 로그인 / 회원가입 화면 */
#auth {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--bg); z-index: 10;
}
#auth[hidden] { display: none; }
#auth-form {
  width: min(380px, 90vw); background: var(--panel); border-radius: 24px; padding: 30px 26px;
  border: 4px solid var(--ink); box-shadow: 0 8px 0 rgba(58,47,42,.18);
  display: flex; flex-direction: column; gap: 12px;
}
#auth-form h1 { font-size: 34px; font-weight: 400; text-align: center; letter-spacing: 1px; }
#auth-form .tabs { display: flex; border-radius: 14px; overflow: hidden; border: 3px solid var(--ink); }
#auth-form .tab {
  flex: 1; padding: 10px; font-size: 18px; font-family: inherit; border: 0; background: transparent; color: var(--fg); cursor: pointer;
}
#auth-form .tab.active { background: #f6c453; }
#auth-form input {
  font-size: 17px; font-family: inherit; padding: 12px 14px; border-radius: 14px; border: 3px solid var(--ink);
  background: #fff; color: var(--fg);
}
#auth-form input::placeholder { color: #b9ab93; }
#auth-form input[hidden] { display: none; }
#auth-form button[type=submit] {
  font-size: 20px; font-family: inherit; padding: 12px; border-radius: 14px; border: 3px solid var(--ink);
  background: var(--accent); color: #fff; cursor: pointer; box-shadow: 0 5px 0 rgba(58,47,42,.18);
}
#auth-form button[type=submit]:active { transform: translateY(4px); box-shadow: none; }
#auth-form button:disabled { opacity: .6; }
#auth-msg { min-height: 1.2em; font-size: 15px; opacity: .85; line-height: 1.5; text-align: center; }
