/* ==============================================================================
   RISHU KEY JUTSU — COMPLETE 6-SCREEN COMBAT & ARCADE STYLESHEET
   Matches ui_main_menu, ui_level_select, ui_typing_dashboard, ui_placement_test
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@500;700;800;900&family=Space+Grotesk:wght@500;700&display=swap');

:root {
    --color-bg: #05080E;
    --color-surface: #0A0F1B;
    --color-surface-card: #0E1524;
    --color-border: #1E283D;
    --color-red: #FF2A4B;
    --color-red-glow: rgba(255, 42, 75, 0.6);
    --color-cyan: #00D2FF;
    --color-green: #42E88A;
    --color-yellow: #FFD700;
    --color-text-dim: #8C99AB;
}

* {
    box-sizing: border-box;
}

body.game-body {
    margin: 0;
    padding: 0;
    background-color: var(--color-bg);
    color: #F2F5F8;
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    user-select: none;
}

/* ==============================================================================
   SCREEN SWITCHER ARCHITECTURE
   ============================================================================== */
.game-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: none;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--color-bg);
    z-index: 10;
}

.game-screen.active {
    display: flex !important;
}

/* ==============================================================================
   SCREEN 1: MAIN MENU (ui_main_menu.png)
   ============================================================================== */
#screen-main-menu {
    background-color: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

.main-menu-stage-wrapper {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000000;
    overflow: hidden;
}

.main-menu-stage {
    position: relative;
    width: 1280px;
    height: 720px;
    max-width: 100vw;
    max-height: 100vh;
    aspect-ratio: 16 / 9;
    background: #000000 url('assets/ui_main_menu.png') no-repeat center center;
    background-size: 100% 100%;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.9);
}

/* Interactive Hitbox Buttons overlaying the exact artwork buttons */
.menu-hitbox-btn {
    position: absolute;
    box-sizing: border-box;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
    outline: none;
    z-index: 20;
    margin: 0;
    padding: 0;
}

.menu-hitbox-btn:hover {
    background: rgba(255, 42, 75, 0.18);
    border-color: rgba(255, 60, 90, 0.85);
    box-shadow: 0 0 16px rgba(255, 42, 75, 0.5), inset 0 0 12px rgba(255, 42, 75, 0.25);
}

.menu-hitbox-btn:active {
    background: rgba(255, 42, 75, 0.35);
    border-color: #FF2A4B;
}

/* Button 1: PLAY GAME (x: 474..848, y: 414..465) */
.menu-hitbox-btn.btn-play {
    top: 57.5%;
    left: 37.031%;
    width: 29.219%;
    height: 7.083%;
}

.menu-hitbox-btn.btn-play:hover {
    border-color: rgba(255, 80, 110, 0.9);
    background: rgba(255, 42, 75, 0.22);
    box-shadow: 0 0 20px rgba(255, 42, 75, 0.65), inset 0 0 14px rgba(255, 42, 75, 0.3);
}

/* Button 2: LEVEL SELECT (x: 474..848, y: 476..520) */
.menu-hitbox-btn.btn-levels {
    top: 66.111%;
    left: 37.031%;
    width: 29.219%;
    height: 6.111%;
}

/* Button 3: TYPING SPEED TEST (x: 474..848, y: 530..574) */
.menu-hitbox-btn.btn-test {
    top: 73.611%;
    left: 37.031%;
    width: 29.219%;
    height: 6.111%;
}

/* Button 4: PROGRESS & STATS (x: 474..848, y: 584..628) */
.menu-hitbox-btn.btn-stats {
    top: 81.111%;
    left: 37.031%;
    width: 29.219%;
    height: 6.111%;
}

/* Bottom Row Buttons (y: 638..675, height: 37px) */
.menu-hitbox-btn.btn-settings {
    top: 88.611%;
    left: 37.188%;
    width: 7.656%;
    height: 5.139%;
}

.menu-hitbox-btn.btn-howto {
    top: 88.611%;
    left: 46.094%;
    width: 9.062%;
    height: 5.139%;
}

.menu-hitbox-btn.btn-exit {
    top: 88.611%;
    left: 56.406%;
    width: 6.406%;
    height: 5.139%;
}

