/* SPDX-License-Identifier: GPL-3.0-only */
/* Copyright 2025~ Yuki Lab */

#mode-tabs {
    gap: 0;
    padding: 0;
    border-radius: 12px;
    background: rgba(92, 61, 46, 0.3);
    border: 1px solid rgba(92, 61, 46, 0.22);
    box-sizing: border-box;
    width: 90%;
    min-width: 320px;
}

#mode-tabs .mode-tab {
    border: 1px solid rgba(92, 61, 46, 0.14);
    justify-content: center;
    flex: 1;
}

#mode-tabs .mode-tab:first-child {
    border-right: none;
}

#mode-tabs .mode-tab:last-child {
    border-left: none;
}

#mode-tabs .mode-tab:hover {
    background: linear-gradient(180deg, #f4ebd7 0%, #e8dfcb 100%);
}

#mode-tabs .mode-tab.active {
    border: none;
}

#mode-tabs .mode-tab.active:hover {
    background: linear-gradient(180deg, #6b4a32 0%, #4f3426 100%);
}

.online-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

#online-settings {
    margin-bottom: 15px;
    padding: 12px 18px;
    background: linear-gradient(135deg, #faf8f3 0%, #f5f0e8 100%);
    border: 2px solid #c5c0bb;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.online-actions button {
    padding: 10px 14px;
    font-size: 14px;
    font-family: 'Yuji Syuku', sans-serif;
    font-weight: bold;
    color: white;
    border: none;
    border-radius: 10px;
    background: linear-gradient(180deg, #9a3b00 0%, #7a2b00 100%);
    box-shadow: 0 4px 12px rgba(154,59,0,0.22);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.online-actions button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.online-actions button:disabled.connecting {
    cursor: wait;
}

/* 招待URL入力 + コピーボタン */
.online-invite-url-wrapper {
    display: flex;
    align-items: stretch;
    margin: 8px 0 0 0;
    border-radius: 8px;
    border: 1.5px solid rgba(92, 61, 46, 0.18);
    background: rgba(255, 255, 255, 0.85);
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.online-invite-url {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
    color: #5C3D2E;
    background: transparent;
    border: none;
    outline: none;
    padding: 9px 12px;
    letter-spacing: -0.01em;
    text-overflow: ellipsis;
}
.online-copy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    flex-shrink: 0;
    border: none;
    border-left: 1.5px solid rgba(92, 61, 46, 0.12);
    background: rgba(92, 61, 46, 0.04);
    color: #5C3D2E;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.online-copy-btn:hover {
    background: rgba(237, 237, 237, 0.1);
    color: #1a1a1a;
}
.online-copy-btn:active {
    background: rgba(206, 206, 206, 0.18);
}
.online-copy-btn.copied {
    background: rgba(34, 139, 34, 0.10);
    color: #228b22;
}
.online-copy-btn.copied:hover {
    background: rgba(34, 139, 34, 0.14);
}
.online-copy-btn .check-icon { display: none; }
.online-copy-btn.copied .copy-icon { display: none; }
.online-copy-btn.copied .check-icon { display: block; }

.online-status {
    font-size: 14px;
    color: #5C3D2E;
    line-height: 1.35;
    margin-bottom: 10px;
}

.tab-icon {
    height: 18px;
}


/* 設定アイコンボタン */
.settings-icon-btn {
    cursor: pointer;
    transition: all 0.3s ease;
}

.settings-icon-btn:hover {
    transform: translateY(-2px) rotate(90deg);
}

.settings-icon-btn:active {
    transform: translateY(0) rotate(87deg);
}

.setting-item label {
    font-size: 16px;
    font-weight: bold;
    color: #5C3D2E;
    flex: 1;
}

.setting-title {
    font-size: 16px;
    font-weight: bold;
    color: #5C3D2E;
}

.player-side-setting {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
}

.player-side-setting .setting-title {
    flex: 0 0 auto;
    min-width: 90px;
}

.player-side-options {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.radio-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border: 2px solid #c4b5a0;
    border-radius: 5px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.radio-chip input[type="radio"] {
    margin: 0;
    width: 18px;
    height: 18px;
    accent-color: #5C3D2E;
}

.radio-chip span {
    font-size: 15px;
    color: #5C3D2E;
}

.radio-chip:hover {
    border-color: #5C3D2E;
    background: #faf8f3;
}

.radio-chip:has(input[type="radio"]:checked) {
    border-color: #5C3D2E;
    background: #f5f0e8;
    box-shadow: 0 2px 6px rgba(92, 61, 46, 0.15);
}

.radio-chip input[type="radio"]:checked + span {
    font-weight: bold;
}


/* ラジオボタングループ */
.radio-group {
    display: flex;
    width: 95%;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    width: 95%;
    justify-content: flex-start;
    padding: 10px 12px;    
    border: 2px solid #c4b5a0;
    border-radius: 6px;
    background: white;
    transition: all 0.2s;
    font-weight: normal;
}

.radio-label:hover {
    border-color: #5C3D2E;
    background: #faf8f3;
}

.radio-label input[type="radio"] {
    margin: 0;
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: #5C3D2E;
}

.radio-label input[type="radio"]:checked + span {
    font-weight: bold;
    color: #5C3D2E;
}

.radio-label:has(input[type="radio"]:checked) {
    border-color: #5C3D2E;
    background: #f5f0e8;
    box-shadow: 0 2px 6px rgba(92, 61, 46, 0.15);
}

.radio-label span {
    font-size: 15px;
    color: #5C3D2E;
    transition: all 0.2s;
}


#ai-settings select {
    cursor: pointer;
    transition: all 0.2s;
}

.setting-select {
    padding: 8px 16px;
    font-size: 15px;
    font-family: 'Yuji Syuku', sans-serif;
    border: 2px solid #c4b5a0;
    border-radius: 8px;
    background: white;
    color: #5C3D2E;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: all 0.2s;
}

#ai-settings select:hover {
    border-color: #a7765e;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.setting-select:hover {
    border-color: #5C3D2E;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#ai-settings select:focus {
    outline: none;
    border-color: #5C3D2E;
    box-shadow: 0 0 0 3px rgba(92, 61, 46, 0.1);
}

.setting-select:focus {
    outline: none;
    border-color: #5C3D2E;
    box-shadow: 0 0 0 3px rgba(92, 61, 46, 0.1);
}

/* 最後に打った手のマーカー */
.last-move-marker {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
    background-color: #E60033;
    z-index: 10;
}

/* 後手の駒の場合は左下に表示 */
.last-move-marker.gote-marker {
    top: auto;
    right: auto;
    bottom: 5px;
    left: 5px;
}

/* 画像モードの駒 */
.piece.image-mode {
    background-color: transparent;
    clip-path: none;
    border-bottom: none;
    padding: 0;
}

.piece.image-mode img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.piece.promoted {
    color: #E60033; /* 成り駒の色を鮮やかに */
}

.captured-pieces .pieces-container {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(247, 228, 175, 0.5) rgba(60, 38, 20, 0.28);
}

.captured-pieces .pieces-container::-webkit-scrollbar {
    height: 8px;
}

.captured-pieces .pieces-container::-webkit-scrollbar-track {
    background: rgba(60, 38, 20, 0.18);
    border-radius: 999px;
}

.captured-pieces .pieces-container::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(247, 228, 175, 0.9), rgba(214, 179, 109, 0.9));
    border-radius: 999px;
}

