/* Reset and Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Prevent zoom on all form inputs on iOS */
input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="search"],
textarea,
select {
    font-size: 16px !important; /* Prevent iOS zoom */
}

/* Additional iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    input, textarea, select {
        font-size: 16px !important;
    }
}


body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #7e8ba3 100%);
    background-attachment: fixed;
    color: #333;
    overflow-x: hidden;
    min-height: 100vh;
}

/* App Container */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

.app-container::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3), transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3), transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(255, 167, 196, 0.2), transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
    background-blend-mode: overlay;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.app-title {
    font-size: 16px;
    font-weight: bold;
}

.app-title a {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.3s;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.app-title a:hover {
    opacity: 0.8;
}

.app-logo {
    height: 35px;
    width: auto;
    object-fit: contain;
}

.app-subtitle {
    color: white;
    font-size: 11px;
    font-weight: 400;
    margin: 0;
    white-space: nowrap;
    line-height: 1;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* Admin Access Bar */
.admin-access-bar {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    padding: 10px 20px;
    text-align: center;
    position: sticky;
    top: 60px;
    z-index: 99;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.admin-access-btn {
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.1) 100%);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 8px 20px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.admin-access-btn:hover {
    background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0.2) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.admin-access-btn .icon {
    font-size: 18px;
}

.icon-btn {
    background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0.1) 100%);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    backdrop-filter: blur(10px);
}

.delete-card-btn {
    width: 32px;
    height: 32px;
    background: #f5f5f5;
}

.delete-card-btn:hover {
    background: #ffebee;
}

.icon-btn:hover {
    background: linear-gradient(135deg, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0.2) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.icon {
    font-size: 20px;
}

/* ゲストユーザー用のロックされたヘッダーアイコン */
.icon-btn.locked {
    position: relative;
    opacity: 0.6;
    cursor: not-allowed;
}

.icon-btn.locked:hover {
    background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0.1) 100%);
    transform: none;
    box-shadow: none;
}

.icon-btn.locked::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        transparent 45%,
        #e74c3c 45%,
        #e74c3c 55%,
        transparent 55%
    );
    pointer-events: none;
    border-radius: 50%;
    z-index: 1;
}

.icon-btn.locked .icon {
    filter: grayscale(100%);
}

/* Header user avatar */
.header-user-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    color: #667eea;
    overflow: hidden;
    flex-shrink: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.header-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: high-quality;
    -ms-interpolation-mode: bicubic;
}

.profile-btn {
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-btn:hover .header-user-avatar {
    opacity: 0.9;
}

.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff1744;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
}

.notification-dot {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 10px;
    height: 10px;
    background: #ff1744;
    border-radius: 50%;
    box-shadow: 0 0 0 2px white;
}

/* Side Menu */
.side-menu {
    position: fixed;
    right: -280px;
    top: 0;
    bottom: 0;
    width: 280px;
    background: white;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    transition: right 0.3s;
    z-index: 200;
    display: flex;
    flex-direction: column;
}

.side-menu.open {
    right: 0;
}

.menu-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
    overflow: hidden;
}

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

.user-details h3 {
    font-size: 18px;
    margin-bottom: 5px;
}

.user-stats {
    font-size: 12px;
    opacity: 0.9;
}

.user-stats span {
    margin-right: 10px;
}

.menu-nav {
    flex: 1;
    padding: 20px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s;
}

.menu-item:hover {
    background: #f5f5f5;
    color: #667eea;
}

.menu-footer {
    padding: 20px;
}

.logout-btn {
    padding: 8px 20px;
    background: #ff5252;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(255,82,82,0.3);
}

.logout-btn:hover {
    background: #ff1744;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255,82,82,0.4);
}


/* Login Info Section */
.login-info-section {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 1px solid #ffeaa7;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
}

.login-info-warning {
    color: #856404;
    font-weight: bold;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Profile Modal Styles */
.profile-modal-content {
    max-width: 450px;
    max-height: 600px;
    display: flex;
    flex-direction: column;
}

.profile-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.profile-modal-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 15px;
}

.profile-modal-top {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.profile-modal-details {
    background: linear-gradient(135deg, #f5f7fa 0%, #f0f2f5 100%);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
}

.profile-modal-detail {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.profile-modal-detail:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.profile-modal-detail .detail-label {
    font-size: 13px;
    color: #666;
    font-weight: 500;
    min-width: 100px;
}

.profile-modal-detail .detail-value {
    font-size: 14px;
    color: #333;
    font-weight: 600;
}

.profile-modal-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #4ECDC4;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: bold;
    color: white;
    overflow: hidden;
    flex-shrink: 0;
}

.profile-modal-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: auto;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
}

.profile-modal-info {
    text-align: center;
    width: 100%;
}

.profile-modal-info h4 {
    margin: 0 0 8px 0;
    font-size: 20px;
    color: #333;
}

.profile-modal-bio {
    margin: 0;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

.profile-modal-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.profile-modal-stats .stat {
    text-align: center;
}

.profile-modal-cards {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.profile-modal-card-section h5 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #333;
}

.profile-modal-cards-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    min-height: 60px;
}

.profile-modal-cards-list .empty-state {
    grid-column: 1 / -1;
    text-align: center;
    margin: 0;
    padding: 15px;
    color: #666;
}

.profile-modal-cards-list .my-card-item {
    width: 60px;
    height: 80px;
}

.profile-modal-cards-list .my-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

/* プロフィールモーダルのカード表示 */
.profile-modal-card-item {
    width: 60px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-modal-card-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    position: relative;
    z-index: 1;
    overflow-x: hidden;
}

/* Footer */
.app-footer {
    background: rgba(0, 0, 0, 0.8);
    padding: 20px;
    text-align: center;
    position: relative;
    z-index: 10;
}

.footer-links {
    font-size: 14px;
}

.footer-links a {
    color: #ccc;
    text-decoration: none;
    transition: color 0.2s;
}

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

.footer-links .separator {
    color: #666;
    margin: 0 10px;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

/* Page Titles */
.content-section h2 {
    color: white;
    font-size: 22px;
    font-weight: 600;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

/* Home Section */
.welcome-message {
    margin-bottom: 20px;
    text-align: center;
}

.welcome-message h3 {
    font-size: 24px;
    margin-bottom: 10px;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.welcome-message p {
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}


/* Icon Guide Section */
.icon-guide {
    background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.9) 100%);
    padding: 25px;
    border-radius: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.3);
}

.icon-guide h3 {
    font-size: 20px;
    margin-bottom: 20px;
    color: #333;
    font-weight: 600;
}

.icon-guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.icon-guide-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.05);
    transition: all 0.2s ease;
    cursor: pointer;
}

.icon-guide-item:hover {
    background: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.icon-guide-item .icon {
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.icon-guide-item .icon-description {
    flex: 1;
    font-size: 14px;
    color: #555;
    font-weight: 500;
}

/* ゲストユーザー用のロックされた機能ガイドアイテム */
.icon-guide-item.locked {
    position: relative;
    opacity: 0.6;
    cursor: not-allowed;
}

.icon-guide-item.locked:hover {
    background: #f8f9fa;
    transform: none;
    box-shadow: none;
}

.icon-guide-item.locked::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        transparent 45%,
        #e74c3c 45%,
        #e74c3c 55%,
        transparent 55%
    );
    pointer-events: none;
    border-radius: 12px;
}

.icon-guide-item.locked .icon {
    filter: grayscale(100%);
}

.icon-guide-item.locked .icon-description {
    color: #999;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.action-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 20px;
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 5px 20px rgba(102,126,234,0.3);
    color: white;
    position: relative;
    overflow: hidden;
}

.action-card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
    transform: rotate(45deg);
    transition: all 0.6s;
    opacity: 0;
}

.action-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(102,126,234,0.4);
}

.action-card:hover::after {
    opacity: 1;
    transform: rotate(45deg) translateX(100%);
}

.action-icon {
    font-size: 36px;
    display: block;
    margin-bottom: 10px;
}

.action-text {
    font-size: 14px;
    color: rgba(255,255,255,0.9);
    font-weight: 500;
}