.menu-hitbox-btn.btn-exit:hover {
    border-color: #FF3B56;
    background: rgba(255, 42, 75, 0.25);
    box-shadow: 0 0 16px rgba(255, 59, 86, 0.6);
}

.menu-credits-bar {
    position: absolute;
    bottom: 12px;
    left: 24px;
    right: 24px;
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: rgba(140, 153, 171, 0.7);
    letter-spacing: 0.08em;
    pointer-events: none;
}

/* ==============================================================================
   SCREEN 2: CHOOSE YOUR PATH - LEVEL SELECT (ui_level_select.png)
   ============================================================================== */
#screen-level-select {
    background: #060910 url('assets/ui_level_select.png') no-repeat center center / cover;
    display: flex;
    align-items: center;
    justify-content: center;
}

.level-select-container {
    width: 95vw;
    max-width: 1200px;
    height: 92vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: rgba(7, 10, 18, 0.88);
    border: 1px solid rgba(255, 42, 75, 0.35);
    border-radius: 12px;
    padding: 24px 32px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.9), inset 0 0 30px rgba(255, 42, 75, 0.1);
    backdrop-filter: blur(8px);
}

.view-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.mini-header-logo {
    height: 38px;
    object-fit: contain;
}

.mini-header-badge {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    border: 1px solid rgba(255, 42, 75, 0.4);
}

.header-center {
    text-align: center;
}

.view-title {
    font-family: 'Outfit', sans-serif;
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: #FFFFFF;
    margin: 0;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

.view-title-line {
    width: 80px;
    height: 3px;
    background: var(--color-red);
    margin: 6px auto 0;
    border-radius: 2px;
    box-shadow: 0 0 10px var(--color-red);
}

/* 10 Level Cards Grid with Carousel */
.cards-carousel-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
    margin: 20px 0;
}

.page-nav-arrow {
    background: rgba(15, 22, 36, 0.8);
    border: 1px solid var(--color-border);
    color: #9DA8B8;
    width: 44px;
    height: 64px;
    border-radius: 8px;
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-nav-arrow:hover:not(:disabled) {
    border-color: var(--color-red);
    color: #FFFFFF;
    background: rgba(255, 42, 75, 0.2);
    box-shadow: 0 0 15px var(--color-red-glow);
}

.page-nav-arrow:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.ten-cards-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 14px;
    flex-grow: 1;
    max-width: 1050px;
}

.ten-level-card {
    background: #090E1A;
    border: 1.5px solid #1A2438;
    border-radius: 10px;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    min-height: 180px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.ten-level-card:hover:not(.locked) {
    border-color: var(--color-cyan);
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 210, 255, 0.25);
}

.ten-level-card.selected {
    border: 2px solid var(--color-red) !important;
    box-shadow: 0 0 25px rgba(255, 42, 75, 0.8), inset 0 0 15px rgba(255, 42, 75, 0.25) !important;
    transform: scale(1.03);
    background: #0E1424;
}

.ten-level-card.locked {
    opacity: 0.45;
    cursor: not-allowed;
    background: #070A12;
}

.card-status-pill {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 3px 10px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-status-pill.unlocked {
    background: #0066CC;
    color: #FFFFFF;
}

.card-status-pill.clear {
    background: #198038;
    color: #FFFFFF;
}

.card-status-pill.locked {
    background: #202738;
    color: #8C99AB;
}

.card-lvl-number {
    font-family: 'Space Grotesk', monospace;
    font-size: 2.8rem;
    font-weight: 800;
    color: #FFFFFF;
    line-height: 1;
    margin: 10px 0 4px;
}

.card-target-wpm {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--color-text-dim);
}

.card-sub-tag {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #409CFF;
    margin-top: 4px;
}

.card-stars-line {
    font-size: 0.75rem;
    color: var(--color-yellow);
    margin-top: 4px;
}

/* Bottom Nav Bar */
.view-bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-top: 10px;
}

.retro-outline-btn {
    background: rgba(14, 20, 32, 0.8);
    border: 1.5px solid rgba(255, 42, 75, 0.4);
    color: #E2E8F0;
    font-family: 'Space Grotesk', monospace;
    font-size: 0.95rem;
    font-weight: 700;
    padding: 10px 24px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.retro-outline-btn:hover {
    border-color: var(--color-red);
    color: #FFFFFF;
    background: rgba(255, 42, 75, 0.2);
    box-shadow: 0 0 15px var(--color-red-glow);
}

.retro-outline-btn.small-back {
    padding: 6px 16px;
    font-size: 0.85rem;
}

.page-indicator-tag {
    font-family: 'Space Grotesk', monospace;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--color-text-dim);
}

