/* Base variables and reset */
:root {
    --bg-color: #d4e8f0;
    --text-primary: #2c3e50;
    --text-gold: #b8860b;
    --text-dark: #1e293b;
    --glass-bg: rgba(255, 255, 255, 0.55);
    --glass-border: rgba(255, 255, 255, 0.75);

    /* 蜴溽･樣｢ｨ 繝ｩ繧､繝医き繝ｩ繝ｼ繝代Ξ繝・ヨ */
    --wish-blue-light: #e8f4fd;
    --wish-blue-mid: #c2dff0;
    --wish-blue-dark: #8ab4cc;
    --wish-gold-light: #f5e6b0;
    --wish-gold-mid: #d4a843;
    --wish-gold-dark: #a07820;
    --wish-teal: #5bbccc;
    --wish-ivory: #faf7f0;

    --rarity-5: #c8841a;
    /* 驥・*/
    --rarity-4: #9b59b6;
    /* 邏ｫ */
    --rarity-3: #2980b9;
    /* 髱・*/
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    font-variant-emoji: text;
}

body {
    font-family: 'Inter', 'Noto Sans JP', 'Segoe UI Symbol', 'Apple Symbols', sans-serif;
    background: linear-gradient(160deg, #daeef8 0%, #c5e0ef 30%, #e8f4f8 60%, #f0e8d8 100%);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    /* iOS Safari 蟇ｾ蠢・*/
    width: 100vw;
    -webkit-tap-highlight-color: transparent;
    /* iOS繧ｿ繝・メ繝上う繝ｩ繧､繝磯撼陦ｨ遉ｺ */
}

#app {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Typography & Utils */
.hidden {
    display: none !important;
}

.glass-panel {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
    color: #1d1d1f;
}

/* Header / Nav */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: linear-gradient(to bottom, rgba(190, 225, 245, 0.85) 0%, rgba(200, 230, 248, 0.5) 70%, transparent 100%);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 10;
}

.logo-text {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 2px;
    background: linear-gradient(90deg, var(--wish-gold-dark), var(--wish-gold-mid), #e8c96a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
    filter: drop-shadow(0 1px 2px rgba(160, 120, 32, 0.3));
}

.header-right {
    display: flex;
    gap: 15px;
    align-items: center;
}

.header-icon-btn {
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 0;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s, border-color 0.2s;
    padding: 0;
    flex-shrink: 0;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.header-icon-btn:hover {
    background: rgba(0, 0, 0, 0.6);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.header-icon-btn:active {
    transform: scale(0.95);
}

.header-icon-btn img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.currency {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 0;
    padding: 2px 10px 2px 2px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.currency:active {
    transform: scale(0.95);
}

.currency:hover {
    box-shadow: 0 3px 12px rgba(100, 160, 200, 0.3);
}

.currency img {
    height: 24px;
    width: 24px;
    margin-right: 8px;
    object-fit: contain;
}

.currency span {
    font-weight: 700;
    min-width: 40px;
    text-align: right;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    font-weight: bold;
    font-size: 14px;
    line-height: 1;
    background: #ece5d8;
    color: #333;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(160, 120, 32, 0.4);
    cursor: pointer;
}

/* Main Banner Area */
.banner-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.banner-wrapper {
    position: relative;
    width: 100%;
    max-width: 1000px;
    height: auto;
    aspect-ratio: 16 / 9;
    max-height: 60vh;
    border-radius: 0;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(90, 140, 180, 0.35), 0 2px 8px rgba(200, 180, 100, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.banner-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.banner-text {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 40px 20px 20px;
    background: linear-gradient(to top, rgba(255, 255, 255, 0.87) 0%, rgba(30, 80, 120, 0.3) 60%, transparent 100%);
}

.banner-text h2 {
    font-size: 2rem;
    color: #f5e6b0;
    text-shadow: 0 2px 8px rgba(0, 60, 100, 0.8), 0 0 20px rgba(200, 180, 100, 0.5);
    margin-bottom: 5px;
}

/* Footer / Action Buttons */
.action-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 20px;
    padding-bottom: 40px;
    background: linear-gradient(to top, rgba(180, 220, 245, 0.75) 0%, rgba(200, 230, 250, 0.45) 70%, transparent 100%);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.footer-left-btns {
    display: flex;
    gap: 12px;
    align-items: center;
}

.footer-right-btns {
    display: flex;
    gap: 20px;
    align-items: center;
}

.footer-sub-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(160, 210, 240, 0.8);
    border-radius: 0;
    padding: 10px 16px;
    color: #3a5a78;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 8px rgba(100, 160, 200, 0.2);
}

.footer-sub-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(100, 160, 200, 0.35);
}

.footer-sub-btn:active {
    transform: scale(0.95);
}

.footer-btn-icon {
    font-size: 1.4rem;
}

.gacha-btn {
    background: linear-gradient(135deg, #c8e8f8, #a8d0e8);
    border: none;
    border-radius: 0;
    padding: 3px;
    cursor: pointer;
    outline: none;
    box-shadow: 0 4px 18px rgba(80, 150, 200, 0.4), 0 1px 4px rgba(80, 120, 160, 0.3);
    transition: transform 0.15s, box-shadow 0.15s;
}

.gacha-btn.pull-10 {
    background: linear-gradient(135deg, #f5e090, #d4a843, #c8841a);
    box-shadow: 0 4px 18px rgba(200, 160, 50, 0.5), 0 1px 4px rgba(180, 130, 30, 0.4);
}

.gacha-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(80, 150, 200, 0.5);
}

.gacha-btn.pull-10:hover {
    box-shadow: 0 6px 22px rgba(200, 160, 50, 0.65);
}

.gacha-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(80, 150, 200, 0.3);
}

.gacha-btn-inner {
    background: linear-gradient(to bottom, #f0f8ff, #e4f2fc);
    border-radius: 0;
    padding: 10px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #2c4a65;
}

.gacha-btn.pull-10 .gacha-btn-inner {
    background: linear-gradient(to bottom, #fefae8, #fdf3cc);
    color: #5a3a10;
}

.btn-title {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 5px;
}

.btn-cost {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    color: #6a8aaa;
}

.gacha-btn.pull-10 .btn-cost {
    color: #a07030;
}

.btn-cost img {
    height: 20px;
}

.pity-info {
    position: absolute;
    bottom: 100px;
    left: 20px;
    font-size: 0.9rem;
    color: rgba(40, 80, 120, 0.85);
    background: rgba(255, 255, 255, 0.55);
    padding: 4px 12px;
    border-radius: 0;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(160, 210, 240, 0.6);
    text-shadow: none;
    font-weight: 600;
}

/* Version Badge */
.version-badge {
    position: fixed;
    bottom: 12px;
    right: 16px;
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(40, 80, 120, 0.35);
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(160, 210, 240, 0.25);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 3px 10px;
    border-radius: 0;
    letter-spacing: 0.5px;
    pointer-events: none;
    z-index: 9999;
    transition: opacity 0.3s;
    opacity: 0.6;
}

/* Admin: version row */
.admin-version-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.admin-version-prefix {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--admin-text, #e8e8f0);
    white-space: nowrap;
}

.admin-version-input {
    width: 120px;
    flex-shrink: 0;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    border-radius: 0;
    padding: 24px;
    display: flex;
    flex-direction: column;
    z-index: 101;
}

.exchange-panel {
    max-width: 400px;
    text-align: center;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(160, 210, 240, 0.4);
    padding-bottom: 15px;
}

.modal-header h2 {
    color: #1a3a65;
    font-weight: 800;
}

.close-btn {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    color: #86868b;
    font-size: 1.4rem;
    cursor: pointer;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1;
}

.close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #1d1d1f;
}

/* Shop Tabs (Segmented Control style) */
.shop-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.05);
    padding: 3px;
    border-radius: 0;
    margin-bottom: 24px;
    border: none;
    gap: 2px;
    position: relative;
    z-index: 1;
}

.shop-tab {
    flex: 1;
    background: none;
    border: none;
    color: #86868b;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 12px;
    position: relative;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0;
    z-index: 1;
}

.shop-tab:hover {
    color: #1d1d1f;
}

.shop-tab.active {
    background: #ffffff;
    color: #1d1d1f;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.shop-tab.active::after {
    display: none;
}

.shop-tab-indicator {
    position: absolute;
    background: #ffffff;
    border-radius: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
    pointer-events: none;
    top: 3px;
    bottom: 3px;
    left: 0;
}

.shop-tab-content {
    display: none;
}

.shop-tab-content.active {
    display: block;
}

#bag-tab-weapon.active {
    display: flex;
}

.shop-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    overflow-y: auto;
    padding: 10px;
}

.shop-item {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.shop-item:hover {
    background: #ffffff;
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
}

.stock-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #ef4444;
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.shop-cost {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 1rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.shop-cost img {
    height: 20px;
    margin: 0;
}

.shop-item img {
    height: 60px;
    margin-bottom: 10px;
}

.item-amount {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1d1d1f;
    margin-bottom: 12px;
}

.buy-btn,
.confirm-btn,
.cancel-btn {
    background: #f0f0f2;
    color: #0071e3;
    border: none;
    padding: 8px 18px;
    border-radius: 0;
    cursor: pointer;
    font-weight: 700;
    width: auto;
    min-width: 90px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: -0.2px;
    font-size: 0.85rem;
}

.buy-btn:hover,
.confirm-btn:hover {
    background: #0071e3;
    color: #fff;
    transform: none;
    box-shadow: 0 4px 12px rgba(0, 113, 227, 0.3);
}

.cancel-btn {
    background: linear-gradient(135deg, #b0c8e0, #7890a8);
    box-shadow: 0 2px 8px rgba(100, 140, 180, 0.3);
}

.cancel-btn:hover {
    background: linear-gradient(135deg, #c0d8f0, #8aa0b8);
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.exchange-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.5rem;
    margin: 20px 0;
}

.small-icon {
    height: 30px;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(240, 250, 255, 0.92);
    color: #2c4a65;
    padding: 10px 24px;
    border-radius: 0;
    z-index: 1000;
    pointer-events: none;
    transition: opacity 0.3s;
    border: 1px solid rgba(160, 210, 240, 0.8);
    box-shadow: 0 4px 16px rgba(80, 140, 200, 0.25);
    font-weight: 600;
    backdrop-filter: blur(8px);
}

/* Animation Screen */
#animation-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    overflow: hidden;
    background: #000;
}

#night-sky {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at 40% 30%, #1a3a6a 0%, #0a1830 60%, #000 100%);
}

#meteor-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

#skip-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 5px 15px;
    border-radius: 0;
    cursor: pointer;
    z-index: 51;
}

/* Result Screen */
#result-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    background: radial-gradient(ellipse at 50% 30%, rgba(200, 235, 255, 0.92) 0%, rgba(170, 215, 248, 0.88) 40%, rgba(230, 245, 255, 0.95) 100%);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.result-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    max-width: 900px;
    padding: 20px;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes slideUpIn {
    0% { opacity: 0; transform: translateY(30px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.result-item {
    width: 130px;
    height: 180px;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.85), rgba(220, 240, 255, 0.7));
    border: 1.5px solid rgba(200, 230, 255, 0.85);
    border-radius: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    position: relative;
    overflow: hidden;
    animation: slideUpIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
    box-shadow: 0 4px 18px rgba(100, 160, 210, 0.3);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.result-item:hover {
    transform: translateY(-8px) scale(1.05);
    z-index: 10;
}

/* Staggered entry for gacha results */
.result-item:nth-child(1) { animation-delay: 0.05s; }
.result-item:nth-child(2) { animation-delay: 0.1s; }
.result-item:nth-child(3) { animation-delay: 0.15s; }
.result-item:nth-child(4) { animation-delay: 0.2s; }
.result-item:nth-child(5) { animation-delay: 0.25s; }
.result-item:nth-child(6) { animation-delay: 0.3s; }
.result-item:nth-child(7) { animation-delay: 0.35s; }
.result-item:nth-child(8) { animation-delay: 0.4s; }
.result-item:nth-child(9) { animation-delay: 0.45s; }
.result-item:nth-child(10) { animation-delay: 0.5s; }

.result-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.5), transparent);
    border-radius: 0;
    pointer-events: none;
}

.result-item.star-5 {
    background: linear-gradient(160deg, rgba(255, 245, 200, 0.95), rgba(240, 200, 80, 0.45));
    border-color: #e8c040;
    box-shadow: 0 0 25px rgba(220, 170, 30, 0.5), 0 4px 18px rgba(200, 150, 20, 0.3);
}

.result-item.star-4 {
    background: linear-gradient(160deg, rgba(245, 230, 255, 0.95), rgba(180, 120, 240, 0.35));
    border-color: #c890f0;
    box-shadow: 0 0 20px rgba(160, 100, 230, 0.4), 0 4px 18px rgba(150, 90, 210, 0.3);
}

.result-item.star-3 {
    background: linear-gradient(160deg, rgba(220, 238, 255, 0.95), rgba(80, 150, 220, 0.3));
    border-color: #80c0f0;
    box-shadow: 0 4px 18px rgba(80, 140, 200, 0.25);
}

/* Bag Item Overrides (Apple Style) */
.bag-tab-content .result-item {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    border-radius: 0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04) !important;
    animation: slideUpIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) backwards !important;
    height: auto !important;
    padding: 14px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    cursor: pointer;
    overflow: hidden;
}

