/* ========================================
   abilumi - game detail shell v2
   Game content itself is intentionally not implemented yet.
======================================== */

:root {
    --page-bg: #fffaf5;
    --surface: #ffffff;
    --text: #2f3135;
    --muted: #74777e;
    --line: #ece8e3;
    --accent: #ff506c;
    --yellow: #ffe28a;
    --shadow: 0 8px 24px rgba(34,34,34,.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-width: 0;
    color: var(--text);
    background: var(--page-bg);
    font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, system-ui, sans-serif;
    line-height: 1.7;
}
body.game-playing { overflow: hidden !important; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }

/* ---------- Header: same visual structure as the other abilumi pages ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #fff;
    border-bottom: 1px solid #eee;
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.header-inner {
    width: min(1200px, 94%);
    height: 80px;
    margin: 0 auto;
    display: flex;
    align-items: center;
}
.logo-link { display: inline-flex; align-items: center; }
.logo, .header-logo {
    width: 90px;
    height: auto;
    object-fit: contain;
}

/* ---------- Breadcrumb ---------- */
.game-breadcrumb {
    width: min(1060px, 92%);
    margin: 16px auto 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: .86rem;
}
.game-breadcrumb a:hover { text-decoration: underline; }
.separator { opacity: .55; }

/* ---------- Game preview ---------- */
.game-section { padding: 18px 0 34px; }
.game-container { width: min(1040px, 94%); margin: 0 auto; }
.game-title {
    margin: 0 0 18px;
    text-align: center;
    font-size: clamp(1.5rem, 4.5vw, 2.25rem);
    line-height: 1.3;
    font-weight: 800;
}
.game-frame {
    width: min(900px, 100%);
    margin: 0 auto;
    padding: clamp(9px, 1.7vw, 15px);
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow);
}
.game-launch-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    min-height: 240px;
    overflow: hidden;
    border-radius: 14px;
    isolation: isolate;
    border: 1px solid #eee7df;
    background: #f3f1ed;
}
.game-preview-image-placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    text-align: center;
    color: #8a8d92;
    font-weight: 800;
    background:
        radial-gradient(circle at 18% 24%, rgba(255,80,108,.14) 0 9%, transparent 10%),
        radial-gradient(circle at 82% 24%, rgba(25,150,232,.13) 0 9%, transparent 10%),
        radial-gradient(circle at 22% 78%, rgba(120,190,32,.13) 0 8%, transparent 9%),
        radial-gradient(circle at 80% 76%, rgba(255,199,44,.16) 0 8%, transparent 9%),
        linear-gradient(145deg, #fff9e9 0%, #fff4f6 48%, #eef8ff 100%);
}
.game-preview-image-placeholder span {
    display: block;
    margin-top: 4px;
    font-size: .78rem;
    font-weight: 600;
    color: #a0a2a6;
}
.game-preview-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.game-preview-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    place-items: center;
    background: rgba(20,22,26,.06);
}
.game-preview-center {
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 20px;
    text-align: center;
}
.game-start-button {
    width: clamp(82px, 15vw, 104px);
    height: clamp(82px, 15vw, 104px);
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    box-shadow: 0 12px 26px rgba(255,80,108,.32);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: transform .16s ease, box-shadow .16s ease;
}
.game-start-button:hover { transform: scale(1.045); box-shadow: 0 15px 30px rgba(255,80,108,.38); }
.game-start-button:active { transform: scale(.97); }
.game-start-icon {
    display: block;
    width: 0;
    height: 0;
    margin-left: 7px;
    border-top: 17px solid transparent;
    border-bottom: 17px solid transparent;
    border-left: 27px solid #fff;
}
.game-start-text {
    margin: 0;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,.90);
    color: #4d5055;
    font-size: .9rem;
    font-weight: 800;
}

/* ---------- Full-screen game shell ---------- */
.game-play-layer[hidden] { display: none !important; }
.game-play-layer {
    position: fixed;
    inset: 0;
    z-index: 9999;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: #f7f7f7;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
}