.glow-red-start-btn {
    background: linear-gradient(180deg, #FF3352 0%, #D81634 100%);
    border: 1px solid #FF5E78;
    color: #FFFFFF;
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    padding: 12px 42px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 0 25px rgba(255, 42, 75, 0.8);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.glow-red-start-btn:hover {
    box-shadow: 0 0 35px rgba(255, 42, 75, 1);
    transform: scale(1.04);
}

/* ==============================================================================
   SCREEN 3: PROGRESS & STATS DASHBOARD & HEATMAP (ui_typing_dashboard.png)
   ============================================================================== */
#screen-stats-dashboard {
    background: #05080E url('assets/ui_main_menu.png') no-repeat center center / cover;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dashboard-outer-frame {
    width: 95vw;
    max-width: 1240px;
    height: 94vh;
    background: rgba(7, 10, 18, 0.94);
    border: 1.5px solid rgba(255, 42, 75, 0.5);
    border-radius: 12px;
    padding: 20px 28px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 0 45px rgba(0, 0, 0, 0.95), inset 0 0 35px rgba(255, 42, 75, 0.12);
    backdrop-filter: blur(10px);
}

.dashboard-header {
    border-bottom: 1px solid rgba(255, 42, 75, 0.2);
    padding-bottom: 12px;
}

/* 8 Metrics Grid */
.dashboard-metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 10px;
    margin: 12px 0;
}

.dash-stat-box {
    background: rgba(14, 20, 34, 0.85);
    border: 1px solid #1C263B;
    border-radius: 8px;
    padding: 10px 14px;
    text-align: center;
}

.stat-big-val {
    font-family: 'Space Grotesk', monospace;
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.2;
}

.stat-sub-lbl {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--color-text-dim);
    margin-top: 4px;
}

