/* GameWorks OAK Common Theme Tokens */

:root {
    /* Colors */
    --oak-color-bg-dark: #05050a;
    --oak-color-bg-card: rgba(20, 20, 35, 0.7);
    --oak-color-primary: #3a86ff;
    --oak-color-secondary: #ff006e;
    --oak-color-accent: #ffbe0b;
    --oak-color-text-main: #f8f9fa;
    --oak-color-text-muted: #adb5bd;
    
    /* Borders & Glassmorphism */
    --oak-glass-border: rgba(255, 255, 255, 0.1);
    --oak-glass-blur: blur(12px);
    
    /* Shadows & Glows */
    --oak-shadow-neon: 0 0 15px rgba(58, 134, 255, 0.4);
    --oak-shadow-card: 0 20px 40px rgba(0, 0, 0, 0.4);
    
    /* Typography */
    --oak-font-heading: 'Outfit', sans-serif;
    --oak-font-body: 'Inter', sans-serif;
}

/* Base Styles */

.theme-dark {
    background-color: var(--oak-color-bg-dark);
    color: var(--oak-color-text-main);
    font-family: var(--oak-font-body);
}

/* Texture Classes (Style Guide compliant) */

.texture-glass {
    background: var(--oak-color-bg-card);
    backdrop-filter: var(--oak-glass-blur);
    border: 1px solid var(--oak-glass-border);
}

.texture-neon-glow {
    box-shadow: var(--oak-shadow-neon);
}

/* Functional Classes (UpperCamelCase) */

.Container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

:root {
    --bg-dark: var(--oak-color-bg-dark);
    --bg-card: var(--oak-color-bg-card);
    --primary: var(--oak-color-primary);
    --secondary: var(--oak-color-secondary);
    --accent: var(--oak-color-accent);
    --text-main: var(--oak-color-text-main);
    --text-muted: var(--oak-color-text-muted);
    --glass-border: var(--oak-glass-border);
    --neon-shadow: var(--oak-shadow-neon);
    
    --font-heading: var(--oak-font-heading);
    --font-body: var(--oak-font-body);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3 {
    font-family: var(--font-heading);
    font-weight: 900;
    letter-spacing: -0.02em;
}

/* Background Animation */

.bg-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: 
        radial-gradient(circle at 20% 30%, rgba(58, 134, 255, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(255, 0, 110, 0.1) 0%, transparent 40%);
    filter: blur(80px);
    animation: meshFlow 20s ease-in-out infinite alternate;
}

@keyframes meshFlow {
    0% { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.1) translate(2%, 2%); }
}

/* Layout */

.Container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header */

header {
    height: 100px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

header.scrolled {
    height: 70px;
    background: rgba(5, 5, 10, 0.8);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

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

.logo {
    display: flex;
    align-items: center;
}

.logo-svg {
    height: 80px;
    width: auto;
    display: block;
    overflow: visible;
    transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

header.scrolled .logo-svg {
    height: 55px;
}

.logo-svg text {
    user-select: none;
    pointer-events: none;
}

/* Cog rotation is handled via JS and SVG attributes for precision */

#logo-cog-1, #logo-cog-2 {
    pointer-events: none;
}

/* Hero Section */

.hero {
    padding: 120px 0 80px;
    text-align: center;
}

.hero h1 {
    font-size: clamp(3rem, 8vw, 6rem);
    margin-bottom: 1.5rem;
    line-height: 1;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 3rem;
}

/* Footer */

footer {
    padding: 60px 0;
    border-top: 1px solid var(--glass-border);
    text-align: center;
}

.copyright {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsive Adjustments */

@media (max-width: 768px) {
    .hero {
        padding: 80px 0 40px;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .logo {
        font-size: 1.4rem;
    }

    header {
        height: 80px;
    }
}

/* Animations */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade {
    opacity: 0;
}

.animate-fade.visible {
    animation: fadeIn 1s ease var(--delay, 0s) forwards;
}

.delay-1 { animation-delay: 0.2s; }

.delay-2 { animation-delay: 0.4s; }

.delay-3 { animation-delay: 0.6s; }

/* Premium Custom Scrollbar */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(10, 10, 20, 0.3);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    border: 1px solid transparent;
    background-clip: padding-box;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary);
}

/* For Firefox */

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.12) rgba(10, 10, 20, 0.3);
}

/* Game Cards Section Styles */

.GamesGrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2.5rem;
    margin-bottom: 100px;
}

.GameCard {
    background: var(--bg-card);
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
}

.GameImg {
    width: 100%;
    height: 220px;
    background-image: var(--bg-image);
    background-size: cover;
    background-position: center;
    position: relative;
    overflow: hidden;
}