.captured-piece {
    font-size: 24px; /* 持ち駒の文字サイズ */
    font-weight: bold;
    cursor: pointer;
    flex: 0 0 auto;
    padding: 4px 8px;
    border: 1px solid rgba(92, 61, 46, 0.24);
    background: linear-gradient(180deg, #fff7e9 0%, #f1dfbf 100%);
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    line-height: 1;
    white-space: nowrap;
    transition: background 0.15s ease-in-out, box-shadow 0.15s ease-in-out,
        border-color 0.15s ease-in-out;
    box-shadow: 0 2px 6px rgba(49, 27, 10, 0.16);
}
.captured-piece:hover {
     background: linear-gradient(180deg, #fffaf1 0%, #f3e5c7 100%);
}

.captured-piece .count {
    font-size: 14px; /* 数字のサイズ */
    font-weight: normal; /* 数字は通常の太さ */
    margin-left: 4px;
    color: #666;
    align-self: center; /* 上下中央揃え */
}

.captured-piece.selected {
    background-color: rgba(255, 215, 0, 0.6); /* 選択中の色 */
    border-color: #e6c300;
    box-shadow: inset 0 0 4px rgba(0,0,0,0.2);
}

#promote-dialog{
    position:fixed;
    top:50%;
    left:50%;
    transform:translate(-50%,-50%);
    background-color:white;
    border:1px solid #ccc;
    padding:25px 20px;
    border-radius:8px;
    box-shadow:0 5px 20px rgba(0,0,0,0.2);
    text-align:center;
    z-index:100;
    min-width: 270px;
}

#promote-dialog p{
    margin:0 0 15px 0;
    font-size:18px
}