.stat-blue { color: #00D2FF; }
.stat-green { color: #42E88A; }
.stat-yellow { color: #FFD700; }
.stat-gold { color: #FFAA00; }
.stat-cyan { color: #00E5FF; }
.stat-divider { color: #556275; margin: 0 4px; }

/* Keyboard Mastery Heatmap Card */
.heatmap-container-box {
    background: rgba(11, 16, 28, 0.85);
    border: 1px solid #1C263B;
    border-radius: 10px;
    padding: 14px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.heatmap-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.heatmap-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #FFFFFF;
}

.heatmap-legend {
    display: flex;
    gap: 16px;
    font-size: 0.72rem;
    color: #9DA8B8;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-dot.weak { background: #FF2A4B; box-shadow: 0 0 6px #FF2A4B; }
.legend-dot.developing { background: #FFD700; box-shadow: 0 0 6px #FFD700; }
.legend-dot.strong { background: #42E88A; box-shadow: 0 0 6px #42E88A; }
.legend-dot.nodata { background: #556275; }

.heatmap-subnote {
    font-size: 0.68rem;
    color: #6C7A8E;
    margin: 4px 0 10px;
}

/* Interactive Heatmap Keyboard */
.interactive-heatmap-keyboard {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    margin: 4px 0;
}

.hm-row {
    display: flex;
    gap: 6px;
}

.hm-key {
    width: 44px;
    height: 44px;
    background: #111624;
    border: 1.5px solid #202A3D;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Space Grotesk', monospace;
    font-size: 1.05rem;
    font-weight: 700;
    color: #E2E8F0;
    cursor: pointer;
    transition: all 0.15s;
}

.hm-key:hover {
    transform: translateY(-2px) scale(1.08);
    z-index: 5;
}

.hm-key.weak {
    border-color: #FF2A4B;
    color: #FF6680;
    background: rgba(255, 42, 75, 0.15);
    box-shadow: 0 0 10px rgba(255, 42, 75, 0.35);
}

.hm-key.developing {
    border-color: #FFD700;
    color: #FFE033;
    background: rgba(255, 215, 0, 0.15);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.hm-key.strong {
    border-color: #42E88A;
    color: #70FFAC;
    background: rgba(66, 232, 138, 0.15);
    box-shadow: 0 0 10px rgba(66, 232, 138, 0.3);
}

.heatmap-tooltip {
    font-size: 0.75rem;
    color: #00D2FF;
    min-height: 18px;
    margin-top: 6px;
    font-family: 'Space Grotesk', monospace;
}

/* Weak & Strong Split Row */
.weak-strong-split-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 10px;
}

.keys-showcase-panel {
    background: rgba(11, 16, 28, 0.85);
    border: 1px solid #1C263B;
    border-radius: 8px;
    padding: 10px 16px;
}

.panel-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.panel-title {
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.weak-title { color: #FF4A68; }
.strong-title { color: #42E88A; }

.practice-weak-btn {
    background: linear-gradient(180deg, #FF3352 0%, #D81634 100%);
    border: 1px solid #FF5E78;
    color: #FFFFFF;
    font-family: 'Space Grotesk', monospace;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(255, 42, 75, 0.6);
    transition: all 0.2s;
}

.practice-weak-btn:hover {
    box-shadow: 0 0 18px rgba(255, 42, 75, 0.9);
    transform: scale(1.03);
}

.key-badges-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.key-stat-badge {
    background: #090E1A;
    border: 1px solid #1E283D;
    border-radius: 6px;
    padding: 6px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 65px;
}

.key-badge-letter {
    font-family: 'Space Grotesk', monospace;
    font-size: 1.1rem;
    font-weight: 800;
}

.key-badge-acc {
    font-size: 0.7rem;
    font-weight: 700;
}

.key-badge-extra {
    font-size: 0.6rem;
    color: #6C7A8E;
}

/* ==============================================================================
   SCREEN 4: TYPING TEST / PLACEMENT MODE (ui_placement_test.png)
   ============================================================================== */
#screen-typing-test {
    background: #05080E url('assets/ui_placement_test.png') no-repeat center center / cover;
    display: flex;
    align-items: center;
    justify-content: center;
}

.typing-test-container {
    width: 95vw;
    max-width: 1200px;
    height: 94vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: rgba(7, 10, 18, 0.94);
    border: 1.5px solid rgba(255, 42, 75, 0.45);
    border-radius: 12px;
    padding: 20px 32px;
    box-shadow: 0 0 45px rgba(0, 0, 0, 0.95), inset 0 0 35px rgba(255, 42, 75, 0.1);
    backdrop-filter: blur(10px);
}

.test-header {
    border-bottom: 1px solid rgba(255, 42, 75, 0.2);
    padding-bottom: 10px;
}

.test-header-sub {
    font-size: 0.78rem;
    color: var(--color-text-dim);
    margin-top: 2px;
}

/* Live Test Metrics Banner */
.test-metrics-banner {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin: 10px 0;
    background: rgba(14, 20, 34, 0.85);
    border: 1px solid #1C263B;
    border-radius: 8px;
    padding: 10px 24px;
}

.test-metric-pill {
    font-family: 'Space Grotesk', monospace;
    font-size: 0.95rem;
    font-weight: 700;
    color: #E2E8F0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pill-icon { font-size: 1.1rem; }
.pill-num { font-size: 1.25rem; font-weight: 800; }
.red-num { color: #FF2A4B; }
.blue-num { color: #00D2FF; }
.green-num { color: #42E88A; }

/* Target Typing Text Box with Glowing Red Border */
.test-type-box-wrap {
    position: relative;
    margin: 8px 0;
}

.type-box-tag {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: #080C16;
    padding: 0 14px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: #FF4A68;
}

.test-type-box {
    background: rgba(12, 16, 28, 0.9);
    border: 2px solid var(--color-red);
    border-radius: 10px;
    padding: 18px 24px;
    box-shadow: 0 0 25px rgba(255, 42, 75, 0.45);
    font-family: 'Space Grotesk', monospace;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-align: center;
    line-height: 1.4;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.test-typed {
    color: var(--color-green);
    text-shadow: 0 0 8px rgba(66, 232, 138, 0.5);
}

.test-cur-char {
    color: #FFFFFF;
    background: #E6203D;
    padding: 2px 6px;
    border-radius: 4px;
    margin: 0 2px;
    box-shadow: 0 0 12px #FF2A4B;
    animation: pulseChar 0.8s infinite alternate;
}

.test-remain {
    color: #8C99AB;
}

/* Full Interactive QWERTY Keyboard */
.test-keyboard-wrapper {
    background: rgba(11, 15, 26, 0.9);
    border: 1.5px solid rgba(255, 42, 75, 0.35);
    border-radius: 10px;
    padding: 14px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.physical-keyboard {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    max-width: 980px;
}

.kb-row {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.kb-key {
    background: #111726;
    border: 1.5px solid #222C42;
    border-radius: 6px;
    padding: 6px;
    min-width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: 'Space Grotesk', monospace;
    font-size: 0.88rem;
    font-weight: 700;
    color: #E2E8F0;
    line-height: 1.1;
    transition: all 0.08s ease-out;
}

.kb-key.wide-key { min-width: 72px; font-size: 0.72rem; }
.kb-key.xwide-key { min-width: 96px; font-size: 0.72rem; }
.kb-key.mod-key { min-width: 60px; font-size: 0.72rem; }
.kb-key.space-key { flex-grow: 1; max-width: 380px; }

/* Active & Pressed Key Lights Up in Bright Glowing Red */
.kb-key.active,
.kb-key.pressed {
    background: #E6203D !important;
    border-color: #FF5E78 !important;
    color: #FFFFFF !important;
    box-shadow: 0 0 25px rgba(255, 42, 75, 0.95), 0 0 10px #FF2A4B !important;
    transform: scale(0.95);
}

.kb-key.target-hint {
    border-color: #00D2FF;
    color: #00D2FF;
    box-shadow: 0 0 12px rgba(0, 210, 255, 0.5);
}

.test-kb-hint {
    font-size: 0.75rem;
    color: #6C7A8E;
    margin-top: 10px;
}

/* ==============================================================================
   SCREEN 5 & 6: COMBAT VIEWPORT (arena_04_underground / arena_08_jungle)
   ============================================================================== */
#screen-combat {
    display: none;
}

.game-hud-bar {
    height: 64px;
    background: rgba(10, 15, 24, 0.95);
    border-bottom: 2px solid #1E2638;
    display: flex;
    align-items: center;
    padding: 0 24px;
    z-index: 100;
}

.game-hud-container {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.hud-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hud-back-btn {
    font-family: 'Space Grotesk', monospace;
    font-weight: 700;
    font-size: 0.8rem;
    color: #9DA8B8;
    background: #111624;
    border: 1px solid #1E2638;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.hud-back-btn:hover {
    color: #FF2A4B;
    border-color: #FF2A4B;
}

.game-brand-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #FFFFFF;
}

.brand-rishu {
    color: #00D2FF;
    text-shadow: 0 0 10px rgba(0, 210, 255, 0.6);
}

.hud-level-badge {
    background: rgba(255, 42, 75, 0.15);
    border: 1px solid rgba(255, 42, 75, 0.4);
    color: #FF2A4B;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 4px;
    letter-spacing: 0.05em;
}

.hud-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
}

.typing-target-box {
    display: flex;
    align-items: center;
    justify-content: center;
}

.word-card {
    background: rgba(13, 20, 32, 0.9);
    border: 2px solid #00D2FF;
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.4);
    padding: 8px 24px;
    border-radius: 8px;
    font-family: 'Space Grotesk', monospace;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    min-width: 220px;
    text-align: center;
}

.typed-chars {
    color: #42E88A;
    text-shadow: 0 0 8px rgba(66, 232, 138, 0.6);
}

.current-char {
    color: #FFFFFF;
    background: rgba(0, 210, 255, 0.35);
    border-bottom: 3px solid #00D2FF;
    animation: pulseChar 0.8s infinite alternate;
    padding: 0 2px;
}

.remaining-chars {
    color: #8C99AB;
}

.hud-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.metric-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.metric-lbl {
    font-size: 0.65rem;
    color: #6C788A;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.metric-val {
    font-family: 'Space Grotesk', monospace;
    font-size: 1.15rem;
    font-weight: 700;
    color: #FFFFFF;
}

.combo-glow {
    color: #FFD700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
}

.hud-icon-btn {
    background: #111624;
    border: 1px solid #1E2638;
    color: #F2F5F8;
    font-size: 1.1rem;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.hud-icon-btn:hover {
    border-color: #00D2FF;
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.4);
}

.game-viewport-wrap {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background-color: #030508;
}

.canvas-container {
    position: relative;
    width: 1280px;
    height: 720px;
    max-width: 100vw;
    max-height: calc(100vh - 64px);
    aspect-ratio: 16 / 9;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
    background-color: #080B10;
}

/* Fighters Health Bars HUD */
.fighters-hud {
    position: absolute;
    top: 20px;
    left: 24px;
    right: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
    z-index: 10;
}

.fighter-hp-wrap {
    width: 350px;
    background: rgba(10, 15, 24, 0.85);
    border: 1px solid #1E2638;
    border-radius: 8px;
    padding: 8px 12px;
    backdrop-filter: blur(4px);
}

.hp-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.fighter-name { color: #FFFFFF; }
.hp-num { font-family: 'Space Grotesk', monospace; color: #8C99AB; }

.hp-bar-track {
    height: 12px;
    background: #0D121D;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #1A2130;
}

.hp-bar-fill {
    height: 100%;
    transition: width 0.25s ease-out;
}

.player-fill {
    background: linear-gradient(90deg, #00D2FF 0%, #42E88A 100%);
    box-shadow: 0 0 10px rgba(66, 232, 138, 0.5);
}

.enemy-fill {
    background: linear-gradient(90deg, #FF2A4B 0%, #FF8A00 100%);
    box-shadow: 0 0 10px rgba(255, 42, 75, 0.5);
}

.arena-center-tag {
    background: rgba(13, 18, 28, 0.85);
    border: 1px solid #202A3D;
    color: #E2E8F0;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    padding: 6px 14px;
    border-radius: 20px;
}

/* ==============================================================================
   MODALS (Settings, How To Play, Victory, Defeat, Pause, Results)
   ============================================================================== */
.game-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 8, 14, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    backdrop-filter: blur(8px);
}

.game-modal-box {
    background: #0A0F1B;
    border: 2px solid rgba(255, 42, 75, 0.5);
    border-radius: 12px;
    padding: 32px;
    width: 90%;
    max-width: 520px;
    text-align: center;
    box-shadow: 0 0 40px rgba(255, 42, 75, 0.35);
    animation: modalPop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.modal-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #1E2638;
    padding-bottom: 12px;
    margin-bottom: 18px;
}

.modal-top-bar h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    margin: 0;
    color: #FFFFFF;
}

.modal-close-btn {
    background: none;
    border: 1px solid #1E2638;
    color: #9DA8B8;
    font-size: 1.2rem;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
}

.modal-close-btn:hover {
    color: #FF2A4B;
    border-color: #FF2A4B;
}

.settings-content, .howto-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: left;
    font-size: 0.9rem;
    color: #9DA8B8;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #0E1424;
    border-radius: 6px;
}

.game-btn {
    font-family: 'Space Grotesk', monospace;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.game-btn-primary {
    background: linear-gradient(180deg, #FF3352 0%, #D81634 100%);
    color: #FFFFFF;
    box-shadow: 0 4px 15px rgba(255, 42, 75, 0.4);
}

.game-btn-primary:hover {
    box-shadow: 0 4px 20px rgba(255, 42, 75, 0.7);
    transform: translateY(-2px);
}

.game-btn-secondary {
    background: #111624;
    color: #00D2FF;
    border: 1px solid #00D2FF;
}

.game-btn-secondary:hover {
    background: rgba(0, 210, 255, 0.15);
}

.game-btn-danger {
    background: #2D0A14;
    color: #FF4A68;
    border: 1px solid #FF2A4B;
}

.game-btn-danger:hover {
    background: #4A0E1E;
}

/* Victory & Defeat Layouts */
.victory-header { margin-bottom: 16px; }
.victory-tag { font-size: 0.85rem; font-weight: 700; color: #42E88A; letter-spacing: 0.15em; }
.victory-rank-showcase { display: flex; flex-direction: column; align-items: center; margin-bottom: 20px; }

.rank-stamp-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid #FFD700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
    font-size: 3.2rem;
    font-weight: 900;
    color: #FFD700;
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.4);
    margin-bottom: 8px;
}

.rank-name-lbl {
    font-family: 'Space Grotesk', monospace;
    font-weight: 700;
    font-size: 0.95rem;
    color: #FFD700;
}

.victory-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.v-stat-card {
    background: #111624;
    border: 1px solid #1E2638;
    border-radius: 6px;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
}

.v-stat-lbl { font-size: 0.68rem; color: #6C788A; font-weight: 700; }
.v-stat-val { font-family: 'Space Grotesk', monospace; font-size: 1.15rem; font-weight: 700; color: #F2F5F8; margin-top: 2px; }

.modal-actions-row {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.modal-actions-row .game-btn { flex: 1; }

.defeat-banner {
    font-family: 'Outfit', sans-serif;
    font-size: 2.6rem;
    font-weight: 900;
    color: #FF2A4B;
    text-shadow: 0 0 20px rgba(255, 42, 75, 0.5);
    margin-bottom: 8px;
}

.defeat-desc { color: #9DA8B8; font-size: 0.9rem; margin-bottom: 16px; }
.defeat-stats { display: flex; justify-content: center; gap: 20px; margin-bottom: 20px; font-family: 'Space Grotesk', monospace; font-weight: 700; color: #00D2FF; }

/* ==============================================================================
   MARTIAL ARTS COMBAT ENHANCEMENTS: CHAKRA, BOSS, BELTS, ENDLESS, CERTIFICATE
   ============================================================================== */

/* Main Menu Quick Mode Badges */
.menu-top-actions {
    position: absolute;
    top: 24px;
    right: 28px;
    display: flex;
    gap: 12px;
    z-index: 50;
}

.menu-action-pill {
    background: rgba(13, 18, 30, 0.88);
    border: 1.5px solid rgba(255, 42, 75, 0.5);
    color: #F8FAFC;
    font-family: 'Space Grotesk', monospace;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.menu-action-pill:hover {
    transform: translateY(-2px);
    border-color: #00D2FF;
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.5);
    color: #FFFFFF;
}

.menu-action-pill.gold {
    border-color: rgba(255, 215, 0, 0.6);
}

.menu-action-pill.gold:hover {
    border-color: #FFD700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}

/* Martial Arts Belt Tag in HUD */
.player-belt-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-left: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
}

.belt-white { background: #E2E8F0; color: #0F172A; border-color: #CBD5E1; }
.belt-yellow { background: #FEF08A; color: #713F12; border-color: #FACC15; }
.belt-green { background: #22C55E; color: #FFFFFF; border-color: #16A34A; }
.belt-blue { background: #0EA5E9; color: #FFFFFF; border-color: #0284C7; }
.belt-red { background: #EF4444; color: #FFFFFF; border-color: #DC2626; }
.belt-black { background: #0F172A; color: #FFD700; border-color: #FFD700; box-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }
.belt-dragon { background: linear-gradient(135deg, #FFD700 0%, #FF8A00 100%); color: #000000; border-color: #FFFFFF; font-weight: 900; animation: dragonGlow 1.5s infinite alternate; }

@keyframes dragonGlow {
    0% { box-shadow: 0 0 8px #FFD700; }
    100% { box-shadow: 0 0 20px #FF8A00, 0 0 30px #FFD700; }
}

/* Chakra / Jutsu Rage Meter */
.chakra-wrap {
    margin-top: 6px;
}

.chakra-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    font-weight: 700;
    margin-bottom: 3px;
}

.chakra-lbl {
    color: #00D2FF;
    letter-spacing: 0.05em;
    text-shadow: 0 0 6px rgba(0, 210, 255, 0.5);
}

.chakra-num {
    font-family: 'Space Grotesk', monospace;
    color: #00D2FF;
}

.chakra-bar-track {
    height: 8px;
    background: #080C14;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #142236;
    position: relative;
}

.chakra-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0077B6 0%, #00D2FF 50%, #FFD700 100%);
    transition: width 0.15s ease-out;
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.6);
}

.chakra-full-anim {
    animation: chakraFullPulse 0.6s infinite alternate;
}

@keyframes chakraFullPulse {
    0% {
        box-shadow: 0 0 8px #FFD700;
        filter: brightness(1.1);
    }
    100% {
        box-shadow: 0 0 22px #FFD700, 0 0 35px #FF8A00;
        filter: brightness(1.6);
    }
}

.chakra-ready-tag {
    font-size: 0.72rem;
    font-weight: 800;
    color: #FFD700;
    text-align: center;
    margin-top: 4px;
    letter-spacing: 0.08em;
    animation: pulseChar 0.5s infinite alternate;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

/* Boss Fight Tactical Overlay */
.boss-hud-overlay {
    position: absolute;
    top: 68px;
    left: 50%;
    transform: translateX(-50%);
    width: 680px;
    max-width: 90%;
    background: rgba(14, 10, 18, 0.92);
    border: 2px solid #FF2A4B;
    border-radius: 8px;
    padding: 10px 18px;
    box-shadow: 0 0 30px rgba(255, 42, 75, 0.65);
    z-index: 20;
    backdrop-filter: blur(6px);
}

.boss-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.boss-name-tag {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 900;
    color: #FF2A4B;
    letter-spacing: 0.08em;
    text-shadow: 0 0 12px rgba(255, 42, 75, 0.7);
}

.boss-phase-badge {
    background: #FF2A4B;
    color: #FFFFFF;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.06em;
}

.boss-phase-badge.berserk {
    background: #FF8A00;
    box-shadow: 0 0 15px #FF8A00;
    animation: pulseChar 0.4s infinite alternate;
}

.boss-hp-track {
    height: 14px;
    background: #080509;
    border: 1px solid #3E1019;
    border-radius: 5px;
    overflow: hidden;
}

.boss-hp-fill {
    height: 100%;
    background: linear-gradient(90deg, #8B0000 0%, #FF2A4B 60%, #FFD700 100%);
    transition: width 0.2s ease-out;
    box-shadow: 0 0 14px rgba(255, 42, 75, 0.8);
}

.boss-warn-text {
    font-size: 0.7rem;
    font-weight: 700;
    color: #FFB020;
    text-align: center;
    margin-top: 4px;
    letter-spacing: 0.05em;
}

/* Endless Survival Mode HUD */
.endless-hud-panel {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: rgba(15, 23, 42, 0.9);
    border: 1.5px solid #FF8A00;
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #FF8A00;
    box-shadow: 0 0 15px rgba(255, 138, 0, 0.4);
    margin-left: 12px;
}

.endless-lives {
    font-size: 0.95rem;
    letter-spacing: 2px;
}

/* BGM Audio Toggle in HUD */
.bgm-btn-active {
    border-color: #42E88A !important;
    color: #42E88A !important;
    box-shadow: 0 0 10px rgba(66, 232, 138, 0.4);
}

/* Certificate Modal & Canvas */
.cert-modal-box {
    max-width: 960px;
    width: 95vw;
    background: #090D16;
    border: 2px solid #FFD700;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.3), 0 0 20px rgba(0, 0, 0, 0.9);
}

.cert-preview-wrap {
    width: 100%;
    margin: 16px 0;
    background: #05080E;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid #1A2438;
}

#cert-canvas {
    width: 100%;
    max-width: 860px;
    height: auto;
    aspect-ratio: 3 / 2;
    display: block;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}

.cert-inputs-row {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
    align-items: center;
}

.cert-name-input {
    flex: 1;
    background: #111726;
    border: 1.5px solid #223048;
    color: #FFFFFF;
    font-family: 'Space Grotesk', monospace;
    font-size: 0.95rem;
    font-weight: 700;
    padding: 10px 14px;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s;
}

.cert-name-input:focus {
    border-color: #FFD700;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.4);
}

/* Arena Center Column & Level Word Progress Counter */
.arena-center-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.level-word-counter {
    display: inline-block;
    padding: 3px 14px;
    font-family: 'Black Ops One', cursive, monospace;
    font-size: 0.88rem;
    letter-spacing: 2px;
    color: #FFD700;
    background: rgba(10, 15, 26, 0.9);
    border: 1px solid rgba(255, 215, 0, 0.45);
    border-radius: 999px;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.25);
    text-transform: uppercase;
    text-shadow: 0 0 6px rgba(255, 215, 0, 0.6);
    pointer-events: none;
    transition: all 0.2s ease-out;
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .ten-cards-grid { grid-template-columns: repeat(2, 1fr); grid-template-rows: auto; }
    .dashboard-metrics-grid { grid-template-columns: repeat(2, 1fr); }
    .weak-strong-split-row { grid-template-columns: 1fr; }
    .physical-keyboard { transform: scale(0.85); transform-origin: top center; }
    .boss-hud-overlay { width: 95%; }
}