/* 5-Star Bag Item Enhancement */
.bag-tab-content .result-item.star-5 {
    background: linear-gradient(135deg, #ffffff 0%, #fffbf0 100%) !important;
    border: 1.5px solid rgba(212, 168, 67, 0.4) !important;
    box-shadow: 0 8px 20px rgba(212, 168, 67, 0.12) !important;
}

.bag-tab-content .result-item.star-5::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    background-size: 200% 100%;
    animation: shimmer 4s infinite linear;
    pointer-events: none;
    border-radius: 0;
}

/* 4-Star Bag Item Enhancement */
.bag-tab-content .result-item.star-4 {
    background: linear-gradient(135deg, #ffffff 0%, #f9f5ff 100%) !important;
    border: 1.5px solid rgba(155, 89, 182, 0.3) !important;
    box-shadow: 0 8px 20px rgba(155, 89, 182, 0.08) !important;
}

.bag-tab-content .result-item:hover {
    transform: translateY(-6px) scale(1.04) !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1) !important;
    background: #ffffff !important;
}

.bag-tab-content .result-item.star-5 .item-stars {
    color: #d4a843 !important;
    text-shadow: 0 0 8px rgba(212, 168, 67, 0.3);
}

.bag-tab-content .result-item.star-4 .item-stars {
    color: #9b59b6 !important;
    text-shadow: 0 0 8px rgba(155, 89, 182, 0.3);
}

.bag-tab-content .result-item::before {
    display: none !important;
}

.bag-tab-content .item-img {
    width: 90px !important;
    height: 90px !important;
    border-radius: 0;
    filter: none !important;
}

/* Character Details Weapon Items - Lightweight */
#character-details-modal #cd-inline-weapon-list .result-item {
    animation: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    transition: none !important;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.7), rgba(220, 240, 255, 0.5)) !important;
    border: 1px solid rgba(200, 230, 255, 0.6) !important;
}

#character-details-modal #cd-inline-weapon-list .result-item:hover {
    transform: none !important;
    z-index: auto !important;
}

#character-details-modal #cd-inline-weapon-list .result-item::before {
    display: none !important;
}

#character-details-modal #cd-inline-weapon-list .result-item.star-5 {
    box-shadow: 0 2px 8px rgba(220, 170, 30, 0.2) !important;
}

#character-details-modal #cd-inline-weapon-list .result-item.star-4 {
    box-shadow: 0 2px 8px rgba(160, 100, 230, 0.2) !important;
}

#character-details-modal #cd-inline-weapon-list .result-item.star-3 {
    box-shadow: 0 2px 8px rgba(80, 140, 200, 0.15) !important;
}

/* --- Weapon Split Layout --- */
.bag-split-container {
    display: flex;
    flex-direction: row;
    height: 100%;
    gap: 15px;
}
.bag-split-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
}
.bag-split-detail {
    width: 320px;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
    padding: 15px;
    display: none;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
}
@media (max-width: 768px) {
    .bag-split-container {
        flex-direction: column;
    }
    .bag-split-detail {
        width: 100%;
        height: 45%;
        flex-shrink: 0;
    }

    /* Character Details: Weapon view (desktop: side-by-side, mobile: top/bottom split) */
    .weapon-view-container {
        display: flex;
        flex-direction: row;
        gap: 15px;
        height: 100%;
    }
    .weapon-list-pane {
        flex: 1 1 auto;
        overflow-y: auto;
        padding: 10px 6px;
        min-height: 0; /* allow flex children to shrink */
    }
    .weapon-detail-pane {
        width: 360px;
        background: rgba(30,41,59,0.9);
        border: 1px solid rgba(255,255,255,0.06);
        border-radius: 0;
        padding: 12px;
        color: #e6eef8;
        overflow-y: auto;
        flex-shrink: 0;
    }

    @media (max-width: 768px) {
        .weapon-view-container {
            flex-direction: column;
        }
        .weapon-list-pane {
            height: 55%;
        }
        .weapon-detail-pane {
            width: 100%;
            height: 45%;
            border-radius: 0;
        }
    }
}
.selected-weapon {
    border: 2px solid #fff !important;
    transform: scale(1.02) !important;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5) !important;
}

.bag-tab-content .item-name {
    color: #1d1d1f !important;
    text-shadow: none !important;
    font-size: 0.8rem !important;
    margin-top: 10px !important;
    font-weight: 600 !important;
}

.bag-tab-content .item-stars {
    font-size: 0.8rem !important;
    margin-bottom: 0 !important;
    text-align: center !important;
}

.item-img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 0;
    margin-bottom: auto;
    filter: drop-shadow(0 3px 6px rgba(60, 100, 160, 0.35));
}

.item-stars {
    color: var(--wish-gold-mid);
    font-size: 1rem;
    margin-bottom: 5px;
}

.item-name {
    font-size: 0.75rem;
    text-align: center;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    width: 100%;
    line-height: 1.2;
    white-space: normal;
    word-break: keep-all;
    overflow-wrap: anywhere;
}

#close-result-btn {
    margin-top: 40px;
    max-width: 200px;
    font-size: 1.1rem;
    padding: 12px 36px;
    background: rgba(20, 20, 35, 0.75) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 0;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    color: #ffffff !important;
    letter-spacing: 1px;
    font-weight: 800;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    cursor: pointer;
}

#close-result-btn:hover {
    background: rgba(35, 35, 55, 0.9) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    color: #f3f4f6 !important;
    transform: translateY(-2px) scale(1.03) !important;
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.45), 0 0 15px rgba(255, 255, 255, 0.15) !important;
}

#close-result-btn:active {
    transform: translateY(0) scale(0.97) !important;
    background: rgba(15, 15, 25, 0.85) !important;
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Allow JS to hide splash image even if other rules set it; toggle `.hidden` on the element */
#cd-splash-img.hidden {
    display: none !important;
}

/* Meteor Animations - 繝ｪ繧｢繝ｫ蛹・*/
.meteor {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
    opacity: 0;
    box-shadow: 0 0 20px 5px currentColor, 0 0 40px currentColor;
}

.meteor::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 50%;
    transform: translateY(-50%) rotate(125deg);
    transform-origin: right center;
    width: 400px;
    height: 6px;
    background: linear-gradient(to left, #fff, currentColor, transparent);
    border-radius: 0;
    filter: blur(2px);
    opacity: 0.9;
}