/* Guide Section Styles */
.guide-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-top: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.guide-section h3 {
    color: #667eea;
    font-size: 1.5em;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.guide-content {
    color: #333;
}

.guide-content p {
    line-height: 1.8;
    margin-bottom: 20px;
}

.guide-image {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin: 20px 0;
    display: block;
}

.guide-list {
    margin: 20px 0;
    padding-left: 0;
    list-style: none;
}

.guide-list li {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    line-height: 1.6;
}

.guide-list li strong {
    color: #667eea;
    display: inline-block;
    margin-bottom: 5px;
}

/* Trade Section */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.tab-nav {
    display: flex;
    gap: 10px;
}

.tab-btn {
    padding: 8px 16px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn.active {
    color: white;
    border-color: #667eea;
}

.tab-content {
    display: none;
    position: relative;
}

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

.collection-description {
    color: white;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
    padding: 0 4px;
}

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-box input {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
}

.search-box select {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    background: white;
}

.search-btn {
    padding: 12px 24px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.search-btn:hover {
    background: #5a67d8;
}

.card-grid {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center; /* 子要素を中央に寄せる */
}

.card-item {
    background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.85) 100%);
    border-radius: 20px;
    padding: 15px 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    transition: all 0.3s;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.5);
    position: relative;
    overflow: hidden;
}

.card-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(102,126,234,0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.card-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(102,126,234,0.2);
}

.card-item:hover::before {
    opacity: 1;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.card-type-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.card-type-badge.want {
    background: #ffebee;
    color: #c62828;
}

.card-type-badge.offer {
    background: #e8f5e9;
    color: #2e7d32;
}

.card-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.user-small-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.section-header-with-button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.section-header-with-button h3 {
    margin: 0;
}

.add-card-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    transition: all 0.3s;
    box-shadow: 0 2px 10px rgba(102,126,234,0.3);
}

.add-card-btn .icon {
    font-size: 18px;
    font-weight: 300;
    line-height: 1;
}

.add-card-btn:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46a0 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102,126,234,0.4);
}

.my-cards-section {
    background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.9) 100%);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.3);
}

.my-cards-section h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.card-list {
    display: grid;
    gap: 15px;
}

/* Friend ID Form */
.friend-id-form {
    margin-top: 10px;
}

.friend-id-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    background: white;
    transition: border-color 0.3s ease;
    letter-spacing: 1px;
}

.friend-id-input:focus {
    outline: none;
    border-color: #667eea;
}

.friend-id-form .form-group {
    margin-bottom: 10px;
}

.friend-id-form .form-hint {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

.friend-id-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 10px;
}

.friend-id-form .submit-btn {
    padding: 8px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
    width: 100%;
}

.friend-id-form .submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

/* Trade Message Form */
.trade-message-form {
    margin-top: 10px;
}

.trade-message-input {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    font-family: inherit;
    background: white;
    transition: border-color 0.3s ease;
}

.trade-message-input:focus {
    outline: none;
    border-color: #667eea;
}

.trade-message-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.character-count {
    font-size: 12px;
    color: #666;
}

.trade-message-form .submit-btn {
    padding: 8px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
    width: auto;
    min-width: 80px;
    max-width: 120px;
}

.trade-message-form .submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

/* Trade Status Form */
.trade-status-form {
    margin-top: 10px;
}

.trade-status-form .form-group {
    margin-bottom: 10px;
}

.trade-status-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.trade-status-select:focus {
    outline: none;
    border-color: #667eea;
}

.trade-status-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.trade-status-form .submit-btn {
    padding: 8px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.trade-status-form .submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.4) 100%);
    backdrop-filter: blur(5px);
    z-index: 300;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

/* Global chat modal has lower z-index */
#globalChatModal {
    z-index: 300;
}

/* Profile view modal has higher z-index to appear above chat modals */
#profileViewModal {
    z-index: 500;
}

/* Self message modal has highest z-index to appear above all other modals */
#selfMessageModal {
    z-index: 600;
}

/* Individual chat modal has higher z-index to appear above global chat */
#chatModal {
    z-index: 400;
}

/* Player rating modal has higher z-index to appear above chat modals */
#playerRatingModal {
    z-index: 500;
}

/* Add card modal - position at top on mobile */
#addCardModal.modal {
    align-items: flex-start;
    padding-top: 20px;
}

@media (max-width: 768px) {
    #addCardModal.modal {
        padding-top: 10px;
    }
}

.modal.show {
    display: flex;
}


.modal-content {
    background: linear-gradient(135deg, rgba(255,255,255,0.98) 0%, rgba(255,255,255,0.95) 100%);
    border-radius: 10px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    height: 90%;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.2);
    animation: modalSlideIn 0.3s ease-out;
}

/* Add card modal content - limit height on mobile */
#addCardModal .modal-content {
    max-height: 80vh;
}

@media (max-width: 768px) {
    #addCardModal .modal-content {
        max-height: 70vh;
        margin-top: 0;
    }
}

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

/* Popular Cards Section */

.popular-cards-section {
    padding: 5px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 15px;
    min-height: 100px;
    border: 1px solid rgba(0,0,0,0.05);
}

/* Responsive grid for smaller screens */
@media (max-width: 480px) {
    /* Even more compact header for small phones */
    .app-header {
        padding: 8px 10px;
    }
    
    .app-title {
        font-size: 14px;
    }
    
    .app-logo {
        height: 25px;
    }
    
    .app-subtitle {
        font-size: 10px;
    }
    
    .icon-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .header-actions {
        gap: 3px;
    }
    
    .popular-cards-list {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 8px;
        max-height: 250px;
        grid-auto-rows: minmax(80px, auto);
    }
    
    .card-image-chip {
        min-height: 80px;
    }
    
    /* Search results grid on mobile */
    .user-cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
        gap: 8px;
    }
    
    /* Profile edit image on mobile */
    .current-image {
        width: 120px !important;
        height: 120px !important;
        min-width: 120px !important;
        min-height: 120px !important;
    }
    
    .profile-image-upload {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    /* Battle lobby specific adjustments for small screens */
    .battle-lobby {
        padding: 8px;
    }
    
    .lobby-content {
        padding: 0;
        margin: 0;
    }
    
    .lobby-users,
    .lobby-chat {
        padding: 12px;
        margin: 0;
    }
    
    .lobby-users h4,
    .lobby-chat h4 {
        font-size: 16px;
        margin-bottom: 8px;
    }
    
    .lobby-user-item {
        padding: 8px;
        gap: 8px;
        margin-right: 0;
    }
    
    .lobby-user-info {
        font-size: 14px;
        gap: 8px;
    }
    
    .battle-recruit-btn {
        padding: 4px 6px;
        font-size: 11px;
    }
    
    .lobby-user-avatar {
        width: 32px;
        height: 32px;
    }
    
    .user-name {
        font-size: 13px;
    }
    
    .user-self {
        font-size: 11px;
    }
    
    .lobby-input-area {
        padding: 8px;
        gap: 4px;
    }
    
    .lobby-input-area input {
        padding: 8px;
        font-size: 14px;
    }
    
    .lobby-input-area .send-btn {
        padding: 8px 12px;
        font-size: 14px;
    }
}

.popular-cards-section h4 {
    margin: 0 0 2px 0;
    color: #666;
    font-size: 14px;
}

.popular-cards-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding: 5px;
    align-items: start;
    grid-auto-rows: auto;
    scroll-behavior: smooth;
}

/* スクロールバーのスタイリング */
.popular-cards-list::-webkit-scrollbar {
    width: 8px;
}

.popular-cards-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.popular-cards-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.popular-cards-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.card-image-chip {
    position: relative;
    cursor: pointer;
    transition: transform 0.2s;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
    aspect-ratio: 3/4;
}

.card-image-chip:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.card-image-chip img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.card-name-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 4px 6px;
    font-size: 10px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Popular card item styles for modal */
.popular-card-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
    position: relative;
}

.popular-card-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.popular-card-item.registered {
    opacity: 0.6;
    cursor: not-allowed;
}

.popular-card-item.registered:hover {
    transform: none;
    box-shadow: none;
}

.popular-card-item img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    display: block;
}

.popular-card-item span {
    display: block;
    width: 100%;
    padding: 4px 6px;
    background: rgba(0,0,0,0.05);
    color: #333;
    font-size: 11px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.registered-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 0, 0, 0.9);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.loading {
    text-align: center;
    color: #666;
    padding: 20px;
    font-size: 14px;
}

.loading-more {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
}

.loading-more .loading {
    padding: 10px;
    color: #999;
    font-size: 13px;
}

