/* ===== リセット & ベース ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    color-scheme: light;
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #5d6773;
    --success-color: #16a34a;
    --danger-color: #dc2626;
    --warning-color: #d97706;
    --light-color: rgba(245, 248, 251, 0.94);
    --dark-color: #101418;
    --bg-color: #f5f7f9;
    --card-bg: rgba(255, 255, 255, 0.9);
    --surface-solid: #ffffff;
    --surface-muted: rgba(245, 248, 251, 0.94);
    --surface-elevated: rgba(255, 255, 255, 0.82);
    --text-color: #101418;
    --text-muted: #5d6773;
    --border-color: rgba(148, 163, 184, 0.28);
    --shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
    --shadow-hover: 0 24px 64px rgba(15, 23, 42, 0.12);
    --focus-ring: rgba(37, 99, 235, 0.16);
    --control-height: 42px;
    --radius-sm: 10px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.2s ease;
}

html.dark {
    color-scheme: dark;
    --primary-color: #60a5fa;
    --primary-hover: #3b82f6;
    --secondary-color: #9aa7b7;
    --success-color: #4ade80;
    --danger-color: #f87171;
    --warning-color: #facc15;
    --light-color: rgba(30, 41, 59, 0.78);
    --dark-color: #eef2f7;
    --bg-color: #0f141a;
    --card-bg: rgba(17, 24, 39, 0.9);
    --surface-solid: #111827;
    --surface-muted: rgba(30, 41, 59, 0.76);
    --surface-elevated: rgba(17, 24, 39, 0.8);
    --text-color: #eef2f7;
    --text-muted: #9aa7b7;
    --border-color: rgba(148, 163, 184, 0.22);
    --shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
    --shadow-hover: 0 24px 64px rgba(0, 0, 0, 0.44);
    --focus-ring: rgba(96, 165, 250, 0.18);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Hiragino Sans", "Yu Gothic", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    overflow-wrap: anywhere;
}

.theme-toggle-card {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 1900;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--surface-elevated);
    box-shadow: var(--shadow);
    padding: 4px;
    display: inline-flex;
    align-items: center;
    backdrop-filter: blur(16px);
}

.theme-toggle-card select {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-solid);
    color: var(--text-color);
    font-size: 12px;
    font-weight: 600;
    height: calc(var(--control-height) - 10px);
    padding: 0 11px;
}

.theme-toggle-card select:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 1px;
}

.account-menu {
    position: relative;
}

.account-menu-button {
    width: var(--control-height);
    height: var(--control-height);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-elevated);
    box-shadow: var(--shadow);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(16px);
    cursor: pointer;
}

.account-avatar {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: var(--primary-color);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}

.account-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    width: min(300px, calc(100vw - 28px));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--surface-solid);
    box-shadow: var(--shadow-hover);
    padding: 6px;
}

.account-menu-panel[hidden] {
    display: none;
}

.account-menu-identity {
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 4px;
    padding: 11px 12px 12px;
}

.account-menu-name {
    color: var(--text-color);
    font-size: 14px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-menu-user,
.account-menu-role {
    color: var(--text-muted);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-menu-item {
    width: 100%;
    border: 0;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-color);
    display: block;
    font-size: 13px;
    min-height: 38px;
    padding: 9px 10px;
    text-align: left;
}

.account-menu-item:hover {
    background: var(--surface-muted);
    color: var(--text-color);
}

.account-menu-logout {
    color: var(--danger-color);
}

.whoo-glass-btn {
    min-height: var(--control-height);
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-lg) !important;
    background: var(--surface-elevated) !important;
    color: var(--text-color) !important;
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
    transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}

.whoo-glass-btn:hover {
    border-color: var(--primary-color) !important;
    background: var(--surface-solid) !important;
    transform: translateY(-1px);
}

.whoo-glass-icon {
    width: var(--control-height);
    min-width: var(--control-height);
    height: var(--control-height);
    padding: 0 !important;
}

.whoo-pill-indicator {
    min-height: calc(var(--control-height) - 8px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--surface-elevated);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
    color: var(--text-color);
}

.whoo-count-badge {
    background: var(--primary-color);
    color: #ffffff;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
}

.whoo-app .bg-white\/90,
.whoo-app .hover\:bg-white:hover {
    background: var(--surface-elevated) !important;
    color: var(--text-color) !important;
    border: 1px solid var(--border-color);
}

.whoo-app .text-gray-800,
.whoo-app .text-gray-700,
.whoo-app .text-gray-600 {
    color: var(--text-color) !important;
}

.whoo-app .text-gray-500,
.whoo-app .text-gray-400,
.whoo-app .text-gray-300 {
    color: var(--text-muted) !important;
}

.whoo-app .modal-sheet,
.whoo-app #cluster-modal > div,
.whoo-app #accounts-modal > div,
.whoo-app #stamp-modal > div,
.whoo-app #location-modal > div {
    background: var(--surface-solid) !important;
    color: var(--text-color) !important;
    border: 1px solid var(--border-color) !important;
}

.whoo-app [id$="-modal"] [style*="background: white"],
.whoo-app [id$="-modal"] [style*="background: #fff"] {
    background: var(--surface-solid) !important;
    color: var(--text-color) !important;
}

.whoo-app [id$="-modal"] [style*="background: #f9fafb"],
.whoo-app [id$="-modal"] [style*="background: #f3f4f6"],
.whoo-app [id$="-modal"] [style*="background: #f0f9ff"] {
    background: var(--surface-muted) !important;
    color: var(--text-color) !important;
    border-color: var(--border-color) !important;
}

.whoo-app [id$="-modal"] [style*="color: #6b7280"],
.whoo-app [id$="-modal"] [style*="color: #9ca3af"],
.whoo-app [id$="-modal"] [style*="opacity: 0.7"] {
    color: var(--text-muted) !important;
}

.whoo-app [id$="-modal"] [style*="border: 2px solid #e5e7eb"] {
    border-color: var(--border-color) !important;
    background: var(--surface-solid) !important;
    color: var(--text-color) !important;
}

.whoo-app [id$="-modal"] button[style*="background: #4A90D9"] {
    background: var(--primary-color) !important;
}

.whoo-app [id$="-modal"] button[style*="background: #6b7280"] {
    background: var(--secondary-color) !important;
}

.whoo-app [id$="-modal"] button[style*="background: #dc2626"] {
    background: var(--danger-color) !important;
}

.whoo-app [id$="-modal"] button[style*="background: #f97316"] {
    background: #ea580c !important;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
}

/* ===== ナビゲーション ===== */
.navbar {
    background: var(--card-bg);
    padding: 1rem 2rem;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-brand a {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    padding: 0.5rem;
    border-radius: 5px;
    transition: var(--transition);
}

.nav-links a:hover {
    color: var(--primary-color);
    background: var(--light-color);
}

.btn-logout {
    background: var(--danger-color) !important;
    color: white !important;
    padding: 0.5rem 1rem !important;
}

.btn-logout:hover {
    background: #c82333 !important;
}

.btn-signup {
    background: var(--primary-color) !important;
    color: white !important;
    padding: 0.5rem 1rem !important;
    border-radius: 5px;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

/* ===== コンテナ ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* ===== アラート ===== */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.alert-success {
    background: #D4EDDA;
    color: #155724;
    border: 1px solid #C3E6CB;
}

.alert-error {
    background: #F8D7DA;
    color: #721C24;
    border: 1px solid #F5C6CB;
}

.alert-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.3s;
}

.alert-close:hover {
    opacity: 1;
}

/* ===== ボタン ===== */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: var(--transition);
    font-size: 1rem;
    font-weight: 500;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* ===== ヒーローセクション ===== */
.hero {
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(135deg, var(--primary-color), #6DB3F2);
    color: white;
    border-radius: 16px;
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.hero-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.hero .btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
}

.hero .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ===== フィーチャーカード ===== */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.feature-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 16px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.feature-card p {
    color: var(--text-muted);
}

/* ===== 認証フォーム ===== */
.auth-container {
    max-width: 450px;
    margin: 0 auto;
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.auth-container h2 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.75rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="date"] {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.1);
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    flex: 1;
    padding-right: 50px;
}

.password-toggle {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    opacity: 0.6;
    transition: opacity 0.3s;
    padding: 0.5rem;
}

.password-toggle:hover {
    opacity: 1;
}

.password-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    display: block;
}