.meteor.star-5 {
    color: var(--rarity-5);
    animation: fall 2.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.meteor.star-4 {
    color: var(--rarity-4);
    animation: fall 2.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.meteor.star-3 {
    color: var(--rarity-3);
    animation: fall 1.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes fall {
    0% {
        opacity: 0;
        transform: translate(0, 0) scale(0);
    }

    10% {
        opacity: 1;
        transform: translate(15vw, 20vh) scale(1.2);
    }

    100% {
        opacity: 0;
        transform: translate(120vw, 160vh) scale(0.5);
    }
}

/* Splash Screen (遶九■邨ｵ) */
#splash-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 55;
    /* 繧｢繝九Γ繝ｼ繧ｷ繝ｧ繝ｳ縺ｨ繝ｪ繧ｶ繝ｫ繝医・髢・*/
    background: linear-gradient(160deg, #c8e4f4 0%, #a8cce4 40%, #d8eef8 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.splash-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at 50% 80%, rgba(200, 230, 255, 0.6) 0%, rgba(150, 200, 240, 0.2) 60%, transparent 100%);
    opacity: 1;
}

#splash-img {
    height: 80vh;
    max-width: 90vw;
    object-fit: contain;
    z-index: 2;
    animation: slideUpFade 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.splash-info {
    position: absolute;
    bottom: 20%;
    left: 10%;
    z-index: 3;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 1);
    animation: fadeInRight 0.5s ease forwards 0.3s;
    opacity: 0;
}

#splash-name {
    font-size: 2.5rem;
    font-weight: 900;
    color: #ffffff;
    margin-bottom: 5px;
    letter-spacing: 2px;
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.8), 0 0 30px rgba(100, 160, 240, 0.5);
}

.click-to-continue {
    position: absolute;
    bottom: 30px;
    right: 30px;
    color: rgba(255, 255, 255, 0.85);
    z-index: 3;
    animation: pulse 1.5s infinite;
    background: rgba(0, 0, 0, 0.35);
    padding: 6px 18px;
    border-radius: 0;
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-weight: 600;
    backdrop-filter: blur(4px);
}

/* Banner Type Tabs (髯仙ｮ・諱貞ｸｸ) */
.banner-type-tabs {
    display: flex;
    gap: 0;
    padding: 0 20px;
    background: linear-gradient(to bottom, rgba(190, 225, 245, 0.6) 0%, transparent 100%);
    border-bottom: 1px solid rgba(160, 210, 240, 0.3);
}

.banner-type-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: rgba(50, 80, 120, 0.6);
    font-size: 0.95rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    position: relative;
    bottom: -1px;
}

.banner-type-tab:hover {
    color: #2c5a88;
}

.banner-type-tab.active {
    color: #1a4a78;
    border-bottom: 3px solid var(--wish-gold-mid);
}

.banner-type-tab[data-banner="standard"].active {
    color: #1a4a78;
    border-bottom: 3px solid #4ab0cc;
}

.banner-type-icon {
    font-size: 0.85rem;
    opacity: 0.8;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0% {
        opacity: 0.4;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.4;
    }
}



/* ==================================
   Loading / Start Screen
==================================== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    background: linear-gradient(160deg, #c8e4f4, #a8cce4, #d8eef8);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease-in-out, visibility 0.8s;
}

.loading-bg-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.85;
    z-index: 1;
}

.loading-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-shadow: 0 2px 10px rgba(80, 140, 200, 0.4);
}

.loading-progress-container {
    width: 300px;
    height: 6px;
    background: rgba(160, 210, 240, 0.35);
    border-radius: 0;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: inset 0 1px 3px rgba(100, 160, 200, 0.3);
}

.loading-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, rgba(200, 230, 255, 0.5), var(--wish-gold-mid), #f5e090);
    border-radius: 0;
    box-shadow: 0 0 10px rgba(212, 168, 67, 0.7);
    transition: width 0.1s linear;
}

.start-game-btn {
    font-size: 1.2rem;
    color: #1a3a60;
    padding: 10px 30px;
    cursor: pointer;
    font-weight: bold;
    animation: flashPulse 2s infinite;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 0;
    border: 1px solid rgba(160, 210, 240, 0.7);
    backdrop-filter: blur(6px);
}

@keyframes flashPulse {

    0%,
    100% {
        opacity: 0.6;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.04);
        box-shadow: 0 0 20px rgba(180, 210, 255, 0.6);
    }
}

@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    80% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ==================================
   Responsive - iPhone / Mobile
==================================== */
@media (max-width: 480px) {

    /* 繝倥ャ繝繝ｼ */
    .top-nav {
        padding: 8px 10px;
    }

    .logo-text {
        font-size: 1rem;
    }

    .header-right {
        gap: 6px;
    }

    .currency {
        padding: 2px 6px 2px 2px;
    }

    .currency img {
        height: 18px;
        width: 18px;
        margin-right: 4px;
    }

    .currency span {
        font-size: 0.8rem;
        min-width: 24px;
    }

    #history-btn {
        font-size: 0.75rem;
        padding: 4px 8px;
    }

    /* バナー */
    .banner-container {
        padding: 10px;
        align-items: flex-start;
    }

    .banner-wrapper {
        width: 100%;
        height: auto;
        max-height: 45vh;
        aspect-ratio: 16 / 9;
    }

    .banner-img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: center;
    }

    .banner-text h2 {
        font-size: 1.2rem;
    }

    .banner-text p {
        font-size: 0.75rem;
    }

    /* 螟ｩ莠戊｡ｨ遉ｺ */
    .pity-info {
        bottom: 90px;
        font-size: 0.8rem;
        left: 10px;
    }

    /* 繝輔ャ繧ｿ繝ｼ */
    .action-buttons {
        padding: 10px;
        padding-bottom: env(safe-area-inset-bottom, 15px);
        gap: 8px;
        flex-wrap: nowrap;
    }

    .footer-left-btns {
        gap: 6px;
    }

    .footer-sub-btn {
        padding: 7px 10px;
        font-size: 0.75rem;
        border-radius: 0;
    }

    .footer-btn-icon {
        font-size: 1.1rem;
    }

    .footer-right-btns {
        gap: 8px;
    }

    .gacha-btn-inner {
        padding: 8px 16px;
    }

    .btn-title {
        font-size: 0.9rem;
    }

    .btn-cost img {
        height: 16px;
    }

    /* モーダル */
    .modal-content {
        width: 95%;
        max-height: 85vh;
        padding: 15px;
        overflow-y: auto;
    }

    /* バッグ画面を全画面表示 */
    #bag-modal .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0;
        margin: 0 !important;
        padding: 12px !important;
        overflow: hidden;
    }
    #bag-modal {
        align-items: stretch !important;
        justify-content: stretch !important;
    }
    #bag-modal .modal-bg {
        display: none;
    }

    .shop-items {
        grid-template-columns: repeat(2, 1fr);
    }

    .shop-tab {
        font-size: 0.95rem;
        padding: 8px 10px;
    }

    .modal-header h2 {
        font-size: 1.1rem;
    }

    /* 繝ｪ繧ｶ繝ｫ繝育判髱｢ */
    .result-grid {
        gap: 8px;
        padding: 10px;
        overflow-y: auto;
        max-height: 75vh;
    }

    .result-item {
        width: 90px;
        height: 140px;
    }

    .item-img {
        width: 70px;
        height: 70px;
    }

    .item-stars {
        font-size: 0.75rem;
    }

    .item-name {
        font-size: 0.65rem;
    }

    /* スマホ版の武器一覧を3列に戻し、名前を非表示、縦長カードに */
    #bag-weapon-list.result-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
        padding: 10px;
    }
    #bag-weapon-list .result-item {
        width: 100% !important;
        height: 125px !important;
        padding: 10px !important;
        display: flex;
        flex-direction: column;
        align-items: center;
        box-sizing: border-box;
    }
    #bag-weapon-list .item-img {
        width: 65px !important;
        height: 65px !important;
        margin-bottom: 8px !important;
    }
    #bag-weapon-list .item-name {
        display: none !important;
    }
    #bag-weapon-list .item-stars {
        margin-top: auto;
        text-align: center !important;
        padding-left: 0 !important;
    }

    #close-result-btn {
        margin-top: 15px;
        font-size: 1rem;
        padding: 10px 20px;
    }

    /* 繧ｹ繝励Λ繝・す繝･逕ｻ髱｢ */
    #splash-img {
        height: 70vh;
    }

    #splash-name {
        font-size: 1.8rem;
    }

    /* 繝ｭ繝ｼ繝臥判髱｢ */
    .loading-progress-container {
        width: 80vw;
    }

    /* 螻･豁ｴ繝｢繝ｼ繝繝ｫ */
    #history-list {
        max-height: 55vh;
    }
}

/* 繝弱ャ繝√↑縺ｩ縺ｮ繧ｻ繝ｼ繝輔お繝ｪ繧｢蟇ｾ蠢・*/
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .action-buttons {
        padding-bottom: calc(env(safe-area-inset-bottom) + 10px);
    }
}

/* ====================================================
   邂｡逅・・ヱ繝阪Ν (Developer Panel - 髱槫・髢区ｩ溯・)
   繧｢繧ｯ繧ｻ繧ｹ: 縲檎･磯｡倥阪Ο繧ｴ繧・蝗樒ｴ譌ｩ縺上ち繝・・
==================================================== */
.admin-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5000;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.admin-container {
    background: #0f172a;
    border: 1px solid rgba(99, 102, 241, 0.5);
    border-radius: 0;
    width: 100%;
    max-width: 720px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow:
        0 0 0 1px rgba(99, 102, 241, 0.1),
        0 0 60px rgba(99, 102, 241, 0.25),
        0 30px 60px rgba(0, 0, 0, 0.8);
    overflow: hidden;
}

/* 繝倥ャ繝繝ｼ */
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: linear-gradient(135deg, #1e293b 0%, #162032 100%);
    border-bottom: 1px solid rgba(99, 102, 241, 0.3);
    flex-shrink: 0;
}

.admin-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-badge {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 2.5px;
    padding: 3px 9px;
    border-radius: 0;
    font-family: 'Courier New', monospace;
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.5);
}

.admin-title {
    color: #e2e8f0;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.admin-close-btn {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #f87171;
    width: 32px;
    height: 32px;
    border-radius: 0;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
    flex-shrink: 0;
}

.admin-close-btn:hover {
    background: rgba(239, 68, 68, 0.35);
    border-color: rgba(239, 68, 68, 0.6);
}

/* 繧ｿ繝悶リ繝・*/
.admin-tabs {
    display: flex;
    background: #1e293b;
    border-bottom: 1px solid rgba(99, 102, 241, 0.2);
    flex-shrink: 0;
}