#promote-dialog button{
    margin:0 10px;
    padding:8px 20px;
    font-size:16px;
    border:1px solid #ccc;
    border-radius:4px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

#promote-dialog button#promote-yes{
    background-color:#5cb85c;
    color:white;
    border-color:#4cae4c
}

#promote-dialog button#promote-no{
    background-color:#d9534f;
    color:white;
    border-color:#d43f3a
}


#promote-dialog button#promote-yes:hover {
    background-color: #4cae4c;
}

#promote-dialog button#promote-no:hover {
    background-color: #d43f3a;
}

#controls button {
    cursor: pointer;
    transition: all 0.3s ease;
}

#undo-button:hover:not(:disabled), #redo-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(74, 124, 89, 0.4);
    background: linear-gradient(180deg, #5a8c69 0%, #4a6f56 100%);
}

#undo-button:active:not(:disabled), #redo-button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(74, 124, 89, 0.3);
}

#undo-button:disabled, #redo-button:disabled {
    background: linear-gradient(180deg, #999 0%, #777 100%);
    cursor: not-allowed;
    opacity: 0.5;
}


#reset-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(154, 59, 0, 0.4);
    background: linear-gradient(180deg, #b34400 0%, #8a3200 100%);
}

#reset-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(154, 59, 0, 0.3);
}

#advanced-settings {
    width: 95%;
    max-width: 415px;
    margin-top: 30px;
    padding: 25px 30px;
    background: linear-gradient(135deg, #faf8f3 0%, #f5f0e8 100%);
    border: 3px solid #d4c4a8;
    border-radius: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08)
}

.settings-title {
    font-size: 22px;
    color: #5C3D2E;
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #d4c4a8;
    font-weight: bold;
    text-align: center
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 15px
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 12px 15px;
    background: white;
    border-radius: 8px;
    border: 2px solid #e8ddc8;
    flex-direction: column;
    align-items: flex-start
}

/* 無料ゲームセクション - 洗練されたデザイン */
#other-games {
    margin-top: 30px;
    padding: 20px;
    background: white;
    width:580px;
    border-radius: 15px;
    box-sizing: border-box;
}

#other-games h2 {
    margin: 0 0 16px 0;
    font-size: 1.4em;
    color: #5C3D2E;
    font-weight: bold;
}

.game-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.game-link {
    text-decoration: none;
    width: 100%;
    display: block;
}

.game-name {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: #faf8f5;
    border: 1px solid #e8e0d4;
    border-radius: 10px;
    text-align: left;
    color: #5C3D2E;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
}

.game-name::after {
    content: '';
    width: 10px;
    height: 10px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 14'%3E%3Cpath d='M1 1l6 6-6 6' fill='none' stroke='%23c4b5a0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.game-link:hover .game-name {
    background: #f5f0e8;
    border-color: #c4b5a0;
}

.game-link:hover .game-name::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 14'%3E%3Cpath d='M1 1l6 6-6 6' fill='none' stroke='%235C3D2E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    transform: translateX(3px);
}

.game-link:active .game-name {
    background: #f0ebe3;
}


/* ゲーム終了ダイアログ */
#game-over-dialog {
    position: fixed;
    inset: 0;
    padding: 12px;
    background:
        radial-gradient(circle at top, rgba(193, 156, 94, 0.18), transparent 42%),
        linear-gradient(180deg, rgba(24, 14, 8, 0.82), rgba(24, 14, 8, 0.9));
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.4s ease-in;
    overflow-y: auto;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.game-over-content {
    --result-accent: #8b6f47;
    --result-soft: rgba(139, 111, 71, 0.16);
    --result-glow: rgba(139, 111, 71, 0.2);
    position: relative;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.14) 28%),
        linear-gradient(180deg, #f9f1e5 0%, #f1e5d3 100%);
    border: 1px solid rgba(125, 94, 62, 0.18);
    border-radius: 28px;
    padding: 34px 30px 26px;
    width: min(560px, calc(100vw - 24px));
    box-shadow:
        0 28px 64px rgba(20, 12, 7, 0.42),
        0 0 0 1px var(--result-glow),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    text-align: center;
    font-family: "Yuji Syuku", serif;
    animation: slideDown 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin: auto;
    overflow: hidden;
}

