/* -------------------------------------
   SHOP PAGE STYLES (Prototype Transplantation)
   ------------------------------------- */

#page-shop {
    background-color: #1a0f05 !important;
    color: #fdf5e6 !important;
    font-family: 'Noto Sans JP', sans-serif;
    min-height: 100vh;
    width: 100% !important;
    box-sizing: border-box;
    padding: 100px 0 0 0 !important; /* 70px -> 100px (header 72px対応) */
    display: none !important;
}

#page-shop.active {
    display: block !important;
}

/* -------------------------------------
   モック用ヘッダー
   ------------------------------------- */
.mock-header {
    display: flex;
    align-items: center;
    border-bottom: 2px solid #8b4513;
    padding: 10px 40px !important;
    margin-bottom: 0;
    width: calc(100% - var(--sidebar-width));
    gap: 20px;
    box-sizing: border-box;
    position: fixed !important;
    top: 0;
    left: var(--sidebar-width);
    background: #1a0f05 !important;
    z-index: 2000 !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.8);
    transition: left var(--transition-base), width var(--transition-base);
    min-height: 72px !important; /* 高さを明示的に固定 */
}

.shopkeeper-img-mini {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid #d4af37;
    background: #2a1a0a;
    object-fit: contain;
}

.header-title-block {
    flex: 1;
}

.header-title {
    color: #d2b48c;
    font-size: 1.2rem;
    margin: 0;
    font-family: 'Cinzel', serif;
}

.header-subtitle {
    font-size: 0.8rem;
    color: #8b4513;
    margin: 0;
    font-weight: bold;
}

/* ユーザー選択・ポイント表示エリア */
.user-profile-block {
    display: flex;
    align-items: center;
    background: #2a1a0a;
    border: 2px solid #8b4513;
    border-radius: 8px;
    padding: 0 20px !important; /* height固定のため上下paddingを0に */
    gap: 20px;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.5);
    min-width: 220px;
    height: 48px !important; /* 統一サイズ */
}

.user-icon-mini {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #d4af37;
    background: #1a0f05;
    object-fit: cover;
    flex-shrink: 0; /* 縮み防止を追加 */
}

.user-info-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center; /* 中央寄せを追加 */
    flex: 1; /* 余白を埋めるために拡張 */
    text-align: center;
}

#shop-user-name {
    line-height: 1.2;
    margin-bottom: 2px;
}

.user-points {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    -webkit-text-fill-color: initial !important;
    -webkit-background-clip: initial !important;
    background-clip: initial !important;
    background: none !important;
    /* 中央寄せに合わせてボーダーを削除し、上下の微調整を行う */
    border-left: none;
    padding-left: 0;
    margin-top: 2px;
    animation: point-glow-cyan 2s ease-in-out infinite alternate;
}

@keyframes point-glow-cyan {
    from { text-shadow: 0 0 5px rgba(100, 255, 218, 0.3), 1px 1px 2px #000 !important; }
    to { text-shadow: 0 0 15px rgba(100, 255, 218, 0.7), 1px 1px 2px #000 !important; }
}

/* カートボタン */
.cart-img-btn {
    position: relative;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-img-btn:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.cart-icon-img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.6));
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e53935;
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 12px;
    border: 2px solid #1a0f05;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* -------------------------------------
   コントロール行
   ------------------------------------- */
.shop-controls {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    margin-top: 100px;
    margin-bottom: 20px;
    padding: 0 40px;
    width: 100%;
}

.shop-notice {
    text-align: center;
    font-size: 0.75rem;
    color: #8b4513;
    margin-bottom: 12px;
    font-weight: bold;
}

.controls-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 20px !important;
}

.category-tabs {
    display: flex !important;
    gap: 10px;
    flex-shrink: 0;
    white-space: nowrap !important;
}

.cat-btn {
    background: #4a3a2a;
    color: #d2b48c;
    border: 2px solid #8b4513;
    padding: 6px 18px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.cat-btn:hover {
    background: #5d4a36;
}

.cat-btn.active {
    background: #8b4513;
    color: white;
    border-color: #d4af37;
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.4);
}

.sort-select {
    background: #2c2c2c;
    color: #64ffda;
    border: 2px solid #4a4a4a;
    padding: 8px 35px 8px 15px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.9rem;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2364ffda'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

/* -------------------------------------
   商品棚レイアウト
   ------------------------------------- */
.shelf-item-wrapper {
    position: relative;
    height: 220px !important;
    margin: 0 !important;
    padding: 0 !important;
    z-index: 2;
}

.shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 220px 40px;
    width: 100%;
    min-height: 80vh;
    margin: 0;
    padding: 20px 60px 300px 60px;
    overflow: visible;
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    background-image: 
        url("./shelf_board.png"), url("./shelf_board.png"), url("./shelf_board.png"), url("./shelf_board.png"), url("./shelf_board.png"),
        url("./shelf_board.png"), url("./shelf_board.png"), url("./shelf_board.png"), url("./shelf_board.png"), url("./shelf_board.png");
    background-repeat: 
        no-repeat, no-repeat, no-repeat, no-repeat, no-repeat,
        no-repeat, no-repeat, no-repeat, no-repeat, no-repeat;
    background-size: 100% 50px;
    background-position: 
        0 240px, 0 680px, 0 1120px, 0 1560px, 0 2000px,
        0 2440px, 0 2880px, 0 3320px, 0 3760px, 0 4200px;
}