.admin-tab-btn {
    flex: 1;
    padding: 11px 16px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: rgba(148, 163, 184, 0.65);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
    letter-spacing: 0.3px;
}

.admin-tab-btn:hover {
    color: #e2e8f0;
    background: rgba(99, 102, 241, 0.08);
}

.admin-tab-btn.active {
    color: #a5b4fc;
    border-bottom-color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
}

/* 繧ｿ繝悶さ繝ｳ繝・Φ繝・*/
.admin-tab-content {
    display: none;
    overflow-y: auto;
    flex: 1;
    padding: 16px 20px;
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.4) transparent;
}

.admin-tab-content::-webkit-scrollbar {
    width: 5px;
}

.admin-tab-content::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.4);
    border-radius: 0;
}

.admin-tab-content.active {
    display: block;
}

/* 繝舌リ繝ｼ險ｭ螳壹ヵ繧ｩ繝ｼ繝 */
.admin-form-section {
    background: #1e293b;
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 0;
    padding: 16px;
    margin-bottom: 14px;
}

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

.admin-section-title {
    color: #a5b4fc;
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 14px;
    letter-spacing: 0.5px;
}

.admin-field-group {
    margin-bottom: 12px;
}

.admin-field-group:last-child {
    margin-bottom: 0;
}

.admin-label {
    display: block;
    color: #64748b;
    font-size: 0.76rem;
    font-weight: 600;
    margin-bottom: 5px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.admin-input-full {
    width: 100%;
    background: #0f172a;
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 0;
    padding: 9px 12px;
    color: #e2e8f0;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    /* 繝・く繧ｹ繝亥・蜉帙・驕ｸ謚槭ｒ險ｱ蜿ｯ */
    user-select: text;
    -webkit-user-select: text;
}

.admin-input-full:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* 繝励・繝ｫ險ｭ螳壹ヲ繝ｳ繝・*/
.admin-hint {
    color: #475569;
    font-size: 0.78rem;
    margin-bottom: 14px;
    line-height: 1.6;
    padding: 8px 12px;
    background: #1e293b;
    border-radius: 0;
    border-left: 3px solid rgba(99, 102, 241, 0.5);
}

.admin-hint code {
    background: #0f172a;
    padding: 1px 6px;
    border-radius: 0;
    color: #a5b4fc;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
}

/* 繝励・繝ｫ繧ｻ繧ｯ繧ｷ繝ｧ繝ｳ */
.admin-pool-section {
    margin-bottom: 14px;
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 0;
    overflow: hidden;
}

.admin-pool-section.rarity-5 {
    border-color: rgba(200, 132, 26, 0.4);
}

.admin-pool-section.rarity-4 {
    border-color: rgba(155, 89, 182, 0.4);
}

.admin-pool-section.rarity-3 {
    border-color: rgba(52, 152, 219, 0.35);
}

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

.admin-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    background: #1e293b;
}

.admin-section-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #64748b;
}

.admin-pool-section.rarity-5 .admin-section-label {
    color: #c8841a;
}

.admin-pool-section.rarity-4 .admin-section-label {
    color: #9b59b6;
}

.admin-pool-section.rarity-3 .admin-section-label {
    color: #3498db;
}

.admin-add-btn {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.35);
    color: #a5b4fc;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 4px 11px;
    border-radius: 0;
    cursor: pointer;
    transition: background 0.2s;
}

.admin-add-btn:hover {
    background: rgba(99, 102, 241, 0.35);
}

.admin-item-list {
    padding: 8px;
    background: #0a1120;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.admin-item-row {
    display: flex;
    align-items: center;
    gap: 7px;
    background: #1e293b;
    border-radius: 0;
    padding: 7px 8px;
    border: 1px solid rgba(99, 102, 241, 0.08);
    transition: border-color 0.15s;
}

.admin-item-row:hover {
    border-color: rgba(99, 102, 241, 0.2);
}

.admin-row-num {
    color: #334155;
    font-size: 0.72rem;
    font-weight: 700;
    min-width: 16px;
    text-align: center;
    font-family: monospace;
}

.admin-input {
    background: #0f172a;
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 0;
    padding: 5px 8px;
    color: #e2e8f0;
    font-size: 0.82rem;
    outline: none;
    transition: border-color 0.2s;
    user-select: text;
    -webkit-user-select: text;
}

.admin-input:focus {
    border-color: #6366f1;
}

.admin-name-input {
    flex: 2.5;
    min-width: 0;
}

.admin-splash-input {
    flex: 2.5;
    min-width: 0;
}

.admin-chara-label {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #64748b;
    font-size: 0.75rem;
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
}

.admin-chara-label input[type=checkbox] {
    accent-color: #6366f1;
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.admin-del-btn {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #f87171;
    border-radius: 0;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.admin-del-btn:hover {
    background: rgba(239, 68, 68, 0.3);
}

.admin-empty {
    text-align: center;
    color: #334155;
    font-size: 0.8rem;
    padding: 12px;
    font-style: italic;
}

/* 繝輔ャ繧ｿ繝ｼ */
.admin-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 20px;
    background: #1e293b;
    border-top: 1px solid rgba(99, 102, 241, 0.2);
    flex-shrink: 0;
}

.admin-save-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    color: white;
    padding: 9px 22px;
    border-radius: 0;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.9rem;
    transition: opacity 0.2s, transform 0.1s;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    letter-spacing: 0.3px;
}

.admin-save-btn:hover {
    opacity: 0.88;
    transform: translateY(-1px);
}

.admin-save-btn:active {
    transform: scale(0.97);
}

.admin-cancel-btn {
    background: rgba(100, 116, 139, 0.15);
    border: 1px solid rgba(100, 116, 139, 0.3);
    color: #94a3b8;
    padding: 9px 16px;
    border-radius: 0;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.88rem;
    transition: background 0.2s;
}

.admin-cancel-btn:hover {
    background: rgba(100, 116, 139, 0.3);
}

.admin-reset-btn {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #f87171;
    padding: 9px 14px;
    border-radius: 0;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.82rem;
    transition: background 0.2s;
}

.admin-reset-btn:hover {
    background: rgba(239, 68, 68, 0.25);
}

/* 遘伜ｯ・・繝偵Φ繝・*/
.admin-secret-hint {
    text-align: center;
    color: rgba(99, 102, 241, 0.25);
    font-size: 0.68rem;
    padding: 5px;
    background: #0a1120;
    flex-shrink: 0;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
}

/* 繝｢繝舌う繝ｫ蟇ｾ蠢・*/
@media (max-width: 480px) {
    .admin-container {
        max-height: 92vh;
        border-radius: 0;
    }

    .admin-tab-content {
        padding: 12px;
    }

    .admin-footer {
        padding: 10px 12px;
        flex-wrap: wrap;
        gap: 7px;
    }

    .admin-save-btn,
    .admin-cancel-btn,
    .admin-reset-btn {
        padding: 8px 12px;
        font-size: 0.82rem;
    }

    .admin-item-row {
        flex-wrap: wrap;
    }

    .admin-name-input,
    .admin-splash-input {
        flex: 1 1 100%;
    }
}

/* ====================================================
   繝舌リ繝ｼ逕ｻ蜒上・繝ｬ繝薙Η繝ｼ (邂｡逅・・ヱ繝阪Ν蜀・
==================================================== */
.admin-image-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-image-row .admin-input-full {
    flex: 1;
}

.admin-banner-preview {
    width: 80px;
    height: 50px;
    object-fit: cover;
    border-radius: 0;
    border: 1px solid rgba(14, 165, 233, 0.35);
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.admin-banner-preview:hover {
    transform: scale(1.05);
    box-shadow: 0 0 12px rgba(14, 165, 233, 0.4);
}

/* ====================================================
   繧ｨ繧ｯ繧ｹ繝昴・繝医・繧ｿ繝ｳ & 繝｢繝ｼ繝繝ｫ
==================================================== */
.admin-export-btn {
    background: rgba(14, 165, 233, 0.12);
    border: 1px solid rgba(14, 165, 233, 0.35);
    color: #38bdf8;
    padding: 9px 14px;
    border-radius: 0;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.82rem;
    transition: background 0.2s;
}

.admin-export-btn:hover {
    background: rgba(14, 165, 233, 0.28);
}

/* 繧ｨ繧ｯ繧ｹ繝昴・繝医Δ繝ｼ繝繝ｫ縺ｮ繧ｪ繝ｼ繝舌・繝ｬ繧､ */
.admin-export-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 6000;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: adminFadeIn 0.18s ease;
}