.game-over-content::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 7px;
    background: linear-gradient(90deg, var(--result-accent), rgba(255, 255, 255, 0.75));
}

.game-over-content.tone-victory {
    --result-accent: #356744;
    --result-soft: rgba(53, 103, 68, 0.15);
    --result-glow: rgba(53, 103, 68, 0.22);
}

.game-over-content.tone-defeat {
    --result-accent: #8a3f3a;
    --result-soft: rgba(138, 63, 58, 0.15);
    --result-glow: rgba(138, 63, 58, 0.2);
}

.game-over-content.tone-draw {
    --result-accent: #7b6755;
    --result-soft: rgba(123, 103, 85, 0.14);
    --result-glow: rgba(123, 103, 85, 0.18);
}

@keyframes slideDown {
    from {
        transform: translateY(-80px) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.game-result-eyebrow {
    margin: 0;
    color: var(--result-accent);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.24em;
    text-transform: uppercase;
}

#game-result-title {
    font-size: 28px;
    color: var(--result-accent);
    margin: 10px 0;
    font-weight: bold;
    text-shadow: 0 2px 10px rgba(255, 255, 255, 0.28);
    letter-spacing: 0.06em;
    line-height: 1.08;
}

#game-result-message {
    font-size: 18px;
    color: #56493f;
    margin: 0;
    line-height: 1.7;
}

#game-result-meta {
    margin: 6px auto 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 5px 16px;
    border-radius: 12px;
    background: var(--result-soft);
    color: #46372a;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.game-result-board-panel {
    margin: 12px 0;
}

.game-result-board-frame {
    width: min(250px, 90%);
    margin: 0 auto;
    padding: 5px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(235, 221, 201, 0.88));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        0 14px 28px rgba(62, 40, 25, 0.14);
}

#game-result-board-mount {
    display: flex;
    justify-content: center;
}

.result-board-preview {
    display: grid;
    grid-template-columns: repeat(9, minmax(0, 1fr));
    grid-template-rows: repeat(9, minmax(0, 1fr));
    width: 100%;
    aspect-ratio: 1;
    box-sizing: border-box;
    border: 5px solid #5C3D2E;
    background: #ddb67c;
    background: radial-gradient(circle, #e4bd8c 0%, #d4a86d 100%);
    position: relative;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    touch-action: manipulation;
}

.result-board-preview.is-flipped {
    transform: rotate(180deg);
}

.result-board-preview:focus-visible {
    outline: 3px solid rgba(154, 59, 0, 0.45);
    outline-offset: 4px;
}

.result-board-preview .square {
    cursor: inherit;
    border-width: 0.8px;
}

.result-board-preview .piece {
    font-size: clamp(14px, 4vw, 15px);
    border-bottom-width: 2px;
}

.result-board-preview .last-move-marker {
    top: 3px;
    right: 3px;
    width: 5px;
    height: 5px;
}

.result-board-preview .last-move-marker.gote-marker {
    top: auto;
    right: auto;
    bottom: 3px;
    left: 3px;
}

.new-game-cta {
    margin: 0;
}

.new-game-btn {
    position: relative;
    width: 100%;
    background: linear-gradient(180deg, #9a3b00 0%, #7a2b00 100%);
    box-shadow: 0 12px 26px rgba(154, 59, 0, 0.28);
    color: #3b1f0c;
    padding: 18px 20px;
    border-radius: 16px;
    border: none;
    font-size: 19px;
    font-weight: 800;
    font-family: "Yuji Syuku", serif;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.3s ease, filter 0.3s ease;
    overflow: hidden;
    isolation: isolate;
}

.new-game-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -60%;
    width: 45%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: skewX(-22deg);
    animation: ctaShine 2.8s ease-in-out infinite;
    z-index: 0;
}

.new-game-btn:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 18px 38px rgba(240, 102, 43, 0.45), 0 0 0 2px rgba(255, 255, 255, 0.55) inset;
    filter: saturate(1.05);
}

.new-game-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(240, 102, 43, 0.38);
}

.new-game-main {
    position: relative;
    z-index: 1;
    display: block;
    letter-spacing: 0.4px;
    color: white;
}