/* Dedicated play-screen header: keeps the same abilumi identity as the rest of the site */
.game-play-site-header {
    min-height: 66px;
    padding-top: env(safe-area-inset-top);
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
    z-index: 2;
}
.game-play-header-inner {
    width: min(1200px, 96%);
    min-height: 66px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(84px, auto) minmax(0, 1fr) minmax(84px, auto);
    align-items: center;
    gap: 12px;
}
.game-play-logo-link { display: inline-flex; align-items: center; justify-self: start; }
.game-play-logo {
    width: 82px;
    height: auto;
    object-fit: contain;
}
.game-play-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    color: #34363b;
    font-size: clamp(.9rem, 2.2vw, 1.08rem);
    font-weight: 800;
}
.game-back-button {
    justify-self: end;
    min-width: 84px;
    min-height: 40px;
    padding: 7px 12px;
    border: 1px solid #e2e2e2;
    border-radius: 11px;
    background: #fff;
    color: #44474d;
    font-size: .9rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 2px 7px rgba(0,0,0,.05);
}
.game-back-button:hover { background: #f7f7f7; }

/* Game occupies all remaining space between the site header and footer */
.game-play-canvas {
    position: relative;
    min-height: 0;
    overflow: hidden;
    background:
        linear-gradient(rgba(255,255,255,.028) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.028) 1px, transparent 1px),
        #101217;
    background-size: 24px 24px;
}
.game-stage-sample {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 1120px;
    height: 700px;
    transform: translate(-50%, -50%) scale(var(--game-scale, 1));
    transform-origin: center center;
    overflow: hidden;
    border-radius: 18px;
    border: 3px solid rgba(255,255,255,.92);
    background: #fff;
    box-shadow: 0 20px 60px rgba(0,0,0,.38);
    display: grid;
    place-items: center;
}
.game-stage-inner {
    width: 100%;
    height: 100%;
    padding: 54px;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 18px;
    text-align: center;
    background:
        radial-gradient(circle at 20% 22%, rgba(255,80,108,.12), transparent 22%),
        radial-gradient(circle at 82% 72%, rgba(25,150,232,.12), transparent 24%),
        #fffdf8;
}
.game-stage-inner strong { font-size: 46px; line-height: 1.2; color: #31343a; }
.game-stage-inner .sample-size { font-size: 31px; font-weight: 800; color: var(--accent); }
.game-stage-inner p { max-width: 720px; margin: 0; color: #686b72; font-size: 22px; line-height: 1.6; }

/* Dedicated play-screen footer: same site-information role as ordinary pages, but compact */
.game-play-site-footer {
    padding-bottom: env(safe-area-inset-bottom);
    background: #fff;
    border-top: 1px solid #e8e8e8;
    z-index: 2;
}
.game-play-footer-inner {
    width: min(1200px, 96%);
    min-height: 58px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.game-play-footer-inner nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 18px;
}
.game-play-footer-inner a {
    color: #55585e;
    font-size: .78rem;
    font-weight: 700;
}
.game-play-footer-inner a:hover { text-decoration: underline; }
.game-play-footer-inner p {
    margin: 0;
    color: #85888e;
    font-size: .76rem;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .game-play-site-header,
    .game-play-header-inner { min-height: 56px; }
    .game-play-header-inner {
        width: 94%;
        grid-template-columns: 70px minmax(0, 1fr) 70px;
        gap: 7px;
    }
    .game-play-logo { width: 64px; }
    .game-back-button {
        min-width: 68px;
        min-height: 36px;
        padding: 6px 8px;
        font-size: .78rem;
    }
    .game-play-title { font-size: .82rem; }
    .game-play-footer-inner {
        width: 94%;
        min-height: 60px;
        padding: 6px 0;
        display: grid;
        justify-items: center;
        gap: 2px;
    }
    .game-play-footer-inner nav {
        justify-content: center;
        gap: 3px 11px;
    }
    .game-play-footer-inner a { font-size: .66rem; }
    .game-play-footer-inner p { font-size: .64rem; }
}

@media (max-height: 600px) {
    .game-play-site-header,
    .game-play-header-inner { min-height: 48px; }
    .game-play-logo { width: 58px; }
    .game-play-footer-inner { min-height: 42px; padding: 2px 0; }
    .game-play-footer-inner a { font-size: .64rem; }
    .game-play-footer-inner p { font-size: .62rem; }
}

/* ---------- Recommended / similar games ---------- */
.game-list-section { padding: 0 0 34px; }
.game-list-inner, .description-inner {
    width: min(980px, 94%);
    margin: 0 auto;
}
.section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.section-heading h2 {
    margin: 0;
    font-size: clamp(1.25rem, 3.6vw, 1.55rem);
}
.game-card-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}
.game-list-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(0,0,0,.05);
}
.game-list-image {
    aspect-ratio: 4 / 3;
    display: grid;
    place-items: center;
    padding: 10px;
    background: #f6f4f0;
    color: #a0a2a5;
    text-align: center;
    font-size: .84rem;
    font-weight: 800;
}
.game-list-name {
    display: block;
    min-height: 54px;
    padding: 11px 12px 12px;
    color: #45484d;
    font-size: .9rem;
    font-weight: 800;
    line-height: 1.45;
}