@keyframes adminFadeIn {
    from {
        opacity: 0;
        transform: scale(0.97);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.admin-export-container {
    background: #0f172a;
    border: 1px solid rgba(14, 165, 233, 0.4);
    border-radius: 0;
    width: 100%;
    max-width: 760px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow:
        0 0 0 1px rgba(14, 165, 233, 0.08),
        0 0 60px rgba(14, 165, 233, 0.2),
        0 30px 60px rgba(0, 0, 0, 0.8);
    overflow: hidden;
}

/* 繧ｨ繧ｯ繧ｹ繝昴・繝医・繝・ム繝ｼ */
.admin-export-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: linear-gradient(135deg, #1e293b, #162032);
    border-bottom: 1px solid rgba(14, 165, 233, 0.25);
    flex-shrink: 0;
}

/* 繧ｨ繧ｯ繧ｹ繝昴・繝医・繝・ぅ */
.admin-export-body {
    overflow-y: auto;
    flex: 1;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(14, 165, 233, 0.3) transparent;
}

.admin-export-body::-webkit-scrollbar {
    width: 5px;
}

.admin-export-body::-webkit-scrollbar-thumb {
    background: rgba(14, 165, 233, 0.3);
    border-radius: 0;
}

/* 菴ｿ縺・婿縺ｮ隱ｬ譏弱ヰ繝ｼ */
.admin-export-notice {
    background: rgba(14, 165, 233, 0.08);
    border: 1px solid rgba(14, 165, 233, 0.25);
    border-left: 4px solid #0ea5e9;
    border-radius: 0;
    padding: 10px 14px;
    color: #94a3b8;
    font-size: 0.82rem;
    line-height: 1.6;
}

.admin-export-notice strong {
    color: #38bdf8;
}

/* 蜷・ヵ繧｡繧､繝ｫ繧ｻ繧ｯ繧ｷ繝ｧ繝ｳ */
.admin-export-section {
    background: #1e293b;
    border: 1px solid rgba(14, 165, 233, 0.15);
    border-radius: 0;
    overflow: hidden;
}

.admin-export-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #162032;
    gap: 10px;
    border-bottom: 1px solid rgba(14, 165, 233, 0.15);
    flex-wrap: wrap;
}

.admin-export-file {
    display: block;
    color: #38bdf8;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    margin-bottom: 3px;
}

.admin-export-where {
    display: block;
    color: #475569;
    font-size: 0.73rem;
    font-family: 'Courier New', monospace;
}

/* 繧ｳ繝ｼ繝峨ユ繧ｭ繧ｹ繝医お繝ｪ繧｢ */
.admin-export-code {
    display: block;
    width: 100%;
    min-height: 160px;
    max-height: 280px;
    background: #0a1120;
    color: #a5f3fc;
    border: none;
    padding: 14px 16px;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 0.8rem;
    line-height: 1.65;
    resize: vertical;
    outline: none;
    /* 繝・く繧ｹ繝磯∈謚槭ｒ險ｱ蜿ｯ */
    user-select: text;
    -webkit-user-select: text;
    scrollbar-width: thin;
    scrollbar-color: rgba(14, 165, 233, 0.3) transparent;
}

.admin-export-code::-webkit-scrollbar {
    width: 4px;
}

.admin-export-code::-webkit-scrollbar-thumb {
    background: rgba(14, 165, 233, 0.3);
    border-radius: 0;
}

/* 繧ｳ繝斐・繝懊ち繝ｳ */
.admin-copy-btn {
    background: rgba(14, 165, 233, 0.15);
    border: 1px solid rgba(14, 165, 233, 0.35);
    color: #38bdf8;
    padding: 7px 16px;
    border-radius: 0;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    flex-shrink: 0;
}

.admin-copy-btn:hover {
    background: rgba(14, 165, 233, 0.3);
}

.admin-copy-btn.copied {
    background: rgba(16, 185, 129, 0.25);
    border-color: rgba(16, 185, 129, 0.5);
    color: #34d399;
}

/* 繝｢繝舌う繝ｫ蟇ｾ蠢・*/
@media (max-width: 480px) {
    .admin-export-container {
        max-height: 92vh;
        border-radius: 0;
    }

    .admin-export-body {
        padding: 12px;
    }

    .admin-export-code {
        min-height: 120px;
        font-size: 0.73rem;
    }

    .admin-export-section-header {
        gap: 8px;
    }
}

/* Epitomized Path Styles */
.epitomized-item {
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 0;
    padding: 10px;
    transition: all 0.2s;
    background: rgba(0, 0, 0, 0.3);
}

.epitomized-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.epitomized-item.selected {
    border-color: #fbbf24;
    background: rgba(251, 191, 36, 0.2);
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.5);
}

.epitomized-img-wrap img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.epitomized-name {
    font-size: 0.9rem;
    font-weight: bold;
    color: #f8fafc;
    margin-top: 5px;
}

#cd-constellation-nodes {
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 20px;
    z-index: 10;
}

/* Constellation node animation */
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(226, 200, 143, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(226, 200, 143, 0); }
    100% { box-shadow: 0 0 0 0 rgba(226, 200, 143, 0); }
}


/* ===== General Mobile Responsiveness ===== */
@media (max-width: 768px) {
    /* Header optimization */
    .top-nav {
        padding: 5px 10px;
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .header-left {
        width: 100%;
    }

    .logo-text {
        font-size: 1rem;
    }

    .header-right {
        width: 100%;
        overflow-x: auto;
        padding: 5px 0;
        -webkit-overflow-scrolling: touch;
        gap: 10px;
        scrollbar-width: none; /* Hide scrollbar for Firefox */
        display: flex;
        align-items: center;
    }

    .header-right::-webkit-scrollbar {
        display: none; /* Hide scrollbar for Chrome/Safari */
    }

    .header-icon-btn {
        width: 36px !important;
        height: 36px !important;
        flex-shrink: 0;
    }

    .header-icon-btn img {
        width: 20px !important;
        height: 20px !important;
    }

    .currency {
        padding: 2px 8px 2px 2px;
        flex-shrink: 0;
    }

    .currency img {
        height: 18px;
        width: 18px;
        margin-right: 4px;
    }

    .currency span {
        font-size: 0.8rem;
        min-width: 30px;
    }

    /* Banner Tabs */
    .banner-type-tabs {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 0 10px;
        display: flex;
    }

    .banner-type-tabs::-webkit-scrollbar {
        display: none;
    }

    .banner-type-tab {
        padding: 8px 15px;
        font-size: 0.85rem;
        flex-shrink: 0;
    }

    /* Footer Buttons */
    .action-buttons {
        padding: 10px;
        padding-bottom: 30px;
        gap: 10px;
    }

    .footer-sub-btn {
        padding: 6px 12px;
        font-size: 0.75rem;
        flex-shrink: 0;
    }

    .footer-btn-icon {
        font-size: 1.1rem;
    }

    .footer-right-btns {
        gap: 10px;
    }

    .gacha-btn-inner {
        padding: 6px 15px;
    }

    .btn-title {
        font-size: 0.85rem;
    }

    .btn-cost {
        font-size: 0.75rem;
        gap: 3px;
    }

    .btn-cost img {
        height: 14px;
    }

    /* Pity Info */
    .pity-info {
        bottom: 85px;
        left: 10px;
        font-size: 0.75rem;
        padding: 3px 10px;
    }

    /* Version Badge */
    .version-badge {
        bottom: 5px;
        right: 5px;
        font-size: 0.6rem;
    }

    /* Banner Area */
    .banner-wrapper {
        max-height: 50vh;
    }

    .banner-text h2 {
        font-size: 1.5rem;
    }

    .banner-text p {
        font-size: 0.8rem;
    }
}

/* ===================================================
   キャラクター詳細 疑似縦画面対応
   （横向きレイアウトを縦向き端末で表示するケース）
   max-width: 768px = 幅が狭い = 疑似縦画面
   =================================================== */

@media (max-width: 768px) {

    /* モーダル全体 */
    #character-details-modal {
        padding: 0 !important;
    }

    /* ヘッダーコンパクト化 */
    #character-details-modal .cd-container {
        padding: 6px 10px 0 10px !important;
        flex-shrink: 0;
    }

    #cd-element-icon {
        width: 20px !important;
        height: 20px !important;
    }

    #cd-element-name, #cd-char-name {
        font-size: 0.8rem !important;
    }

    #cd-char-list {
        max-width: 42% !important;
        gap: 4px !important;
    }

    #cd-char-list > div {
        width: 28px !important;
        height: 28px !important;
        flex-shrink: 0;
    }

    #close-cd-btn {
        width: 26px !important;
        height: 26px !important;
        font-size: 1rem !important;
        flex-shrink: 0;
    }

    /* ボディ: 縦積みフレックス */
    .cd-body {
        flex-direction: column !important;
        overflow: hidden !important;
        flex: 1;
        min-height: 0;
    }

    /* ===== サイドバー → 横並びタブバー ===== */
    .cd-sidebar {
        order: 0 !important;
        width: 100% !important;
        flex-direction: row !important;
        padding: 0 !important;
        padding-top: 0 !important;
        gap: 0 !important;
        font-size: 0.78rem !important;
        font-weight: bold !important;
        background: rgba(0, 0, 0, 0.6) !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
        flex-shrink: 0 !important;
        z-index: 15 !important;
        text-shadow: none !important;
        /* 回転リセット */
        writing-mode: horizontal-tb !important;
        transform: none !important;
    }

    /* タブ: 横並び、テキスト回転なし */
    .cd-tab {
        flex: 1 !important;
        text-align: center !important;
        padding: 9px 2px !important;
        font-size: 0.78rem !important;
        writing-mode: horizontal-tb !important;
        transform: none !important;
        white-space: nowrap;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-direction: row !important;
        gap: 0 !important;
    }

    /* ♦ アイコン非表示（スペース節約） */
    .cd-tab-diamond {
        display: none !important;
    }

    .cd-tab-indicator {
        left: 10% !important;
        width: 80% !important;
    }

    /* ===== 立ち絵: ステータスタブのみ表示 ===== */
    /* 他タブでは JS で display:none を設定済み */
    #cd-splash-img {
        /* position:absolute のまま維持（デスクトップと同じ挙動） */
        /* JS で非表示タブ時に style.display='none' が入る */
        height: 80% !important;
        max-width: 55% !important;
        top: 50% !important;
        left: 42% !important;
        transform: translate(-50%, -44%) !important;
        opacity: 0.85;
    }

    /* ===== メインコンテンツ: スクロール可能 ===== */
    .cd-main {
        order: 1 !important;
        position: relative !important;
        width: 100% !important;
        flex: 1 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding: 10px !important;
        background: rgba(0, 0, 0, 0.3) !important;
        backdrop-filter: blur(6px) !important;
        -webkit-backdrop-filter: blur(6px) !important;
        box-sizing: border-box !important;
        min-height: 0;
    }

    /* ===== ステータスパネル ===== */
    #cd-status-view {
        position: static !important;
        width: 100% !important;
        right: auto !important;
        top: auto !important;
        z-index: auto !important;
    }

    #cd-status-name {
        font-size: 1.2rem !important;
    }

    /* ===== 天賦パネル ===== */
    #cd-talent-view {
        position: static !important;
        width: 100% !important;
        right: auto !important;
        top: auto !important;
        z-index: auto !important;
    }

    /* ===== 武器パネル ===== */
    #cd-weapon-view {
        position: static !important;
        width: 100% !important;
        right: auto !important;
        top: auto !important;
        flex-direction: column !important;
    }

    .weapon-list-pane {
        max-height: 200px !important;
        overflow-y: auto !important;
        padding: 10px !important;
    }

    .weapon-detail-pane {
        flex: none !important;
        width: 100% !important;
        max-width: 100% !important;
        border-left: none !important;
        border-top: 1px solid rgba(255, 255, 255, 0.12) !important;
        padding: 10px !important;
    }

    /* 命ノ星座 */
    #cd-constellation-view {
        position: static !important;
        width: 100% !important;
        height: auto !important;
        min-height: 280px !important;
        overflow-y: visible !important;
    }

    #cd-constellation-bg {
        width: 200px !important;
        height: 200px !important;
        top: 10px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
    }

    #cd-constellation-nodes {
        right: auto !important;
        left: 50% !important;
        bottom: 10px !important;
        top: auto !important;
        transform: translateX(-50%) !important;
        flex-direction: row !important;
        gap: 10px !important;
        z-index: 10 !important;
    }

    #cd-constellation-nodes > div {
        width: 34px !important;
        height: 34px !important;
    }

    #cd-constellation-detail {
        position: static !important;
        transform: none !important;
        width: 100% !important;
        margin-top: 10px !important;
        margin-bottom: 60px !important;
        left: auto !important;
        top: auto !important;
        padding: 12px !important;
    }
}