.item-display {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    transition: transform 0.2s;
    height: 220px;
}

.shelf-item-wrapper:hover .item-display {
    transform: translateY(-12px); /* より明確な浮遊感 */
}

/* ついでにバナーも少し連動させるとより自然 */
.shelf-item-wrapper:hover .hanging-banner {
    transform: translateX(-50%) translateY(-3px);
}

.item-icon {
    font-size: 5.5rem;
    filter: drop-shadow(2px 8px 6px rgba(0,0,0,0.8));
    line-height: 1;
}

.item-img {
    max-width: 140px;
    max-height: 140px;
    object-fit: contain;
    filter: drop-shadow(2px 8px 6px rgba(0,0,0,0.8));
}

.hanging-banner {
    position: absolute;
    top: 240px;
    left: 50%;
    transform: translateX(-50%);
    width: 240px;
    background: #fdf5e6;
    border: 1px solid #856133;
    border-top: 4px solid #5d4a36;
    padding: 4px 5px;
    color: #2a1a0a;
    box-shadow: 2px 4px 10px rgba(0,0,0,0.5);
    border-radius: 0 0 10px 10px;
    z-index: 3;
    text-align: center;
    transition: transform 0.3s ease-out;
    transform-origin: top;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.price-tag {
    background: #8b4513;
    color: #ffd700;
    padding: 3px 12px;
    font-size: 1rem;
    font-weight: 900;
    border-radius: 4px;
    border: 2px solid #5d4a36;
    margin: 5px auto 8px auto;
}

.insufficient-stamp {
    position: absolute;
    bottom: 12px; /* 購入ボタン領域に重ねる */
    left: 50%;
    transform: translateX(-50%) rotate(-10deg);
    background: rgba(239, 68, 68, 0.9);
    color: white;
    padding: 4px 15px;
    font-size: 0.85rem;
    font-weight: 900;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    border: 2.5px solid #fff;
    border-radius: 4px;
    z-index: 20;
    pointer-events: none;
    white-space: nowrap;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    letter-spacing: 1px;
}

/* 復元：残り個数のデザイン */
.item-remaining-badge {
    background: #fffafa; /* ほんのり紙っぽい白 */
    border: 1px solid #8b4513;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.85rem;
    color: #5d4037;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: inset 1px 1px 2px rgba(0,0,0,0.1);
    font-weight: 800;
}

.item-remaining-label {
    font-weight: 950;
    color: #a0522d;
    font-size: 0.75rem;
    margin-right: 1px;
}

.qty-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.03);
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px dashed #8b4513;
    margin-bottom: 10px;
}

.qty-btn {
    background: #fff;
    color: #2a1a0a;
    border: 1px solid #8b4513;
    border-radius: 3px;
    padding: 2px 5px;
    font-weight: 800;
    min-width: 65px;
    text-align: center;
}

.btn-add-to-cart {
    background: linear-gradient(180deg, #d4af37, #b8860b);
    color: #1a0f05;
    border: 1px solid #8b4513;
    border-radius: 4px;
    padding: 8px 10px;
    font-size: 0.85rem;
    font-weight: 950;
    cursor: pointer;
    width: 90%;
}

/* ── カゴの中身・モーダル内パーツ (案1: ギルド正典・強化版) ── */
.modal.game-modal-style .modal__body {
    padding: 0 !important; /* フッター等との隙間をなくす */
}

.cart-items-list {
    max-height: 320px;
    overflow-y: auto;
    padding: 12px 20px;
}

/* スクロールバーの装飾 */
.cart-items-list::-webkit-scrollbar {
    width: 8px;
}
.cart-items-list::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.3);
}
.cart-items-list::-webkit-scrollbar-thumb {
    background: #8b4513;
    border: 2px solid #1a0f05;
    border-radius: 4px;
}

.cart-modal-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid rgba(139, 69, 19, 0.2);
}

.cart-item-img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.6));
    border-radius: 6px;
    flex-shrink: 0;
}

.cart-item-icon-placeholder {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    flex-shrink: 0;
}

.cart-item-name {
    font-weight: 900;
    color: #fff;
    font-size: 1.15rem;
    text-shadow: 1px 1px 3px #000;
    margin-bottom: 3px;
}

.cart-item-meta {
    font-size: 0.9rem;
    color: #d2b48c;
    display: flex;
    gap: 10px;
}

.cart-item-unit-cost {
    font-family: 'Cinzel', serif;
    opacity: 0.8;
}

.cart-item-qty {
    color: #8b4513;
    font-weight: bold;
}

.cart-item-subtotal {
    margin-left: auto;
    font-family: 'Cinzel', serif;
    font-weight: 900;
    color: #64ffda;
    font-size: 1.35rem;
    text-shadow: 0 0 15px rgba(100, 255, 218, 0.3);
    text-align: right;
    min-width: 100px;
}

