/* 좀비서울 디자인 토큰·공통 요소. 모던워페어풍: 짙은 남색·검정, 반투명 패널, 얇은 선, 좁은 대문자 보조 라벨 */
:root {
  --bg0: #04060b;
  --bg1: #0a1020;
  --bg2: #111a30;
  --panel: rgba(8, 13, 26, 0.78);
  --panel2: rgba(16, 24, 44, 0.72);
  --panel-solid: #0c1322;
  --line: rgba(255, 255, 255, 0.12);
  --line2: rgba(255, 255, 255, 0.24);
  --text: #e9edf5;
  --text2: #b9c1d3;
  --muted: #7f8aa3;
  --amber: #ffb21e;
  --amber2: #ffd166;
  --amber-dim: rgba(255, 178, 30, 0.18);
  --danger: #ff3b30;
  --crimson: #b3001b;
  --green: #5dff7a;
  --poison: #39d353;
  --cyan: #4fd1ff;
  --f-kr: 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  --f-title: 'Black Han Sans', var(--f-kr);
  --f-num: 'Rajdhani', var(--f-kr);
  --f-cap: 'Oswald', var(--f-kr);
  --r: 3px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg0);
  color: var(--text);
  font-family: var(--f-kr);
  font-size: 14px;
  line-height: 1.45;
  overflow: hidden;
  word-break: keep-all;          /* 한글이 낱말 중간에서 끊기지 않게 ("내려가세 / 요" 방지) */
  overflow-wrap: anywhere;       /* 띄어쓰기 없는 긴 글은 그래도 넘치지 않게 */
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 1px solid var(--amber); outline-offset: 2px; }
img { display: block; max-width: 100%; }
a { color: var(--amber2); text-decoration: none; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* 타이포 */
.cap { font-family: var(--f-cap); text-transform: uppercase; letter-spacing: 0.18em; font-weight: 500; font-size: 11px; color: var(--muted); }
.cap.amber { color: var(--amber); }
.num { font-family: var(--f-num); font-weight: 700; font-variant-numeric: tabular-nums; }
.title { font-family: var(--f-title); font-weight: 400; letter-spacing: 0.01em; line-height: 1.05; }
h1, h2, h3 { margin: 0; font-weight: 700; }

/* 부팅 화면 (설정·폰트 준비 전) */
#boot {
  position: fixed; inset: 0; z-index: 1000;
  background: radial-gradient(ellipse at 50% 60%, #0d1528 0%, var(--bg0) 70%);
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 18px;
  transition: opacity 0.45s var(--ease);
}
#boot.out { opacity: 0; pointer-events: none; }
#boot .boot-mark {
  width: 46px; height: 46px; border: 2px solid rgba(255, 255, 255, 0.12); border-top-color: var(--amber);
  border-radius: 50%; animation: spin 0.9s linear infinite;
}
#boot .boot-text { font-family: Oswald, Arial, sans-serif; text-transform: uppercase; letter-spacing: 0.3em; font-size: 11px; color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }

