/* ============================================================
   ゲームサイト固有スタイル
   共通デザインは https://tools.takocyaman.uk/sidber/common.css を参照。
   ここではポータルとプレイヤーのレイアウトだけを定義する。
   ============================================================ */

/* ---------- ポータル ---------- */

body.portal {
    display: block;
    height: auto;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
}

.site-head {
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
}

.site-head-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: min(1000px, 100%);
    margin: 0 auto;
    padding: 12px 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text-strong);
    text-decoration: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
}

.brand-mark svg {
    width: 19px;
    height: 19px;
}

.brand-text b {
    display: block;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.14em;
    line-height: 1.2;
}

.brand-text span {
    display: block;
    color: var(--text-faint);
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.22em;
}

.page {
    width: min(1000px, 100%);
    margin: 0 auto;
    padding: 40px 24px 64px;
}

.page-head {
    margin-bottom: 24px;
}

.page-head h2 {
    margin: 0 0 10px;
    font-size: 26px;
    font-weight: 600;
    color: var(--text-strong);
}

.page-lead {
    max-width: 660px;
    margin: 0;
    color: var(--text-muted);
    font-size: 13.5px;
    line-height: 1.8;
}

.stats-line {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: 16px;
    color: var(--text-faint);
    font-size: 12px;
}

.stats-line b {
    color: var(--text-strong);
    font-size: 14px;
}

/* 検索バー（tools のダッシュボードと同じ構成） */
.search-wrap {
    margin: 24px 0 28px;
}

.search-bar {
    display: flex;
    align-items: stretch;
}

.search-cat {
    flex-shrink: 0;
    max-width: 170px;
    padding: 0 4px 0 12px;
    border: 1px solid var(--border);
    border-right: none;
    border-radius: 8px 0 0 8px;
    background: var(--hover-bg);
    color: #555;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.search-cat:focus {
    outline: none;
    border-color: var(--accent);
}

.search-bar:focus-within .search-cat {
    border-color: var(--accent);
}

.search-field {
    position: relative;
    flex: 1;
    min-width: 0;
}

.search-input {
    width: 100%;
    padding: 12px 40px 12px 40px;
    border: 1px solid var(--border);
    border-radius: 0 8px 8px 0;
    background: #fff;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.15s;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
}

.search-input::placeholder {
    color: #aaa;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    width: 18px;
    height: 18px;
    color: var(--text-faint);
    transform: translateY(-50%);
    pointer-events: none;
}

.search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    display: none;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--active-bg);
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    transform: translateY(-50%);
}

.search-clear.show {
    display: grid;
    place-items: center;
}

.search-meta {
    margin-top: 8px;
    color: var(--text-faint);
    font-size: 12px;
}

/* セクション見出し */
.game-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.game-section-head h3 {
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--text-faint);
    text-transform: uppercase;
}

.game-section-head span {
    color: var(--text-faint);
    font-size: 12px;
}

/* カードグリッド */
.game-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.game-card {
    display: flex;
    flex-direction: column;
    min-height: 200px;
    padding: 20px 22px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s, background-color 0.15s;
}

.game-card:hover {
    border-color: var(--text-strong);
    background: var(--subtle-bg);
}

.game-card.is-coming {
    background: var(--subtle-bg);
}

.game-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-bottom: 16px;
    border-radius: 9px;
    background: var(--code-bg);
    color: #333;
    transition: background-color 0.15s, color 0.15s;
}

.game-card:hover .game-icon {
    background: var(--active-bg);
    color: var(--text-strong);
}

.game-icon svg {
    width: 28px;
    height: 28px;
}

.game-title {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 24px;
    color: var(--text-strong);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}

.game-title .title-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.new-badge {
    display: inline-block;
    flex-shrink: 0;
    padding: 2px 6px;
    border-radius: 10px;
    background: #ff3b30;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    vertical-align: middle;
}

.game-desc {
    display: -webkit-box;
    flex: 1;
    margin-top: 8px;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.game-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    color: var(--text-faint);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.game-meta .dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: currentColor;
}

.game-meta .play-flag {
    margin-left: auto;
    color: var(--text-strong);
}

.is-coming .game-meta .play-flag {
    color: var(--text-faint);
}

.is-coming .game-icon {
    color: #777;
    background: var(--hover-bg);
}

.empty {
    grid-column: 1 / -1;
    padding: 56px 20px;
    border: 1px dashed var(--border-strong);
    border-radius: 8px;
    color: var(--text-faint);
    font-size: 13px;
    text-align: center;
}

.site-foot {
    border-top: 1px solid var(--border);
    padding: 22px 24px 34px;
    color: var(--text-faint);
    font-size: 12px;
}

.site-foot-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: min(1000px, 100%);
    margin: 0 auto;
}

.site-foot a {
    color: var(--text-muted);
    text-decoration: none;
}

.site-foot a:hover {
    color: var(--text-strong);
}

/* ---------- プレイヤー ---------- */

body.player {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: #fff;
}

.player-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border);
    background: #fff;
}

.back-btn {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.15s, border-color 0.15s;
}

.back-btn:hover {
    border-color: var(--text-faint);
    background: var(--hover-bg);
}

.back-btn svg {
    width: 15px;
    height: 15px;
}

.player-title {
    flex: 1;
    min-width: 0;
}

.player-title b {
    display: block;
    overflow: hidden;
    color: var(--text-strong);
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-title span {
    display: block;
    margin-top: 2px;
    overflow: hidden;
    color: var(--text-faint);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-actions {
    display: flex;
    gap: 6px;
}

.icon-btn {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}

.icon-btn:hover {
    border-color: var(--text-faint);
    background: var(--hover-bg);
}

.icon-btn svg {
    width: 16px;
    height: 16px;
}

.stage {
    position: relative;
    flex: 1;
    min-height: 0;
    background: #0b0b0b;
}

.stage iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.stage-loading {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    place-items: center;
    gap: 14px;
    background: #0b0b0b;
    color: #aaa;
    font-size: 12.5px;
    transition: opacity 0.3s;
}

.stage-loading.hide {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 34px;
    height: 34px;
    border: 3px solid rgba(255, 255, 255, 0.14);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.notice {
    display: grid;
    place-items: center;
    height: 100%;
    padding: 24px;
}

.notice-card {
    width: min(560px, 100%);
    padding: 32px 26px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    text-align: center;
}

.notice-card h1 {
    margin: 0 0 10px;
    color: var(--text-strong);
    font-size: 21px;
    font-weight: 600;
}

.notice-card p {
    max-width: 440px;
    margin: 0 auto 16px;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.8;
}

.notice-card code {
    display: inline-block;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--code-bg);
    color: var(--text-secondary);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 11.5px;
    word-break: break-all;
}

.notice-card .btn {
    margin-top: 20px;
}

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

@media (max-width: 640px) {
    .site-head-inner {
        padding: 10px 16px;
    }

    .page {
        padding: 28px 16px 52px;
    }

    .page-head h2 {
        font-size: 23px;
    }

    .search-cat {
        max-width: 120px;
    }

    .game-grid {
        grid-template-columns: 1fr;
    }

    .game-card {
        min-height: 0;
    }

    .player-bar {
        padding: 9px 12px;
    }

    .player-title span {
        display: none;
    }

    .notice {
        padding: 16px;
    }

    .notice-card {
        padding: 26px 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}
