:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-color: #ffffff;

    /* Portama Theme */
    --portama-yellow: #fffaf0;
    --portama-orange: #f48c06;
    --portama-dark: #1e293b;
    --portama-bg: #f7f9fc;
}

html {
    scrollbar-gutter: stable;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', 'Noto Sans JP', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Base Body Style (Login/Profile pages use centering) */
body.centered-mode {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-gradient);
    color: var(--text-color);
    padding: 80px 20px 20px;
    /* Top padding for fixed header */
}

/* Portama Standard Body (Landing/BBS/Square) */
body.portama-mode {
    background: var(--portama-bg);
    color: var(--portama-dark);
    margin: 0;
    overflow-x: hidden;
    padding-top: 80px;
    /* Top padding for fixed header */
}

@media (max-width: 768px) {
    body.portama-mode {
        padding-top: 65px;
        /* Smaller header padding on mobile */
    }
}

/* Global Navigation Wrapper */
#header-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 2000;
}

nav.global-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 5px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(42, 30, 92, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
}

.logo-container,
.header-right-actions {
    flex: 1;
    display: flex;
    align-items: center;
}

.header-right-actions {
    justify-content: flex-end;
}

.logo {
    color: var(--portama-orange);
    font-size: 1.8rem;
    font-weight: 800;
    text-decoration: none;
    letter-spacing: -1px;
}

.nav-links {
    display: flex;
    gap: 30px;
    align-items: center;
    flex: 1;
    justify-content: center;
}

.nav-link {
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    opacity: 0.8;
    transition: 0.3s;
    position: relative;
    white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
    opacity: 1;
    color: var(--portama-orange);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--portama-orange);
}

/* Language Switcher - Desktop Default */
.lang-switcher-container {
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2100;
}

.lang-trigger {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 600;
    transition: 0.3s;
}

.lang-trigger:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.lang-trigger::after {
    content: '▼';
    margin-left: 8px;
    font-size: 0.7rem;
    opacity: 0.5;
}

/* Base Dropdown Styles */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 15px);
    right: 0;
    width: 180px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 3000;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.dropdown-menu.show {
    display: flex;
}

.dropdown-item {
    padding: 12px 15px;
    text-decoration: none;
    color: var(--portama-dark);
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s;
    border-bottom: 1px solid #eee;
    text-align: left;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: #f8f9fa;
    color: var(--portama-orange);
}

.dropdown-item.active-lang {
    background: #f8f9fa;
    color: var(--portama-orange);
    font-weight: 700;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    nav.global-nav {
        padding: 10px 20px;
    }

    .logo {
        font-size: 1.4rem;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%;
        height: 100vh;
        background: rgba(42, 30, 92, 0.98);
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 25px;
        transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        z-index: 3050;
        overflow-y: auto;
        padding: 40px;
        flex: none;
    }

    .nav-links.active {
        right: 0;
    }

    .nav-link {
        font-size: 1.4rem;
        padding: 10px 30px;
        border-radius: 30px;
        width: auto;
    }

    .nav-link.active {
        background: rgba(255, 255, 255, 0.1);
        color: var(--portama-yellow);
    }

    .nav-link.active::after {
        display: none;
    }

    /* Multi-language menu inside hamburger */
    .lang-switcher-container {
        position: static;
        width: 100%;
        transform: none;
        margin-top: 10px;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .lang-trigger {
        background: rgba(255, 255, 255, 0.05);
        border: none;
        width: auto;
        font-size: 1.4rem;
        padding: 10px 30px;
        border-radius: 30px;
        justify-content: center;
    }

    .lang-switcher-container .dropdown-menu {
        position: static;
        width: auto;
        min-width: 200px;
        background: transparent;
        box-shadow: none;
        border: none;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out;
    }

    .lang-switcher-container .dropdown-menu.show {
        max-height: 500px;
        display: flex;
        margin-top: 10px;
    }

    .lang-switcher-container .dropdown-item {
        color: rgba(255, 255, 255, 0.7);
        text-align: center;
        width: auto;
        font-size: 1.1rem;
        border: none;
        padding: 10px 30px;
    }

    .lang-switcher-container .dropdown-item.active-lang {
        color: white;
        background: rgba(255, 255, 255, 0.1);
    }

    /* Menu Toggle */
    .menu-toggle {
        display: flex;
        flex-direction: column;
        gap: 5px;
        cursor: pointer;
        z-index: 3100;
    }

    .menu-toggle span {
        width: 25px;
        height: 3px;
        background: white;
        border-radius: 3px;
        transition: 0.3s;
    }

    .menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 6px);
    }

    .menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -7px);
    }
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
    color: white;
}