/* ---------- Game description ---------- */
.description-section { padding: 0 0 44px; }
.description-card {
    padding: clamp(20px, 4vw, 30px);
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
}
.description-card > h2 {
    margin: 0 0 18px;
    font-size: clamp(1.3rem, 3.8vw, 1.65rem);
}
.description-fields {
    display: grid;
    gap: 14px;
}
.description-field {
    padding: 17px 18px;
    border: 1px solid #eee9e2;
    border-radius: 14px;
    background: #fffdf9;
}
.description-field h3 {
    margin: 0 0 7px;
    font-size: 1.03rem;
}
.description-field p {
    margin: 0;
    color: #7d8085;
    font-size: .92rem;
}
.description-field ul {
    margin: 6px 0 0;
    padding-left: 1.3em;
    color: #7d8085;
    font-size: .92rem;
}
.placeholder-copy { font-style: italic; }

/* ---------- Footer: same visual structure as the other abilumi pages ---------- */
.site-footer {
    padding: 30px 15px;
    background: #f2f2f2;
    color: #555;
    text-align: center;
}
.site-footer nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 10px;
}
.site-footer p { margin: 0; }
.top-button {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 900;
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 50%;
    background: var(--yellow);
    font-size: 21px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,.15);
    display: none;
}
.top-button.is-visible { display: grid; place-items: center; }

.game-start-button:focus-visible,
.game-back-button:focus-visible,
.top-button:focus-visible,
.game-list-card:focus-visible {
    outline: 3px solid #1996e8;
    outline-offset: 3px;
}

@media (max-width: 900px) {
    .game-card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 650px) {
    .header-inner { height: 72px; }
    .logo, .header-logo { width: 105px; }
    .game-breadcrumb { margin-top: 12px; font-size: .78rem; }
    .game-section { padding-top: 14px; }
    .game-container { width: 94%; }
    .game-title { margin-bottom: 13px; }
    .game-frame { width: min(100%, 760px); padding: 7px; border-radius: 15px; }
    .game-launch-preview { min-height: 205px; border-radius: 11px; }
    .game-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .game-play-toolbar { grid-template-columns: auto 1fr; }
    .game-size-chip { display: none; }
    .game-list-name { min-height: 50px; padding: 9px 10px 11px; font-size: .82rem; }
    .description-field { padding: 15px; }
}

@media (max-width: 390px) {
    .game-launch-preview { min-height: 190px; }
    .game-start-button { width: 78px; height: 78px; }
    .game-start-icon { border-top-width: 14px; border-bottom-width: 14px; border-left-width: 23px; }
}


/* ---------- Integrated standalone games ---------- */
.game-stage-sample.abilumi-embedded-stage {
    display: block;
    padding: 0;
    background: #fff;
}
.abilumi-game-iframe {
    display: block;
    width: 1120px;
    height: 700px;
    border: 0;
    margin: 0;
    padding: 0;
    background: #fff;
}