@keyframes ctaPulse {
    0%, 100% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.06); opacity: 1; }
}

@keyframes ctaShine {
    0% { left: -65%; }
    100% { left: 195%; }
}

.share-section {
    margin-top: 16px;
}

.share-buttons {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
}

.share-btn {
    min-width: 0;
    min-height: 56px;
    padding: 0;
    border: 1px solid rgba(125, 94, 62, 0.18);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(243, 236, 226, 0.94));
    cursor: pointer;
    border-radius: 16px;
    transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 24px rgba(52, 34, 21, 0.1);
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 28px rgba(52, 34, 21, 0.14);
}

.share-btn:active {
    transform: translateY(0);
    box-shadow: 0 10px 18px rgba(52, 34, 21, 0.12);
}

.twitter-btn {
    background: linear-gradient(180deg, #050505 0%, #1a1a1a 100%);
    border-color: rgba(157, 157, 157, 0.9);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.22);
}

.twitter-btn:hover {
    background: linear-gradient(180deg, #141414 0%, #2b2b2b 100%);
    border-color: rgba(17, 17, 17, 1);
}

.facebook-btn {
    border-color: rgba(24, 119, 242, 0.22);
}

.facebook-btn:hover {
    border-color: rgba(24, 119, 242, 0.4);
}

.line-btn {
    border-color: rgba(0, 185, 0, 0.22);
}

.line-btn:hover {
    border-color: rgba(0, 185, 0, 0.42);
}

.copy-btn {
    border-color: rgba(93, 105, 121, 0.24);
}

.copy-btn:hover {
    border-color: rgba(93, 105, 121, 0.44);
}

.copy-btn.copied {
    background: linear-gradient(180deg, rgba(238, 249, 241, 0.98), rgba(224, 244, 229, 0.94));
    border-color: rgba(46, 126, 74, 0.48);
    box-shadow: 0 14px 26px rgba(46, 126, 74, 0.16);
    animation: successPulse 0.4s ease-out;
}

@keyframes successPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.share-icon-image {
    width: 24px;
    height: 24px;
    display: block;
    object-fit: contain;
    flex-shrink: 0;
}

.line-share-icon {
    width: 26px;
    height: 26px;
    padding: 1px;
    border-radius: 7px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.close-dialog-btn {
    background: rgba(255, 255, 255, 0.38);
    color: #5b4a3d;
    border: 1px solid rgba(125, 94, 62, 0.18);
    padding: 14px 20px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    border-radius: 16px;
    font-family: "Yuji Syuku", serif;
    transition: transform 0.2s ease, box-shadow 0.25s ease, background 0.25s ease;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
    width: 100%;
    margin-top: 15px;
}

.close-dialog-btn:hover {
    background: rgba(255, 255, 255, 0.55);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(52, 34, 21, 0.12);
}

.close-dialog-btn:active {
    transform: translateY(0);
    box-shadow: 0 8px 16px rgba(52, 34, 21, 0.08);
}

.share-btn:focus-visible,
.new-game-btn:focus-visible,
.close-dialog-btn:focus-visible {
    outline: 3px solid rgba(154, 59, 0, 0.3);
    outline-offset: 3px;
}

.guide-section p,.guide-section li {
    font-family: serif;
}
.sansSerif{
    font-family: sans-serif;
}

/* ゲームガイドセクション */
#game-guide {
    font-family: 'Yuji Syuku', serif;
    padding: 20px;
    border-radius: 15px;
    width: 95%;
}

.guide-section {
    margin-bottom: 40px;
    line-height: 1.9;
    margin: auto;
}

.guide-section:last-child {
    margin-bottom: 0;
}

.guide-section h2 {
    font-size: 28px;
    color: #5C3D2E;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 3px solid #d4c4a8;
    font-weight: bold;
    letter-spacing: 1px;
}

.guide-section h3 {
    font-size: 22px;
    color: #7a5c47;
    margin-top: 28px;
    margin-bottom: 16px;
    font-weight: bold;
    padding-left: 12px;
    border-left: 5px solid #d4c4a8;
}

.guide-section p {
    font-size: 17px;
    color: #444;
    margin-bottom: 18px;
    text-align: justify;
    text-justify: inter-ideograph;
}

.guide-section p:last-child {
    margin-bottom: 0;
}

@media screen and (max-width: 770px) {
    #game-guide {
        padding: 25px 20px;
    }
    #promote-dialog{
        padding: 20px 5px;
    }

    .guide-section h2 {
        font-size: 24px;
        margin-bottom: 16px;
        padding-bottom: 10px;
    }

    .guide-section h3 {
        font-size: 19px;
        margin-top: 24px;
        margin-bottom: 14px;
        padding-left: 10px;
        border-left-width: 4px;
    }

    .guide-section p {
        font-size: 16px;
        line-height: 1.8;
        margin-bottom: 16px;
    }
    .game-link {
        width: 100%;
    }
}