.user-avatar-nav {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--portama-yellow);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--portama-dark);
    font-weight: bold;
    overflow: hidden;
    text-decoration: none;
    transition: transform 0.3s;
}

.user-avatar-nav:hover {
    transform: scale(1.1);
}

.user-avatar-nav img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-premium {
    background: var(--portama-yellow);
    color: var(--portama-dark);
    padding: 10px 25px;
    border-radius: 30px;
    font-weight: bold;
    text-decoration: none;
    transition: all 0.3s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-premium:hover {
    box-shadow: 0 5px 15px rgba(255, 210, 63, 0.4);
    transform: translateY(-2px);
}

/* User Dropdown */
.user-menu-container {
    position: relative;
    display: flex;
    align-items: center;
}

.user-trigger {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 15px);
    right: 0;
    width: 200px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 3000;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

.dropdown-menu.show {
    display: flex;
}

.dropdown-header {
    padding: 15px;
    background: var(--portama-dark);
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
}

.dropdown-item {
    padding: 12px 15px;
    text-decoration: none;
    color: var(--portama-dark);
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s;
    border-bottom: 1px solid #eee;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: #f8f9fa;
    color: var(--portama-orange);
}

/* Original Components */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

h1 {
    font-size: 2rem;
    margin-bottom: 30px;
    text-align: center;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    opacity: 0.9;
}

input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
}

input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

button.btn-premium {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    /* margin-top: 10px; */
}

button.btn-premium:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

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

.alert {
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    text-align: center;
}

.alert-error {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert-success {
    background: rgba(34, 197, 94, 0.2);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #86efac;
}

.footer-text {
    margin-top: 25px;
    text-align: center;
    font-size: 0.9rem;
    opacity: 0.7;
}

.footer-text a {
    color: white;
    text-decoration: none;
    font-weight: 600;
    opacity: 1;
}

.footer-text a:hover {
    text-decoration: underline;
}

/* 追加機能用スタイル */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.checkbox-group input {
    width: 20px !important;
    height: 20px !important;
    margin: 0 !important;
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-group label {
    margin: 0 !important;
    font-size: 0.9rem;
    white-space: nowrap;
    opacity: 0.9;
}

/* ログイン画面の紫線を消すための徹底的な上書き */
.centered-mode .form-group {
    border: none !important;
    box-shadow: none !important;
    background: none !important;
}

.profile-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--glass-border);
}

.avatar-upload {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.avatar-upload input {
    display: none;
}

.avatar-upload:hover .user-avatar {
    background: rgba(255, 255, 255, 0.3);
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    pointer-events: none;
    /* 画像へのイベントを無視して親のlabelに任せる */
}

/* アバターホバー時のオーバーレイ表示 */
.avatar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    opacity: 0;
    transition: opacity 0.3s;
    text-align: center;
    padding: 10px;
    box-sizing: border-box;
    pointer-events: none;
}

.avatar-upload:hover .avatar-overlay {
    opacity: 1;
}

.user-avatar {
    user-select: none;
    -webkit-user-select: none;
    cursor: pointer;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    margin-top: 10px;
}

/* Okinawan Modern Design (Bingta Mode) */
body.bingta-mode {
    background-color: var(--portama-bg);
    padding-bottom: 60px;
}

.glass-container {
    max-width: 1100px;
    margin: 30px auto 50px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    border-radius: 30px;
    padding: 60px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.bingta-hero h1 {
    font-size: clamp(3rem, 10vw, 5rem);
    color: var(--portama-dark);
    text-shadow: 2px 2px 0 white;
    margin-bottom: 0;
    line-height: 1.1;
}

.bingta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
    margin-top: 15px;
}