.validation-status {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    min-height: 1.25rem;
}

.validation-status.valid {
    color: var(--success-color);
}

.validation-status.invalid {
    color: var(--danger-color);
}

/* 画像アップロード */
.image-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.image-upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(74, 144, 217, 0.05);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
}

.upload-icon {
    font-size: 2.5rem;
}

.image-preview {
    display: none;
}

.image-preview img {
    max-width: 150px;
    max-height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
}

.auth-divider {
    text-align: center;
    margin: 1.5rem 0;
    position: relative;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: var(--border-color);
}

.auth-divider::before {
    left: 0;
}

.auth-divider::after {
    right: 0;
}

.auth-divider span {
    background: var(--card-bg);
    padding: 0 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--primary-color);
    font-weight: 500;
}

/* ===== ダッシュボード ===== */
.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-header h2 {
    margin-bottom: 0.5rem;
}

.user-info {
    color: var(--text-muted);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.card h3 {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--light-color);
    font-size: 1.1rem;
}

.profile-summary {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.profile-image {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
}

.profile-details p {
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.location-list,
.request-list {
    list-style: none;
}

.location-item,
.request-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--light-color);
    gap: 0.75rem;
}

.location-item:last-child,
.request-item:last-child {
    border-bottom: none;
}

.small-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.friend-name {
    font-weight: 500;
}