.modal-header {
    padding: 5px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.card-input-container {
    padding: 20px;
}

/* Compact form for add card modal */
#addCardModal .card-input-container {
    padding: 15px 20px 10px;
}

#addCardModal .form-group {
    margin-bottom: 0;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group {
    position: relative;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
}

.form-group textarea {
    resize: vertical;
}

.submit-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102,126,234,0.3);
}

.submit-btn:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46a0 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102,126,234,0.4);
}

/* Profile Section */
.profile-card {
    background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.9) 100%);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.3);
    position: relative;
    overflow: hidden;
}

.profile-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(102,126,234,0.05) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
    z-index: -1;
    pointer-events: none;
}

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

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.profile-avatar {
    width: 200px;
    height: 200px;
    min-width: 200px;
    min-height: 200px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e0e0e0 0%, #d0d0d0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 72px;
    font-weight: bold;
    color: #667eea;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    position: relative;
    z-index: 1;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.profile-actions {
    display: flex;
    gap: 10px;
    position: relative;
    z-index: 10;
}

.edit-btn {
    padding: 8px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    box-shadow: 0 2px 10px rgba(102,126,234,0.3);
    transition: all 0.3s;
}

.edit-btn:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46a0 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102,126,234,0.4);
}

.profile-info h3 {
    font-size: 20px;
    margin-bottom: 10px;
}

.profile-bio {
    color: #666;
    margin-bottom: 20px;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.stat {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: bold;
    color: #333;
}

/* Empty States */
.empty-state {
    text-align: center;
    color: #999;
    padding: 40px;
}

/* Search tab empty state - white text */
#searchTab .empty-state {
    color: white;
}

/* Unofficial Site Badge */
.unofficial-site-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 10px 15px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    backdrop-filter: blur(10px);
    width: fit-content;
}

.unofficial-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.unofficial-text {
    color: white;
    font-size: 14px;
    font-weight: 500;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Coming Soon */
.coming-soon {
    text-align: center;
    padding: 60px;
}

.coming-soon .icon {
    font-size: 64px;
    display: block;
    margin-bottom: 20px;
}

/* My Cards Grid */
.my-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 10px;
    padding: 10px 0;
}

.my-card-item {
    position: relative;
    aspect-ratio: 3/4;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.my-card-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.my-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.my-card-item .delete-card-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 0, 0, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.my-card-item:hover .delete-card-btn {
    opacity: 1;
}

.my-card-item .delete-card-btn:hover {
    background: rgba(255, 0, 0, 1);
}

/* Profile Cards Section */
.profile-cards-section {
    margin-top: 30px;
}

.profile-card-subsection {
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.profile-card-subsection h3 {
    margin-bottom: 15px;
    color: #333;
}

.profile-cards-list {
    min-height: 100px;
}

/* Search Results */
.search-results-header {
    margin: 0 0 1rem 0;
    font-size: 1.2rem;
    color: white;
    font-weight: 600;
}

/* 検索結果タイトル */
.search-results-title {
    margin: 20px 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.search-results-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px 0;
}

/* カード検索結果のグリッドレイアウト */
#searchResults {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

/* タブレット表示 */
@media (max-width: 1024px) {
    #searchResults {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    }
}

/* モバイル表示では1カラムに */
@media (max-width: 768px) {
    #searchResults {
        grid-template-columns: 1fr;
    }
}

.user-results-section {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 200px;
}

/* User profile link in the top right corner */
.user-profile-link {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    background: #f3f4f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 10;
}

.user-profile-link:hover {
    background: #e5e7eb;
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

.profile-link-icon {
    font-size: 20px;
    font-weight: bold;
    color: #667eea;
}

.arrow-icon {
    font-size: 18px;
    font-weight: bold;
    color: #667eea;
}

/* Preview button */
.preview-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin: 10px 0 20px 0;
    display: block;
    margin-left: auto;
}

.preview-btn:hover {
    background: #5a67d8;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* User profile area in search results */
.user-profile-area {
    display: flex;
    align-items: center;
    flex: 1;
    cursor: pointer;
    transition: opacity 0.3s;
}

.user-profile-area:hover {
    opacity: 0.8;
}

/* More cards indicator */
.more-cards {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    color: #666;
    font-size: 14px;
    font-weight: 500;
    padding: 10px;
    border-radius: 8px;
    min-height: 60px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.more-cards:hover {
    background: #e0e0e0;
    color: #333;
    transform: scale(1.05);
}

.user-cards-section {
    margin-top: 15px;
}

.no-cards-message {
    text-align: center;
    color: #999;
    font-size: 14px;
    padding: 20px;
    margin: 0;
}

/* User Trade Message */
/* User Trade Status */
.user-trade-status {
    padding: 8px 15px;
    margin: 10px 0;
    text-align: center;
}

.trade-status-label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    background: #f3f4f6;
    padding: 6px 16px;
    border-radius: 20px;
    display: inline-block;
}

.user-trade-message {
    margin-top: 15px;
    padding: 15px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    border-radius: 12px;
    border: 1px solid rgba(102, 126, 234, 0.2);
    position: relative;
    overflow: hidden;
}

.trade-message-label {
    font-size: 11px;
    color: #667eea;
    margin-bottom: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.trade-message-label::before {
    content: '💬';
    font-size: 14px;
}

.trade-message-text {
    font-size: 14px;
    color: #2d3748;
    line-height: 1.6;
    font-weight: 500;
}

.cards-section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #666;
    margin: 0 0 10px 0;
}

.user-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 10px;
    max-width: 100%;
}

.user-cards-grid img {
    width: 100%;
    height: auto;
    aspect-ratio: 3/4;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    display: block;
}

.show-more-cards {
    width: 100%;
    aspect-ratio: 3/4;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.show-more-cards span {
    font-size: 16px;
    font-weight: bold;
    color: #666;
}

.show-more-cards:hover {
    transform: scale(1.05);
    background: linear-gradient(135deg, #e8e8e8 0%, #d0d0d0 100%);
}

.show-more-cards:hover span {
    color: #333;
}

.show-more-cards-btn {
    margin-top: 10px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.show-more-cards-btn:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46a0 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.search-card-item {
    position: relative;
    aspect-ratio: 3/4;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s;
    max-width: 80px;
}

.search-card-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.search-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.user-result-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.chat-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.chat-icon.clickable {
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.chat-icon.clickable:hover {
    transform: scale(1.2);
    opacity: 0.8;
}

/* プレイヤー一覧のチャットアイコンに説明テキストを追加 */
.user-result-header .chat-icon {
    position: relative;
}

.user-result-header .chat-icon::before {
    content: '＼交渉はこちらから／';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 10px;
    color: #FF6B35;
    font-weight: bold;
    pointer-events: none;
    text-shadow: 0 0 3px rgba(255, 255, 255, 0.8);
}

.user-result-header.clickable {
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.user-result-header.clickable:hover {
    opacity: 0.8;
}

.user-result-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}


/* ステータスによる並び順の視覚的優先度 */
/* orderプロパティを削除（JavaScriptで管理するため） */
.user-results-section.online {
    /* order削除 */
}

.user-results-section.active {
    /* order削除 */
}

.user-results-section.inactive {
    /* opacity: 0.7; 削除 - オフラインユーザーの透明度効果を無効化 */
}

/* 現在のユーザー（自分）を強調表示 */
.user-results-section.current-user-highlight {
    background: linear-gradient(135deg, #fff4e6 0%, #fffaf0 100%);
    border: 2px solid #ff9800;
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
    /* order削除 */
}

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

.user-result-avatar .avatar-initial {
    font-size: 20px;
    font-weight: bold;
    color: #667eea;
}

.user-result-info {
    flex: 1;
}

.user-result-info h4 {
    margin: 0;
    font-size: 16px;
    color: #333;
    display: flex;
    align-items: center;
}

.search-status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
}

.search-status-indicator.online {
    background-color: #4CAF50;
    box-shadow: 0 0 4px rgba(76, 175, 80, 0.6);
}

.search-status-indicator.active {
    background-color: #ff9800;
    box-shadow: 0 0 4px rgba(255, 152, 0, 0.6);
}

.search-status-indicator.offline,
.search-status-indicator.inactive {
    background-color: #9e9e9e;
}

/* ステータステキストの背景色 */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.status-badge.online {
    background-color: #4CAF50;
}

.status-badge.active {
    background-color: #ff9800;
}

.status-badge.inactive {
    background-color: #9e9e9e;
}

.user-rating {
    font-size: 14px;
    color: #e91e63;
}

/* User status and rating container */
.user-status-rating {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}

/* Status text styles */
.status-text {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
}

.status-text.online {
    color: #2e7d32;
    background-color: rgba(76, 175, 80, 0.15);
}

.status-text.active {
    color: #f57c00;
    background-color: rgba(255, 193, 7, 0.15);
}

.status-text.offline {
    color: #616161;
    background-color: rgba(158, 158, 158, 0.15);
}

.chat-btn {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-btn:hover {
    background: #5a67d8;
}


/* Chat Modal */
#chatModal.modal {
    padding: 5px;
}

.chat-modal-content {
    max-width: 500px;
    width: 100%;
    height: 600px;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    touch-action: pan-y; /* Allow vertical scrolling within modal */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    pointer-events: auto; /* Ensure content is clickable */
    position: relative; /* Create stacking context */
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 12px;
    position: relative;
    overflow: visible;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 50px;
    flex-shrink: 0; /* ヘッダーが縮まないようにする */
}

.chat-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.chat-header-middle {
    display: flex !important;
    align-items: center;
    gap: 8px;
    visibility: visible !important;
    opacity: 1 !important;
}

.chat-header-middle h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px; /* 約15文字分 */
}

.chat-header-bottom {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
}

.chat-user-info-item {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    font-size: 11px;
    white-space: nowrap;
}

.chat-header-friendid {
    display: flex;
    align-items: center;
    padding: 5px 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
}

.chat-back-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

.chat-back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.chat-back-btn .back-arrow {
    font-weight: bold;
}

.chat-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding-right: 40px; /* Space for close button */
}



.chat-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    color: #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    overflow: hidden;
    flex-shrink: 0;
}

.chat-user-avatar.clickable {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-user-avatar.clickable:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.chat-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    image-rendering: auto;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
}

.chat-user-avatar #chatUserInitial {
    pointer-events: none;
}

.self-avatar {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.self-avatar:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.self-message-avatar {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.self-message-avatar:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.chat-user-info h4 {
    margin: 0;
    font-size: 14px;
    color: white;
    font-weight: 600;
}

.player-rating-section {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    margin: 0;
    flex-shrink: 0;
}

.rating-label {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    text-decoration: underline;
    margin: 0;
    white-space: nowrap;
    line-height: 1;
}

.rating-label:hover {
    color: rgba(255, 255, 255, 1);
}

.rating-buttons {
    display: flex;
    gap: 4px;
}

.like-btn {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    flex-shrink: 0;
}

.like-btn.liked {
    background: #ffe0e3;
    border-color: #ff4458;
    border-width: 2px;
    width: 28px;
    height: 28px;
}

.like-icon {
    font-size: 14px;
    color: #ff4458;
    transition: transform 0.2s ease;
}

.like-btn.liked .like-icon {
    transform: scale(1.1);
}

.bad-btn {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    flex-shrink: 0;
}

.bad-btn.bad-rated {
    background: #ffe0e3;
    border-color: #ff4458;
    border-width: 2px;
    width: 28px;
    height: 28px;
}

.bad-icon {
    font-size: 12px;
}

.chat-user-details-container {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    padding-left: 4px;
}

.chat-user-top-row {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 16px;
}

.chat-user-bottom-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    height: 20px;
}

.chat-user-bottom-row h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
}

.chat-status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.chat-status-indicator.online {
    background-color: #4CAF50;
    box-shadow: 0 0 4px rgba(76, 175, 80, 0.6);
}

.chat-status-indicator.offline {
    background-color: #9e9e9e;
}

.chat-status-indicator.active {
    background-color: #ff9800;
    box-shadow: 0 0 4px rgba(255, 152, 0, 0.6);
}

/* Profile status indicator */
.profile-status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
}