.bingta-card {
    background: white;
    padding: 30px 20px;
    border-radius: 20px;
    text-align: center;
    border-bottom: 6px solid var(--portama-orange);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-decoration: none;
    color: var(--portama-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.bingta-card:hover {
    transform: scale(1.05) translateY(-10px);
    box-shadow: 0 15px 35px rgba(238, 66, 102, 0.15);
}

.bingta-card .icon {
    font-size: 2.5rem;
}

@media (max-width: 768px) {
    .glass-container {
        margin: 10px 15px 30px;
        padding: 30px 20px;
    }

    .bingta-hero h1 {
        font-size: 3rem;
    }
}

/* Cookie Banner - Premium Glassmorphism */
.cookie-banner {
    position: fixed !important;
    bottom: 30px !important;
    right: 30px !important;
    width: 400px !important;
    max-width: calc(100% - 60px) !important;
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    border-radius: 28px !important;
    padding: 30px !important;
    box-shadow: 0 25px 50px rgba(42, 30, 92, 0.2) !important;
    z-index: 10000 !important;
    animation: cookieSlideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
    font-family: inherit !important;
    text-align: left !important;
}

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

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

.cookie-banner h4 {
    margin: 0 !important;
    font-size: 1.25rem !important;
    font-weight: 800 !important;
    color: var(--portama-dark) !important;
    letter-spacing: -0.5px !important;
    text-align: left !important;
    line-height: 1.2 !important;
}

.cookie-banner p {
    font-size: 0.95rem !important;
    line-height: 1.6 !important;
    margin: 0 !important;
    color: var(--portama-dark) !important;
    opacity: 0.9 !important;
    text-align: left !important;
}

.cookie-banner .cookie-links {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 12px 20px !important;
    font-size: 0.85rem !important;
}

.cookie-banner .cookie-links a {
    color: var(--portama-orange) !important;
    text-decoration: none !important;
    font-weight: 700 !important;
    transition: all 0.3s !important;
    border-bottom: 1px solid transparent !important;
}

.cookie-banner .cookie-links a:hover {
    color: var(--portama-dark) !important;
    border-bottom: 1px solid var(--portama-dark) !important;
}

.cookie-banner .cookie-actions {
    display: flex !important;
    justify-content: flex-end !important;
    margin-top: 5px !important;
}

.cookie-banner .accept-btn {
    background: var(--portama-orange) !important;
    color: white !important;
    border: none !important;
    padding: 12px 35px !important;
    border-radius: 40px !important;
    font-weight: 700 !important;
    font-size: 1rem !important;
    cursor: pointer !important;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    width: auto !important;
    display: inline-block !important;
    box-shadow: 0 4px 15px rgba(238, 66, 102, 0.3) !important;
}

.cookie-banner .accept-btn:hover {
    background: var(--portama-dark) !important;
    transform: translateY(-4px) !important;
    box-shadow: 0 10px 25px rgba(42, 30, 92, 0.3) !important;
}

@keyframes cookieFadeDown {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
}

@media (max-width: 480px) {
    .cookie-banner {
        bottom: 20px !important;
        right: 15px !important;
        left: 15px !important;
        width: auto !important;
        padding: 25px 20px !important;
        border-radius: 24px !important;
    }

    .cookie-banner .accept-btn {
        width: 100% !important;
        text-align: center !important;
    }
}

/* Kunkunshi Plaza (kunkun4) specific styles */
.kunkun4-header {
    max-width: 1200px;
    margin: 10px auto 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.search-wrapper {
    flex: 1;
    min-width: 300px;
    position: relative;
}

.search-wrapper input {
    background: white;
    color: var(--portama-dark);
    padding: 12px 16px 12px 45px;
    border-radius: 30px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    width: 100%;
    font-size: 1rem;
    transition: 0.3s;
}

.search-wrapper input:focus {
    outline: none;
    border-color: var(--portama-orange);
    box-shadow: 0 0 0 4px rgba(238, 66, 102, 0.1);
}

.search-wrapper::before {
    content: '🔍';
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
    z-index: 1;
}

.filter-tabs {
    display: flex;
    background: rgba(42, 30, 92, 0.05);
    padding: 5px;
    border-radius: 40px;
    gap: 5px;
}

.filter-tab {
    padding: 10px 25px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.3s;
    font-size: 0.9rem;
    color: var(--portama-dark);
    opacity: 0.6;
    user-select: none;
}

.filter-tab.active {
    background: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    opacity: 1;
    color: var(--portama-orange);
}

.kunkun-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 20px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.kunkun-card {
    background: #ffffff;
    /* 白背景に変更してコントラストを強化 */
    border: 1px solid #e2e8f0;
    /* ソフトなグレーの枠線を追加して視認性を大幅向上 */
    border-radius: 25px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 320px;
    transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.04);
    /* 上品な柔らかい影に調整 */
}

.kunkun-card:hover {
    border-color: var(--portama-orange);
    box-shadow: 0 10px 40px rgba(238, 66, 102, 0.15);
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 20px 0;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.divider:not(:empty)::before {
    margin-right: .5em;
}

.divider:not(:empty)::after {
    margin-left: .5em;
}

#google-signin-btn {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    width: 100%;
    overflow: hidden;
    /* 防止ボタンがはみ出る場合 */
}

.kunkun-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background: var(--portama-orange);
    opacity: 0;
    transition: 0.3s;
}

.kunkun-card:hover::after {
    opacity: 1;
}

.kunkun-card h3 {
    font-size: 1.4rem;
    color: var(--portama-dark);
    margin-bottom: 5px;
    line-height: 1.3;
    text-align: left;
    transition: all 0.3s ease;
}

.song-title-link {
    text-decoration: none;
}

.song-title-link:hover h3 {
    color: var(--portama-orange);
    text-shadow: 0 2px 10px rgba(244, 140, 6, 0.25);
}

.kunkun-card .author {
    font-size: 0.85rem;
    opacity: 0.6;
    margin-bottom: 20px;
}

.kunkun-card .price-tag {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--portama-orange);
    margin-bottom: 20px;
}

