/* 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; max-height: 94%; overflow-y: auto; text-align: center; }
.panel_inner_wide { width: 56em; }
.title_menu { display: flex; flex-direction: column; gap: 0.6em; min-width: 14em; }
.btn_wide { padding: 0.8em 2em; font-size: 1.05em; }
.panel_head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 0.6em; width: 100%; }
.btn_back { justify-self: start; padding: 0.4em 0.9em; font-size: 0.85em; }
.panel_desc { color: #8a8a8a; font-size: 0.9em; }
.option input { min-width: 0; padding: 0.4em 0.6em; border: 1px solid #555; background: #151515; color: #ddd; font: inherit; }
.option input::placeholder { color: #555; }

.multi_box { display: flex; gap: 1em; width: 100%; text-align: left; }
.multi_card { display: flex; flex-direction: column; align-items: flex-start; gap: 0.9em; min-width: 0; padding: 1em; border: 1px solid #333; background: rgba(20, 20, 20, 0.7); }
.multi_card:first-child { flex: 7 1 0; }
.multi_card:last-child { flex: 4 1 0; }
.multi_card .options { grid-template-columns: repeat(3, 1fr); gap: 0.5em 0.5em; }
.multi_card .option select { padding: 0.3em 0.4em; font-size: 0.85em; }
.multi_card .option { width: 100%; }
.multi_title { font-size: 1.05em; letter-spacing: 1px; color: #eee; }
.multi_notice { min-height: 1.4em; color: #e8c55a; font-size: 0.9em; }

.dex_tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4em; }
.dex_tab { padding: 0.35em 0.9em; border: 1px solid #444; background: #151515; color: #999; font: inherit; font-size: 0.85em; cursor: pointer; }
.dex_tab.is_on { border-color: #e8c55a; color: #e8c55a; }
.dex_scroll { overflow-y: auto; max-height: 62vh; width: 100%; }
.dex_list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6em; list-style: none; text-align: left; }
.dex_card { display: flex; align-items: flex-start; gap: 0.8em; min-width: 0; padding: 0.7em 0.8em; border: 1px solid #2c2c2c; background: rgba(22, 22, 22, 0.85); }
.dex_card[hidden] { display: none; }
.dex_icon { flex: 0 0 auto; width: 3em; height: 3em; image-rendering: pixelated; background: #0c0c0c; border: 1px solid #333; }
.dex_body { display: flex; flex-direction: column; gap: 0.3em; min-width: 0; }
.dex_head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4em; min-width: 0; }
.dex_name { font-size: 0.95em; color: #f0f0f0; }
.dex_badge { padding: 0.05em 0.45em; border: 1px solid #555; font-size: 0.7em; color: #aaa; white-space: nowrap; }
.dex_badge.is_pool { border-color: #444; color: #888; }
.dex_badge.is_special { border-color: #a03030; color: #ff7a6e; }
.dex_desc { font-size: 0.82em; line-height: 1.5; color: #c4c4c4; }
.dex_meta { font-size: 0.72em; color: #777; }
.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; }

.option_name { width: 14em; max-width: 100%; }
.name_row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.7em; }
.name_value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.15em; color: #e8c55a; }
.room_head { display: flex; justify-content: space-between; align-items: center; gap: 0.6em; width: 100%; }
.room_list { display: flex; flex-direction: column; gap: 0.4em; width: 100%; min-height: 8em; max-height: 16em; overflow-y: auto; list-style: none; }
.room_item { display: flex; align-items: center; gap: 0.6em; min-width: 0; padding: 0.5em 0.6em; border: 1px solid #333; background: #141414; }
.room_info { flex: 1 1 0; display: flex; flex-direction: column; gap: 0.15em; min-width: 0; }
.room_name { min-width: 0; overflow-wrap: anywhere; font-size: 0.9em; color: #eee; }
.room_meta { min-width: 0; overflow-wrap: anywhere; font-size: 0.72em; color: #888; }
.room_count { flex: 0 0 auto; font-family: 'Courier New', monospace; font-size: 0.9em; color: #bbb; }
.room_empty { padding: 1.2em 0.4em; font-size: 0.8em; color: #777; text-align: center; }
.code_row { display: flex; gap: 0.4em; width: 100%; }
.code_row input { flex: 1 1 0; min-width: 0; padding: 0.4em 0.6em; border: 1px solid #555; background: #151515; color: #ddd; font: inherit; }
.lobby_title { font-size: 1.05em; color: #eee; }
.lobby_player { display: flex; align-items: center; gap: 0.5em; }
.lobby_emote { font-size: 0.85em; color: #e8c55a; animation: emote_pop 3s ease forwards; }
.emote_row { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.35em; }
.emote_btn { display: flex; align-items: center; justify-content: center; gap: 0.3em; min-width: 2.4em; min-height: 2.2em; padding: 0.2em 0.5em; border: 1px solid #444; background: #161616; color: #ddd; font: inherit; font-size: 1em; cursor: pointer; }
.emote_btn:hover { border-color: #888; }
.emote_bar { display: none; flex-wrap: wrap; justify-content: center; gap: 0.35em; max-width: 90%; margin: 0 auto; pointer-events: auto; }
.emote_bar.is_open { display: flex; }
.emote_bar .emote_btn { flex-direction: column; gap: 0.1em; min-width: 4em; padding: 0.3em 0.4em; background: rgba(0, 0, 0, 0.6); }
.emote_key { font-size: 0.6em; color: #888; }
.emote_icon { font-size: 1.2em; }
.emote_label { font-size: 0.65em; white-space: nowrap; }
.hud_myemote { min-height: 1.2em; font-size: 0.9em; color: #e8c55a; }
@keyframes emote_pop { 0% { opacity: 0; transform: translateY(4px); } 10% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; } }
.btn_small { padding: 0.35em 0.9em; font-size: 0.8em; }
.lobby_code { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.8em; }
.lobby_code_label { font-size: 0.85em; color: #888; }
.lobby_code_value { font-family: 'Courier New', monospace; font-size: 2.2em; letter-spacing: 8px; color: #e8c55a; }
.lobby_players { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5em; list-style: none; min-height: 2.4em; }
.lobby_player { min-width: 0; max-width: 12em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0.4em 0.9em; border: 1px solid #444; background: #161616; }
.lobby_player.is_host { border-color: #a01010; }
.lobby_settings { font-size: 0.85em; color: #999; }
.btn[hidden] { display: none; }

.game_stage { touch-action: none; }
.touch_ui { position: absolute; inset: 0; /* overlay */ display: none; flex-direction: column; justify-content: space-between; padding: 2% 3% 3%; pointer-events: none; }
.touch_ui.is_on { display: flex; }
.touch_top { display: flex; justify-content: flex-end; gap: 0.5em; }
.touch_row { display: flex; justify-content: space-between; align-items: flex-end; gap: 2%; }
.touch_stick { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; width: 24%; aspect-ratio: 1; border: 2px solid rgba(255, 255, 255, 0.18); border-radius: 50%; background: rgba(0, 0, 0, 0.25); pointer-events: auto; touch-action: none; }
.stick_knob { display: block; width: 42%; aspect-ratio: 1; border-radius: 50%; background: rgba(255, 255, 255, 0.28); pointer-events: none; }
.touch_center { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 0.6em; min-width: 0; pointer-events: none; }
.touch_slots, .touch_actions { display: flex; justify-content: center; gap: 0.5em; }
.touch_slot, .touch_btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.15em; min-width: 4.4em; min-height: 3.2em; padding: 0.25em 0.4em; border: 1px solid rgba(255, 255, 255, 0.3); background: rgba(0, 0, 0, 0.5); color: #ddd; font: inherit; font-size: clamp(10px, 1.6vw, 15px); pointer-events: auto; touch-action: none; }
.touch_slot span { max-width: 6em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.touch_slot canvas { width: 1.8em; height: 1.8em; image-rendering: pixelated; }
.touch_slot.is_hand { border-color: #e8c55a; background: rgba(60, 48, 10, 0.6); }
.touch_slot.is_hidden { display: none; }
.touch_weapon { border-color: rgba(255, 70, 60, 0.8); }
.touch_use { min-width: 5.6em; min-height: 4em; border-color: #c03020; background: rgba(110, 10, 0, 0.6); font-weight: 700; }
.touch_pause { min-width: 2.4em; min-height: 2.4em; border: 1px solid rgba(255, 255, 255, 0.3); background: rgba(0, 0, 0, 0.5); color: #ddd; font: inherit; pointer-events: auto; }
.is_touch .hud_inv { display: none; }
.is_touch .hud_bottom { padding-bottom: 0; }
.is_touch .hud_lower { margin-bottom: 26%; }
.is_touch .hud_top { padding-right: 9%; }

.rotate_notice { position: fixed; inset: 0; /* overlay */ display: none; align-items: center; justify-content: center; background: #000; color: #ddd; font-size: 18px; text-align: center; z-index: 10; }
.rotate_notice b { color: #e8c55a; }
@media (orientation: portrait) {
    .is_touch .rotate_notice { display: flex; }
}

@media (max-width: 768px) {
    .options { grid-template-columns: repeat(2, 1fr); }
    .multi_box { flex-direction: column; }
    .dex_list { grid-template-columns: 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; } }

.mon_pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4em 0.8em; width: 100%; text-align: left; }
.mon_pick[hidden] { display: none; }
.mon_check { display: flex; align-items: center; gap: 0.35em; min-width: 0; font-size: 0.8em; color: #ccc; white-space: nowrap; }
.mon_check input { accent-color: #a01010; }
.multi_card .mon_pick { grid-template-columns: repeat(3, 1fr); }
.option select:disabled { opacity: 0.45; }
.room_diff { display: inline-block; padding: 0.02em 0.4em; border: 1px solid #555; font-size: 0.72em; font-weight: 400; color: #aaa; vertical-align: middle; white-space: nowrap; }
.room_diff.is_easy { border-color: #4caf6a; color: #6fd08c; }
.room_diff.is_hard { border-color: #e8a13a; color: #f0b45a; }
.room_diff.is_expert { border-color: #d03a30; color: #ff6a5e; background: rgba(120, 10, 0, 0.35); }