.badge {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    padding: 0.4rem 1rem;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 700;
    z-index: 20;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.badge.texture-hot {
    background: #b0003a;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 10px rgba(255, 0, 110, 0.4);
}

.badge.texture-info {
    background: #000000;
    color: var(--accent);
    border: 1px solid var(--accent);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.badge.none {
    display: none;
}

.GameInfo {
    padding: 2rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.GameInfo h3 {
    font-size: 1.6rem;
    color: var(--text-main);
}

.card-header {
    display: none; /* 画像内に移動するため非表示 */
}

.GameTitleOverlay {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    right: 1.5rem;
    z-index: 10;
    pointer-events: none;
    text-align: center;
    /* 複数のシャドウを重ねて輪郭を強調 */
    filter: 
        drop-shadow(0 2px 4px rgba(0, 0, 0, 0.9)) 
        drop-shadow(0 4px 12px rgba(0, 0, 0, 0.7))
        drop-shadow(0 0 20px rgba(0, 0, 0, 0.5));
}

.GameTitleOverlay h3 {
    transition: transform 0.3s ease-out;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tag {
    font-size: 0.75rem;
    color: var(--primary);
    background: rgba(58, 134, 255, 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 100px;
    border: 1px solid rgba(58, 134, 255, 0.3);
    font-weight: 600;
}

.GameInfo p {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

.BtnMore {
    text-decoration: none;
    width: 100%;
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    border: 1px solid transparent;
}

.BtnMore.state-published {
    border-color: var(--primary);
    background: rgba(58, 134, 255, 0.1);
    color: var(--primary);
}

.BtnMore.state-published:hover {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 20px rgba(58, 134, 255, 0.4);
    transform: translateY(-2px);
}

.BtnMore.state-pending {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--glass-border);
    color: var(--text-muted);
    cursor: default;
    filter: grayscale(1);
    opacity: 0.6;
    pointer-events: none;
}

.HistoryLink {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.7rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
    text-decoration: underline;
    opacity: 0.6;
    white-space: nowrap;
    flex-shrink: 0;
    align-self: flex-end;
    margin-bottom: 0.2rem;
}

/* Game Title Styles (Logos) */

.GameCard .title-burst-cascade {
    font-family: 'Outfit', sans-serif;
    font-style: italic;
    font-weight: 900;
    /* 親セレクターの追加により、!important を排除 */
    font-size: clamp(1.5rem, 18cqw, 2.8rem);
    background: linear-gradient(to right, #ff006e, #3a86ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 5px rgba(255, 0, 110, 0.3));
    letter-spacing: -1px;
}

.GameCard .title-magic-crystal {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    color: #fff;
    text-shadow: 
        0 0 10px rgba(0, 242, 255, 0.8),
        0 0 20px rgba(0, 242, 255, 0.4);
    letter-spacing: 2px;
    font-size: clamp(1.2rem, 15cqw, 2.4rem);
}

.GameCard .title-gravity-freight {
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 
        1px 1px 0px #000,
        0 0 10px rgba(58, 134, 255, 0.6);
    font-size: clamp(1rem, 15cqw, 2.2rem);
}

/* 画像ロゴ用のスタイル（ユーザーが画像を用意した場合） */

.GameLogoImg {
    height: auto; /* 高さを自動にして横幅を優先 */
    max-height: var(--logo-height, 80px); /* 上限を 80px に引き上げ */
    width: 100%;
    object-fit: contain;
    object-position: center; /* 中央寄せに変更 */
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.5));
}

.GameLogoWrapper {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 100%;
    pointer-events: none;
    container-type: inline-size; /* 文字サイズの動的調整用 */
}

.GameLogoWrapper.LogoStandard {
    width: 300px;
    height: 140px;
    max-width: 100%;
    max-height: 140px;
    margin: 0 auto;
}

.GameLogoWrapper.LogoText {
    height: 60px; /* テキスト表示時のデフォルト高さ */
}

.GameLogoWrapper.LogoText h3 {
    margin: 0;
    font-size: clamp(1rem, 15cqw, 2.2rem);
    white-space: nowrap; /* 折り返しを防止して縮小を優先 */
}

.GameLogoWrapper svg,
.GameLogoWrapper img {
    max-height: 100%;
    max-width: 100%;
    height: auto;
    object-fit: scale-down;
    object-position: center;
    display: block;
    overflow: visible;
}

.BtnGroup {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    margin-top: auto;
}

/* Responsive Adjustments */

@media (max-width: 768px) {
    .GamesGrid {
        grid-template-columns: 1fr; /* スマホでは1カラムに固定 */
        gap: 1.5rem;
    }
 
    .GameInfo {
        padding: 1.5rem;
    }

    .card-header {
        min-height: auto;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .HistoryLink {
        padding-left: 0;
    }
}

/* Fix sticky hover on touch devices */

@media (hover: hover) {
    .GameCard:hover {
        transform: translateY(-12px) scale(1.02);
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), var(--neon-shadow);
        border-color: rgba(58, 134, 255, 0.5);
    }

    .GameCard:hover .GameLogoWrapper,
    .GameCard:hover .GameTitleOverlay h3 {
        transform: scale(1.05);
    }

    .BtnMore.state-published:hover {
        background: var(--primary);
        color: white;
        box-shadow: 0 0 15px var(--primary);
    }
    
    .HistoryLink:hover {
        opacity: 1;
        color: var(--primary);
    }
}

/* Maintenance Card Fallback Styles (State-based Unification) */

.GameCard.state-maintenance {
    border-color: rgba(255, 255, 255, 0.04) !important;
    background: rgba(15, 15, 25, 0.6) !important;
}

.GameCard.state-maintenance .GameImg {
    background: linear-gradient(135deg, rgba(25, 25, 45, 0.9) 0%, rgba(8, 8, 16, 0.95) 100%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.GameCard.state-maintenance .GameTitleOverlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 5, 10, 0.65);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    z-index: 10;
    padding: 1.5rem;
    pointer-events: none;
}

/* Calm warn icon via CSS pseudo-element ::before */

.GameCard.state-maintenance .GameTitleOverlay::before {
    content: "";
    width: 36px;
    height: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='8' x2='12' y2='12'/%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    margin-bottom: 0.2rem;
    animation: pulse 3s infinite ease-in-out;
}

/* Objective MAINTENANCE text via CSS pseudo-element ::after */

.GameCard.state-maintenance .GameTitleOverlay::after {
    content: "MAINTENANCE";
    font-family: var(--font-heading);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.2em;
    color: var(--text-muted);
    opacity: 0.8;
    margin-top: 0.2rem;
}

.tag-maintenance {
    color: var(--text-muted) !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Disabled state inside maintenance cards */

.GameCard.state-maintenance .HistoryLink {
    cursor: not-allowed !important;
    opacity: 0.25 !important;
    pointer-events: none !important;
}

/* Calm opacity pulse for warning icons */

@keyframes pulse {
    0%, 100% {
        opacity: 0.85;
        transform: scale(1);
    }
    50% {
        opacity: 0.35;
        transform: scale(0.96);
    }
}

.animate-pulse {
    animation: pulse 3s infinite ease-in-out;
}

/* Update History Modal Section Styles */

.ModalOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(15px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

.ModalOverlay.active {
    opacity: 1;
    visibility: visible;
}

.ModalContent {
    background: var(--bg-card);
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* ヘッダーとボディの境界を角丸に合わせる */
    transform: translateY(40px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
}

.ModalOverlay.active .ModalContent {
    transform: translateY(0);
}

.ModalHeader {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
}

.ModalTitle {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--text-main);
    margin: 0;
    letter-spacing: -0.01em;
}

.ModalClose {
    background: transparent;
    border: none;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.2s ease;
}

.ModalClose:hover {
    color: var(--text-main);
}

.ModalBody {
    padding: 2rem;
    overflow-y: auto;
    flex-grow: 1;
}

@media (max-width: 600px) {
    .ModalHeader {
        padding: 1rem 1.5rem;
    }
    .ModalBody {
        padding: 1.5rem;
    }
    .ModalTitle {
        font-size: 1.2rem;
    }
}

/* Timeline */

.HistoryItem {
    margin-bottom: 2.5rem;
    position: relative;
    padding-left: 1.5rem;
    border-left: 2px solid var(--primary);
}

.HistoryHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.HistoryVersion {
    color: var(--primary);
    font-weight: 900;
    font-family: var(--font-heading);
}

.HistoryDate {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.HistoryChanges {
    list-style: none;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.HistoryChanges li {
    margin-bottom: 0.3rem;
    position: relative;
    padding-left: 1rem;
}

.HistoryChanges li::before {
    display: none; /* ドットを非表示にしてタグを優先 */
}

.HistoryTag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 0.65rem;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid currentColor;
    margin-right: 0.6rem;
    white-space: nowrap;
    text-transform: uppercase;
    transition: all 0.3s ease;
    vertical-align: middle;
    min-width: 3.5rem;
}

.HistoryTag.tag-new {
    color: hsl(180, 100%, 60%);
    background: hsla(180, 100%, 60%, 0.08);
    box-shadow: 0 0 8px hsla(180, 100%, 60%, 0.12);
}

.HistoryTag.tag-imp {
    color: hsl(285, 100%, 72%);
    background: hsla(285, 100%, 72%, 0.08);
    box-shadow: 0 0 8px hsla(285, 100%, 72%, 0.12);
}

.HistoryTag.tag-fix {
    color: hsl(35, 100%, 60%);
    background: hsla(35, 100%, 60%, 0.08);
    box-shadow: 0 0 8px hsla(35, 100%, 60%, 0.12);
}

.HistoryTag.tag-etc {
    color: hsl(0, 0%, 75%);
    background: hsla(0, 0%, 75%, 0.06);
}

.ModalPlaceholder {
    text-align: center;
    padding: 4rem;
    color: var(--text-muted);
}

.ModalPlaceholder p {
    font-size: 1.1rem;
    letter-spacing: 0.1em;
    margin: 0;
}

.LoadingSpinner {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

@media (hover: hover) {
    .ModalClose:hover {
        color: var(--secondary);
    }
}