.kunkun-card .price-tag.free {
    color: #22c55e;
}

.kunkun-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-kunkun {
    padding: 12px;
    border-radius: 14px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    font-size: 0.95rem;
    transition: 0.3s;
    border: none;
    cursor: pointer;
    width: 100%;
}

.btn-edit,
.btn-pdf-preview {
    background: rgba(238, 66, 102, 0.1);
    color: var(--portama-orange);
}

.btn-edit:hover,
.btn-pdf-preview:hover {
    background: var(--portama-orange);
    color: white;
}

.btn-cart {
    background: var(--portama-yellow) !important;
    color: var(--portama-dark) !important;
}

.btn-mysongs {
    background: var(--portama-dark) !important;
    color: white !important;
}

.btn-cart:hover,
.btn-mysongs:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .kunkun4-header {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-tabs {
        justify-content: center;
    }
}

/* Cart & Modal Styles */
.cart-float-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 65px;
    height: 65px;
    background: var(--portama-orange);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(255, 107, 53, 0.4);
    z-index: 1000;
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cart-float-btn:hover {
    transform: scale(1.1) rotate(-10deg);
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #f44336;
    color: white;
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: 20px;
    border: 2px solid white;
    font-weight: bold;
}

.cart-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    transition: 0.3s;
}

.cart-modal.show {
    opacity: 1;
    display: flex;
}

.cart-content {
    background: white;
    width: 90%;
    max-width: 500px;
    border-radius: 30px;
    padding: 25px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    transform: translateY(30px);
    transition: 0.3s;
    max-height: 95vh;
    overflow-y: auto;
}

.cart-modal.show .cart-content {
    transform: translateY(0);
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    opacity: 0.5;
    padding: 0;
    line-height: 1;
}

.cart-items-list {
    max-height: 28vh;
    overflow-y: auto;
    margin-bottom: 20px;
    padding-right: 12px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f9f9f9;
}

.cart-item-info {
    flex: 1;
}

.cart-item-info h4 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--portama-dark);
}

.cart-item-info p {
    margin: 5px 0 0;
    opacity: 0.6;
    font-size: 0.85rem;
}

.cart-item-price {
    font-weight: bold;
    color: var(--portama-orange);
    margin-left: 15px;
}