@media screen and (max-width: 600px) {
    .setting-item label {
        font-size: 15px;
    }
    #advanced-settings {
        padding: 20px 15px;
        margin-top: 20px;
    }

    .settings-title {
    font-size: 20px;
    margin-bottom: 15px;
    }
    .radio-label span {
        font-size: 14px;
    }

    #advanced-settings select {
        width: 100%;
        min-width: 0;
        font-size: 14px;
        padding: 8px 12px;
    }

    .piece{
        font-size: 20px;
    }
    .captured-piece {
        font-size: 20px;
    }
    .captured-piece .count {
        font-size: 14px;
    }

    .game-over-content {
        padding: 28px 18px 20px;
        width: min(100%, 430px);
        border-radius: 24px;
    }

    #game-result-title {
        margin-bottom: 10px;
        letter-spacing: 1px;
    }

    #game-result-message {
        font-size: 15px;
        line-height: 1.5;
    }

    #game-result-meta {
        margin-top: 5px;
        min-height: 23px;
        padding: 4px 14px;
        font-size: 14px;
    }

    .game-result-board-frame {
        padding: 2px;
    }

    .share-buttons {
        gap: 8px;
    }

    .share-btn {
        min-height: 48px;
        border-radius: 14px;
    }

    .share-icon-image {
        width: 22px;
        height: 22px;
    }

    .line-share-icon {
        width: 24px;
        height: 24px;
    }

    .new-game-btn {
        padding: 16px 14px;
        font-size: 17px;
    }

    .new-game-main {
        font-size: 18px;
    }
    .close-dialog-btn {
        padding: 13px 18px;
        font-size: 16px;
    }
    #other-games{
     width: calc(95% + 30px) !important;
    }
}

/* ===== PWA インストールバナー ===== */
#pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #5C3D2E 0%, #4a3123 100%);
    color: white;
    padding: 16px 20px;
    z-index: 10000;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.install-banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    max-width: 800px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.install-banner-icon {
    font-size: 36px;
    flex-shrink: 0;
}

.install-banner-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 200px;
}

.install-banner-text strong {
    font-size: 16px;
    color: #F7E4AF;
}

.install-banner-text span {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
}

.install-banner-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.install-btn {
    background: linear-gradient(180deg, #F7E4AF 0%, #e8d5a0 100%);
    color: #5C3D2E;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Yuji Syuku', sans-serif;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.install-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    background: linear-gradient(180deg, #fff5d4 0%, #F7E4AF 100%);
}

.install-btn:active {
    transform: translateY(0);
}

.install-close-btn {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.install-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.8);
}

/* モバイル対応 */
@media screen and (max-width: 600px) {
    #pwa-install-banner {
        padding: 14px 16px;
    }

    .install-banner-content {
        gap: 12px;
    }

    .install-banner-icon {
        font-size: 28px;
    }

    .install-banner-text {
        min-width: 150px;
    }

    .install-banner-text strong {
        font-size: 14px;
    }

    .install-banner-text span {
        font-size: 12px;
    }

    .install-btn {
        padding: 10px 18px;
        font-size: 14px;
    }

    .install-close-btn {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
}

/* ===== iOS インストールガイドモーダル ===== */
#ios-install-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.ios-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.ios-modal-content {
    position: relative;
    background: white;
    border-radius: 20px;
    padding: 28px 24px;
    max-width: 380px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
    text-align: center;
}

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

.ios-modal-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    font-size: 16px;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.ios-modal-close-btn:hover {
    background: #e0e0e0;
    color: #333;
}

.ios-modal-title {
    font-size: 20px;
    color: #5C3D2E;
    margin: 0 0 12px 0;
    font-weight: bold;
}

.ios-modal-desc {
    font-size: 14px;
    color: #666;
    margin: 0 0 20px 0;
    line-height: 1.5;
}

