/* 《오늘, 가롤로(카를로) 아쿠티스와 함께 걷습니다》 — 모바일 세로 전용 스타일 */

:root {
  --ink: #3a2a1e;
  --cream: #fff8ec;
  --night: #16233f;
  --dusk: #2b3b60;
  --sun: #f2b56b;
  --font-kr: 'Gowun Dodum', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--night);
  font-family: var(--font-kr);
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
  touch-action: none;
}

body {
  /* 배경이 캔버스 레터박스와 자연스럽게 이어지도록 */
  background: radial-gradient(120% 80% at 50% 12%, #2b3b60 0%, #16233f 62%, #101a30 100%);
}

/* 노치·홈바 안전영역을 확보한 실제 게임 영역 */
#game-shell {
  position: fixed;
  inset: 0;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  display: flex;
  align-items: center;
  justify-content: center;
}

#game {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game canvas {
  display: block;
  touch-action: none;
  /* 저사양 기기에서도 또렷하게 */
  image-rendering: auto;
  border-radius: 2px;
}

/* ── 가로 화면 안내 ───────────────────────────── */
#rotate-guard {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  background: linear-gradient(160deg, #1b2a4a 0%, #101a30 100%);
  padding: 24px calc(24px + env(safe-area-inset-left, 0px));
}

#rotate-guard.show { display: flex; }

.rotate-inner { text-align: center; max-width: 460px; }

.rotate-icon {
  font-size: 52px;
  margin-bottom: 18px;
  animation: tilt 2.4s ease-in-out infinite;
}

@keyframes tilt {
  0%, 100% { transform: rotate(-90deg); }
  45%, 75% { transform: rotate(0deg); }
}

.rotate-title {
  color: var(--cream);
  font-size: 22px;
  line-height: 1.5;
  margin: 0 0 10px;
}

.rotate-sub {
  color: #c8d4ea;
  font-size: 17px;
  line-height: 1.6;
  margin: 0;
}

/* ── 첫 로딩 화면 ─────────────────────────────── */
#boot-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(170deg, #2b3b60 0%, #16233f 70%);
  transition: opacity .6s ease;
}

#boot-screen.hide { opacity: 0; pointer-events: none; }

.boot-inner { text-align: center; padding: 0 28px; }

.boot-title {
  color: var(--cream);
  font-size: 21px;
  line-height: 1.7;
  letter-spacing: .5px;
  margin: 0 0 26px;
}

.boot-bar {
  width: 190px;
  height: 4px;
  margin: 0 auto 16px;
  border-radius: 4px;
  background: rgba(255, 248, 236, .18);
  overflow: hidden;
}

.boot-bar span {
  display: block;
  width: 40%;
  height: 100%;
  border-radius: 4px;
  background: var(--sun);
  animation: slide 1.5s ease-in-out infinite;
}

@keyframes slide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(320%); }
}

.boot-sub {
  color: #b9c6df;
  font-size: 16px;
  margin: 0;
}

/* ── PC (마우스와 키보드) ─────────────────────── */
body.desktop {
  background:
    radial-gradient(70% 60% at 50% 8%, #33456f 0%, #1b2a4a 46%, #101a30 100%);
}

/* 창 높이를 가득 채웁니다 */
body.desktop #game-shell { padding: 0; }

body.desktop #game canvas {
  height: 100vh !important;
  height: 100dvh !important;
  width: auto !important;
  max-width: 100vw;
  border-radius: 0;
  box-shadow: 0 0 90px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 248, 236, .07);
}

/* PC 에서는 창 모양이 어떻든 세로로 돌리라는 안내를 하지 않습니다 */
body.desktop #rotate-guard { display: none !important; }

/* ── 직접 적는 칸 ─────────────────────────────────
   게임 화면(캔버스) 위에 브라우저 입력창을 따로 띄웁니다.
   Phaser 안에 얹으면 자판이 올라올 때 화면 전체가 다시 맞춰지며 깨집니다. */
#ask-layer {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 70;
  display: flex;
  justify-content: center;
  background: rgba(14, 21, 38, .975);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* 게임 화면에는 글자 선택·스크롤을 막아 두었습니다.
   적는 칸 안에서는 다시 풀어 줍니다. */
#ask-layer,
#ask-layer * {
  -webkit-user-select: auto;
  user-select: auto;
  touch-action: auto;
}

#ask-layer .ask-field {
  -webkit-user-select: text;
  user-select: text;
}

#ask-layer .ask-inner {
  width: 100%;
  max-width: 430px;
  padding: 34px 26px 26px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  overflow-y: auto;
}

#ask-layer .ask-q {
  margin: 0;
  color: #fff8ec;
  font-size: 23px;
  line-height: 1.5;
  text-align: center;
  word-break: keep-all;
}

#ask-layer .ask-note {
  margin: 0;
  color: #e0d3bd;
  font-size: 17px;
  line-height: 1.5;
  text-align: center;
  opacity: .85;
  word-break: keep-all;
}

#ask-layer .ask-field {
  width: 100%;
  box-sizing: border-box;
  margin-top: 6px;
  padding: 16px 18px;
  font-family: inherit;
  font-size: 22px;
  line-height: 1.4;
  color: #3d2c20;
  background: #fdf3e0;
  border: 3px solid rgba(210, 130, 47, .85);
  border-radius: 16px;
  outline: none;
  -webkit-appearance: none;
}

#ask-layer .ask-field::placeholder { color: #b9a88f; }

#ask-layer .ask-tip {
  margin: 0;
  color: #9db0cc;
  font-size: 15px;
  text-align: center;
}

#ask-layer .ask-btn {
  width: 100%;
  box-sizing: border-box;
  min-height: 62px;
  padding: 14px 18px;
  font-family: inherit;
  font-size: 20px;
  color: #3d2c20;
  background: #f2b56b;
  border: 2px solid rgba(210, 130, 47, .7);
  border-radius: 16px;
  cursor: pointer;
}

#ask-layer .ask-btn.ask-skip {
  min-height: 56px;
  font-size: 17px;
  color: #fdf3e0;
  background: transparent;
  border-color: rgba(253, 243, 224, .35);
}

#ask-layer .ask-btn:active { transform: translateY(2px); }