/* 버튼 */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 20px; border: 1px solid var(--line2); border-radius: var(--r);
  background: rgba(255, 255, 255, 0.04); color: var(--text); font-weight: 500; font-size: 14px;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.15s var(--ease), color 0.15s;
  white-space: nowrap;
}
.btn::before { content: ''; position: absolute; left: -1px; top: -1px; bottom: -1px; width: 3px; background: var(--amber); opacity: 0; transition: opacity 0.15s; }
.btn:hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.4); transform: translateX(2px); }
.btn:hover::before { opacity: 1; }
.btn:active { transform: translateX(2px) scale(0.985); }
.btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.btn:disabled::before { opacity: 0; }
.btn.primary { background: var(--amber); border-color: var(--amber); color: #15120a; font-weight: 700; }
.btn.primary:hover { background: var(--amber2); border-color: var(--amber2); }
.btn.primary::before { background: #15120a; }
.btn.danger { border-color: rgba(255, 59, 48, 0.6); color: #ff8a84; }
.btn.danger:hover { background: rgba(255, 59, 48, 0.14); }
.btn.danger::before { background: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text2); }
.btn.ghost:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.lg { height: 50px; padding: 0 28px; font-size: 15px; }
.btn.block { width: 100%; }
.btn .cap { color: inherit; opacity: 0.7; }

/* 입력 */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12px; color: var(--text2); display: flex; justify-content: space-between; }
.field > label small { color: var(--muted); font-weight: 400; }
.input, .select, .textarea {
  width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line2); border-radius: var(--r);
  background: rgba(0, 0, 0, 0.35); color: var(--text); transition: border-color 0.15s, background 0.15s;
}
.textarea { height: auto; min-height: 110px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: rgba(255, 255, 255, 0.28); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--amber); background: rgba(0, 0, 0, 0.5); outline: none; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 18px, calc(100% - 11px) 18px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.select option { background: var(--panel-solid); }
.input.code { font-family: var(--f-num); font-weight: 700; font-size: 28px; letter-spacing: 0.42em; text-align: center; height: 62px; text-transform: uppercase; }

/* 토글·세그먼트 */
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: var(--r); overflow: hidden; }
.seg button { height: 36px; padding: 0 14px; color: var(--text2); font-size: 13px; border-right: 1px solid var(--line); transition: background 0.15s, color 0.15s; }
.seg button:last-child { border-right: 0; }
.seg button:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.seg button.on { background: var(--amber); color: #15120a; font-weight: 700; }
.seg button:disabled { opacity: 0.45; cursor: default; }
.toggle { position: relative; width: 44px; height: 24px; border-radius: 12px; background: rgba(255, 255, 255, 0.14); border: 1px solid var(--line2); transition: background 0.15s; flex: none; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.18s var(--ease); }
.toggle.on { background: var(--amber); border-color: var(--amber); }
.toggle.on::after { transform: translateX(20px); background: #15120a; }
.toggle:disabled { opacity: 0.4; cursor: default; }
.range { -webkit-appearance: none; width: 100%; height: 4px; background: rgba(255, 255, 255, 0.16); border-radius: 2px; outline: none; }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--amber); border: 2px solid #15120a; box-shadow: 0 0 0 1px var(--amber); cursor: pointer; }

/* 패널·카드 */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.panel-head .cap { font-size: 11px; }
.panel-body { padding: 16px; }
.line-amber { height: 2px; width: 44px; background: var(--amber); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 2px; font-family: var(--f-cap); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; border: 1px solid var(--line2); color: var(--text2); }
.chip.amber { background: var(--amber); border-color: var(--amber); color: #15120a; }
.chip.green { border-color: rgba(93, 255, 122, 0.5); color: var(--green); }
.chip.red { border-color: rgba(255, 59, 48, 0.6); color: #ff8a84; }
.chip.dim { opacity: 0.5; }

/* 키 표시 */
.kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 26px; padding: 0 8px; border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 3px; font-family: var(--f-num); font-weight: 700; font-size: 13px; color: var(--text); background: rgba(255, 255, 255, 0.05); }

/* 애니메이션 */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes slideInL { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.anim-rise { animation: riseIn 0.35s var(--ease) both; }
.anim-fade { animation: fadeIn 0.3s var(--ease) both; }

/* 비네팅·노이즈 */
.vignette { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.6) 100%); }
.scan { position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.015) 0 1px, transparent 1px 3px); mix-blend-mode: overlay; }