.ios-install-guide-img {
    width: 100%;
    max-width: 320px;
    height: auto;
    border-radius: 12px;
    border: 2px solid #e8e8e8;
    margin-bottom: 20px;
}

.ios-modal-ok-btn {
    background: linear-gradient(180deg, #5C3D2E 0%, #4a3123 100%);
    color: #F7E4AF;
    border: none;
    padding: 14px 40px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    font-family: 'Yuji Syuku', sans-serif;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(92, 61, 46, 0.3);
}

.ios-modal-ok-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(92, 61, 46, 0.4);
}

.footer
{
    font-size:11px;
    margin:20px 0 5px;
    text-align:center;
    font-family: sans-serif;
    color:#646464;
    text-decoration:none;
}
.footer a{
    text-decoration:none;
    color:#003b9a
}

.ios-modal-ok-btn:active {
    transform: translateY(0);
}

/* iOS モーダル モバイル対応 */
@media screen and (max-width: 400px) {
    .ios-modal-content {
        padding: 24px 18px;
    }

    .ios-modal-title {
        font-size: 18px;
    }

    .ios-modal-desc {
        font-size: 13px;
    }

    .ios-modal-ok-btn {
        padding: 12px 32px;
        font-size: 15px;
    }
}

/* ===== AI思考中インジケータ（盤面オーバーレイ） ===== */
#ai-thinking-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(92, 61, 46, 0.9);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#ai-thinking-indicator.visible {
    opacity: 1;
    visibility: visible;
}

.thinking-dots {
    display: inline-flex;
    gap: 3px;
    align-items: center;
}

.thinking-dots span {
    width: 5px;
    height: 5px;
    background: #F7E4AF;
    border-radius: 50%;
    animation: thinkingPulse 1.4s ease-in-out infinite;
}

.thinking-dots span:nth-child(1) {
    animation-delay: 0s;
}

.thinking-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.thinking-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes thinkingPulse {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.thinking-text {
    color: #F7E4AF;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

@media screen and (max-width: 600px) {
    #ai-thinking-indicator {
        padding: 3px 10px;
        gap: 5px;
    }

    .thinking-dots span {
        width: 4px;
        height: 4px;
    }
    
    .thinking-text {
        font-size: 11px;
    }
}

/* ロックされた難易度オプション */
#difficulty option.locked-level {
    color: #999;
    background-color: #f0f0f0;
}

#difficulty option.locked-level:disabled {
    cursor: not-allowed;
}

/* レベル解放ポップアップ */
#level-unlock-popup {
    position: fixed;
    top: -23%;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    pointer-events: none;
    animation: popupFadeIn 0.5s ease-out;
}

#level-unlock-popup.fade-out {
    animation: popupFadeOut .8s ease-out;
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes popupFadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.8);
    }
}

.unlock-popup-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    border: 3px solid #e94560;
    border-radius: 20px;
    padding: 35px 50px;
    text-align: center;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.6),
        0 0 40px rgba(233, 69, 96, 0.3),
        inset 0 0 30px rgba(233, 69, 96, 0.1);
    animation: unlockGlow 2s ease-in-out infinite alternate;
}

@keyframes unlockGlow {
    from {
        box-shadow: 
            0 20px 60px rgba(0, 0, 0, 0.6),
            0 0 40px rgba(233, 69, 96, 0.3),
            inset 0 0 30px rgba(233, 69, 96, 0.1);
    }
    to {
        box-shadow: 
            0 20px 60px rgba(0, 0, 0, 0.6),
            0 0 60px rgba(233, 69, 96, 0.5),
            inset 0 0 40px rgba(233, 69, 96, 0.2);
    }
}

.unlock-icon {
    font-size: 64px;
    margin-bottom: 15px;
    animation: unlockBounce 0.6s ease-out;
}

