All files / components/screens/intro IntroScreen3D.tsx

65.68% Statements 67/102
62.16% Branches 46/74
61.53% Functions 16/26
64.64% Lines 64/99

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660                                                              1x                     1x               1x                 1x 10x     10x       1x                   1x               5x 5x 5x       5x                     5x   5x       5x       5x 5x     5x 5x 25x 25x                             5x 5x 5x       5x               5x                                             5x 5x             5x 5x 5x   5x   5x 5x           5x 5x                                                           5x 5x                           5x     5x             5x 5x                       5x 5x       5x       5x   5x   5x               5x         5x 5x     5x     5x 5x     5x       5x       5x 5x 5x 5x     5x   5x                 5x                                                                                                   5x                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
// UI renders outside Canvas in absolute-positioned div - no Html needed
import { Canvas } from "@react-three/fiber";
import React, {
  useCallback,
  useEffect,
  useMemo,
  useRef,
  useState,
} from "react";
import { useAudio } from "../../../audio/AudioProvider";
import { useWebGLContextLossHandler } from "../../../hooks/useWebGLContextLossHandler";
import { useWindowSize } from "../../../hooks/useWindowSize";
import { getScreenSize } from "../../../systems/ResponsiveScaling";
import { PLAYER_ARCHETYPES_DATA } from "../../../systems/types";
import { GameMode, PlayerArchetype } from "../../../types/common";
import {
  ARCHETYPE_BACKGROUNDS,
  getKoreanFontSize,
  getPerformanceSettings,
} from "../../../types/constants";
import { Z_INDEX } from "../../../types/LayoutTypes";
import { hexToRgbaString } from "../../../utils/colorUtils";
import { shouldUseMobileControls } from "../../../utils/deviceDetection";
import { getArchetypeAssets } from "../../../utils/playerUtils";
import { useKoreanTheme } from "../../shared/base/useKoreanTheme";
import { BackgroundScene3D } from "../../shared/three";
import { VolumeControl } from "../../shared/ui/VolumeControl";
import { ArchetypeDisplayOverlayHtml } from "./components/ArchetypeDisplayOverlayHtml";
import { EnhancedArchetypeDisplay } from "./components/EnhancedArchetypeDisplayOverlayHtml";
import { MenuSectionOverlayHtml } from "./components/MenuSectionOverlayHtml";
 
const APP_VERSION = import.meta.env.APP_VERSION;
 
export interface IntroScreen3DProps {
  readonly onMenuSelect: (mode: GameMode, archetype?: PlayerArchetype) => void;
  readonly onArchetypeSelect?: (archetype: PlayerArchetype) => void;
  readonly selectedArchetype?: PlayerArchetype;
  readonly width?: number;
  readonly height?: number;
  readonly useEnhancedArchetypeDisplay?: boolean; // Use enhanced card display
}
 
const MENU_ITEMS: { mode: GameMode; korean: string; english: string }[] = [
  { mode: GameMode.VERSUS, korean: "대전", english: "Combat" },
  { mode: GameMode.TRAINING, korean: "훈련", english: "Training" },
  { mode: GameMode.CONTROLS, korean: "조작", english: "Controls" },
  { mode: GameMode.PHILOSOPHY, korean: "철학", english: "Philosophy" },
];
 
// Texture key mapping for archetypes
const ARCHETYPE_TEXTURE_MAPPING: Record<PlayerArchetype, string> = {
  [PlayerArchetype.MUSA]: "musa",
  [PlayerArchetype.AMSALJA]: "amsalja",
  [PlayerArchetype.HACKER]: "hacker",
  [PlayerArchetype.JEONGBO_YOWON]: "jeongbo_yowon",
  [PlayerArchetype.JOJIK_POKRYEOKBAE]: "jojik_pokryeokbae",
};
 
// Helper function to convert PlayerArchetype enum to array index
const getArchetypeIndex = (archetype: PlayerArchetype): number => {
  const archetypeKeys = Object.keys(
    PLAYER_ARCHETYPES_DATA,
  ) as PlayerArchetype[];
  return archetypeKeys.indexOf(archetype);
};
 