.remove-item {
    background: none !important;
    border: none !important;
    color: #ff5252 !important;
    cursor: pointer;
    font-size: 0.85rem !important;
    padding: 5px !important;
    margin-left: 10px !important;
    width: auto !important;
    box-shadow: none !important;
    transform: none !important;
    margin-top: 0 !important;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.3rem;
    font-weight: 800;
    padding-top: 15px;
    border-top: 2px solid #eee;
    color: var(--portama-dark);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333;
    color: white;
    padding: 12px 30px;
    border-radius: 50px;
    z-index: 3000;
    transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    white-space: nowrap;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* Purchased Ribbon & Tag */
.kunkun-card {
    position: relative;
    overflow: hidden;
    /* Ribbon positioning */
}

.card-ribbon {
    position: absolute;
    top: 5px;
    left: -35px;
    background: var(--portama-orange);
    width: 120px;
    height: 15px;
    /* Text removed, just a strip */
    transform: rotate(-45deg);
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    pointer-events: none;
}

.card-ribbon.free {
    background: #4CAF50;
    /* Green for free items */
}

.price-tag.purchased {
    background: rgba(238, 66, 102, 0.1) !important;
    color: #EE4266 !important;
    border: 1px solid rgba(238, 66, 102, 0.3);
    font-weight: 700;
    box-shadow: none !important;
}

.price-tag.free {
    background: rgba(76, 175, 80, 0.1) !important;
    color: #4CAF50 !important;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

/* YouTube & Requests Styles */
.card-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 5px;
}

.card-title-row h3 {
    margin-bottom: 0 !important;
    flex: 1;
}

.yt-link {
    display: flex;
    align-items: center;
    color: #FF0000;
    transition: transform 0.2s;
}

.yt-link:hover {
    transform: scale(1.1);
}

.yt-icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.yt-link-small .yt-icon {
    width: 20px;
    height: 20px;
}

/* Request Cards */
.request-card {
    border: 1px solid rgba(238, 66, 102, 0.15) !important;
}

.requester {
    font-size: 0.8rem;
    opacity: 0.6;
    margin-top: 5px;
}

.comment {
    font-size: 0.85rem;
    margin-top: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-style: italic;
    max-height: 100px;
    overflow-y: auto;
    word-break: break-all;
}

.comment::-webkit-scrollbar {
    width: 4px;
}

.comment::-webkit-scrollbar-track {
    background: transparent;
}

.comment::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.request-actions {
    margin-top: 15px;
    display: flex;
    justify-content: flex-end;
}

.btn-like {
    background: white;
    border: 1px solid #ddd;
    border-radius: 25px;
    padding: 6px 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--portama-dark);
    /* 明示的に暗い色を指定 */
    font-weight: 700;
}

.btn-like:hover {
    transform: scale(1.05);
    border-color: var(--portama-orange);
    background: rgba(238, 66, 102, 0.05);
}

.btn-like.liked {
    background: var(--portama-orange);
    color: white !important;
    border-color: var(--portama-orange);
}

.btn-like.liked .heart {
    filter: brightness(1.5);
}

.btn-like .count {
    font-weight: 700;
    font-size: 0.9rem;
}

/* Card Options & Dropdown */
.card-options {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.kebab-trigger {
    background: transparent;
    border: none;
    color: var(--portama-dark);
    font-size: 1.4rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
    opacity: 0.7;
}

.kebab-trigger:hover {
    background: rgba(42, 30, 92, 0.05);
    opacity: 1;
}

.request-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(42, 30, 92, 0.1);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    min-width: 160px;
    z-index: 100;
    display: none;
    padding: 8px 0;
    margin-top: 5px;
}

.request-dropdown.show {
    display: block;
    animation: menuFadeIn 0.2s ease-out;
}

@keyframes menuFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

.dropdown-item-btn {
    width: 100%;
    text-align: left;
    padding: 10px 16px;
    background: transparent;
    border: none;
    font-size: 0.9rem;
    color: var(--portama-dark);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dropdown-item-btn:hover {
    background: rgba(42, 30, 92, 0.05);
}

.dropdown-item-btn.btn-delete {
    color: #ff4d4d;
}

/* FAB */
.fab-request {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--portama-orange);
    color: white;
    border: none;
    font-size: 30px;
    box-shadow: 0 4px 15px rgba(238, 66, 102, 0.4);
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s;
}

.fab-request:hover {
    transform: scale(1.1) rotate(90deg);
}

/* Unified Search & Sort Bar */
.search-wrapper {
    display: flex;
    gap: 10px;
    background: rgba(42, 30, 92, 0.1);
    padding: 5px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    transition: all 0.3s;
    position: relative;
    /* アイコン配置用 */
}

.search-wrapper::before {
    content: "🔍";
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    pointer-events: none;
    z-index: 5;
    opacity: 0.6;
}

.search-wrapper:focus-within {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--portama-orange);
    box-shadow: 0 0 15px rgba(238, 66, 102, 0.2);
}