.friend-username {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.request-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.online-status {
    margin-left: auto;
    font-size: 0.8rem;
}

.empty-message {
    color: var(--text-muted);
    text-align: center;
    padding: 1.5rem;
    font-size: 0.9rem;
}

.more-link {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0.5rem 0;
}

.more-link a {
    color: var(--primary-color);
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    background: var(--light-color);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-color);
    transition: var(--transition);
    font-size: 0.9rem;
}

.action-btn:hover {
    background: var(--border-color);
    transform: translateY(-2px);
}

.action-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

/* ===== プロフィールページ ===== */
.profile-page {
    max-width: 800px;
    margin: 0 auto;
}

.profile-header {
    display: flex;
    gap: 2rem;
    align-items: center;
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.profile-image-large {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary-color);
}

.profile-info h1 {
    margin-bottom: 0.5rem;
}

.profile-info .username {
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.profile-info .introduction {
    color: var(--text-color);
    margin-top: 0.75rem;
}

.profile-stats {
    display: flex;
    justify-content: space-around;
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.stat-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.profile-details-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.profile-details-card h3 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--light-color);
}

.details-list {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 0.75rem 1rem;
}

.details-list dt {
    font-weight: 500;
    color: var(--text-muted);
}

.details-list dd {
    color: var(--text-color);
}

/* ===== チャットルーム ===== */
.rooms-page h2 {
    margin-bottom: 1.5rem;
}

.rooms-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.room-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--card-bg);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: var(--transition);
}

.room-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.room-avatar img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.default-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--light-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.room-info {
    flex: 1;
    min-width: 0;
}