// Helper function to convert array index to PlayerArchetype enum
const getArchetypeFromIndex = (index: number): PlayerArchetype => {
  const archetypeKeys = Object.keys(
    PLAYER_ARCHETYPES_DATA,
  ) as PlayerArchetype[];
  return archetypeKeys[index] ?? PlayerArchetype.MUSA;
};
 
/**
 * Three.js-based IntroScreen Component
 */
export const IntroScreen3D: React.FC<IntroScreen3DProps> = ({
  onMenuSelect,
  onArchetypeSelect,
  selectedArchetype = PlayerArchetype.MUSA,
  width: propWidth,
  height: propHeight,
  useEnhancedArchetypeDisplay = true, // Default to enhanced display
}) => {
  const audio = useAudio();
  const introMusicStarted = useRef(false);
  const [selectedMenuIndex, setSelectedMenuIndex] = useState(0);
  // UI now renders outside Canvas - no canvas ready state needed
 
  // Handle WebGL context loss and restoration (for 3D background only)
  useWebGLContextLossHandler({
    onContextLost: () => {
      console.warn("⚠️ WebGL context lost in IntroScreen");
    },
    onContextRestored: () => {
      console.log("✓ WebGL context restored in IntroScreen");
    },
    autoRestore: true,
  });
 
  // Add local state for archetype management
  const [currentArchetype, setCurrentArchetype] =
    useState<PlayerArchetype>(selectedArchetype);
  const [selectedArchetypeIndex, setSelectedArchetypeIndex] = useState<number>(
    getArchetypeIndex(selectedArchetype),
  );
 
  const { width, height } = useWindowSize();
 
  // Use prop dimensions if provided, otherwise use window size with defensive fallbacks
  // Ensure minimum valid dimensions to prevent rendering issues
  const screenWidth = propWidth ?? (width || 1200);
  const screenHeight = propHeight ?? (height || 800);
 
  // Create archetype data with texture keys from PLAYER_ARCHETYPES_DATA
  const archetypeData = useMemo(() => {
    return Object.entries(PLAYER_ARCHETYPES_DATA).map(([key, data]) => {
      const archetypeEnum = key as PlayerArchetype;
      return {
        id: key.toLowerCase(),
        korean: data.name.korean,
        english: data.name.english,
        description: data.description.korean,
        color: data.colors.primary,
        textureKey: ARCHETYPE_TEXTURE_MAPPING[archetypeEnum],
        stats: data.stats,
        philosophy: data.philosophy,
        specialAbilities: data.specialAbilities, // Include special abilities
      };
    });
  }, []);
 
  // Sync with prop changes
  useEffect(() => {
    setCurrentArchetype(selectedArchetype);
    setSelectedArchetypeIndex(getArchetypeIndex(selectedArchetype));
  }, [selectedArchetype]);
 
  // Direct menu selection - MOVED BEFORE useEffect that uses it
  const handleMenuItemSelect = useCallback(
    (mode: GameMode) => {
      onMenuSelect(mode, currentArchetype);
    },
    [onMenuSelect, currentArchetype],
  );
 
  // Handle archetype change by index - MOVED BEFORE useEffect that uses it
  const handleArchetypeIndexChange = useCallback(
    (index: number) => {
      const newArchetype = getArchetypeFromIndex(index);
      setSelectedArchetypeIndex(index);
      setCurrentArchetype(newArchetype);
      onArchetypeSelect?.(newArchetype);
 
      // Check if audio system is ready, not individual methods
      if (audio.isAudioReady) {
        audio.playSFX("menu_hover");
 
        // Play archetype theme music preview when archetype changes
        // Use getArchetypeAssets utility for proper error handling and fallback
        const archetypeAssets = getArchetypeAssets(newArchetype);
        // Stop intro music and play archetype theme
        audio.stopMusic();
        audio.playMusic(archetypeAssets.themeId);
      }
    },
    [onArchetypeSelect, audio],
  );
 
  // Play intro music after first user interaction
  useEffect(() => {
    const startMusic = () => {
      if (audio.isAudioReady && !introMusicStarted.current) {
        introMusicStarted.current = true;
        audio.playMusic("intro_theme");
      }
    };
    // Event listeners with { once: true } are automatically removed after triggering
    window.addEventListener("keydown", startMusic, { once: true });
    window.addEventListener("mousedown", startMusic, { once: true });
    window.addEventListener("touchstart", startMusic, { once: true, passive: true });
 
    return () => {
      // Safe cleanup - check if audio is initialized before stopping music
      Eif (audio.isInitialized) {
        audio.stopMusic();
      }
    };
  }, [audio]);
 
  // Keyboard navigation
  useEffect(() => {
    const handleKeyDown = (event: KeyboardEvent) => {
      // Archetype navigation (handleArchetypeIndexChange already plays menu_hover SFX)
      if (event.key === "ArrowLeft") {
        const newIndex =
          selectedArchetypeIndex === 0
            ? archetypeData.length - 1
            : selectedArchetypeIndex - 1;
        handleArchetypeIndexChange(newIndex);
      } else if (event.key === "ArrowRight") {
        const newIndex = (selectedArchetypeIndex + 1) % archetypeData.length;
        handleArchetypeIndexChange(newIndex);
      } else {
        // Direct game mode shortcuts
        switch (event.key.toLowerCase()) {
          case "c":
            handleMenuItemSelect(GameMode.CONTROLS);
            break;
          case "p":
            handleMenuItemSelect(GameMode.PHILOSOPHY);
            break;
          case "t":
            handleMenuItemSelect(GameMode.TRAINING);
            break;
          case "v":
            handleMenuItemSelect(GameMode.VERSUS);
            break;
        }
      }
    };
 
    window.addEventListener("keydown", handleKeyDown);
    return () => window.removeEventListener("keydown", handleKeyDown);
  }, [
    audio,
    archetypeData.length,
    selectedArchetypeIndex,
    handleArchetypeIndexChange,
    handleMenuItemSelect,
  ]);
 
  // Responsive layout calculations with large desktop support
  // Use device detection instead of width-only breakpoint to correctly identify high-res mobile devices
  // shouldUseMobileControls() uses user-agent detection which doesn't change during session
  // Use isMobile only for mobile CONTROLS (touch controls, etc.)
  // Layout sizing should use screenWidth-based calculations
  const isMobile = useMemo(() => shouldUseMobileControls(), []);
 
  // Use Korean theme hook for consistent theming
  const theme = useKoreanTheme({
    variant: "primary",
    size: "md",
    isMobile,
  });
 
  // Memoize colors from theme for performance
  const colors = useMemo(
    () => ({
      trigramTextShadow: `0 0 10px ${hexToRgbaString(
        theme.colors.PRIMARY_CYAN,
        0.8,
      )}`,
      footerBackground: hexToRgbaString(theme.colors.UI_BACKGROUND_DARK, 0.9),
      footerBorder: hexToRgbaString(theme.colors.ACCENT_GOLD, 0.3),
    }),
    [theme],
  );
 
  // Performance settings based on device tier
  const performanceSettings = useMemo(() => {
    return getPerformanceSettings(screenWidth, isMobile);
  }, [screenWidth, isMobile]);
 
  // Get screen size category for layout calculations (mobile, tablet, desktop, large, xlarge)
  const screenSize = useMemo(() => getScreenSize(screenWidth), [screenWidth]);
 
  // Use percentage-based layout based on screen dimensions
  // Logo takes priority - larger and more prominent
  const logoSize = useMemo(() => {
    // Logo should be prominent - use percentage of smaller dimension
    const minDim = Math.min(screenWidth, screenHeight);
    // Scale based on screen size category
    const logoScale = {
      mobile: 0.28,
      tablet: 0.22,
      desktop: 0.18,
      large: 0.15,
      xlarge: 0.12,
    }[screenSize];
    // Cap at reasonable max size for very large screens
    return Math.min(minDim * logoScale, screenSize === "xlarge" ? 250 : 300);
  }, [screenWidth, screenHeight, screenSize]);
 
  // Dynamic heights based on available screen space (percentage-based)
  // All calculations use screen dimensions, not device type
  const layoutHeights = useMemo(() => {
    const availableHeight = screenHeight;
 
    // Title area - small header with title and description
    const titleHeight = screenWidth < 768 ? 32 : 38;
 
    // Logo area - based on logo size plus trigram symbols (compact)
    const trigramHeight = screenWidth < 768 ? 16 : 22;
    const logoAreaHeight = logoSize + trigramHeight;
 
    // Footer - compact with all info
    const footerHeight = Math.max(availableHeight * 0.05, 48);
 
    // Remaining space for menu + archetype
    const contentHeight =
      availableHeight - titleHeight - logoAreaHeight - footerHeight;
 
    // Menu needs enough height for 2x2 grid (2 rows of ~40px buttons + title + padding)
    // Mobile needs column layout (4 buttons stacked)
    const menuMinHeight = screenWidth < 768 ? 180 : 120;
    const menuPercent = screenWidth < 768 ? 0.38 : 0.25;
    const menuHeight = Math.max(contentHeight * menuPercent, menuMinHeight);
    const archetypeHeight = contentHeight - menuHeight - 8; // 8px gap
 
    // Gap scales with screen (minimal)
    const gap = Math.max(screenHeight * 0.002, 2);
 
    return {
      titleHeight,
      logoAreaHeight,
      menuHeight,
      archetypeHeight,
      footerHeight,
      gap,
    };
  }, [screenHeight, screenWidth, logoSize]);
  return (
    <div
      style={{
        width: screenWidth,
        height: screenHeight,
        position: "relative",
        overflow: "hidden",
      }}
      data-testid="intro-screen"
    >
      {/* Archetype background image (very subtle, behind 3D scene) */}
      <div
        style={{
          position: "absolute",
          top: 0,
          left: 0,
          width: "100%",
          height: "100%",
          backgroundImage: `url(${ARCHETYPE_BACKGROUNDS.overview})`,
          backgroundSize: "cover",
          backgroundPosition: "center",
          backgroundRepeat: "no-repeat",
          opacity: 0.08,
          filter: "blur(4px)",
          zIndex: Z_INDEX.BACKGROUND,
        }}
        data-testid="archetype-background"
      />
 
      {/* Volume Control - outside Canvas to maintain AudioProvider context */}
      <VolumeControl position="top-right" compact={isMobile} />
 
      {/* Three.js Canvas for 3D background */}
      <Canvas
        style={{
          position: "absolute",
          top: 0,
          left: 0,
          width: "100%",
          height: "100%",
          zIndex: Z_INDEX.ARENA,
        }}
        gl={{
          antialias: performanceSettings.antialias,
          alpha: true,
          powerPreference: "high-performance",
        }}
        dpr={performanceSettings.dpr}
        camera={{ position: [0, 5, 10], fov: 75 }}
        onCreated={({ gl }) => {
          gl.setClearColor(theme.colors.UI_BACKGROUND_DARK, 0.95);
        }}
      >
        {/* 3D Background Scene */}
        <BackgroundScene3D theme="intro" />
      </Canvas>
 
      {/* UI Overlay (positioned absolutely over Canvas) - matches CombatScreen pattern */}
      <div
        style={{
          position: "absolute",
          top: 0,
          left: 0,
          width: "100%",
          height: "100%",
          pointerEvents: "none",
          zIndex: Z_INDEX.HUD,
        }}
        data-testid="intro-hud-overlay"
      >
        <div
          style={{
            width: "100vw",
            height: "100vh",
            display: "flex",
            flexDirection: "column",
            alignItems: "center",
            justifyContent: "space-between",
            padding: 0,
            pointerEvents: "none",
            zIndex: Z_INDEX.HUD,
            overflow: "hidden",
          }}
        >
          {/* Title - Small, above logo */}
          <div
            style={{
              display: "flex",
              flexDirection: "column",
              alignItems: "center",
              gap: "2px",
              pointerEvents: "none",
              marginTop: "4px",
              flexShrink: 0,
            }}
            data-testid="main-title-container"
          >
            <div
              style={{
                fontSize: screenWidth < 768 ? "14px" : "16px",
                fontWeight: "bold",
                fontFamily: theme.koreanTypography.fontFamily,
                lineHeight: theme.koreanTypography.lineHeight,
                letterSpacing: theme.koreanTypography.letterSpacing,
                wordBreak: theme.koreanTypography.wordBreak,
                color: `#${theme.colors.ACCENT_GOLD.toString(16).padStart(6, "0")}`,
                textShadow: "0 0 10px rgba(255, 170, 0, 0.5)",
              }}
            >
              흑괘 | Black Trigram
            </div>
            <div
              style={{
                fontSize: screenWidth < 768 ? "10px" : "11px",
                fontFamily: theme.koreanTypography.fontFamily,
                color: `#${theme.colors.TEXT_SECONDARY.toString(16).padStart(6, "0")}`,
              }}
            >
              한국 무술 시뮬레이터 | Korean Martial Arts Simulator
            </div>
          </div>
 
          {/* Logo Section - Primary branding */}
          <div
            style={{
              flexShrink: 0,
              display: "flex",
              flexDirection: "column",
              alignItems: "center",
              justifyContent: "center",
              height: `${layoutHeights.logoAreaHeight}px`,
              pointerEvents: "none",
            }}
            data-testid="logo-section"
          >
            {/* Logo Image - Prominent */}
            <img
              src="/assets/visual/logo/black-trigram.png"
              alt="Black Trigram Logo"
              style={{
                width: `${logoSize}px`,
                height: `${logoSize}px`,
                objectFit: "contain",
                filter: "drop-shadow(0 0 30px rgba(0, 255, 255, 0.6))",
              }}
              data-testid="main-logo"
              onError={(e) => {
                e.currentTarget.style.display = "none";
              }}
            />
 
            {/* Trigram Symbols */}
            <div
              style={{
                fontSize: screenWidth < 768 ? "16px" : "18px",
                color: `#${theme.colors.PRIMARY_CYAN.toString(16).padStart(
                  6,
                  "0",
                )}`,
                letterSpacing: screenWidth < 768 ? "6px" : "8px",
                textAlign: "center",
                marginTop: screenWidth < 768 ? "8px" : "10px",
                textShadow: colors.trigramTextShadow,
              }}
              data-testid="trigram-symbols"
            >
              ☰ ☱ ☲ ☳ ☴ ☵ ☶ ☷
            </div>
          </div>
 
          {/* Main Content Area */}
          <div
            style={{
              width: "100%",
              flex: 1,
              display: "flex",
              flexDirection: "column",
              alignItems: "center",
              justifyContent: "flex-start",
              gap: "4px",
              paddingLeft: screenWidth < 768 ? "8px" : "16px",
              paddingRight: screenWidth < 768 ? "8px" : "16px",
              overflow: "hidden",
              pointerEvents: "auto",
              minHeight: 0,
            }}
            data-testid="main-content"
          >
            {/* Menu Section - Compact */}
            <div
              style={{
                width: screenWidth < 768 ? "95%" : "70%",
                maxWidth: screenWidth < 768 ? "100%" : "600px",
              }}
              data-testid="menu-section-container"
            >
              <MenuSectionOverlayHtml
                menuItems={MENU_ITEMS}
                selectedIndex={selectedMenuIndex}
                onModeSelect={handleMenuItemSelect}
                onSelectedIndexChange={setSelectedMenuIndex}
                onPlaySFX={audio.playSFX}
                width={
                  // Compact menu width - narrower for better proportions
                  screenWidth < 768
                    ? screenWidth * 0.9
                    : screenWidth < 1024
                      ? Math.min(500, screenWidth * 0.6)
                      : Math.min(550, screenWidth * 0.4)
                }
                height={layoutHeights.menuHeight}
                isMobile={isMobile}
              />
            </div>
 
            {/* Archetype Selection - Scrollable container */}
            <div
              style={{
                width: screenWidth < 768 ? "100%" : "85%",
                maxWidth: screenWidth < 768 ? "100%" : "900px",
                flex: 1,
                minHeight: 0,
                overflowY: "auto",
                overflowX: "hidden",
              }}
              data-testid="archetype-section-container"
            >
              {useEnhancedArchetypeDisplay ? (
                <EnhancedArchetypeDisplay
                  archetypes={archetypeData}
                  selectedIndex={selectedArchetypeIndex}
                  onArchetypeChange={handleArchetypeIndexChange}
                  onPlaySFX={audio.playSFX}
                  width={
                    screenWidth < 768
                      ? screenWidth * 0.9
                      : screenWidth < 1024
                        ? Math.min(700, screenWidth * 0.7)
                        : Math.min(850, screenWidth * 0.55)
                  }
                  height={Math.max(layoutHeights.archetypeHeight - 40, 200)}
                  isMobile={isMobile}
                  allowDetailedView={screenWidth >= 768}
                />
              ) : (
                <ArchetypeDisplayOverlayHtml
                  archetypes={archetypeData}
                  selectedIndex={selectedArchetypeIndex}
                  onArchetypeChange={handleArchetypeIndexChange}
                  onPlaySFX={audio.playSFX}
                  width={
                    screenWidth < 768
                      ? screenWidth * 0.9
                      : screenWidth < 1024
                        ? Math.min(700, screenWidth * 0.7)
                        : Math.min(850, screenWidth * 0.55)
                  }
                  height={Math.max(layoutHeights.archetypeHeight - 40, 200)}
                  isMobile={isMobile}
                />
              )}
            </div>
          </div>
 
          {/* Footer - Compact with all info */}
          <div
            style={{
              width: "100%",
              minHeight: `${layoutHeights.footerHeight}px`,
              display: "flex",
              flexDirection: "column",
              alignItems: "center",
              justifyContent: "center",
              gap: "1px",
              background: `linear-gradient(to bottom, rgba(0, 0, 0, 0), ${colors.footerBackground})`,
              borderTop: `1px solid ${colors.footerBorder}`,
              pointerEvents: "auto",
              paddingBottom: "2px",
              flexShrink: 0,
            }}
            data-testid="intro-footer"
          >
            {/* Motto */}
            <div
              style={{
                fontSize: `${Math.max(getKoreanFontSize("SMALL", screenWidth) - 3, 10)}px`,
                color: `#${theme.colors.ACCENT_CYAN.toString(16).padStart(6, "0")}`,
                fontFamily: theme.koreanTypography.fontFamily,
                fontStyle: "italic",
                textAlign: "center",
              }}
              data-testid="footer-motto"
            >
              흑괘의 길을 걸어라 - Walk the Path of the Black Trigram
            </div>
            {/* Open Source Link */}
            <div
              style={{
                fontSize: `${Math.max(getKoreanFontSize("SMALL", screenWidth) - 4, 9)}px`,
                color: `#${theme.colors.ACCENT_BLUE.toString(16).padStart(6, "0")}`,
                textAlign: "center",
                cursor: "pointer",
              }}
              onClick={() =>
                window.open("https://github.com/Hack23/blacktrigram", "_blank")
              }
              data-testid="footer-link"
            >
              Open Source Korean Martial Arts Game by Hack23
            </div>
            {/* Version */}
            <div
              style={{
                fontSize: `${Math.max(getKoreanFontSize("SMALL", screenWidth) - 5, 8)}px`,
                color: `#${theme.colors.ACCENT_BLUE.toString(16).padStart(6, "0")}`,
                textAlign: "center",
                cursor: "pointer",
              }}
              onClick={() =>
                window.open(
                  `https://github.com/Hack23/blacktrigram/releases/tag/v${APP_VERSION}`,
                  "_blank",
                )
              }
              data-testid="footer-version"
            >
              v{APP_VERSION}
            </div>
          </div>
        </div>
      </div>
    </div>
  );
};
 
export default IntroScreen3D;