/* 管理者用リセットボタン */
.admin-danger-btn {
    background: linear-gradient(135deg, #ff4d4d, #cc0000) !important;
    color: white !important;
    border: none;
    padding: 8px 16px;
    border-radius: 0;
    cursor: pointer;
    font-weight: bold;
    transition: filter 0.2s;
}

.admin-danger-btn:hover {
    filter: brightness(1.2);
}

/* ========================================
   Character Level-Up Panel
   ======================================== */
.cd-levelup-panel {
    margin-top: 15px;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-radius: 0;
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 4px 20px rgba(0, 0, 0, 0.15);
}

.cd-levelup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.cd-asc-badge {
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(226, 200, 143, 0.15);
    color: #e2c88f;
    padding: 3px 10px;
    border-radius: 0;
    border: 1px solid rgba(226, 200, 143, 0.25);
    letter-spacing: 0.5px;
}

.cd-exp-text {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* EXP Bar */
.cd-exp-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 0;
    margin-bottom: 12px;
    overflow: hidden;
    position: relative;
}

.cd-exp-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #c9a84c, #e2c88f, #f5deb3);
    border-radius: 0;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
}

.cd-exp-fill-anim {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, rgba(226, 200, 143, 0.5), rgba(245, 222, 179, 0.3));
    border-radius: 0;
    transition: width 0.3s ease;
    z-index: 1;
}

@keyframes expFlash {
    0% { opacity: 1; filter: brightness(1.8); }
    50% { opacity: 0.8; filter: brightness(1.2); }
    100% { opacity: 1; filter: brightness(1); }
}

.cd-exp-fill.flash {
    animation: expFlash 0.4s ease-out;
}

/* Level-up info row */
.cd-levelup-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    margin-bottom: 8px;
    color: rgba(226, 200, 143, 0.9);
    font-weight: 500;
}

.cd-cost-label {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cd-cost-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    vertical-align: middle;
}

.cd-target-label {
    font-weight: 700;
    font-size: 0.85rem;
    color: #e2c88f;
}

/* Custom Range Slider */
.cd-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0;
    outline: none;
    margin-bottom: 12px;
    cursor: pointer;
    position: relative;
}

.cd-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f5deb3, #e2c88f);
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 12px rgba(226, 200, 143, 0.3);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cd-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4), 0 0 18px rgba(226, 200, 143, 0.5);
}

.cd-slider::-webkit-slider-thumb:active {
    transform: scale(1.25);
}

.cd-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f5deb3, #e2c88f);
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 12px rgba(226, 200, 143, 0.3);
    cursor: pointer;
}

.cd-slider::-moz-range-track {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0;
    border: none;
}

/* Level-up buttons row */
.cd-levelup-btns {
    display: flex;
    gap: 8px;
}

.cd-action-btn {
    border: none;
    font-weight: 700;
    cursor: pointer;
    border-radius: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.85rem;
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
}

.cd-action-btn:active {
    transform: scale(0.95);
}

.cd-btn-small {
    flex: 1;
    padding: 9px 6px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(4px);
}

.cd-btn-small:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(226, 200, 143, 0.4);
    color: #e2c88f;
}

.cd-btn-confirm {
    flex: 2;
    padding: 9px 16px;
    background: linear-gradient(135deg, #e2c88f, #c9a84c);
    color: #1a1000;
    box-shadow: 0 2px 12px rgba(226, 200, 143, 0.25);
}

.cd-btn-confirm:hover {
    background: linear-gradient(135deg, #f0d8a0, #d4b05c);
    box-shadow: 0 4px 18px rgba(226, 200, 143, 0.4);
    transform: translateY(-1px);
}

.cd-btn-confirm:active {
    transform: scale(0.96);
}

/* Ascend controls */
.cd-ascend-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.cd-ascend-label {
    font-size: 0.9rem;
    color: #e2c88f;
    font-weight: 600;
}

.cd-ascend-cost {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
}

.cd-btn-ascend {
    width: 100%;
    padding: 11px;
    background: linear-gradient(135deg, #e2c88f, #c9a84c);
    color: #1a1000;
    box-shadow: 0 2px 12px rgba(226, 200, 143, 0.25);
    font-size: 0.95rem;
}

.cd-btn-ascend:hover {
    background: linear-gradient(135deg, #f0d8a0, #d4b05c);
    box-shadow: 0 4px 18px rgba(226, 200, 143, 0.4);
    transform: translateY(-1px);
}

/* Level-up animation overlay */
@keyframes levelUpPulse {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.02); opacity: 1; }
    100% { transform: scale(1); opacity: 0.8; }
}

@keyframes expCountUp {
    0% { opacity: 0; transform: translateY(8px); }
    20% { opacity: 1; transform: translateY(0); }
    80% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-10px); }
}

.cd-exp-popup {
    position: absolute;
    top: -20px;
    right: 10px;
    color: #e2c88f;
    font-size: 0.85rem;
    font-weight: 700;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
    animation: expCountUp 1.2s ease-out forwards;
    pointer-events: none;
    z-index: 10;
}

/* Bag character grid: 3 columns on mobile */
#bag-character-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

#bag-character-list .result-item {
    width: auto;
}

@media (max-width: 480px) {
    #bag-character-list {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    #bag-character-list .result-item {
        width: auto;
        height: auto;
        min-height: 140px;
    }
}

/* Primogem Exchange Modal: align buttons to the center and style as DarkGlass */
#exchange-modal .modal-actions {
    justify-content: center;
}

#exchange-modal .cancel-btn,
#exchange-modal .confirm-btn {
    background: rgba(25, 25, 35, 0.7) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: #ffffff !important;
    border-radius: 0;
    padding: 8px 24px !important;
    font-weight: 700 !important;
    font-size: 0.85rem !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.05) !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    cursor: pointer;
    min-width: 90px;
}

#exchange-modal .cancel-btn:hover {
    background: rgba(45, 45, 60, 0.85) !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35) !important;
}

#exchange-modal .confirm-btn {
    border-color: rgba(212, 168, 67, 0.35) !important;
    color: #f5e090 !important; /* Premium gold accent to indicate gacha confirmation */
}

#exchange-modal .confirm-btn:hover {
    background: rgba(35, 35, 50, 0.95) !important;
    border-color: rgba(212, 168, 67, 0.7) !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 20px rgba(212, 168, 67, 0.25) !important;
}

#exchange-modal .cancel-btn:active,
#exchange-modal .confirm-btn:active {
    transform: translateY(0) scale(0.97) !important;
}

#cancel-epitomized-btn {
    background: rgba(25, 25, 35, 0.7) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: #ffffff !important;
    border-radius: 0;
    padding: 8px 24px !important;
    font-weight: 700 !important;
    font-size: 0.85rem !important;
    backdrop-filter: blur(12px) !important;
    transition: all 0.2s ease !important;
}

#cancel-epitomized-btn:hover {
    background: rgba(35, 35, 50, 0.85) !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35) !important;
}

#cancel-epitomized-btn:active {
    transform: translateY(0) scale(0.97) !important;
}

/* ========================================
   武器画面レイアウト (weapon view)
   ======================================== */

/* cd-weapon-view 自体: 親(.cd-main)のサイズに合わせて全体を占める */
/* display は .hidden と競合させないため :not(.hidden) で指定 */
.weapon-view-container {
    position: absolute !important;
    top: 0; left: 0; right: 0; bottom: 0;
    flex-direction: row;
    gap: 0;
    overflow: hidden;
    z-index: 10;
}

.weapon-view-container:not(.hidden) {
    display: flex;
}

/* 左ペイン: 武器一覧 — スクロール可能 */
.weapon-list-pane {
    flex: 1 1 0;
    min-width: 0;
    overflow-y: auto;
    padding: 20px 16px 20px 20px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* 右ペイン: 武器詳細 — スクロールに追随しない (sticky) */
.weapon-detail-pane {
    flex: 0 0 340px;
    width: 340px;
    max-width: 340px;
    overflow-y: auto;
    padding: 20px 20px 20px 16px;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.35);
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(6px);
    /* sticky ではなく独自スクロールで固定感を出す */
    position: relative;
}

/* スマホ: 縦積みレイアウトに切り替え */
@media (max-width: 640px) {
    .weapon-view-container {
        position: static !important;
        flex-direction: column !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        flex: 1 !important;
    }

    .weapon-view-container:not(.hidden) {
        display: flex !important;
    }

    .weapon-list-pane {
        flex: 0 0 auto;
        overflow-y: unset;
        padding: 12px;
        max-height: none;
    }

    .weapon-detail-pane {
        flex: 0 0 auto;
        width: 100% !important;
        max-width: 100% !important;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.12);
        padding: 12px;
        overflow-y: unset;
    }
}

/* ===============================
   TITLE SCREEN
   =============================== */
.title-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #e0f2fe; /* light blue sky fallback */
}

.title-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../assets/bluesky.jpg');
    background-size: cover;
    background-position: center;
    z-index: -1;
}