.room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.room-name {
    font-size: 1rem;
    font-weight: 500;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.room-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.last-message {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unread-badge {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.room-type {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    border-radius: 5px;
    background: var(--light-color);
    color: var(--text-muted);
}

/* ===== マップページ ===== */
.map-page {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
    height: calc(100vh - 150px);
}

.map-container {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

#map {
    height: 100%;
    width: 100%;
}

.map-sidebar {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow-y: auto;
}

.map-sidebar h3 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--light-color);
    font-size: 1rem;
}

.friends-on-map,
.spots-list,
.events-list {
    margin-bottom: 1.5rem;
}

.friend-location-item,
.spot-item,
.event-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.friend-location-item:hover,
.spot-item:hover,
.event-item:hover {
    background: var(--light-color);
}

.friend-location-info {
    display: flex;
    flex-direction: column;
}

.location-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.my-location-marker {
    font-size: 30px;
    text-align: center;
}

/* ===== フレンド管理ページ ===== */
.friends-page {
    max-width: 900px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h2 {
    margin: 0;
}

.back-link {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.back-link:hover {
    color: var(--primary-color);
}

/* タブナビゲーション */
.tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    background: var(--light-color);
    padding: 0.25rem;
    border-radius: 12px;
    overflow-x: auto;
}

.tab-btn {
    padding: 0.75rem 1.25rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-muted);
    border-radius: 10px;
    transition: var(--transition);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-btn:hover {
    color: var(--text-color);
}

.tab-btn.active {
    background: var(--card-bg);
    color: var(--primary-color);
    font-weight: 600;
    box-shadow: var(--shadow);
}

.tab-btn .badge {
    background: var(--danger-color);
    color: white;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.tab-btn .badge.secondary {
    background: var(--secondary-color);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab-content.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

/* フレンドリクエストカード */
.friend-requests-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.friend-request-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.friend-request-card:hover {
    box-shadow: var(--shadow-hover);
}

.friend-request-card.accepted {
    transform: translateX(100%);
    opacity: 0;
}

.request-user-info {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.user-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
    flex-shrink: 0;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    margin: 0 0 0.25rem 0;
    font-size: 1.1rem;
}

.user-username {
    color: var(--text-muted);
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
}

.user-intro {
    color: var(--text-color);
    font-size: 0.9rem;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.user-location {
    color: var(--primary-color);
    font-size: 0.85rem;
    margin: 0.5rem 0 0 0;
}

.request-status {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.online-indicator {
    font-size: 0.85rem;
}

.online-indicator.online {
    color: var(--success-color);
}

.online-indicator.offline {
    color: var(--text-muted);
}

.private-badge {
    font-size: 0.85rem;
    color: var(--warning-color);
}

.request-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.request-actions .btn {
    flex: 1;
    min-width: 120px;
}

/* フレンド一覧グリッド */
.friends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.friend-card-link {
    text-decoration: none;
    color: inherit;
}

.friend-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
}

.friend-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.friend-card.pending {
    opacity: 0.7;
}

.friend-card.sent {
    border: 2px solid var(--success-color);
}

.friend-card.recommended {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.friend-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 1rem;
    border: 3px solid var(--light-color);
}

.friend-card.recommended .friend-avatar {
    margin: 0;
}

.friend-info h4 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
}

.friend-info .username {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0 0 0.5rem 0;
}

.friend-count-small {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

.pending-badge {
    display: inline-block;
    background: var(--warning-color);
    color: #333;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.friendship-badges {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.friendship-badges .badge {
    font-size: 1rem;
    padding: 0.25rem;
}

.friendship-badges .badge.best {
    color: #FFD700;
}

.friendship-badges .badge.super-best {
    color: #FFA500;
}

.friendship-badges .badge.life-best {
    color: #87CEEB;
}

/* ===== 検索ページ ===== */
.search-page {
    max-width: 700px;
    margin: 0 auto;
}

.search-box {
    margin-bottom: 2rem;
}

.search-input-wrapper {
    display: flex;
    gap: 0.75rem;
}

.search-input-wrapper input {
    flex: 1;
    padding: 1rem 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    transition: var(--transition);
}

.search-input-wrapper input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.1);
}

.search-results h3 {
    margin-bottom: 1rem;
    color: var(--text-muted);
    font-size: 1rem;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.search-result-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--card-bg);
    padding: 1.25rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.result-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.result-info {
    flex: 1;
    min-width: 0;
}

.result-info h4 {
    margin: 0 0 0.25rem 0;
}

.result-info .username {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0 0 0.25rem 0;
}

.result-info .introduction {
    font-size: 0.85rem;
    color: var(--text-color);
    margin: 0.5rem 0;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.result-actions {
    display: flex;
    gap: 0.5rem;
    flex-direction: column;
}

.friend-badge {
    background: var(--success-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    text-align: center;
}

.blocked-badge,
.blocking-badge {
    background: var(--danger-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    text-align: center;
}

.search-hint {
    text-align: center;
    padding: 3rem;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.search-hint .empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* ===== 空状態 ===== */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* ===== モーダル ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 1rem;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    width: 100%;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.modal-content h3 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.modal-content p {
    margin-bottom: 1.5rem;
    color: var(--text-muted);
}

/* ===== ローディングオーバーレイ ===== */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 3000;
}

.loading-overlay.show {
    display: flex;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--light-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay p {
    color: var(--text-muted);
}

/* ===== その他のユーティリティ ===== */
.friend-count {
    background: var(--light-color);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.text-muted {
    color: var(--text-muted);
}

/* ===== レスポンシブ ===== */
@media (max-width: 768px) {
    .navbar {
        padding: 1rem;
    }
    
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--card-bg);
        flex-direction: column;
        padding: 1rem;
        box-shadow: var(--shadow);
        gap: 0.5rem;
    }
    
    .nav-links.show {
        display: flex;
    }
    
    .nav-toggle {
        display: block;
    }
    
    .container {
        padding: 1rem;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .auth-container {
        padding: 1.5rem;
    }
    
    .profile-header {
        flex-direction: column;
        text-align: center;
    }
    
    .profile-image-large {
        width: 120px;
        height: 120px;
    }
    
    .profile-stats {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .stat-item {
        flex: 1;
        min-width: 80px;
    }
    
    .map-page {
        grid-template-columns: 1fr;
        grid-template-rows: 50vh auto;
        height: auto;
    }
    
    .map-sidebar {
        height: auto;
        max-height: 400px;
    }
    
    .tabs {
        padding: 0.15rem;
    }
    
    .tab-btn {
        padding: 0.6rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .request-user-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .request-actions {
        flex-direction: column;
    }
    
    .request-actions .btn {
        width: 100%;
    }
    
    .friends-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .search-input-wrapper {
        flex-direction: column;
    }
    
    .search-result-card {
        flex-direction: column;
        text-align: center;
    }
    
    .result-actions {
        width: 100%;
    }
    
    .result-actions .btn {
        width: 100%;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 2rem 1rem;
    }
    
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .hero-buttons {
        flex-direction: column;
    }
    
    .hero-buttons .btn {
        width: 100%;
    }
    
    .features {
        grid-template-columns: 1fr;
    }
    
    .friends-grid {
        grid-template-columns: 1fr;
    }
    
    .friend-card.recommended {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }
    
    .friend-card.recommended .friend-avatar {
        width: 50px;
        height: 50px;
    }
    
    .friend-card.recommended .friend-info {
        flex: 1;
    }
    
    .friend-card.recommended .btn {
        width: 100%;
    }
}

/* ===== Admin Panel ===== */
.admin-shell {
    width: min(100vw - 28px, 1320px);
    margin: 0 auto;
    padding: 18px 0 42px;
}

.admin-header {
    align-items: flex-start;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 18px;
}

.admin-header h1 {
    font-size: 1.46rem;
    font-weight: 700;
    letter-spacing: 0;
    margin-bottom: 2px;
}

.admin-kicker,
.admin-meta {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin: 0;
}

.admin-header-actions {
    align-items: center;
    display: flex;
    gap: 10px;
}

.admin-back-link {
    align-items: center;
    background: var(--surface-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-color);
    display: inline-flex;
    font-size: 0.88rem;
    font-weight: 600;
    height: 40px;
    justify-content: center;
    padding: 0 14px;
}

.admin-main {
    display: grid;
    gap: 14px;
}

.admin-summary-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-summary-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    display: grid;
    gap: 6px;
    min-height: 78px;
    padding: 12px 14px;
}

.admin-summary-card span {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
}

.admin-summary-card strong {
    color: var(--text-color);
    font-size: 1.25rem;
    letter-spacing: 0;
    line-height: 1.1;
}

.admin-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 14px;
}

.admin-section h2 {
    font-size: 1rem;
    margin-bottom: 10px;
}

.admin-error {
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.24);
    border-radius: var(--radius-md);
    color: var(--danger-color);
    padding: 12px 14px;
}

.admin-table {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.admin-table-head,
.admin-table-row {
    align-items: center;
    display: grid;
    gap: 10px;
    grid-template-columns: 1.2fr 0.7fr 1fr 1.5fr;
    padding: 10px 12px;
}

.admin-table-head {
    background: var(--surface-muted);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.admin-table-row {
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.admin-table-row strong {
    display: block;
    font-size: 0.87rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-table-row small {
    color: var(--text-muted);
    display: block;
    font-size: 0.74rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-dot {
    border-radius: 999px;
    display: inline-block;
    height: 8px;
    margin-right: 6px;
    width: 8px;
}

.status-dot.is-online {
    background: #22c55e;
}

.status-dot.is-offline {
    background: var(--text-muted);
}

.admin-history-list {
    display: grid;
    gap: 10px;
}

.admin-history-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.admin-history-item > header {
    align-items: baseline;
    background: var(--surface-muted);
    display: flex;
    gap: 8px;
    justify-content: space-between;
    padding: 8px 10px;
}

.admin-history-item > header small {
    color: var(--text-muted);
    font-size: 0.76rem;
}

.admin-history-item ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.admin-history-item li {
    border-top: 1px solid var(--border-color);
    display: grid;
    gap: 8px;
    grid-template-columns: 1.2fr 0.6fr 1.8fr 0.8fr;
    padding: 8px 10px;
}

.admin-history-item li span {
    font-size: 0.79rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-empty {
    color: var(--text-muted);
    font-size: 0.84rem;
}

/* ===== Admin Panel Login ===== */
.admin-login-wrap {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 14px;
}

.admin-login-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    box-shadow: var(--shadow);
    max-width: 360px;
    padding: 18px;
    width: 100%;
}

.admin-login-brand {
    display: grid;
    gap: 10px;
    justify-items: center;
    margin-bottom: 14px;
}

.admin-login-icon {
    align-items: center;
    background: var(--surface-muted);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    color: var(--primary-color);
    display: inline-flex;
    height: 52px;
    justify-content: center;
    width: 52px;
}

.admin-login-icon svg {
    fill: none;
    height: 22px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
    width: 22px;
}

.admin-login-brand h1 {
    font-size: 1.34rem;
    letter-spacing: 0;
    margin: 0;
}

.admin-login-error {
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.24);
    border-radius: 12px;
    color: var(--danger-color);
    font-size: 0.82rem;
    margin-bottom: 10px;
    padding: 9px 10px;
}

.admin-login-form {
    display: grid;
    gap: 10px;
}

.admin-login-form label {
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 700;
}

.admin-login-form input {
    background: var(--surface-solid);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-color);
    height: 44px;
    padding: 0 12px;
}

.admin-login-form button {
    background: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 12px;
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 700;
    height: 44px;
}

.admin-login-form button:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

@media (max-width: 980px) {
    .admin-summary-grid {
        grid-template-columns: 1fr;
    }

    .admin-table-head,
    .admin-table-row {
        grid-template-columns: 1fr;
    }

    .admin-history-item li {
        grid-template-columns: 1fr;
    }
}

/* ===== Criticer theme alignment ===== */
html {
    background: var(--bg-color);
}

body {
    background: var(--bg-color);
    color: var(--text-color);
}

.navbar,
.auth-container,
.feature-card,
.card,
.profile-header,
.profile-stats,
.profile-details-card,
.room-card,
.map-container,
.map-sidebar,
.friend-request-card,
.friend-card,
.search-result-card,
.search-hint,
.empty-state,
.modal-content {
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    backdrop-filter: blur(18px);
}

.navbar {
    box-shadow: 0 1px 0 var(--border-color), 0 12px 32px rgba(15, 23, 42, 0.05);
}

.container {
    width: min(100vw - 28px, 1200px);
    padding: 20px 0 40px;
}

.hero {
    padding: clamp(2rem, 5vw, 3rem) clamp(1rem, 3vw, 2rem);
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    box-shadow: var(--shadow);
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    letter-spacing: 0;
}

.hero p {
    color: var(--text-muted);
}

.modal-sheet,
.modal-overlay > div {
    background: var(--card-bg) !important;
    color: var(--text-color) !important;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.modal-sheet input,
.modal-sheet select,
.modal-sheet textarea {
    background: var(--surface-solid) !important;
    border-color: var(--border-color) !important;
    color: var(--text-color) !important;
}

.btn,
button,
input,
select,
textarea {
    font: inherit;
}

.btn,
.btn-signup,
.btn-logout,
.tab-btn,
.action-btn {
    border-radius: 12px;
}

.btn-primary,
.btn-signup,
.unread-badge {
    background: var(--primary-color) !important;
    color: #ffffff !important;
}

.btn-primary:hover:not(:disabled),
.btn-signup:hover,
.bg-primary:hover,
.hover\:bg-primary-hover:hover {
    background: var(--primary-hover) !important;
}

.btn-secondary,
.action-btn,
.friend-count,
.room-type,
.default-avatar {
    background: var(--surface-muted);
    color: var(--text-color);
}

.btn-logout {
    background: var(--danger-color) !important;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="date"],
.search-input-wrapper input,
input,
select,
textarea {
    border-color: var(--border-color);
    background: var(--surface-solid);
    color: var(--text-color);
}

.form-group input:focus,
.search-input-wrapper input:focus,
input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--focus-ring);
    outline: none;
}

.card h3,
.profile-details-card h3,
.map-sidebar h3,
.location-item,
.request-item {
    border-color: var(--border-color);
}

.tabs,
.friend-location-item:hover,
.spot-item:hover,
.event-item:hover,
.nav-links a:hover {
    background: var(--surface-muted);
}

.tab-btn.active {
    background: var(--card-bg);
    color: var(--primary-color);
    border: 1px solid var(--border-color);
}

.map-container {
    min-height: 360px;
}

.leaflet-control-zoom a,
.leaflet-bar a,
.leaflet-control-layers {
    background: var(--card-bg) !important;
    color: var(--text-color) !important;
    border-color: var(--border-color) !important;
}

.leaflet-bar {
    border-color: var(--border-color) !important;
    box-shadow: var(--shadow) !important;
}

.bg-white,
.bg-white\/90 {
    background-color: var(--card-bg) !important;
}

.bg-gray-50,
.bg-gray-100,
.bg-gray-200,
.hover\:bg-gray-50:hover,
.hover\:bg-gray-100:hover,
.hover\:bg-gray-200:hover {
    background-color: var(--surface-muted) !important;
}

.text-gray-400,
.text-gray-500,
.text-gray-600 {
    color: var(--text-muted) !important;
}

.text-gray-700,
.text-gray-800 {
    color: var(--text-color) !important;
}

.text-primary,
.hover\:text-primary:hover {
    color: var(--primary-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.border-gray-100,
.border-gray-200,
.border-gray-300 {
    border-color: var(--border-color) !important;
}

.shadow,
.shadow-md,
.shadow-lg,
.shadow-xl {
    box-shadow: var(--shadow) !important;
}

html.dark .alert-success {
    background: rgba(22, 101, 52, 0.22);
    color: #bbf7d0;
    border-color: rgba(52, 211, 153, 0.28);
}

html.dark .alert-error {
    background: rgba(127, 29, 29, 0.24);
    color: #fecaca;
    border-color: rgba(248, 113, 113, 0.28);
}

html.dark .loading-overlay {
    background: rgba(15, 20, 26, 0.92);
}

@media (max-width: 768px) {
    .container {
        width: min(100vw - 20px, 1200px);
        padding: 14px 0 28px;
    }

    .navbar {
        padding: 0.75rem 1rem;
    }

    .nav-brand a {
        font-size: 1.2rem;
    }

    .auth-container,
    .card,
    .profile-header,
    .profile-stats,
    .profile-details-card,
    .map-sidebar,
    .friend-request-card,
    .friend-card,
    .search-result-card,
    .empty-state {
        padding: 1rem;
        border-radius: 14px;
    }

    .details-list {
        grid-template-columns: 1fr;
        gap: 0.25rem 0;
    }

    .map-page {
        gap: 1rem;
    }
}

/* ===== eSIM-style entry layout ===== */
.entry-shell {
    width: min(100vw - 28px, 920px);
    margin: 0 auto;
    padding: 16px 0 40px;
    display: grid;
    gap: 12px;
}

.entry-top,
.entry-panel {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--card-bg);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.entry-top {
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.entry-brand {
    margin: 0;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 0;
    color: var(--text-color);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.entry-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.entry-btn {
    min-height: var(--control-height);
    padding: 0 13px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-solid);
    color: var(--text-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}

.entry-select {
    min-height: var(--control-height);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-solid);
    color: var(--text-color);
    padding: 0 36px 0 12px;
    font-size: 13px;
    font-weight: 700;
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
        linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-position:
        calc(100% - 16px) calc(50% - 2px),
        calc(100% - 11px) calc(50% - 2px);
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}

.entry-select:hover {
    border-color: var(--primary-color);
}

.entry-btn:hover {
    border-color: var(--primary-color);
    color: var(--text-color);
    transform: translateY(-1px);
}

.entry-btn-primary {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: #fff;
}

.entry-btn-primary:hover {
    background: var(--primary-hover);
    color: #fff;
}

.entry-btn-block {
    width: 100%;
}

.entry-panel {
    padding: 16px;
}

.entry-hero h1 {
    margin: 0;
    font-size: clamp(32px, 6vw, 56px);
    line-height: 1.05;
    letter-spacing: 0;
}

.entry-hero p {
    margin: 8px 0 0;
    color: var(--text-muted);
    font-size: 13px;
}

.entry-chip-row {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.entry-chip {
    min-height: 28px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--surface-solid);
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.entry-section-title {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    color: var(--text-color);
}

.entry-feature-grid {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.entry-feature {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-muted);
    padding: 12px;
    display: grid;
    gap: 8px;
}

.entry-feature-icon {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--surface-solid);
    color: var(--primary-color);
    display: inline-grid;
    place-items: center;
    font-size: 14px;
}

.entry-feature h3 {
    margin: 0;
    font-size: 16px;
    line-height: 1.2;
    color: var(--text-color);
}

.entry-feature p {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
}

.entry-auth-wrap {
    min-height: calc(100vh - 110px);
    display: grid;
    place-items: center;
}

.entry-auth-panel {
    width: min(460px, 100%);
}

.entry-title {
    margin: 0;
    font-size: 36px;
    line-height: 1.08;
    font-weight: 900;
    letter-spacing: 0;
    color: var(--text-color);
}

.entry-sub {
    margin: 6px 0 0;
    color: var(--text-muted);
    font-size: 13px;
}

.entry-alert {
    margin-top: 10px;
    border: 1px solid color-mix(in srgb, var(--danger-color) 42%, var(--border-color));
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--danger-color) 10%, transparent);
    color: var(--danger-color);
    padding: 9px 10px;
    font-size: 12px;
}

.entry-form {
    margin-top: 12px;
    display: grid;
    gap: 10px;
}

.entry-field {
    display: grid;
    gap: 6px;
}

.entry-field > span {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
    color: var(--text-muted);
}

.entry-field input {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-solid);
    color: var(--text-color);
    padding: 0 12px;
    font-size: 15px;
}

.entry-field input:focus-visible,
.entry-btn:focus-visible,
.entry-select:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--primary-color) 40%, transparent);
    outline-offset: 2px;
}

.entry-input-wrap {
    position: relative;
}

.entry-input-wrap input {
    padding-right: 46px;
}

.entry-input-btn {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--surface-solid);
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.entry-input-btn[aria-pressed="true"] {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.entry-help {
    margin: 4px 0 0;
    font-size: 11px;
    color: var(--text-muted);
}

.entry-help.is-pending {
    color: var(--text-muted);
}

.entry-help.is-valid {
    color: var(--success-color);
}

.entry-help.is-invalid {
    color: var(--danger-color);
}

.entry-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.entry-upload {
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-muted);
    min-height: 108px;
    padding: 10px;
    display: grid;
    place-items: center;
    text-align: center;
    cursor: pointer;
}

.entry-upload img {
    width: 72px;
    height: 72px;
    border-radius: 999px;
    object-fit: cover;
}

.entry-foot {
    margin: 12px 0 0;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

.entry-foot a {
    color: var(--primary-color);
    font-weight: 700;
}

@media (max-width: 860px) {
    .entry-feature-grid {
        grid-template-columns: 1fr;
    }

    .entry-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .entry-shell {
        width: min(100vw - 20px, 920px);
    }
}