@keyframes unlockBounce {
    0% {
        transform: scale(0) rotate(-45deg);
    }
    50% {
        transform: scale(1.2) rotate(10deg);
    }
    70% {
        transform: scale(0.9) rotate(-5deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

.unlock-title {
    font-size: 20px;
    color: #e94560;
    font-weight: bold;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.unlock-level-name {
    font-size: 42px;
    font-weight: 900;
    background: linear-gradient(135deg, #ffd700 0%, #ff8c00 50%, #ff4500 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    text-shadow: 0 2px 10px rgba(255, 215, 0, 0.3);
    animation: levelNameShine 2s ease-in-out infinite;
}

@keyframes levelNameShine {
    0%, 100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.3);
    }
}

.unlock-message {
    font-size: 16px;
    color: #a0a0a0;
    font-weight: 500;
}

/* 次のレベルへボタンの強調 */
.new-game-btn.next-level-btn {
    background: linear-gradient(180deg, #e94560 0%, #c73e54 100%);
    box-shadow: 0 6px 20px rgba(233, 69, 96, 0.4);
}

.new-game-btn.next-level-btn:hover {
    background: linear-gradient(180deg, #ff5a75 0%, #e94560 100%);
    box-shadow: 0 10px 30px rgba(233, 69, 96, 0.5);
}

/* モバイル対応 */
@media screen and (max-width: 600px) {
    .unlock-popup-content {
        padding: 25px 35px;
        margin: 0 20px;
    }
    
    .unlock-icon {
        font-size: 48px;
    }
    
    .unlock-title {
        font-size: 16px;
    }
    
    .unlock-level-name {
        font-size: 32px;
    }
    
    .unlock-message {
        font-size: 14px;
    }
}

/* 対戦開始オーバーレイ */
#match-start-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2500;
    pointer-events: none;
    background: radial-gradient(ellipse at center, rgba(0,0,0,0.45) 0%, rgba(0,0,0,0.15) 100%);
    animation: matchOverlayIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

#match-start-overlay.fade-out {
    animation: matchOverlayOut 0.6s ease-in forwards;
}

@keyframes matchOverlayIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes matchOverlayOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.match-start-card {
    position: relative;
    text-align: center;
    padding: 40px 60px;
    border-radius: 16px;
    background: linear-gradient(145deg, rgb(96, 87, 75) 0%, rgb(30,25,18) 100%);
    border: 2px solid rgb(193,154,107);
    box-shadow:
        0 25px 80px rgba(0,0,0,0.5),
        0 0 50px rgba(193,154,107,0.15),
        inset 0 1px 0 rgba(255,255,255,0.08);
    animation: matchCardIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    overflow: hidden;
}

#match-start-overlay.fade-out .match-start-card {
    animation: matchCardOut 0.5s ease-in forwards;
}

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

@keyframes matchCardOut {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.9) translateY(-15px);
    }
}

.match-start-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        from 0deg,
        transparent,
        rgba(193,154,107,0.08),
        transparent,
        rgba(193,154,107,0.05),
        transparent
    );
    animation: matchCardShimmer 6s linear infinite;
    pointer-events: none;
}

@keyframes matchCardShimmer {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.match-start-label {
    font-family: 'Yuji Syuku', serif;
    font-size: 25px;
    color: rgb(255, 255, 255);
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-bottom: 12px;
    font-weight: 400;
}

.match-start-side {
    font-family: serif;
    font-size: 18px;
    font-weight: 100;
    margin-bottom: 8px;
    line-height: 1.2;
    position: relative;
    z-index: 1;
}

.match-start-side.sente {
    color: #ffffff;
    text-shadow:
        0 0 30px rgba(255,215,150,0.3),
        0 2px 8px rgba(0,0,0,0.5);
}

.match-start-side.gote {
    color: #ffffff;
    text-shadow:
        0 0 30px rgba(255,215,150,0.3),
        0 2px 8px rgba(0,0,0,0.5);
}

.match-start-icon {
    font-size: 56px;
    margin-bottom: 16px;
    animation: matchIconPulse 2s ease-in-out infinite;
    position: relative;
    z-index: 1;
    color: #fff;
}

@keyframes matchIconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.match-start-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 0 0 16px 16px;
    animation: matchBarShrink 3s linear forwards;
}

.match-start-bar.sente {
    background: linear-gradient(90deg, rgba(255,215,150,0.7), rgba(193,154,107,0.3));
}

.match-start-bar.gote {
    background: linear-gradient(90deg, rgba(150,190,255,0.7), rgba(120,160,220,0.3));
}

@keyframes matchBarShrink {
    from { width: 100%; }
    to { width: 0%; }
}

/* モバイル対応 */
@media screen and (max-width: 600px) {
    .match-start-card {
        padding: 30px 40px;
        margin: 0 20px;
    }

    .match-start-side {
        font-size: 18px;
    }

    .match-start-icon {
        font-size: 44px;
    }

    .match-start-label {
        font-size: 18px;
        letter-spacing: 3px;
    }

}