.profile-status-indicator.online {
    background-color: #4CAF50;
    box-shadow: 0 0 4px rgba(76, 175, 80, 0.6);
}

.profile-status-indicator.offline {
    background-color: #9e9e9e;
}

.profile-status-indicator.active {
    background-color: #ff9800;
    box-shadow: 0 0 4px rgba(255, 152, 0, 0.6);
}

.chat-user-details-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.chat-user-top-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-user-bottom-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-user-bottom-row h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    max-width: 200px;
}

.chat-friend-id {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.2;
    white-space: normal;
}

.chat-user-info-item {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    white-space: normal;
}

/* 未設定の項目を薄く表示 */
.chat-user-info-item.unset,
.chat-friend-id.unset {
    opacity: 0.6;
    font-style: italic;
}


.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: linear-gradient(135deg, #d3d3d3 0%, #f5f5f5 100%);
    position: relative;
}

.chat-messages::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 30% 60%, rgba(102,126,234,0.05), transparent 40%),
        radial-gradient(circle at 70% 30%, rgba(118,75,162,0.05), transparent 40%);
    pointer-events: none;
}

.message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.message.sent {
    align-items: flex-end;
}

.message.received {
    align-items: flex-start;
}

.message-content {
    padding: 10px 15px;
    border-radius: 18px;
    word-wrap: break-word;
    flex: 1;
}

.message.sent .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(102,126,234,0.3);
}

.message.received .message-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    color: #333;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid rgba(0,0,0,0.05);
}

.message-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
    gap: 8px;
}

.message-time {
    font-size: 11px;
    color: #999;
}

.message-read-status {
    font-size: 11px;
    color: #2d9d92;
    font-weight: 500;
}

/* Message content wrapper */
.message-content-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: 70%;
}

.message.sent .message-content-wrapper {
    flex-direction: row-reverse;
}

/* Message header for guest messages */
.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

/* Message delete button */
.message-delete-btn {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #666;
    font-size: 20px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
    flex-shrink: 0;
    font-weight: bold;
}

.message-delete-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
    transform: scale(1.1);
}

/* メッセージ送信者の名前 */
.message-sender {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}


.chat-input-area {
    padding: 20px 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Empty state */
.empty-state {
    text-align: center;
    color: #999;
    padding: 5px;
}

/* Battle chat modal specific input area */
#battleChatModal .chat-input-area,
#globalChatModal .chat-input-area {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    padding: 15px;
    gap: 10px;
}

#battleChatModal .chat-input-area input,
#globalChatModal .chat-input-area input {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    width: auto;
}

#battleChatModal .chat-input-area .send-btn,
#globalChatModal .chat-input-area .send-btn {
    flex: 0 0 auto;
    width: 80px;
    margin: 0;
    padding: 15px 20px;
}

/* Mobile specific styles for battle/global chat */
@media (max-width: 768px) {
    #battleChatModal .chat-input-area,
    #globalChatModal .chat-input-area {
        display: flex !important;
        flex-direction: row !important;
    }
    
    #battleChatModal .chat-input-area input,
    #globalChatModal .chat-input-area input {
        width: calc(100% - 90px) !important;
        max-width: none !important;
    }
    
    #battleChatModal .chat-input-area .send-btn,
    #globalChatModal .chat-input-area .send-btn {
        width: 70px !important;
        padding: 15px 10px !important;
        font-size: 14px !important;
    }
}

/* ゲストユーザー用の2段階レイアウト */
.chat-input-area.guest-mode {
    flex-direction: column;
    gap: 0;
}

.chat-input-area.guest-mode #guestNameInput {
    width: 50%;
    margin-bottom: 10px;
}

.chat-input-area.guest-mode #guestNameInput input {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 16px;
    box-sizing: border-box;
}

.message-input-row {
    display: flex;
    gap: 10px;
    width: 100%;
}

.message-input-row input {
    flex: 1;
}

.chat-input-area.guest-mode .message-input-row {
    width: 100%;
}

.chat-input-area input,
#chatInput {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 16px;
    min-height: 50px;
    width: 100%;
    box-sizing: border-box;
}

.send-btn {
    padding: 15px 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    flex-shrink: 0;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(102,126,234,0.3);
    transition: all 0.3s;
}

.send-btn:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46a0 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102,126,234,0.4);
}

/* Chat List */
.chat-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-list-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.9) 100%);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.5);
}

.chat-list-item:hover {
    background: #f8f8f8;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.chat-list-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    overflow: hidden;
}

