/* 기본: 색 변수, 글꼴, 바탕, 본문 폭, 초점 표시, 모션 최소화 */
:root {
  --bg: #0b0709;
  --bg-2: #160c10;
  --card: #1c1015;
  --card-hi: #26151c;
  --line: #3a2129;
  --text: #f3e9ea;
  --muted: #a8939a;
  --red: #d6283b;
  --red-hi: #ff4458;
  --gold: #e8c160;
  --gold-dk: #b8862b;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(1200px 600px at 50% -200px, #3a0a1255, transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
main { max-width: 960px; margin: 0 auto; padding: 24px 16px 48px; outline: none; }
.muted { color: var(--muted); }
@media (max-width: 480px) {
  main { padding-left: 10px; padding-right: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
/* 한국어: 단어 중간에서 줄이 바뀌지 않게 */
html:lang(ko) body { word-break: keep-all; overflow-wrap: break-word; }
body {
  font-family: "Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  letter-spacing: -.011em;
  background:
    radial-gradient(900px 520px at 50% -180px, rgba(255, 45, 75, .16), transparent 70%),
    radial-gradient(600px 400px at 100% 0%, rgba(120, 60, 200, .08), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
main { position: relative; z-index: 1; }
::selection { background: rgba(255, 45, 75, .35); }
:focus-visible { outline: 2px solid var(--red-hi); outline-offset: 2px; }
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { outline: none; }
:root {
  --bg: #060509;
  --surface: rgba(255, 255, 255, .035);
  --text: #f4f1f6;
  --red: #ff2d4b;
  --red-deep: #b3132f;
  /* 바탕: 거의 검은 자주(aubergine). 이미지 #09050c / #170e1a / #261728 계열 */
  --bg: #0a0710;
  --bg-2: #130c1c;
  --card: #1a1124;
  --card-hi: #241730;
  /* 유리 표면·선: 자주 뮤트에 맞춘 약간 보라빛 알파 (구 시안 알파 대체) */
  --surface: rgba(196, 168, 214, .05);
  --surface-hi: rgba(196, 168, 214, .1);
  --line: rgba(176, 156, 198, .1);
  --line-hi: rgba(196, 172, 214, .22);
  /* 글자: 밝은 라벤더 화이트(#d4cad7 계열) + 뮤트 그레이(#a583a0 계열) */
  --text: #f1ecf4;
  --muted: #a294ad;
  /* 인터랙션 액센트: 장밋빛 로즈(이미지 #9c3148 / #973147 를 밝게). 시안 네온 자리.
     변수명 --blue* 는 기존 참조 호환용 토큰으로 두되 값은 로즈. */
  --blue: #e0649a;
  --blue-hi: #ff9ec2;
  --blue-dim: rgba(224, 100, 154, .15);
  --blue-deep: #7a1f44;
  /* 위험·오답·패배 전용: 순수 경고 레드(로즈와 명확히 구분) */
  --red: #ff2d4b;
  --red-hi: #ff5c70;
  /* 재화 전용 금색 — 유지 */
  --gold: #e8c160;
  --gold-dk: #b8862b;
  /* 브랜드·로고 "크롬": 장밋빛 플래티넘(로즈골드 느낌, 구 실버 크롬 대체) */
  --chrome-1: #f6eef3;
  --chrome-2: #ddc6da;
  --chrome-3: #a98fa8;
  --chrome-4: #6a556a;
  --radius: 18px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --shadow: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 30px 60px -30px rgba(0, 0, 0, .95);
  --glow: 0 10px 32px -10px rgba(224, 100, 154, .55);
  --chrome-text: linear-gradient(180deg, var(--chrome-1) 0%, var(--chrome-2) 34%, var(--chrome-3) 52%, #e9d8e8 56%, var(--chrome-4) 100%);
  color-scheme: dark;
}
/* 바탕 빛은 화면에 고정된 층(body::after)에 둔다. body 배경에 두면 화면 한 장 높이로 되풀이돼
   스크롤하면 이음새가 가로 띠처럼 보였다 (2026-11-27 사용자 지적) */
body { background: var(--bg); }
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 40%, transparent 55%, rgba(0, 0, 0, .5) 100%),
    radial-gradient(900px 480px at 50% -220px, rgba(224, 100, 154, .2), transparent 65%),
    radial-gradient(760px 520px at 110% -80px, rgba(150, 50, 90, .16), transparent 70%),
    radial-gradient(1100px 760px at 50% 118%, rgba(60, 24, 50, .42), transparent 70%);
}
main { z-index: 1; }
::selection { background: rgba(224, 100, 154, .35); color: #fff; }
:focus-visible { outline: 2px solid var(--blue-hi); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* 폰 자판 대응 (js/shell/keyboard.js, 2026-11-27): 입력 줄을 자판 바로 위에 띄워 붙인다. 화면은 그대로 둔다 */
.kb-dock {
  position: fixed !important;
  left: 8px;
  right: 8px;
  z-index: 950;
  margin: 0 !important;
  padding: 10px;
  max-width: none !important;
  width: auto !important;
  box-sizing: border-box;
  border-radius: 16px;
  background: rgba(14, 7, 12, .97);
  border: 1px solid rgba(255, 92, 141, .35);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, .65), 0 0 22px rgba(255, 45, 85, .18);
  transform: none !important;
  animation: kb-up .16s ease-out;
}
/* 자판이 떠 있는 동안 입력 줄 위에 띄우는 게임 화면 ([data-kb-float]. 2026-11-28) */
.kb-float {
  position: fixed !important;
  left: 8px;
  right: 8px;
  z-index: 949;
  margin: 0 !important;
  width: auto !important;
  max-width: none !important;
  box-sizing: border-box;
  display: flex !important;
  flex-direction: column;
  box-shadow: 0 0 0 100vmax rgba(5, 3, 4, .82), 0 10px 30px rgba(0, 0, 0, .7) !important;
  animation: kb-up .16s ease-out;
}
.kb-float > * { flex: 0 0 auto; }
.kb-float [data-kb-scroll] {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none !important;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}
@keyframes kb-up { from { opacity: 0; transform: translateY(12px); } }
/* 입력칸 기본 모양 (2026-11-28 사용자 지시 "흰색으로 구린 입력칸 디자인 개선"): 따로 꾸미지 않은 입력칸도 앱 분위기에 맞게.
   :where 라서 우선순위가 0 이다 → 화면마다 정한 모양이 그대로 이긴다 */
:where(input[type="text"], input[type="search"], input[type="number"], input[type="tel"], input[type="email"], input[type="password"], input:not([type]), textarea) {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  background: #12090e;
  color: var(--text);
  border: 1px solid rgba(255, 140, 180, .28);
  font: inherit;
  caret-color: #ff5c8d;
}
:where(textarea) { padding: 10px 14px; }
:where(input, textarea)::placeholder { color: var(--muted); opacity: .8; }
:where(input[type="text"], input[type="search"], input[type="number"], input[type="tel"], input[type="email"], input[type="password"], input:not([type]), textarea):focus {
  outline: none;
  border-color: #ff5c8d;
  box-shadow: 0 0 0 3px rgba(255, 92, 141, .28);
}
/* 아이폰은 글자가 16px 보다 작은 입력칸을 누르면 화면을 확대한다 → 폰에서는 입력칸 글자를 16px 이상으로 */
@media (pointer: coarse) {
  input[type="text"], input[type="search"], input[type="number"], input[type="tel"], input[type="email"], input[type="password"], input:not([type]), textarea { font-size: max(16px, 1em); }
}