.search-wrapper input {
    flex: 1;
    background: transparent;
    border: none !important;
    box-shadow: none !important;
    padding: 10px 10px 10px 45px !important;
    /* 左側にアイコン分を確保 */
    color: var(--portama-dark);
}

.search-wrapper input::placeholder {
    color: rgba(42, 30, 92, 0.5);
}

.search-wrapper .sort-select {
    width: auto;
    min-width: 130px;
    background: white;
    border: none;
    border-radius: 30px;
    padding: 0 15px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

/* Modal Base & Enhancements */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 3000;
    overflow-y: auto;
    padding: 40px 20px;
}

.modal.show {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 500px;
    border-radius: 20px;
    padding: 30px;
    margin: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    position: relative;
    color: var(--portama-dark);
}

.modal-content.glass-effect {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--portama-dark);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: white;
    color: var(--portama-dark);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 30px;
}

.btn-primary {
    background: #eee;
    padding: 12px 25px;
    border-radius: 10px;
    cursor: pointer;
    color: var(--portama-dark);
}

.btn-cancel {
    background: #eee;
    border: none;
    padding: 12px 25px;
    border-radius: 10px;
    cursor: pointer;
    color: var(--portama-dark);
}

/* Tip Box */
.tip-box {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 15px 25px;
    margin: 15px auto 15px;
    color: var(--portama-dark);
    font-size: 0.95rem;
    line-height: 1.6;
    text-align: center;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
    max-width: 800px;
}

.request-notes {
    margin-top: 20px;
    font-size: 0.75rem;
    color: var(--portama-dark);
    opacity: 0.7;
    line-height: 1.6;
    padding: 12px;
    background: rgba(42, 30, 92, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(42, 30, 92, 0.1);
}

/* Welcome Modal */
.welcome-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(42, 30, 92, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.welcome-overlay.show {
    opacity: 1;
    visibility: visible;
}

.welcome-modal {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 32px;
    padding: 40px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.2);
    transform: translateY(20px) scale(0.95);
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: center;
}

.welcome-overlay.show .welcome-modal {
    transform: translateY(0) scale(1);
}

.welcome-modal h2 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 25px;
    color: var(--portama-dark);
}

.welcome-section {
    margin-bottom: 30px;
    text-align: left;
    background: rgba(42, 30, 92, 0.03);
    padding: 20px;
    border-radius: 20px;
    border: 1px solid rgba(42, 30, 92, 0.05);
}

.welcome-section h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--portama-orange);
    display: flex;
    align-items: center;
    gap: 8px;
}

.welcome-section p {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #444;
    margin: 0;
}

.migration-link {
    display: inline-block;
    margin-top: 10px;
    color: #2A1E5C;
    font-weight: 700;
    text-decoration: underline;
    font-size: 0.95rem;
}

.migration-link:hover {
    color: var(--portama-orange);
}

@keyframes welcomeFadeOut {
    from {
        opacity: 1;
        visibility: visible;
    }

    to {
        opacity: 0;
        visibility: hidden;
        transform: scale(1.05);
    }
}

/* Kunkunshi Plaza Mobile Responsive Improvements */
@media (max-width: 576px) {
    .kunkun4-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .search-wrapper {
        flex-direction: column !important;
        border-radius: 24px !important;
        padding: 8px !important;
        gap: 8px !important;
    }

    .search-wrapper::before {
        top: 25px !important;
        transform: translateY(-50%) !important;
    }

    .search-wrapper input {
        padding: 10px 10px 10px 40px !important;
        font-size: 0.95rem !important;
        width: 100% !important;
    }

    .search-wrapper .sort-select {
        width: 100% !important;
        padding: 10px 15px !important;
        height: 40px !important;
        font-size: 0.9rem !important;
        border-radius: 18px !important;
    }

    .filter-tabs {
        display: flex !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 4px !important;
        border-radius: 30px !important;
    }

    .filter-tabs::-webkit-scrollbar {
        display: none !important;
        /* スクロールバーを隠す */
    }

    .filter-tab {
        padding: 8px 18px !important;
        font-size: 0.85rem !important;
        white-space: nowrap !important;
        /* 改行を防止 */
        flex-shrink: 0 !important;
        /* 縮み防止 */
        border-radius: 24px !important;
    }
}