/* 공포 분위기 레이어 (js/ui/fx.js 가 붙임). --horror = 세기 0~1 */
:root { --grain-url: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); }
.horror { --horror: 0.6; }
.fx-grain { position: absolute; inset: -12%; pointer-events: none; background-image: var(--grain-url); background-size: 220px 220px; opacity: calc(0.22 * var(--horror)); mix-blend-mode: overlay; animation: grain 0.5s steps(5) infinite; z-index: 1; }
@keyframes grain { 0% { transform: translate(0, 0); } 20% { transform: translate(-2%, 1.5%); } 40% { transform: translate(1.5%, -2%); } 60% { transform: translate(-1%, -1%); } 80% { transform: translate(2%, 2%); } 100% { transform: translate(0, 0); } }
.fx-scan { position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px); opacity: calc(0.55 * var(--horror)); z-index: 1; }
.fx-redvign { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 100% 0%, rgba(110, 0, 8, 0.55) 0, rgba(110, 0, 8, 0) 42%), radial-gradient(ellipse at 0% 100%, rgba(90, 0, 6, 0.5) 0, rgba(90, 0, 6, 0) 40%); opacity: calc(0.9 * var(--horror)); animation: redbreath 6s ease-in-out infinite; z-index: 1; }
@keyframes redbreath { 0%, 100% { opacity: calc(0.7 * var(--horror)); } 50% { opacity: calc(1 * var(--horror)); } }
.fx-blood { position: absolute; width: 46vw; height: 46vw; pointer-events: none; background-size: contain; background-repeat: no-repeat; background-position: center; opacity: calc(0.42 * var(--horror)); filter: brightness(0.42) saturate(1.1); z-index: 1; }
.fx-blood.tr { right: -10vw; top: -14vw; transform: rotate(-24deg); }
.fx-blood.bl { left: -14vw; bottom: -16vw; transform: rotate(140deg) scaleX(-1); }
.fx-blood.br { right: -12vw; bottom: -18vw; transform: rotate(60deg); }
.fx-blood.c { left: 50%; top: 10%; width: 60vw; height: 60vw; margin-left: -30vw; opacity: calc(0.3 * var(--horror)); transform: rotate(8deg); }
.fx-blood.css { background-image: radial-gradient(circle at 50% 50%, rgba(70, 0, 4, 0.9) 0 18%, rgba(70, 0, 4, 0) 19%), radial-gradient(circle at 34% 40%, rgba(70, 0, 4, 0.85) 0 9%, rgba(70, 0, 4, 0) 10%), radial-gradient(circle at 66% 36%, rgba(70, 0, 4, 0.85) 0 7%, rgba(70, 0, 4, 0) 8%), radial-gradient(circle at 60% 70%, rgba(70, 0, 4, 0.8) 0 6%, rgba(70, 0, 4, 0) 7%); }
/* 가끔 지직 하고 깜빡임 (로고·제목) */
.horror.flick .logo .ko, .horror.flick .s-loading .mtitle, .horror.flick .s-end .hero h1 { animation: flick 7s linear infinite; }
@keyframes flick { 0%, 91%, 100% { opacity: 1; transform: none; filter: none; } 92% { opacity: 0.5; transform: translateX(1.5px); } 93% { opacity: 1; } 94.5% { opacity: 0.35; transform: translateX(-2px) skewX(3deg); filter: brightness(1.7) blur(0.4px); } 95.2% { opacity: 1; transform: none; filter: none; } 97% { opacity: 0.75; } 97.6% { opacity: 1; } }
.horror .logo .en { color: #ff5a4f; text-shadow: 0 0 10px rgba(255, 59, 48, 0.45); }
.horror .logo .ko { text-shadow: 0 2px 24px rgba(0, 0, 0, 0.7), 0 0 28px rgba(140, 0, 10, 0.55); }

/* 움직임 줄이기 설정(또는 자동 시험): 애니메이션·전환 끔 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .menu-bg .flicker, .fx-grain { display: none; }
}

/* 그래픽 가속이 꺼진 브라우저(소프트웨어 렌더, html.zs-lite): 흐림·섞기·화면 전체가 움직이는 꾸밈을 끄고 불투명하게 (소프트웨어 합성은 이게 아주 비쌈) */
.zs-lite *, .zs-lite *::before, .zs-lite *::after { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
.zs-lite .panel { background: rgba(8, 13, 26, 0.94); }
.zs-lite .fx-grain, .zs-lite .scan, .zs-lite .menu-bg .flicker { display: none !important; }
.zs-lite .fx-redvign { animation: none; }
.zs-lite .menu-bg.drift .img, .zs-lite .s-loading .bg { animation: none !important; transform: scale(1.06); }
.zs-lite .horror.flick .logo .ko, .zs-lite .horror.flick .s-loading .mtitle, .zs-lite .horror.flick .s-end .hero h1 { animation: none; }

/* 그래픽 가속 꺼짐 안내 카드 (메인 메뉴 가운데 칸, js/ui/perfcheck.js) */
.perf-warn { align-self: center; justify-self: center; width: 100%; max-width: 440px; padding: 18px 18px 12px; border: 1px solid rgba(255, 178, 30, 0.5); border-left: 3px solid var(--amber); background: rgba(16, 11, 4, 0.9); animation: riseIn 0.35s var(--ease) both; transition: opacity 0.25s; }
.perf-warn.out { opacity: 0; }
.perf-warn.nogl { border-color: rgba(255, 59, 48, 0.6); border-left-color: var(--danger); }
.perf-warn .pw-img { width: 100%; border-radius: var(--r); margin-bottom: 12px; }
.perf-warn .pw-head { display: flex; align-items: center; gap: 10px; }
.perf-warn .pw-ico, .perf-line .pw-ico { flex: none; width: 22px; height: 22px; color: var(--amber); }
.perf-warn.nogl .pw-ico { color: var(--danger); }
.perf-warn .pw-ico svg, .perf-line .pw-ico svg { width: 100%; height: 100%; display: block; }
.perf-warn h3 { font-size: 17px; color: #fff; }
.perf-warn .pw-body { margin: 10px 0 0; font-size: 13.5px; line-height: 1.6; color: var(--text2); }
.perf-warn .pw-row { display: flex; gap: 8px; align-items: center; }
.perf-warn .pw-url { flex: 1; min-width: 0; height: 32px; line-height: 30px; padding: 0 10px; border: 1px solid var(--line2); border-radius: var(--r); background: rgba(0, 0, 0, 0.45); color: #fff; font-family: Consolas, 'Courier New', monospace; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: text; }
.perf-warn .pw-gpu { margin-top: 10px; font-size: 11px; color: var(--muted); }
.perf-warn .pw-foot { margin-top: 8px; display: flex; justify-content: flex-end; }
/* 고치는 방법 단계 (번호 + 제목 + 설명 + 주소 복사) */
.perf-warn .pw-steps { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.perf-warn .pw-step { display: grid; grid-template-columns: 22px minmax(0, 1fr); column-gap: 10px; align-items: start; }
.perf-warn .pw-step .n { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(255, 178, 30, 0.6); color: var(--amber); font-family: var(--f-num); font-weight: 700; font-size: 13px; line-height: 20px; text-align: center; }
.perf-warn .pw-step .c { min-width: 0; }
.perf-warn .pw-step b { display: block; font-size: 14px; line-height: 22px; color: #fff; }
.perf-warn .pw-step p { margin: 2px 0 0; font-size: 13px; line-height: 1.55; color: var(--text2); }
.perf-warn .pw-body, .perf-warn .pw-step p { text-wrap: pretty; }
.perf-warn .pw-step .pw-row { grid-column: 1 / -1; margin-top: 8px; }
.perf-warn .pw-row .btn { flex: none; }
/* 메뉴 가운데 칸보다 길면 카드 안에서 스크롤 (1280x720 등) */
.menu-main .perf-warn { max-height: 100%; overflow: auto; }
/* 게임 중 알약을 눌러 연 창: 창 테두리 없이 카드만 */
.modal.pw-modal { background: none; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.modal.pw-modal .perf-warn { max-width: none; animation: none; }