.title-logo-container {
    margin-top: 5vh;
    margin-bottom: 5vh;
    animation: slideDownFade 1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.title-logo-img {
    width: 280px;
    height: auto;
    max-height: 40vh;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

.title-btn-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    width: 100%;
}

.ts-action-btn {
    position: relative;
    width: 260px;
    height: 50px;
    background: linear-gradient(180deg, #333333 0%, #1a1a1a 100%);
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: bold;
    letter-spacing: 4px;
    border: none;
    cursor: pointer;
    clip-path: polygon(10% 0%, 100% 0%, 90% 100%, 0% 100%);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, filter 0.2s;
    animation: fadeIn 1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    animation-delay: 0.3s;
    opacity: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ts-action-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, #14b8a6 0%, #06b6d4 100%);
    box-shadow: 0 -2px 10px rgba(6, 182, 212, 0.5);
}

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

.ts-action-btn:active {
    transform: scale(0.95);
}

.title-footer-icons {
    position: absolute;
    bottom: 30px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 40px;
    box-sizing: border-box;
}

.tf-icon {
    width: 60px;
    height: 60px;
    background: #6b7280;
    border-radius: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2), inset 0 0 10px rgba(20, 184, 166, 0.3);
    transition: transform 0.2s;
}

.tf-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 15px rgba(0,0,0,0.3), inset 0 0 15px rgba(20, 184, 166, 0.5);
}

.tf-icon img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.3));
}

@media (max-height: 500px), (orientation: portrait) and (max-width: 932px) {
    .title-logo-container {
        margin-top: 2vh;
        margin-bottom: 2vh;
    }
    .title-logo-img {
        max-height: 35vh;
    }
    .ts-action-btn {
        height: 40px;
        font-size: 1.2rem;
    }
    .title-footer-icons {
        bottom: 15px;
        padding: 0 20px;
    }
    .tf-icon {
        width: 45px;
        height: 45px;
    }
    .tf-icon img {
        width: 28px;
        height: 28px;
    }
}

@keyframes slideDownFade {
    0% { opacity: 0; transform: translateY(-30px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* --- Global Rotation Logic --- */
#game-wrapper {
    position: relative;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    transition: transform 0.3s ease, width 0.3s ease, height 0.3s ease;
}

@media (orientation: portrait) and (max-width: 932px) {
    #game-wrapper.force-landscape {
        position: fixed;
        width: 100vh;
        width: 100dvh;
        height: 100vw;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) rotate(90deg);
        transform-origin: center center;
        z-index: 100;
    }

    #game-wrapper.force-landscape .title-screen {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        z-index: 1000;
        pointer-events: auto;
    }

    #game-wrapper.force-landscape .title-btn-container,
    #game-wrapper.force-landscape .ts-action-btn {
        position: relative;
        z-index: 2;
        pointer-events: auto;
    }

    /* Force-landscape fixes for Gacha screen */
    #game-wrapper.force-landscape #main-screen {
        height: 100vw;
        display: flex;
        flex-direction: column;
    }

    #game-wrapper.force-landscape .banner-wrapper {
        width: auto !important;
        height: 100% !important;
        max-height: calc(100vw - 150px) !important;
        max-width: 100% !important;
        aspect-ratio: 16 / 9 !important;
    }

    #game-wrapper.force-landscape .banner-container {
        padding: 5px 20px !important;
        align-items: center !important;
        justify-content: center !important;
    }

    #game-wrapper.force-landscape .banner-img {
        object-fit: cover !important;
    }

    #game-wrapper.force-landscape .top-nav {
        padding: 5px 20px !important;
    }

    #game-wrapper.force-landscape .banner-type-tabs {
        padding: 0 20px !important;
    }

    #game-wrapper.force-landscape .action-buttons {
        padding: 10px 20px !important;
        padding-bottom: 15px !important;
    }

    /* Force-landscape fixes for Shop Screen */
    #game-wrapper.force-landscape .shop-items {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
        padding: 10px !important;
    }

    #game-wrapper.force-landscape .shop-item {
        padding: 10px 15px !important;
    }

    #game-wrapper.force-landscape .shop-item img {
        height: 45px !important;
        margin-bottom: 5px !important;
    }

    #game-wrapper.force-landscape .item-amount {
        font-size: 1rem !important;
        margin-bottom: 8px !important;
    }

    /* Make Shop Modal Full Screen */
    #game-wrapper.force-landscape #shop-modal .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
        margin: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        padding: 12px !important;
    }

    #game-wrapper.force-landscape #shop-modal {
        align-items: stretch !important;
        justify-content: stretch !important;
    }

    #game-wrapper.force-landscape #shop-modal .modal-bg {
        display: none !important;
    }

    #game-wrapper.force-landscape #shop-modal .shop-tab-content.active {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 !important;
        min-height: 0 !important;
    }

    #game-wrapper.force-landscape #shop-modal .shop-items {
        flex: 1 !important;
        overflow-y: auto !important;
        align-content: flex-start !important;
    }

    /* Scale down payment popup to 60% */
    #game-wrapper.force-landscape #payment-modal .payment-content {
        left: 0 !important;
        right: 0 !important;
        margin: 0 auto !important;
        transform: scale(0.6) !important;
        transform-origin: bottom center !important;
        bottom: 0 !important;
    }

    /* Notice modal: popup in pseudo-landscape */
    #game-wrapper.force-landscape #notice-modal .modal-content {
        width: 80% !important;
        max-width: 500px !important;
        height: 85% !important; /* Properly bounds the height */
        max-height: 85% !important;
        border-radius: 15px !important;
        margin: auto !important;
        display: flex !important;
        flex-direction: column !important;
        padding: 24px 30px !important; /* Give more padding on sides */
    }
    #game-wrapper.force-landscape #notice-modal {
        align-items: center !important;
        justify-content: center !important;
    }
    #game-wrapper.force-landscape #notice-modal .modal-bg {
        display: block !important;
    }
    #game-wrapper.force-landscape #notice-content {
        flex: 1 !important;
        overflow-y: auto !important;
        padding: 10px 10px 10px 5px !important; /* Inner padding for text */
        font-size: 0.95rem !important;
        line-height: 1.8 !important; /* Improved readability */
    }

    /* ===== Character Detail Modal: Fit within 932x430px CSS canvas ===== */

    /* Compact header to save vertical space */
    #game-wrapper.force-landscape #character-details-modal .cd-container {
        padding: 8px 12px 0 12px !important;
    }
    #game-wrapper.force-landscape #cd-element-icon {
        width: 28px !important;
        height: 28px !important;
    }
    #game-wrapper.force-landscape #cd-element-name,
    #game-wrapper.force-landscape #cd-char-name {
        font-size: 0.95rem !important;
    }
    /* Limit char icon list to a single scrollable row */
    #game-wrapper.force-landscape #cd-char-list {
        max-width: 50% !important;
        gap: 4px !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        max-height: 32px !important;
    }
    #game-wrapper.force-landscape #cd-char-list > div {
        width: 28px !important;
        height: 28px !important;
        flex-shrink: 0 !important;
    }
    #game-wrapper.force-landscape #close-cd-btn {
        width: 26px !important;
        height: 26px !important;
        font-size: 1rem !important;
        flex-shrink: 0 !important;
    }

    /* Body: horizontal layout (sidebar left, main right) */
    #game-wrapper.force-landscape .cd-body {
        flex-direction: row !important;
        overflow: hidden !important;
        height: 100% !important;
        align-items: stretch !important;
    }

    /* Sidebar: compact vertical tabs on the left */
    #game-wrapper.force-landscape .cd-sidebar {
        order: 0 !important;
        width: 160px !important;
        flex-direction: column !important;
        gap: 8px !important;
        padding-top: 20px !important;
        padding-left: 8px !important;
        font-size: 1rem !important;
        font-weight: bold !important;
        background: none !important;
        border-bottom: none !important;
        flex-shrink: 0 !important;
        z-index: 10 !important;
        text-shadow: 0 1px 3px rgba(0,0,0,0.8) !important;
        overflow: visible !important;
    }
    #game-wrapper.force-landscape .cd-tab {
        flex: none !important;
        text-align: left !important;
        padding: 6px 8px !important;
        font-size: 1rem !important;
        white-space: nowrap !important;
    }
    #game-wrapper.force-landscape .cd-tab-indicator {
        left: 26px !important;
        width: 60% !important;
    }

    /* Splash image: absolute overlay in center */
    #game-wrapper.force-landscape #cd-splash-img {
        position: absolute !important;
        top: 50% !important;
        left: 45% !important;
        transform: translate(-50%, -45%) !important;
        height: 100% !important;
        width: auto !important;
        max-width: 60% !important;
        object-fit: contain !important;
        object-position: unset !important;
        flex-shrink: unset !important;
        z-index: 1 !important;
    }

    /* Main content area: relative, fills remaining height */
    #game-wrapper.force-landscape .cd-main {
        order: 0 !important;
        position: relative !important;
        width: auto !important;
        flex: 1 !important;
        height: 100% !important;
        min-height: 0 !important;
        overflow: hidden !important;
        padding: 0 !important;
        background: transparent !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    /* Status/Weapon panel: compact, scrollable, fits in 430px CSS height */
    #game-wrapper.force-landscape #cd-status-view,
    #game-wrapper.force-landscape #cd-weapon-view {
        position: absolute !important;
        right: 20px !important;
        top: 8px !important;
        width: 260px !important;
        max-height: calc(100% - 16px) !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    /* Weapon view: override mobile stacked layout back to PC side-by-side */
    #game-wrapper.force-landscape #cd-weapon-view {
        position: absolute !important;
        top: 0 !important;
        right: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        max-height: 100% !important;
        flex-direction: row !important;
        overflow: hidden !important;
    }
    #game-wrapper.force-landscape .weapon-list-pane {
        flex: 1 1 0 !important;
        overflow-y: auto !important;
        padding: 12px !important;
        max-height: none !important;
    }
    #game-wrapper.force-landscape .weapon-detail-pane {
        flex: 0 0 240px !important;
        width: 240px !important;
        max-width: 240px !important;
        height: 100% !important;
        box-sizing: border-box !important;
        border-left: 1px solid rgba(255,255,255,0.12) !important;
        border-top: none !important;
        padding: 12px !important;
        overflow-y: auto !important;
    }
    #game-wrapper.force-landscape #cd-status-name {
        font-size: 1.4rem !important;
    }
    #game-wrapper.force-landscape #cd-status-stars {
        font-size: 1rem !important;
        margin: 2px 0 !important;
    }
    #game-wrapper.force-landscape #cd-level-display {
        font-size: 1.1rem !important;
    }
    #game-wrapper.force-landscape #cd-status-content {
        font-size: 0.9rem !important;
        gap: 4px !important;
    }

    /* Constellation view: full area */
    #game-wrapper.force-landscape #cd-constellation-view {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        min-height: unset !important;
        overflow: hidden !important;
    }
    #game-wrapper.force-landscape #cd-constellation-bg {
        width: 300px !important;
        height: 300px !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
    }
    #game-wrapper.force-landscape #cd-constellation-nodes {
        position: absolute !important;
        right: 20px !important;
        left: auto !important;
        top: 50% !important;
        bottom: auto !important;
        transform: translateY(-50%) !important;
        flex-direction: column !important;
        gap: 8px !important;
    }
    #game-wrapper.force-landscape #cd-constellation-nodes > div {
        width: 36px !important;
        height: 36px !important;
    }
    #game-wrapper.force-landscape #cd-constellation-detail {
        position: absolute !important;
        left: 20px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        width: 220px !important;
        max-height: 90% !important;
        overflow-y: auto !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        padding: 15px !important;
    }
}