.subtotal-unit {
    font-size: 0.8rem;
    margin-left: 3px;
    opacity: 0.7;
}

.cart-item-remove {
    background: transparent;
    border: none;
    color: #8b4513;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 8px;
    transition: all 0.2s;
    opacity: 0.5;
}

.cart-item-remove:hover {
    transform: scale(1.2) rotate(5deg);
    color: #ff5252;
    opacity: 1;
}

/* フッター（計算ボード） */
.cart-modal-footer.guild-ledger-footer {
    background: #1a0f05;
    padding: 12px 20px 0 20px;
    border-top: 2px solid #8b4513;
    box-shadow: inset 0 10px 30px rgba(0,0,0,0.6);
}

.cart-calc-board {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid #8b4513;
    padding: 10px 14px;
    border-radius: 12px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
}

.cart-calc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Cinzel', serif;
    font-size: 0.95rem;
    color: #ffd700; /* ラベルを金色にして視認性アップ */
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.calc-label {
    font-weight: 900;
    opacity: 1;
}

.calc-value {
    font-weight: 900;
    font-size: 1.1rem;
    color: #ffffff !important; /* 値を完全に白にして際立たせる */
    text-shadow: 0 0 10px rgba(255,255,255,0.3);
}

.total-row {
    color: #ffeb3b !important; /* 明るい黄色 */
    font-size: 1.15rem;
}

.cart-calc-divider {
    height: 2px;
    background: #8b4513;
    margin: 6px 0;
    opacity: 1;
    box-shadow: 0 1px 0 rgba(255,215,0,0.2);
}

.balance-row {
    color: #00ffc3 !important; /* より鮮やかなミントグリーン */
    font-size: 1.4rem; /* さらに大きく */
    padding-top: 4px;
    text-shadow: 0 0 20px rgba(0, 255, 195, 0.4);
}

.balance-row.insufficient {
    color: #ff1744 !important; /* より鮮やかな赤 */
    text-shadow: 0 0 20px rgba(255, 23, 68, 0.6);
}

.cart-password-section {
    margin-top: 6px;
    margin-bottom: 10px;
}

.cart-password-section .form-label {
    color: #d2b48c;
    font-family: 'Cinzel', serif;
    font-weight: 900;
    font-size: 0.8rem;
    text-align: center;
    display: block;
    margin-bottom: 6px;
    letter-spacing: 0.2em;
}

.cart-pass-input {
    background: #000 !important;
    color: #ffd700 !important;
    -webkit-text-fill-color: #ffd700 !important; /* passwordの点を確実に金色にする */
    font-weight: 900 !important;
    font-size: 1.2rem !important; /* 「巨大」にならないようサイズ調整 */
    text-align: center !important;
    letter-spacing: 0.8em !important;
    height: 42px !important;
    padding: 0 !important;
    border-radius: 10px !important;
    box-shadow: inset 0 3px 15px rgba(0,0,0,1) !important;
    display: block;
    width: 100%;
}

.cart-pass-input::placeholder {
    color: rgba(255, 215, 0, 0.4) !important;
    -webkit-text-fill-color: rgba(255, 215, 0, 0.4) !important;
    font-size: 1rem !important; /* 未入力時のドットを小さく調整 */
    letter-spacing: 0.6em !important;
}

/* モーダル標準ボタンの上書き (案1プレミアム版) */
.modal.game-modal-style .modal__footer {
    background: #1a0f05 !important;
    padding: 0 20px 16px !important;
    border-top: none !important;
    display: flex !important;
    gap: 15px !important;
}

.modal.game-modal-style #modal-cancel {
    background: #3a2a1a !important;
    border: 1px solid #8b4513 !important;
    color: #d2b48c !important;
    flex: 1;
    height: 45px;
    font-weight: bold;
    transition: all 0.2s;
}

.modal.game-modal-style #modal-confirm {
    background: #ffd700 !important;
    border: none !important;
    color: #000 !important;
    flex: 2;
    height: 45px;
    font-weight: 900;
    font-size: 1.1rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    transition: all 0.2s;
}

.modal.game-modal-style #modal-confirm:hover:not(:disabled) {
    background: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.4);
}

.modal.game-modal-style #modal-confirm:disabled {
    background: #4a3a2a !important;
    color: #8b4513 !important;
}

/* ── ユーザー選択グリッド ── */
.user-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
    padding: 10px;
}

.user-select-card {
    background: #2a1a0a;
    border: 2px solid #8b4513;
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.user-select-card:hover {
    transform: translateY(-5px);
    border-color: #ffd700;
    background: #3a2a1a;
}

.user-select-card.active {
    border-color: #64ffda;
    background: #1a2a1a;
}

.user-select-card .user-icon-large {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid #d4af37;
    background: #1a0f05;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    overflow: hidden;
}

.user-select-card .user-name-large {
    font-weight: 900;
    color: #fdf5e6;
    font-size: 1rem;
    text-align: center;
}

.user-select-card .user-points-large {
    font-family: 'Cinzel', serif;
    color: #ffd700;
    font-weight: bold;
    font-size: 0.9rem;
}