/* ---------- Step4: related-game circulation ---------- */
.section-subcopy { margin:0; color:#7d8085; font-size:.82rem; line-height:1.5; }
.game-list-link { display:block; height:100%; color:inherit; text-decoration:none; }
.game-list-image { padding:0; overflow:hidden; }
.game-list-image img { display:block; width:100%; height:100%; object-fit:cover; }
.game-list-meta { display:block; margin:-5px 12px 12px; color:#8a8d91; font-size:.72rem; font-weight:700; }
.game-list-card { transition:transform .16s ease,box-shadow .16s ease,border-color .16s ease; }
.game-list-card:hover { transform:translateY(-2px); border-color:#ded7ce; box-shadow:0 8px 20px rgba(0,0,0,.08); }
.game-list-link:focus-visible { outline:3px solid #1996e8; outline-offset:-3px; }
@media (max-width:650px) { .section-heading{align-items:flex-start;flex-direction:column;gap:5px} }


/* ===== Step5: responsive / viewport hardening ===== */
html, body { max-width: 100%; overflow-x: clip; }
body { min-width: 0; }
.header-inner, .game-breadcrumb, .game-container, .game-frame, .game-list-inner, .description-inner, .description-card { min-width: 0; }
.game-card-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.game-list-card, .game-list-link, .game-list-image { min-width: 0; }
.game-list-name, .game-list-meta, .description-field p, .description-field li, .section-subcopy { overflow-wrap: anywhere; }
.game-play-layer { width: 100%; max-width: 100%; min-height: 0; }
.game-play-canvas { contain: layout paint; }
.game-stage-sample { max-width: none; max-height: none; }
.game-play-footer-inner nav { row-gap: 3px; }
.top-button { right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); }
@media (max-width: 900px) {
  .game-card-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 650px) {
  .header-inner { height: 64px; }
  .logo, .header-logo { width: 78px; }
  .game-breadcrumb, .game-container, .game-list-inner, .description-inner { width: min(100% - 24px, 980px); }
  .game-section { padding: 12px 0 26px; }
  .game-title { font-size: clamp(1.35rem, 6vw, 1.75rem); }
  .game-frame { padding: 6px; }
  .game-launch-preview { min-height: 0; aspect-ratio: 16/10; }
  .game-start-button { width: 76px; height: 76px; }
  .game-start-text { font-size: .82rem; }
  .game-list-section { padding-bottom: 28px; }
  .game-card-grid { gap: 10px; }
  .description-card { padding: 18px 14px; }
  .description-field { padding: 14px; }
  .site-footer { padding: 24px 12px; }
  .site-footer nav { gap: 8px 14px; font-size: .86rem; }
  .game-play-site-header, .game-play-header-inner { min-height: 50px; }
  .game-play-header-inner { width: calc(100% - 16px); grid-template-columns: 64px minmax(0,1fr) 68px; gap: 4px; }
  .game-play-logo { width: 58px; }
  .game-back-button { min-width: 64px; min-height: 34px; padding: 5px 7px; font-size: .76rem; }
  .game-play-title { font-size: .78rem; }
  .game-play-footer-inner { width: calc(100% - 16px); min-height: 46px; padding: 3px 0; }
  .game-play-footer-inner nav { gap: 2px 9px; }
  .game-play-footer-inner a { font-size: .62rem; }
  .game-play-footer-inner p { font-size: .6rem; }
}
@media (max-width: 420px) {
  .game-card-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .game-list-name { min-height: 0; font-size: .78rem; padding: 8px 8px 9px; }
  .game-list-meta { margin: -3px 8px 9px; font-size: .66rem; }
  .section-heading h2 { font-size: 1.18rem; }
  .section-subcopy { font-size: .76rem; }
}
@media (max-height: 600px) {
  .game-play-site-header, .game-play-header-inner { min-height: 42px; }
  .game-play-logo { width: 50px; }
  .game-back-button { min-height: 30px; padding: 3px 7px; }
  .game-play-footer-inner { min-height: 34px; padding: 1px 0; }
  .game-play-footer-inner nav { gap: 1px 8px; }
  .game-play-footer-inner a { font-size: .58rem; }
  .game-play-footer-inner p { font-size: .56rem; }
}
@media (max-height: 480px) and (orientation: landscape) {
  .game-play-site-header, .game-play-header-inner { min-height: 38px; }
  .game-play-logo { width: 46px; }
  .game-play-title { font-size: .7rem; }
  .game-play-footer-inner { min-height: 26px; }
  .game-play-footer-inner nav { display: none; }
  .game-play-footer-inner p { font-size: .54rem; }
}
@media (hover: none) {
  .game-list-card:hover { transform: none; box-shadow: 0 4px 14px rgba(0,0,0,.05); }
  .game-start-button:hover { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .game-list-card, .game-start-button { transition: none !important; }
}


/* STEP8 performance: skip layout/paint work for off-screen heavy sections. */
@supports (content-visibility: auto) {
  .game-list-section,
  .description-section,
  .related-section,
  .section-block.games-section {
    content-visibility: auto;
    contain-intrinsic-size: auto 720px;
  }
}

/* Issue40 approved fixed frame: target eight introductions only. */
html[data-first8-release="i41-1"] .game-stage-sample.abilumi-embedded-stage {
    display: block;
    width: min(1120px, 100%);
    height: min(700px, 100%);
    transform: translate(-50%, -50%);
    border-width: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    background: #fff;
}
html[data-first8-release="i41-1"] .abilumi-game-iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    margin: 0;
    padding: 0;
}