.chat-list-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-list-avatar .avatar-initial {
    font-size: 20px;
    font-weight: bold;
    color: #667eea;
}

.chat-list-info {
    flex: 1;
    min-width: 0;
}

.chat-list-info h4 {
    margin: 0 0 5px 0;
    font-size: 16px;
    color: #333;
}

.chat-list-info .last-message {
    margin: 0;
    font-size: 14px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-list-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.chat-time {
    font-size: 12px;
    color: #999;
}

.unread-badge {
    background: #ff1744;
    color: white;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

/* Battle styles */
.battle-description {
    text-align: center;
    color: white;
    font-size: 16px;
    margin-bottom: 1.5rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.battle-modes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.battle-mode-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
}

.battle-mode-card h4 {
    margin-bottom: 1rem;
    color: #333;
}

.battle-mode-card p {
    color: #666;
    margin-bottom: 1.5rem;
}

.battle-mode-btn {
    background: #4ECDC4;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    margin: 0.5rem;
}

.battle-mode-btn:hover:not(:disabled) {
    background: #3ab8af;
    transform: translateY(-2px);
}

.room-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.battle-start-btn {
    background: #FF6B6B;
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.battle-start-btn:hover:not(:disabled) {
    background: #e55555;
    transform: translateY(-2px);
}

.battle-start-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.distance-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.distance-selector select {
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.battle-status {
    text-align: center;
    padding: 2rem;
}

.searching-animation {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.searching-animation .icon {
    font-size: 3rem;
    animation: pulse 1.5s infinite;
}

.recent-battles {
    margin-top: 3rem;
}

.battles-list {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.battle-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

.battle-history-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.battle-opponent {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.opponent-avatar {
    width: 50px;
    height: 50px;
    min-width: 50px;
    min-height: 50px;
    border-radius: 50%;
    background: #4ECDC4;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
}

.opponent-avatar.clickable {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.opponent-avatar.clickable:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(78, 205, 196, 0.5);
}

.opponent-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    image-rendering: auto;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
    position: absolute;
    top: 0;
    left: 0;
}

.opponent-avatar .avatar-initial {
    pointer-events: none;
}

.opponent-info {
    display: flex;
    flex-direction: column;
}

.opponent-name {
    font-weight: 500;
    color: #333;
}

.battle-date {
    font-size: 0.85rem;
    color: #666;
}

.battle-password {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f0f8ff;
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

.password-label {
    font-size: 0.85rem;
    color: #666;
}

.password-value {
    font-weight: bold;
    color: #4169e1;
    letter-spacing: 0.05em;
}

/* Battle room styles */
.battle-room {
    padding: 1rem;
}

.battle-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 2rem;
}

.player-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.player-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #4ECDC4;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
}

.player-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    image-rendering: auto;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
}

.battle-vs {
    font-size: 2rem;
    font-weight: bold;
    color: #FF6B6B;
}

.battle-field {
    min-height: 400px;
    background: #f0f0f0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.battle-actions {
    text-align: center;
}

.exit-btn {
    background: #666;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
}

.exit-btn:hover {
    background: #555;
}

.cancel-btn {
    background: #666;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
}

.cancel-btn:hover {
    background: #555;
}

/* Battle Lobby styles */
.battle-lobby {
    padding: 1rem;
    width: 100%;
    overflow-x: hidden;
}

/* 新しいロビーヘッダーデザイン */
.lobby-header-new {
    text-align: center;
    margin-bottom: 1rem;
    padding-top: 0.5rem; /* 上部に少し余白を追加 */
}

.lobby-description {
    font-size: 14px;
    color: #ffffff;
    margin-bottom: 1rem;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* 対戦募集ボタン */
.recruit-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 12px 40px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.recruit-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.recruit-btn.recruiting {
    background: #ff5722;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* シンプルなユーザーリスト */
.lobby-users-simple {
    background: rgba(255,255,255,0.95);
    border-radius: 10px;
    padding: 1rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

/* 対戦カードセクション */
.battle-cards-section {
    margin-top: 2rem;
}

.battle-cards-header {
    font-size: 16px;
    margin-bottom: 1rem;
    color: #333;
    font-weight: 600;
}

/* 対戦カードエリア */
.battle-cards-area {
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.battle-card {
    transition: all 0.3s ease;
}


.battle-card.concluded {
    opacity: 0.7;
    background: #f5f5f5;
}

.battle-card-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.battle-card-players {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.player-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 対戦カード内のオンラインユーザーアバター */
.battle-card-message .online-user-avatar {
    width: 40px;
    height: 40px;
    margin-bottom: 4px;
}

.battle-card-message .online-user-avatar span {
    font-size: 16px;
}

.ready-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 8px 16px;
    font-size: 12px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.decline-btn {
    background: #f44336;
    color: white;
    border: none;
    padding: 6px 12px;
    font-size: 11px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: -4px;
}

.decline-btn:hover {
    background: #d32f2f;
}

.ready-btn.clickable {
    animation: pulse-animation 1.5s ease-in-out infinite;
}

.ready-btn.clickable:hover:not(:disabled) {
    background: #45a049;
    animation: none;
}

.ready-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    animation: none;
}

.ready-btn.ready {
    background: #ff5722;
    animation: none;
}

/* 他人の準備完了ボタンは灰色で表示 */
.ready-btn.disabled.ready {
    background: #9e9e9e !important;
    animation: none;
}

@keyframes pulse-animation {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.battle-card .player-name {
    font-weight: bold;
    font-size: 14px;
    padding: 5px 10px;
    border-radius: 5px;
    transition: all 0.3s ease;
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
}

.battle-card .player-name.self {
    color: #f9a825;
}


.battle-card .player-name.clickable {
    cursor: pointer;
}

.battle-card .player-name.clickable:hover {
    background: #e3f2fd;
}

.result-label {
    display: block;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-bottom: 4px;
}

.result-label.win {
    background: #ff5722;
    color: white;
}

.result-label.lose {
    background: #9e9e9e;
    color: white;
}

.vs {
    font-weight: bold;
    color: #666;
    font-size: 16px;
    padding: 0 10px;
}

.battle-card-info {
    text-align: center;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
    margin-top: 10px;
}

.password-line {
    font-size: 14px;
    color: #333;
    margin-bottom: 0.5rem;
}

.password-line .password-text {
    color: #f44336;
    font-weight: bold;
    font-size: 16px;
    margin-left: 0.5rem;
}

.instruction-line {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
    margin-bottom: 10px;
}

.result-selection {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

.result-select {
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    min-width: 150px;
}

.result-select:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

.confirm-btn {
    padding: 6px 16px;
    font-size: 13px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.confirm-btn:hover:not(:disabled) {
    background: #1976D2;
}

.confirm-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.result-label.draw {
    background: #ff9800;
    color: white;
}

.result-label.decline {
    background: #757575;
    color: white;
}


.lobby-users-simple h4 {
    font-size: 16px;
    margin-bottom: 1rem;
    color: #333;
}

.lobby-users-list-simple {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.lobby-user-simple {
    background: #f0f0f0;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    color: #333;
    transition: all 0.2s ease;
}

.lobby-user-simple.self {
    background: #e3f2fd;
    font-weight: bold;
}

.lobby-user-simple.self.recruiting {
    background: #ffcdd2;
    color: #c62828;
    animation: highlight 1s infinite;
}

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

.lobby-header {
    text-align: center;
    padding: 1rem;
    margin-bottom: 2rem;
}

.lobby-header h3 {
    margin-bottom: 0.5rem;
    color: white;
}

.lobby-header p {
    color: white;
}

.lobby-header .exit-btn {
    margin-top: 1rem;
}

.room-password-display {
    display: inline-block;
    background: #f0f8ff;
    border: 2px solid #4169e1;
    border-radius: 10px;
    padding: 10px 20px;
    margin: 10px 0;
    font-size: 1.2rem;
}

.password-label {
    color: #666;
    margin-right: 10px;
}

.password-text {
    font-weight: bold;
    color: #4169e1;
    letter-spacing: 0.1em;
}

.room-delete-time {
    font-size: 0.85rem;
    color: white;
    margin-bottom: 10px;
}

.lobby-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    overflow-x: hidden;
}

.lobby-users {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1rem;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.lobby-users h4 {
    margin-bottom: 1rem;
    text-align: center;
}

.lobby-users-list {
    max-height: 500px;
    overflow-y: auto;
    width: 100%;
    padding-right: 5px;
}

.lobby-user-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    background: white;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.lobby-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #4ECDC4;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    flex-shrink: 0;
}

.lobby-user-avatar.clickable {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.lobby-user-avatar.clickable:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(78, 205, 196, 0.5);
}

.lobby-user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    image-rendering: auto;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
}

.lobby-user-avatar .avatar-initial {
    pointer-events: none;
}

.lobby-user-info {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    overflow: hidden;
}

.user-name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-self {
    color: #666;
    font-size: 0.9rem;
}

.battle-recruit-btn {
    background: #4ECDC4;
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    white-space: nowrap;
}

.battle-recruit-btn:hover {
    background: #3ab8af;
}

.battle-recruit-btn[data-status="recruiting"] {
    background: #FF6B6B;
    animation: pulse 2s infinite;
}

/* 他ユーザーの募集状態は非表示のため、これらのスタイルは不要 */

.lobby-chat {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.lobby-messages {
    flex: 1;
    background: white;
    border-radius: 8px;
    padding: 1rem;
    max-height: 450px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.welcome-message {
    text-align: center;
    color: #666;
    padding: 10px;
}

.lobby-message {
    margin-bottom: 1rem;
    padding: 0.5rem;
    border-radius: 8px;
    background: #f0f0f0;
}

.lobby-message.own-message {
    background: #e3f2fd;
    text-align: right;
}

.lobby-message.system-message {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    text-align: center;
    font-weight: bold;
}

/* マッチングメッセージ */
.match-message {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 15px !important;
    margin: 10px 0;
    transition: all 0.3s ease;
}

.match-message.confirmed {
    background: #fff3cd;
    border-color: #ffc107;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
}

.match-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.match-lamps {
    display: flex;
    gap: 8px;
}

.match-lamp {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.match-lamp.active {
    background: #ffc107;
    box-shadow: 0 0 10px rgba(255, 193, 7, 0.5);
}

.match-lamp .lamp-icon {
    font-size: 18px;
    filter: grayscale(1);
    transition: filter 0.3s ease;
}

.match-lamp.active .lamp-icon {
    filter: grayscale(0);
}

.match-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.match-password {
    font-weight: bold;
    color: #dc3545;
}

.match-confirm-btn {
    padding: 8px 20px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.match-confirm-btn:hover {
    background: #218838;
    transform: translateY(-1px);
}

.match-confirm-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.message-user {
    font-weight: 500;
    color: #333;
}

.message-text {
    margin: 0 0.5rem;
}

.message-time {
    font-size: 0.8rem;
    color: #666;
}

.lobby-input-area {
    display: flex;
    gap: 0.5rem;
}

.lobby-input-area input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

.lobby-input-area .send-btn {
    padding: 0.75rem 1.5rem;
    background: #4ECDC4;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
}

.lobby-input-area .send-btn:hover {
    background: #3ab8af;
}

/* Profile Edit Section */
.profile-edit-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    max-width: 600px;
    margin: 0 auto;
}

#profileEditForm {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 500;
    color: #333;
    font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group select,
.form-group textarea {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input[type="text"]:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4ECDC4;
}

.form-hint {
    font-size: 0.85rem;
    color: #666;
}

.profile-image-upload {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.current-image {
    width: 120px;
    height: 120px;
    min-width: 120px;
    min-height: 120px;
    border-radius: 50%;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 3px solid #e0e0e0;
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
}

.current-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: auto;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
}

.current-image span {
    font-size: 2rem;
    color: #666;
    font-weight: bold;
}

.upload-btn {
    padding: 0.5rem 1rem;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-btn:hover {
    background: #e0e0e0;
}

.reset-btn {
    padding: 0.5rem 1rem;
    background: #ffebee;
    border: 1px solid #ffcdd2;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #d32f2f;
    margin-top: 0.5rem;
}

.reset-btn:hover {
    background: #ffcdd2;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    align-items: flex-start;
}

.save-btn {
    flex: 1;
    padding: 0.75rem;
    background: #4ECDC4;
    color: white;
    border: 1px solid #4ECDC4;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s ease, border-color 0.3s ease;
    height: 44px;
    box-sizing: border-box;
}

.save-btn:hover {
    background: #3ab8af;
    border-color: #3ab8af;
}

.form-actions .cancel-btn {
    flex: 1;
    padding: 0.75rem;
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    height: 44px;
    box-sizing: border-box;
    font-weight: normal;
}

.form-actions .cancel-btn:hover {
    background: #e0e0e0;
}

/* High-quality image rendering for all avatars */
img {
    image-rendering: auto;
}

.header-user-avatar img,
.profile-avatar img,
.chat-user-avatar img,
.lobby-user-avatar img,
.player-avatar img,
.opponent-avatar img,
.profile-modal-avatar img,
.current-image img,
.profile-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    will-change: transform;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Profile details */
.profile-details {
    margin: 1.5rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.profile-detail {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.profile-detail:last-child {
    margin-bottom: 0;
}

.detail-label {
    font-weight: 500;
    color: #666;
    margin-right: 0.5rem;
}

.detail-value {
    color: #333;
}

/* Profile Image Modal */
.profile-image-modal-content {
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.profile-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 20px;
    padding: 20px;
    justify-items: center;
}

.profile-image-item {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 4px solid #f0f0f0;
    transition: all 0.3s ease;
    background: #f8f8f8;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.profile-image-item:hover {
    transform: scale(1.1);
    border-color: #4ECDC4;
}

.profile-image-item.selected {
    border-color: #4ECDC4;
    box-shadow: 0 0 10px rgba(78, 205, 196, 0.5);
}

.profile-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: auto;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
    filter: blur(0);
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Player Rating Modal */
.rating-modal-content {
    max-width: 500px;
}

.rating-modal-body {
    padding: 20px;
}

.rating-modal-body p {
    line-height: 1.8;
    color: #333;
    margin: 0;
}

/* Policy Modal Styles */
.policy-modal-content {
    max-width: 800px;
    max-height: 80vh;
}

.policy-modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(80vh - 100px);
}

.policy-content {
    line-height: 1.8;
    color: #333;
}

.policy-content h4 {
    margin: 20px 0 10px 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

.policy-content p {
    margin: 10px 0;
    font-size: 14px;
}

.policy-content ul {
    margin: 10px 0;
    padding-left: 20px;
}

.policy-content li {
    margin: 5px 0;
    font-size: 14px;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Recent Chat Styles */
.recent-activities {
    background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.9) 100%);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    margin-top: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.3);
    position: relative;
    overflow: hidden;
}

.recent-activities::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -30%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(118,75,162,0.05) 0%, transparent 70%);
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(120deg); }
    66% { transform: translate(-20px, 20px) rotate(240deg); }
}

.recent-activities h3 {
    margin-bottom: 8px;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.recent-activities-description {
    margin: 0 0 15px 0;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.recent-chat-item {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 15px;
    padding: 15px;
    transition: all 0.2s ease;
    border: 1px solid rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}



.chat-participants {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.participant {
    display: flex;
    align-items: center;
    gap: 8px;
}

.participant-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.participant-avatar.clickable {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.participant-avatar.clickable:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.participant-avatar.clickable:active {
    transform: scale(0.95);
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* モバイルデバイスでのタッチハイライトを無効化 */
.participant-avatar.clickable {
    -webkit-tap-highlight-color: transparent;
}

/* タッチデバイス向けの追加スタイル */
@media (hover: none) and (pointer: coarse) {
    .participant-avatar.clickable:active {
        transform: scale(0.9);
        transition: transform 0.1s ease;
    }
}

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

.participant-avatar .avatar-initial {
    font-size: 14px;
    font-weight: bold;
    color: #667eea;
}

.participant-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.arrow {
    color: #999;
    font-size: 16px;
}

.chat-message {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 14px;
    color: #333;
    line-height: 1.4;
    margin-bottom: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}


.chat-time {
    font-size: 12px;
    color: #999;
    text-align: right;
}

/* Responsive */
@media (max-width: 768px) {
    /* Header adjustments for mobile */
    .app-header {
        padding: 10px 15px;
    }
    
    .header-content {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .app-title a {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1px;
    }
    
    .app-logo {
        height: 30px;
        max-width: 100%;
    }
    
    .app-subtitle {
        font-size: 10px;
        margin: 0;
    }
    
    .header-actions {
        gap: 5px;
    }
    
    .icon-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .main-content {
        padding: 10px;
    }
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .card-grid {
        grid-template-columns: 1fr;
    }
    
    .profile-stats {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .profile-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .profile-avatar {
        width: 150px;
        height: 150px;
        min-width: 150px;
        min-height: 150px;
        font-size: 56px;
        margin-bottom: 20px;
        aspect-ratio: 1 / 1;
    }
    
    .profile-avatar img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }
    
    .profile-actions {
        width: 100%;
        justify-content: center;
    }
    
    /* Fix for profile avatar aspect ratio on mobile */
    .header-user-avatar {
        aspect-ratio: 1 / 1;
        width: 32px !important;
        height: 32px !important;
    }
    
    /* Chat modal responsive adjustments */
    .chat-modal-content {
        max-width: 95%;
        width: 95%;
        height: 100%;
        max-height: 600px;
        margin: 20px auto;
    }
    
    .chat-header {
        padding: 8px 10px;
    }
    
    .chat-header-top {
        gap: 8px;
    }
    
    .chat-header-middle {
        gap: 6px;
    }
    
    .chat-header-middle h4 {
        font-size: 16px;
        max-width: 120px; /* モバイルでは少し狭く */
    }
    
    .chat-header-bottom {
        gap: 8px;
    }
    
    .chat-back-btn {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }
    
    /* Profile modal adjustments for mobile */
    .profile-modal-content {
        max-width: 95%;
        width: 95%;
        max-height: 90%;
        margin: 20px auto;
    }
    
    .modal-header {
        flex-shrink: 0;
        position: sticky;
        top: 0;
        background: white;
        z-index: 10;
    }
    
    .profile-modal-body {
        max-height: 500px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .chat-user-details-container {
        min-width: 0;
        flex: 1;
    }
    
    .chat-user-bottom-row h4 {
        font-size: 14px;
        max-width: 120px;
    }
    
    .chat-user-avatar {
        width: 36px;
        height: 36px;
    }
    
    /* Ensure visibility on mobile */
    .chat-user-info-item,
    #chatUserName {
        display: inline-block !important;
        visibility: visible !important;
        opacity: 1 !important;
        color: white !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 200px !important;
    }
    
    /* Friend ID should not be truncated */
    .chat-friend-id {
        display: inline-block !important;
        visibility: visible !important;
        opacity: 1 !important;
        color: white !important;
        white-space: nowrap !important;
        overflow: visible !important;
        text-overflow: clip !important;
        max-width: none !important;
    }
    
    .chat-user-top-row,
    .chat-user-bottom-row {
        display: flex !important;
        visibility: visible !important;
    }
    
    .chat-status-indicator {
        display: inline-block !important;
    }
    
    .player-rating-section {
        flex: 1 1 100%;
        flex-direction: row;
        justify-content: flex-end;
        align-items: center;
        gap: 10px;
        margin-top: 5px;
    }
    
    .rating-label {
        font-size: 10px;
    }
    
    .rating-buttons {
        gap: 6px;
    }
    
    /* Chat input area responsive adjustments */
    .chat-input-area {
        padding: 10px;
        gap: 8px;
    }
    
    .chat-input-area input {
        padding: 12px 16px;
        font-size: 16px; /* Prevent zoom on iOS */
        min-width: 0;
        min-height: 44px;
    }
    
    .send-btn {
        padding: 8px 16px;
        font-size: 14px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    
    /* Battle lobby responsive adjustments */
    .battle-lobby {
        padding: 0.5rem;
    }
    
    .lobby-content {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .lobby-users {
        max-height: 300px;
    }
    
    .lobby-messages {
        max-height: 300px;
    }
    
    .lobby-header {
        padding: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .room-password-display {
        font-size: 1rem;
        padding: 8px 16px;
    }
}

/* Card Preview Modal */
#cardPreviewModal.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.card-preview-modal {
    position: relative;
    background: white;
    border-radius: 20px;
    padding: 20px;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
}

.card-preview-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.card-preview-image {
    max-width: 100%;
    max-height: 70vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.card-preview-name {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    text-align: center;
}

/* Add cursor pointer to card images */
.my-card-image {
    cursor: pointer;
}

/* Modal close button specific to card preview */
.card-preview-modal .modal-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    z-index: 1;
}

.card-preview-modal .modal-close-btn:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* Responsive adjustments for card preview */
@media (max-width: 768px) {
    .card-preview-modal {
        padding: 15px;
        margin: 10px;
    }
    
    .card-preview-image {
        max-height: 60vh;
    }
    
    .card-preview-name {
        font-size: 16px;
    }
}

/* Card delete button in preview */
.card-delete-btn {
    background: rgba(255, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 15px;
    transition: background 0.2s;
}

.card-delete-btn:hover {
    background: rgba(255, 0, 0, 0.85);
}

/* Global Chat Styles */
#globalChatSection .global-chat-container {
    display: flex;
    flex-direction: column;
    height: 500px;
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-top: 10px;
}

.global-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
    min-height: 0;
    border-radius: 20px 20px 0 0;
}

.global-chat-message {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.global-chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    color: #666;
    flex-shrink: 0;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.global-chat-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.global-chat-avatar.clickable {
    cursor: pointer;
}

.global-chat-avatar.self-message-avatar {
    cursor: pointer;
}

.global-chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Guest user styling for battle chat */
.guest-user-message .global-chat-avatar {
    background: #f0f0f0;
    color: #667eea;
}

.global-chat-message-content {
    flex: 1;
    background: white;
    padding: 10px 14px;
    border-radius: 18px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
}

/* 自分のメッセージのスタイル */
.global-chat-message.own {
    flex-direction: row-reverse;
}

.global-chat-message.own .global-chat-message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.global-chat-message.own .global-chat-username,
.global-chat-message.own .global-chat-message-text,
.global-chat-message.own .global-chat-timestamp {
    color: white;
}

.global-chat-message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.global-chat-username {
    font-weight: 600;
    color: #333;
    font-size: 13px;
}

.global-chat-timestamp {
    font-size: 11px;
    color: #999;
}

.global-chat-message-text {
    color: #333;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.global-chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: white;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
    border-radius: 0 0 20px 20px;
}

#globalChatInput {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
    background: #f5f5f5;
}

#globalChatInput:focus {
    border-color: #667eea;
    background: white;
}

#globalChatSendBtn {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

#globalChatSendBtn:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

#globalChatSendBtn:active {
    transform: translateY(0);
}

/* Mobile responsive for global chat */
@media (max-width: 768px) {
    /* Make content section take full height on mobile */
    .main-content {
        padding: 10px;
    }
    
    /* Global chat specific mobile styles */
    #globalChatSection.active {
        position: fixed;
        top: 60px; /* Header height */
        left: 0;
        right: 0;
        bottom: 0;
        bottom: env(safe-area-inset-bottom, 0);
        display: flex;
        flex-direction: column;
        padding: 0;
        background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #7e8ba3 100%);
    }
    
    #globalChatSection.active h2 {
        flex-shrink: 0;
        margin: 10px;
        font-size: 18px;
    }
    
    #globalChatSection.active .global-chat-container {
        flex: 1;
        display: flex;
        flex-direction: column;
        height: 100%;
        border-radius: 0;
        margin: 0;
        overflow: hidden;
        box-shadow: none;
    }
    
    .global-chat-messages {
        flex: 1;
        padding: 12px;
        overflow-y: auto;
        min-height: 0;
        -webkit-overflow-scrolling: touch;
    }
    
    .global-chat-message {
        margin-bottom: 12px;
    }
    
    .global-chat-avatar {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }
    
    .global-chat-message-content {
        padding: 8px 12px;
    }
    
    .global-chat-username {
        font-size: 12px;
    }
    
    .global-chat-timestamp {
        font-size: 10px;
    }
    
    .global-chat-message-text {
        font-size: 13px;
    }
    
    .global-chat-input-area {
        padding: 10px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0));
        gap: 6px;
        background: white;
        border-top: 1px solid #e0e0e0;
        z-index: 10;
        flex-shrink: 0;
    }
    
    #globalChatInput {
        padding: 8px 12px;
        font-size: 16px;
    }
    
    #globalChatSendBtn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    /* Hide footer when global chat section is active on mobile */
    body:has(#globalChatSection.active) .app-footer {
        display: none;
    }
}

/* Login Required Modal */
.login-required-modal-content {
    max-width: 400px;
    padding: 30px;
    text-align: center;
}

.login-required-modal-content .modal-body {
    margin-bottom: 24px;
}

.login-required-modal-content .modal-body p {
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    margin: 0;
}

.login-required-modal-content .modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.login-required-modal-content .cancel-btn,
.login-required-modal-content .ok-btn {
    padding: 10px 24px;
    font-size: 15px;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.login-required-modal-content .cancel-btn {
    background: #e5e7eb;
    color: #374151;
}

.login-required-modal-content .cancel-btn:hover {
    background: #d1d5db;
}

.login-required-modal-content .ok-btn {
    background: #3b82f6;
    color: white;
}

.login-required-modal-content .ok-btn:hover {
    background: #2563eb;
}

/* Battle Chat Room Styles */
.battle-recruit-section {
    padding: 0px;
}


.recruit-btn {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    font-weight: bold;
    color: white;
    white-space: normal;
    line-height: 1.3;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.recruit-btn:hover {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

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

.recruit-btn.recruiting {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    animation: pulse 2s infinite;
}

.recruit-btn.matched {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    cursor: not-allowed;
    opacity: 0.9;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.8; }
    100% { opacity: 1; }
}

.online-users-section {
    padding: 0;
}

/* 招待URLセクション */
.invite-url-section {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    font-size: 14px;
}

.invite-url-label {
    color: #666;
    font-weight: 500;
}

.invite-url-text {
    flex: 1;
    color: #333;
    font-family: monospace;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.copy-url-btn {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-url-btn:hover {
    background: #f0f0f0;
    border-color: #999;
}

.copy-url-btn:active {
    transform: scale(0.95);
}

.copy-url-btn svg {
    width: 16px;
    height: 16px;
    color: #666;
}

.online-users-list {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    overflow-y: visible;
    padding: 0;
}

.online-user-item {
    flex-shrink: 0;
    padding: 15px;
    transition: all 0.2s ease;
    position: relative;
    overflow: visible;
}

.online-user-item.recruiting .online-user-avatar {
    position: relative;
    animation: recruitingPulse 1s ease-in-out infinite;
    border: 2px solid #ff0000;
}

.online-user-item.overflow-indicator {
    cursor: default;
}

.online-user-item.overflow-indicator .online-user-avatar {
    background: #6c757d;
    color: white;
    font-weight: bold;
    font-size: 14px;
}

@keyframes recruitingPulse {
    0% {
        transform: scale(1.0);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1.0);
    }
}


.online-user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    overflow: visible;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.online-user-avatar:hover {
    transform: scale(1.05);
}

.online-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Guest user styling */
.guest-user .online-user-avatar {
    background: #f0f0f0;
    color: #667eea;
}

/* ポケリンク名刺ボタンコンテナ */
.profile-card-button-container {
    text-align: center;
    padding: 8px 0 24px 0;
    margin-bottom: 0;
}

/* ポケリンク名刺ボタン */
.profile-card-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #6b7280;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.profile-card-btn:hover {
    background: #4b5563;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.profile-card-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.profile-card-btn .icon {
    font-size: 20px;
}

/* モーダル内の紹介URLセクション */
.modal-invite-section {
    margin: 16px 0;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
}

.modal-invite-section h5 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #374151;
}

.modal-invite-url-container {
    display: flex;
    gap: 6px;
    align-items: center;
}

.modal-invite-url-input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    background: white;
    font-size: 13px;
    color: #374151;
    cursor: text;
    user-select: all;
}

.modal-invite-url-input:focus {
    outline: none;
    border-color: #667eea;
}

/* モーダル内のチャットアイコン */
.modal-chat-icon {
    font-size: 36px;
    cursor: pointer;
    transition: all 0.2s ease;
    align-self: center;
}

.modal-chat-icon:hover {
    transform: scale(1.1);
    opacity: 0.8;
}

/* Entrance animation for user icons */
.online-user-item.entrance-animation {
    animation: fadeIn 1s ease-in-out;
}

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


/* Battle Card in Chat */
.battle-card-message {
    background: #ffffff;
    border-radius: 12px;
    padding: 16px;
    margin: 10px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.battle-card-players {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 12px;
}

.battle-player-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.battle-player-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    overflow: hidden;
    cursor: pointer;
}

.battle-player-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.battle-player-name {
    font-size: 12px;
    font-weight: 500;
}

.vs-text {
    font-size: 18px;
    font-weight: bold;
    color: #6b7280;
}

.battle-card-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.ready-btn {
    flex: 1;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: white;
    background: #10b981;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ready-btn:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
}

.ready-btn.ready {
    background: #6b7280;
}

.battle-password-section {
    margin-top: 16px;
}

.battle-instruction {
    font-size: 13px;
    color: #4b5563;
    line-height: 1.5;
    text-align: center;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: #e5e7eb;
    border-radius: 8px;
}

.battle-password {
    padding: 12px;
    background: #fef3c7;
    border-radius: 8px;
    text-align: center;
}

.password-label {
    font-size: 12px;
    color: #92400e;
    margin-bottom: 4px;
}

.password-text {
    font-size: 20px;
    font-weight: bold;
    color: #b45309;
    letter-spacing: 2px;
}

/* Battle card ready buttons */
.battle-card-message .ready-btn {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.battle-card-message .ready-btn.clickable {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.battle-card-message .ready-btn.clickable:hover:not(:disabled) {
    background: linear-gradient(135deg, #16a34a 0%, #14532d 100%);
}

.battle-card-message .ready-btn.disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.battle-card-message .ready-btn.ready {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.battle-card-message .player-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.battle-card-message .ready-btn {
    margin-bottom: 8px;
}

.battle-card-message .decline-btn {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    color: white;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.battle-card-message .decline-btn.clickable {
    animation: pulse-animation 1.5s ease-in-out infinite;
}

/* ゲストメッセージ */
.guest-message {
    background-color: #E3F2FD;
    border: 1px solid #2196F3;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    text-align: center;
}

.guest-message p {
    margin: 5px 0;
    color: #1976D2;
}

.guest-message a {
    color: #0D47A1;
    font-weight: bold;
    text-decoration: underline;
}

/* ログインボタン */
.login-button {
    display: inline-block;
    padding: 8px 20px;
    background-color: #2196F3;
    color: white;
    text-decoration: none;
    border-radius: 20px;
    font-weight: bold;
    transition: background-color 0.3s;
}

.login-button:hover {
    background-color: #1976D2;
}

.battle-card-message .decline-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    animation: none;
}

.battle-card-message .decline-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    opacity: 0.6;
    animation: none;
}

.battle-card-message .battle-card-players {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 16px;
}

.battle-card-message .vs-section {
    font-size: 18px;
    font-weight: bold;
    color: #6b7280;
}

/* Mobile responsive for battle chat */
@media (max-width: 768px) {
    .recruit-btn {
        font-size: 14px;
        padding: 10px 16px;
    }
    
    .online-users-section {
        padding: 0;
    }
    
    .online-users-list {
        max-height: 120px;
    }
    
    .online-user-item {
        padding: 4px;
    }
    
    .online-user-avatar {
        width: 30px;
        height: 30px;
    }
}
/* Notification Animation */
@keyframes slideDown {
    from {
        transform: translateX(-50%) translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

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

/* Guest message notice in battle chat */
.guest-message-notice {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px;
    margin: 10px;
    text-align: center;
}

.guest-message-notice p {
    margin: 0;
    color: #6c757d;
    font-size: 14px;
}

.guest-message-notice a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.guest-message-notice a:hover {
    text-decoration: underline;
}

/* ============================================
   通知表示
   ============================================ */
.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    animation: slideDown 0.3s ease-out;
    font-size: 14px;
    max-width: 90%;
    text-align: center;
}

.notification.success {
    background-color: #10b981;
}

.notification.error {
    background-color: #ef4444;
}

.notification.info {
    background-color: #3b82f6;
}

.notification.warning {
    background-color: #f59e0b;
}

.notification.fade-out {
    animation: slideUp 0.3s ease-out;
}

/* ============================================
   トップへ戻るボタン
   ============================================ */
.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scroll-to-top.show {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

.scroll-to-top:active {
    transform: translateY(-1px);
}

/* モバイル対応 */
@media (max-width: 768px) {
    .scroll-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
}