/* Rotation Toggle Button */
.rotation-toggle {
    position: fixed;
    bottom: 100px;
    right: 15px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.3);
    color: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: background 0.2s, color 0.2s;
}

.rotation-toggle:hover {
    background: rgba(0, 0, 0, 0.5);
    color: white;
}

@media (min-width: 1024px) {
    .rotation-toggle {
        display: none; /* Hide on desktop */
    }
}

/* ==========================================
   Multiplayer Widget & Panel Styles (HSR Theme)
   ========================================== */
.multi-toggle-btn-menu {
    border: none;
    font-weight: 700;
    letter-spacing: 0.05em;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.25), inset 0 0 8px rgba(255, 255, 255, 0.05);
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.multi-toggle-btn-menu::after {
    background: linear-gradient(90deg, #6366f1 0%, #4f46e5 100%) !important;
    box-shadow: 0 -2px 10px rgba(99, 102, 241, 0.5) !important;
}
.multi-toggle-btn-menu:hover {
    box-shadow: 0 0 25px rgba(99, 102, 241, 0.5), inset 0 0 12px rgba(255, 255, 255, 0.1);
}

.multi-panel {
    position: fixed;
    bottom: 85px;
    right: 25px;
    width: 380px;
    height: 550px;
    background: rgba(10, 10, 24, 0.88);
    border: 1px solid rgba(100, 110, 200, 0.3);
    border-radius: 6px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), inset 0 0 20px rgba(99, 102, 241, 0.1);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(20px);
    color: #e2e8f0;
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    animation: slideFadeIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.multi-panel.hidden {
    display: none !important;
}

.mp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: linear-gradient(90deg, rgba(30, 27, 75, 0.4), rgba(15, 23, 42, 0.4));
    border-bottom: 1px solid rgba(100, 110, 200, 0.25);
}
.mp-header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: #fff;
    text-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
    text-transform: uppercase;
}
.mp-close-btn {
    background: none;
    border: none;
    color: #8a8ab0;
    font-size: 1.6rem;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
}
.mp-close-btn:hover {
    color: #fff;
    transform: scale(1.1);
}

.mp-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.mp-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(100, 110, 200, 0.2);
}
.mp-tabs button {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    color: #7878a0;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    transition: all 0.3s;
}
.mp-tabs button.active {
    color: #fff;
    background: rgba(99, 102, 241, 0.15);
    border-bottom: 2px solid #818cf8;
    text-shadow: 0 0 8px rgba(129, 140, 248, 0.6);
}

#auth-form-container {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.auth-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.auth-group label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #8a8ab0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.auth-group input {
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(100, 110, 200, 0.2);
    border-radius: 4px;
    color: white;
    font-size: 0.9rem;
    transition: all 0.3s;
}
.auth-group input:focus {
    outline: none;
    border-color: rgba(129, 140, 248, 0.6);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
    background: rgba(255, 255, 255, 0.05);
}
.auth-hint {
    font-size: 0.75rem;
    color: #60608a;
    line-height: 1.5;
}

.mp-user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid rgba(100, 110, 200, 0.15);
    font-size: 0.8rem;
    color: #a0aec0;
}
.mp-user-info strong {
    color: #fff;
    text-shadow: 0 0 5px rgba(255,255,255,0.2);
}

.mp-nav-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.5);
    border-bottom: 1px solid rgba(100, 110, 200, 0.15);
}
.mp-nav-btn {
    flex: 1;
    padding: 12px 0;
    background: none;
    border: none;
    color: #7878a0;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.05em;
    transition: all 0.3s;
}
.mp-nav-btn.active {
    color: #fff;
    background: rgba(99, 102, 241, 0.1);
    box-shadow: inset 0 -2px 0 #818cf8;
}

.mp-tab-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 16px;
    background: linear-gradient(180deg, rgba(10, 10, 24, 0) 0%, rgba(5, 5, 12, 0.5) 100%);
}
.mp-tab-content.hidden {
    display: none !important;
}

.chat-box {
    flex: 1;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(100, 110, 200, 0.15);
    border-radius: 4px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}
.chat-item {
    font-size: 0.85rem;
    line-height: 1.5;
    animation: slideFadeIn 0.2s ease forwards;
}
.chat-item strong {
    color: #818cf8;
    margin-right: 6px;
}
.chat-item.system {
    color: #fbbf24;
    text-align: center;
    font-style: italic;
    background: rgba(251, 191, 36, 0.05);
    padding: 4px;
    border-radius: 4px;
    border: 1px dashed rgba(251, 191, 36, 0.2);
}
.chat-input-row {
    display: flex;
    gap: 8px;
}
.chat-input-row input {
    flex: 1;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(100, 110, 200, 0.2);
    border-radius: 4px;
    color: white;
    font-size: 0.9rem;
    transition: all 0.3s;
}
.chat-input-row input:focus {
    outline: none;
    border-color: rgba(129, 140, 248, 0.5);
    background: rgba(255, 255, 255, 0.05);
}
.chat-input-row button {
    padding: 10px 20px;
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}
.chat-input-row button:hover {
    filter: brightness(1.15);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.friend-add-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.friend-add-row input {
    flex: 1;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(100, 110, 200, 0.2);
    border-radius: 4px;
    color: white;
    font-size: 0.9rem;
}
.friend-add-row button {
    padding: 10px 20px;
    background: linear-gradient(135deg, #059669, #047857);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: white;
    font-weight: 700;
    cursor: pointer;
}
.friend-list, .friend-sub-list {
    overflow-y: auto;
    max-height: 180px;
    margin-bottom: 12px;
}
.friend-list h4, .friend-sub-list h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #8a8ab0;
    margin-bottom: 8px;
    border-left: 3px solid #818cf8;
    padding-left: 6px;
}
.friend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 8px;
    border-bottom: 1px solid rgba(100, 110, 200, 0.1);
    font-size: 0.9rem;
}
.friend-item.pending {
    background: rgba(251, 191, 36, 0.03);
    border-radius: 4px;
}
.friend-item .status.online {
    color: #10b981;
    font-size: 0.75rem;
    font-weight: 700;
}
.friend-item .status.offline {
    color: #60608a;
    font-size: 0.75rem;
}

.room-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}
.room-actions button {
    flex: 1;
    padding: 10px 0;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    font-weight: 700;
    font-size: 0.85rem;
    transition: all 0.3s;
}
.room-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.room-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(100, 110, 200, 0.15);
    border-radius: 4px;
    transition: all 0.3s;
}
.room-item:hover {
    background: rgba(99, 102, 241, 0.05);
    border-color: rgba(100, 110, 200, 0.3);
}
.room-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.room-info strong {
    font-size: 0.95rem;
    color: #fff;
}
.type-tag {
    font-size: 0.75rem;
    font-weight: 700;
    color: #818cf8;
}
.members-tag {
    font-size: 0.75rem;
    color: #8a8ab0;
}

.active-room-view {
    position: absolute;
    top: 48px;
    left: 0;
    width: 100%;
    height: calc(100% - 48px);
    background: #06060f;
    z-index: 100;
    display: flex;
    flex-direction: column;
    padding: 16px;
    box-sizing: border-box;
}
.active-room-view h4 {
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 12px;
    text-shadow: 0 0 8px rgba(99,102,241,0.4);
}
#room-member-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}
.room-member-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(100, 110, 200, 0.2);
    border-radius: 4px;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}
.badge.ready {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid #10b981;
    color: #10b981;
    padding: 2px 6px;
    border-radius: 2px;
    font-size: 0.7rem;
    font-weight: 700;
}
.badge.waiting {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #60608a;
    color: #8a8ab0;
    padding: 2px 6px;
    border-radius: 2px;
    font-size: 0.7rem;
}
.room-control-buttons {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}
.room-control-buttons button {
    flex: 1;
    padding: 12px 0;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.1);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
}

/* ボタン汎用クラス */
.btn-sm {
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.05);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}
.btn-primary { 
    background: linear-gradient(135deg, #4f46e5, #4338ca); 
    color: white; 
}
.btn-secondary { 
    background: rgba(255, 255, 255, 0.05); 
    color: #a0aec0; 
    border: 1px solid rgba(100,100,150,0.2);
}
.btn-success { 
    background: linear-gradient(135deg, #10b981, #059669); 
    color: white; 
}
.btn-danger { 
    background: linear-gradient(135deg, #ef4444, #dc2626); 
    color: white; 
}
.btn-sm.success { 
    background: rgba(16, 185, 129, 0.15); 
    border: 1px solid #10b981;
    color: #10b981; 
}
.btn-sm.danger { 
    background: rgba(239, 68, 68, 0.15); 
    border: 1px solid #ef4444;
    color: #ef4444; 
}
.btn-sm:hover, .btn-primary:hover, .btn-secondary:hover, .btn-success:hover, .btn-danger:hover {
    filter: brightness(1.2);
}


