/* who is monster */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; background: #000; overflow: hidden; }
body { font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif; color: #d8d8d8; user-select: none; }

.game_wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; min-height: 100svh; background: #000; }
.game_stage { position: relative; width: min(100vw, calc(100vh * 16 / 9)); aspect-ratio: 16 / 9; overflow: hidden; background: #111; }
.game_screen { display: block; width: 100%; height: 100%; image-rendering: crisp-edges; image-rendering: pixelated; cursor: crosshair; }

.hud { position: absolute; inset: 0; /* overlay */ display: flex; flex-direction: column; pointer-events: none; font-size: clamp(11px, 1.5vw, 22px); text-shadow: 0 0 4px #000, 0 0 2px #000; }
.hud.is_hidden { display: none; }
.hud_top { display: flex; justify-content: space-between; align-items: center; gap: 1em; max-width: 96%; width: 100%; margin: 0 auto; padding-top: 1.2%; }
.hud_zone, .hud_alive { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: 1px; color: #bdbdbd; }
.hud_alive { text-align: right; }
.hud_timer { flex: 0 0 auto; font-family: 'Courier New', monospace; font-weight: 700; font-size: 1.5em; letter-spacing: 2px; color: #eee; }
.hud_timer.is_final { color: #ff3b30; animation: timer_pulse 1s infinite; }
.hud_sub { display: flex; justify-content: space-between; gap: 1em; max-width: 96%; width: 100%; margin: 0 auto; font-size: 0.8em; }
.hud_keys { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #e8c55a; }
.hud_status { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #9fd0ff; text-align: right; }

.hud_center { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.6em; min-width: 0; min-height: 0; }
.hud_banner { display: flex; flex-direction: column; align-items: center; gap: 0.3em; opacity: 0; text-align: center; }
.hud_banner.is_on { animation: banner_show 3.6s ease forwards; }
.banner_title { font-size: 2.4em; font-weight: 900; letter-spacing: 4px; color: #ff3b30; }
.banner_sub { font-size: 1em; color: #eee; }
.hud_log { display: flex; flex-direction: column; align-items: center; gap: 0.2em; min-height: 5em; max-width: 90%; }
.log_line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; max-width: 100%; font-size: 0.9em; color: #e6e6e6; transition: opacity 0.9s; }
.log_line.is_warn { color: #ff5a4f; font-weight: 700; }
.log_line.is_fade { opacity: 0; }

.hud_lower { display: flex; flex-direction: column; align-items: center; gap: 0.4em; min-height: 3.4em; }
.hud_hint { max-width: 80%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.85em; color: #f0f0f0; }
.hud_action { display: flex; flex-direction: column; align-items: center; gap: 0.25em; visibility: hidden; }
.hud_action.is_on { visibility: visible; }
.action_label { font-size: 0.8em; color: #ddd; }
.action_track { display: block; width: 9em; height: 0.35em; background: rgba(255, 255, 255, 0.2); }
.action_bar { display: block; height: 100%; background: #e8c55a; transform-origin: left center; transform: scaleX(0); }

.hud_bottom { display: flex; justify-content: space-between; align-items: flex-end; gap: 1em; max-width: 96%; width: 100%; margin: 0 auto; padding-bottom: 1.4%; }
.hud_inv { display: flex; flex-direction: column; gap: 0.35em; min-width: 0; max-width: 60%; }
.hud_desc { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.75em; color: #cfcfcf; }
.hud_desc.is_hidden, .hud_slots.is_hidden { visibility: hidden; }
.hud_slots { display: flex; gap: 0.4em; }
.slot { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; gap: 0.15em; min-width: 5em; min-height: 4.2em; padding: 0.3em 0.45em; border: 1px solid rgba(255, 255, 255, 0.25); background: rgba(0, 0, 0, 0.45); }
.slot.is_full { border-color: rgba(255, 255, 255, 0.45); }
.slot.is_hand { border-color: #e8c55a; background: rgba(60, 48, 10, 0.55); box-shadow: 0 0 0 1px #e8c55a; }
.slot.is_weapon { border-color: rgba(255, 70, 60, 0.8); }
.slot_key { font-size: 0.7em; color: #888; }
.slot_icon { width: 1.6em; height: 1.6em; image-rendering: pixelated; }
.slot_name { font-size: 0.75em; color: #f0f0f0; white-space: nowrap; }
.hud_spectate { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; font-size: 0.85em; color: #bbb; }

.hud_ring { position: absolute; inset: 0; /* overlay */ pointer-events: none; opacity: 0; box-shadow: inset 0 0 12vw 3vw rgba(255, 0, 0, 0.65); }
.hud_ring.is_on { animation: ring_pulse 0.5s infinite alternate; }
.hud_flash { position: absolute; inset: 0; /* overlay */ pointer-events: none; opacity: 0; }
.hud_flash.is_red { background: #8a0000; }
.hud_flash.is_white { background: #fff; }
.hud_flash.is_black { background: #000; }
.hud_flash.is_on { animation: flash_out 1.6s ease-out forwards; }

.panel { position: absolute; inset: 0; /* overlay */ display: none; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.82); font-size: clamp(12px, 1.4vw, 20px); }
.panel.is_open { display: flex; }
.panel_menu { background: radial-gradient(ellipse at center, rgba(40, 40, 40, 0.92) 0%, rgba(0, 0, 0, 0.97) 75%); }
.panel_inner { display: flex; flex-direction: column; align-items: center; gap: 1.1em; max-width: 92%; width: 40em; text-align: center; }
.game_title { font-family: 'Courier New', monospace; font-size: clamp(30px, 5.6vw, 88px); line-height: 0.95; font-weight: 900; letter-spacing: 6px; color: #e9e9e9; text-shadow: 3px 3px 0 #7a0000; }
.game_sub { color: #9a9a9a; line-height: 1.6; }
.options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.7em 0.8em; width: 100%; }
.option { display: flex; flex-direction: column; gap: 0.3em; min-width: 0; text-align: left; }
.option_label { font-size: 0.8em; color: #888; }
.option select { min-width: 0; padding: 0.4em 0.6em; border: 1px solid #555; background: #151515; color: #ddd; font: inherit; }
.btn_row { display: flex; gap: 0.6em; }
.btn { padding: 0.6em 1.6em; border: 1px solid #666; background: #1a1a1a; color: #ddd; font: inherit; cursor: pointer; letter-spacing: 1px; }
.btn:hover { border-color: #aaa; color: #fff; }
.btn_main { border-color: #a01010; background: #5a0000; color: #fff; }
.btn_main:hover { background: #7a0000; border-color: #ff4a3d; }
.help { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4em 1.2em; list-style: none; font-size: 0.8em; color: #777; }
.help b { color: #bbb; font-weight: 700; }
.panel_title { font-size: 2em; letter-spacing: 4px; }

.result_title { font-family: 'Courier New', monospace; font-size: clamp(30px, 5.6vw, 84px); font-weight: 900; letter-spacing: 6px; color: #ff3b30; }
.result_sub { color: #aaa; }
.table_scroll { overflow-x: auto; max-width: 100%; width: 100%; }
.result_table { width: 100%; border-collapse: collapse; font-size: 0.85em; }
.result_table th, .result_table td { padding: 0.45em 0.6em; border-bottom: 1px solid #333; text-align: left; white-space: nowrap; }
.result_table thead th { color: #888; font-weight: 400; border-bottom-color: #555; }
.result_table tbody th { font-weight: 700; color: #ddd; }
.result_table tr.is_me th, .result_table tr.is_me td { color: #ff8a80; }

@media (max-width: 768px) {
    .options { grid-template-columns: repeat(2, 1fr); }
}

@keyframes timer_pulse { 50% { opacity: 0.55; } }
@keyframes ring_pulse { from { opacity: 0.15; } to { opacity: 1; } }
@keyframes flash_out { 0% { opacity: 0.9; } 100% { opacity: 0; } }
@keyframes banner_show { 0% { opacity: 0; transform: scale(1.15); } 10% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
