@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Cinzel:wght@600;700;900&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
    --bg-dark: #0f111a;
    --bg-card: rgba(26, 29, 45, 0.75);
    --bg-card-hover: rgba(35, 40, 60, 0.85);
    --bg-card-border: rgba(99, 102, 241, 0.2);
    --bg-card-border-glow: rgba(99, 102, 241, 0.5);
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #8b5cf6;
    --accent: #f59e0b;
    --accent-glow: rgba(245, 158, 11, 0.4);
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.4);
    --warning: #f59e0b;
    --danger: #ef4444;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-heading: 'Cinzel', serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(15, 23, 42, 0.8) 0px, transparent 100%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #818cf8;
}

/* Glassmorphism Cards */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--bg-card-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    padding: 1.5rem;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.glass-card:hover {
    border-color: var(--bg-card-border-glow);
}

/* App Layout & Navbar */
.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 2rem;
    margin: 1rem 2rem;
    border-radius: 16px;
    position: sticky;
    top: 1rem;
    z-index: 100;
    transition: all 0.2s ease;
}

.nav-brand-row {
    display: flex;
    align-items: center;
}

.nav-actions-mobile {
    display: none;
}

.btn-mobile-toggle {
    display: none;
}

.mobile-logout-wrapper {
    display: none;
}

.desktop-auth {
    display: flex;
}

.nav-brand-container .brand-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1px;
}

.brand-highlight {
    color: var(--primary);
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-item-link {
    color: var(--text-muted);
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.nav-item-link:hover, .nav-item-link.active {
    color: #fff;
    background: rgba(99, 102, 241, 0.2);
}

.nav-pill {
    background: var(--primary);
    color: #fff;
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-weight: 700;
}

.nav-auth-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-google-signin {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #ffffff;
    color: #1f2937;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

.btn-google-signin:hover {
    background: #f3f4f6;
    transform: translateY(-1px);
}

.user-profile-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.08);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
}

.btn-user-profile {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: none;
    border: none;
    color: inherit;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
}

.btn-user-profile:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--primary);
}

.user-edit-icon {
    font-size: 0.75rem;
    opacity: 0.7;
    transition: opacity 0.15s ease;
}

.btn-user-profile:hover .user-edit-icon {
    opacity: 1;
}

.profile-edit-dialog {
    max-width: 480px;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

/* App Main Content */
.app-main-content {
    flex: 1;
    padding: 1rem 2rem 3rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.page-container {
    width: 100%;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-top: 0.25rem;
}

/* Hero Section */
.hero-jumbotron {
    padding: 3.5rem 3rem;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(30, 34, 53, 0.9) 0%, rgba(20, 24, 38, 0.9) 100%);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.hero-title {
    font-family: var(--font-heading);
    font-size: 2.8rem;
    font-weight: 900;
    line-height: 1.2;
}

.gradient-text {
    background: linear-gradient(135deg, #818cf8 0%, #c084fc 50%, #f472b6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 700px;
    margin-top: 1rem;
}

.hero-meta-badge {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
    font-size: 0.85rem;
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-weight: 600;
}

.feature-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.feature-card {
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
}

.feature-icon {
    font-size: 2.2rem;
    margin-bottom: 0.75rem;
}

.feature-card h3 {
    font-family: var(--font-heading);
    margin-bottom: 0.5rem;
}

.feature-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.feature-link {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
}

/* Card Visuals (CardDisplay) */
.card-display {
    background: rgba(20, 24, 38, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0.75rem;
    width: 170px;
    max-width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-display:hover,
.card-display:focus,
.card-display:focus-within {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6);
    z-index: 50;
}

.card-display.golden {
    border-color: #f59e0b;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.25);
}

.card-display.compact {
    width: 130px;
    max-width: 100%;
    padding: 0.5rem;
}

.card-image-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
}

.card-img {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: contain;
    border-radius: 8px;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.5));
}

.golden-toggle-btn {
    position: absolute;
    bottom: 0.25rem;
    right: 0.25rem;
    background: rgba(0, 0, 0, 0.75);
    color: #ffd700;
    border: 1px solid #ffd700;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.golden-toggle-btn:hover, .golden-toggle-btn.active {
    background: #ffd700;
    color: #000;
}

.card-info {
    width: 100%;
    margin-top: 0.5rem;
    text-align: center;
}

.card-title {
    font-weight: 700;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
}

.card-rarity {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.15rem;
}

.card-skill {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: left;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.25rem 0.4rem;
    border-radius: 4px;
}

/* Hero Visuals (HeroDisplay) */
.hero-display {
    background: rgba(20, 24, 38, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0.75rem;
    width: 170px;
    max-width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    transition: transform 0.2s ease;
}

.hero-display:hover,
.hero-display:focus,
.hero-display:focus-within {
    transform: translateY(-4px);
    z-index: 50;
}

.hero-display.compact {
    width: 130px;
    max-width: 100%;
    padding: 0.5rem;
}

.hero-image-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
}

.hero-img {
    width: 100%;
    max-height: 190px;
    object-fit: contain;
    border-radius: 8px;
}

.hero-cost-badge {
    position: absolute;
    top: 0.25rem;
    left: 0.25rem;
    background: #f59e0b;
    color: #000;
    font-weight: 800;
    font-size: 0.75rem;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.hero-info {
    width: 100%;
    margin-top: 0.5rem;
    text-align: center;
}

.hero-title {
    font-weight: 700;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
}

.hero-meta {
    display: flex;
    justify-content: center;
    gap: 0.35rem;
    margin-top: 0.25rem;
}

.hero-faction, .hero-rarity {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
}

.hero-effect {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: left;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.25rem 0.4rem;
    border-radius: 4px;
}

/* Match Badges */
.match-badge-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.match-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.6rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.8rem;
}

.badge-label {
    opacity: 0.8;
    font-size: 0.7rem;
    text-transform: uppercase;
}

.badge-success-glow {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid var(--success);
    color: #34d399;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid var(--success);
    color: #34d399;
}

.badge-primary {
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid var(--primary);
    color: #a5b4fc;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid var(--warning);
    color: #fcd34d;
}

.badge-secondary {
    background: rgba(148, 163, 184, 0.15);
    border: 1px solid #64748b;
    color: #cbd5e1;
}

.badge-muted {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-dim);
}

.badge-playable-tag {
    background: #10b981;
    color: #000;
    font-weight: 800;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
}

/* Guides Grid */
.guides-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 1.5rem;
}

.guide-card {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 260px;
    border: 1px solid var(--bg-card-border);
    position: relative;
}

.guide-card:hover,
.guide-card:focus,
.guide-card:focus-within {
    transform: translateY(-4px);
    border-color: var(--primary);
    z-index: 30;
}

.guide-card-playable {
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.15);
}

.guide-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.guide-card-header .guide-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.35rem;
    line-height: 1.3;
}

.guide-badges {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
    flex-wrap: wrap;
    margin-bottom: 0.45rem;
}

.badge-season {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
    letter-spacing: 0.02em;
    line-height: 1.4;
    flex-shrink: 0;
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-skill {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
    letter-spacing: 0.02em;
    line-height: 1.4;
    flex-shrink: 0;
}

.badge-skill-beginner {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.4);
}

.badge-skill-intermediate {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.badge-skill-advanced {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.4);
}

.badge-unlisted {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
    letter-spacing: 0.02em;
    line-height: 1.4;
    flex-shrink: 0;
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.guide-author-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.guide-summary {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.guide-match-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.guide-deck-preview {
    margin-bottom: 0.75rem;
}

.deck-preview-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.deck-group-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-dim);
    width: 50px;
}

.deck-thumb-row {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    flex-wrap: wrap;
}

.thumb-wrapper {
    position: relative;
    width: 38px;
    height: 48px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.thumb-wrapper:hover,
.thumb-wrapper:focus,
.thumb-wrapper:focus-within {
    z-index: 100;
}

.thumb-wrapper.thumb-owned {
    border-color: #10b981;
}

.thumb-wrapper.thumb-missing {
    opacity: 0.45;
    filter: grayscale(80%);
}

.thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 3px;
}

.req-indicator {
    position: absolute;
    top: 0;
    right: 0;
    background: #f59e0b;
    color: #000;
    font-size: 0.55rem;
    padding: 0 0.2rem;
    font-weight: 800;
}

.more-tag {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.guide-card-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: auto;
    padding-top: 0.5rem;
}

.view-guide-link {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.85rem;
}

/* Match Summary Card */
.match-summary-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
    border-color: rgba(99, 102, 241, 0.3);
}

.summary-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.summary-icon {
    font-size: 2.2rem;
}

.summary-title {
    font-weight: 700;
    font-size: 1.1rem;
}

.summary-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.summary-playable-count {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.5rem 1.25rem;
    border-radius: 12px;
}

.count-val {
    font-size: 1.8rem;
    font-weight: 900;
    color: #34d399;
}

.count-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* Filter Controls Bar */
.filter-controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.search-field {
    flex: 1;
    min-width: 280px;
}

.filter-options {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.sort-select-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sort-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* Search Dropdown / Input */
.search-input-container {
    position: relative;
    width: 100%;
    z-index: 50;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 0.85rem;
    font-size: 1rem;
    opacity: 0.6;
}

.search-box input {
    padding-left: 2.5rem;
    padding-right: 2rem;
}

.clear-search-btn {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: bold;
}

.search-dropdown-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 380px;
    overflow-y: auto;
    background: #1a1d2d;
    border: 1px solid var(--primary);
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(0,0,0,0.7);
    z-index: 1000;
}

.search-card-group {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.search-card-group:last-child {
    border-bottom: none;
}

.search-card-group-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.85rem;
    background: rgba(255, 255, 255, 0.04);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.card-group-slot {
    font-size: 0.75rem;
    color: var(--accent);
}

.version-count-badge {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--text-dim);
}

.search-item {
    position: relative;
    display: flex;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.15s ease;
}

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

.search-item:hover,
.search-item:focus,
.search-item:focus-within {
    background: rgba(99, 102, 241, 0.2);
    z-index: 50;
}

.search-thumb {
    width: 44px;
    height: 56px;
    object-fit: cover;
    border-radius: 4px;
}

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

.search-item-title {
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.version-title-name {
    color: #fff;
}

.version-badge {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.4);
    font-size: 0.7rem;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-weight: 600;
}

.version-id-tag {
    font-size: 0.7rem;
    color: var(--text-dim);
}

.version-id-meta {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 0.2rem;
}

.card-modal-skill {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.search-item-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 450px;
}

.version-chips {
    display: flex;
    gap: 0.35rem;
    margin-top: 0.35rem;
}

.version-chip {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    cursor: pointer;
}

.version-chip:hover {
    background: var(--primary);
    border-color: var(--primary);
}

/* Modals */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    padding: 1rem;
}

.modal-dialog {
    max-width: 750px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    border: 1px solid var(--primary);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.75rem;
}

.btn-close-modal {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.picker-mode-switcher {
    display: flex;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.25);
    padding: 0.4rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.picker-mode-switcher .btn {
    flex: 1;
    font-size: 0.85rem;
    padding: 0.45rem 0.75rem;
}

/* Image Position Selector & Custom Image Form in Modal */
.position-selector-container {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0.75rem 1rem;
}

.position-selector-container .btn-group {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.position-selector-container .btn-group .btn {
    flex: 1;
    min-width: 130px;
    font-size: 0.85rem;
    padding: 0.4rem 0.6rem;
    border-radius: 6px !important;
}

.custom-image-form {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.modal-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    max-height: 480px;
    overflow-y: auto;
}

.modal-card-card {
    position: relative;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.2s ease;
}

.modal-card-card:hover,
.modal-card-card:focus-within {
    z-index: 50;
}

.card-thumb-sm {
    width: 70px;
    height: 90px;
    object-fit: cover;
    border-radius: 4px;
}

/* Item Selector List */
.item-selector-container {
    position: relative;
    z-index: 30;
}

.selector-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    position: relative;
    z-index: 30;
}

.selector-column {
    position: relative;
    z-index: 20;
}

.selector-column:focus-within {
    z-index: 40;
}

.selector-input-row {
    position: relative;
    z-index: 50;
}

@media (max-width: 900px) {
    .selector-columns {
        grid-template-columns: 1fr;
    }
}

.column-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
}

.column-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.item-list {
    max-height: 380px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.selector-item-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.selector-item-card:hover,
.selector-item-card:focus-within {
    z-index: 50;
}

.selector-item-card.req-item {
    border-left: 4px solid var(--accent);
}

.selector-item-card.rec-item {
    border-left: 4px solid var(--primary);
}

.selector-thumb {
    width: 36px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
}

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

.selector-item-name {
    font-weight: 600;
    font-size: 0.85rem;
}

.selector-item-meta {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.selector-item-controls {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.btn-req {
    background: var(--accent);
    color: #000;
    font-weight: 700;
    border: 1px solid var(--accent);
}

.btn-outline-req {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}

.btn-rec {
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    border: 1px solid var(--primary);
}

.btn-outline-rec {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-icon-remove {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
    cursor: pointer;
}

/* Markdown Editor Studio */
.editor-equipment-section {
    position: relative;
    z-index: 30;
}

.editor-studio {
    position: relative;
    z-index: 1;
}

.editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.toolbar-group {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    flex-wrap: wrap;
}

.toolbar-divider {
    width: 1px;
    height: 22px;
    background: rgba(255, 255, 255, 0.15);
    margin: 0 0.25rem;
}

.btn-toolbar-item {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    transition: all 0.15s ease-in-out;
    line-height: 1.4;
    text-decoration: none;
}

.btn-toolbar-item:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.5);
    color: #ffffff;
}

.btn-toolbar-item:active {
    transform: translateY(1px);
}

.editor-panes {
    display: grid;
    gap: 1.5rem;
}

.editor-panes.mode-split {
    grid-template-columns: 1fr 1fr;
}

.editor-panes.mode-edit {
    grid-template-columns: 1fr;
}

.editor-panes.mode-preview {
    grid-template-columns: 1fr;
}

@media (max-width: 900px) {
    .editor-panes.mode-split {
        grid-template-columns: 1fr;
    }
}

.markdown-textarea {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    line-height: 1.6;
    background: rgba(10, 12, 20, 0.85);
    color: #f1f5f9;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    resize: vertical;
}

.pane-preview {
    background: rgba(10, 12, 20, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1.25rem;
    max-height: 507px;
    overflow-y: auto;
}

.preview-header {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.25rem;
}

/* Markdown Body Rendering */
.markdown-body {
    color: #e2e8f0;
    line-height: 1.7;
    display: flow-root;
}

.markdown-body::after {
    content: "";
    display: table;
    clear: both;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3 {
    font-family: var(--font-heading);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #fff;
}

.markdown-body p {
    margin-bottom: 1rem;
}

.markdown-body ul, .markdown-body ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.markdown-body blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 1rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 1rem;
}

.markdown-body img {
    max-width: 100%;
    max-height: 320px;
    border-radius: 8px;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.5));
    margin: 1rem 0;
    display: inline-block;
    transition: transform 0.2s ease;
}

/* Block positioned image */
.markdown-body img.img-block,
.markdown-body .img-block {
    display: block;
    margin: 1.5rem auto;
    max-width: 100%;
    clear: both;
    text-align: center;
}

/* Floating images (left / right) */
.markdown-body img.img-float-left,
.markdown-body img.img-floating-left,
.markdown-body img.img-float,
.markdown-body img.img-floating,
.markdown-body .img-float-left,
.markdown-body .img-floating-left,
.markdown-body .img-float,
.markdown-body .img-floating {
    float: left;
    margin: 0.5rem 1.5rem 1rem 0;
    max-width: 45%;
    display: block;
    clear: left;
}

.markdown-body img.img-float-right,
.markdown-body img.img-floating-right,
.markdown-body .img-float-right,
.markdown-body .img-floating-right {
    float: right;
    margin: 0.5rem 0 1rem 1.5rem;
    max-width: 45%;
    display: block;
    clear: right;
}

.markdown-body .clearfix,
.markdown-body .clear {
    clear: both;
    display: block;
    height: 0;
    visibility: hidden;
}

.markdown-body code {
    font-family: var(--font-mono);
    background: rgba(0, 0, 0, 0.4);
    color: #f472b6;
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    font-size: 0.9em;
}

.markdown-body pre {
    background: rgba(0, 0, 0, 0.6);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1rem;
}

/* Card Link & Marked Text Tooltip */
.card-tooltip-wrapper {
    position: relative;
    display: inline-block;
    cursor: pointer;
    vertical-align: baseline;
    margin: 0 0.2rem;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.card-tooltip-wrapper:hover,
.card-tooltip-wrapper:focus,
.card-tooltip-wrapper:focus-within,
.card-tooltip-wrapper:active {
    z-index: 10000;
}

mark.card-link,
.card-tooltip-wrapper mark {
    background: rgba(99, 102, 241, 0.22);
    color: #e0e7ff;
    border: 1px solid rgba(99, 102, 241, 0.45);
    border-bottom: 2px solid #818cf8;
    border-radius: 4px;
    padding: 0.12rem 0.45rem;
    font-weight: 600;
    display: inline-block;
    line-height: 1.35;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

mark.card-link.golden-card-link,
.card-tooltip-wrapper mark.golden-card-link {
    background: rgba(245, 158, 11, 0.25);
    color: #fef3c7;
    border: 1px solid rgba(245, 158, 11, 0.5);
    border-bottom: 2px solid #f59e0b;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.15);
}

.card-tooltip-wrapper:hover mark.card-link,
.card-tooltip-wrapper:focus mark.card-link,
.card-tooltip-wrapper:focus-within mark.card-link,
.card-tooltip-wrapper:active mark.card-link {
    background: rgba(99, 102, 241, 0.5);
    color: #ffffff;
    border-color: #a5b4fc;
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.6);
    transform: translateY(-1px);
}

.card-tooltip-wrapper:hover mark.golden-card-link,
.card-tooltip-wrapper:focus mark.golden-card-link,
.card-tooltip-wrapper:focus-within mark.golden-card-link,
.card-tooltip-wrapper:active mark.golden-card-link {
    background: rgba(245, 158, 11, 0.5);
    color: #ffffff;
    border-color: #fbbf24;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.6);
    transform: translateY(-1px);
}

.card-tooltip-content {
    display: none !important;
}

/* Global Floating Card Tooltip (Body-level Portal) */
.global-card-tooltip {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000000;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px) scale(0.96);
    transition: opacity 0.15s cubic-bezier(0.16, 1, 0.3, 1), transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.15s;
    background: rgba(13, 17, 28, 0.96);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.85), 0 0 20px rgba(99, 102, 241, 0.25);
    width: 180px;
    max-width: 85vw;
    text-align: center;
    box-sizing: border-box;
}

.global-card-tooltip.is-golden {
    border-color: rgba(245, 158, 11, 0.7);
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.85), 0 0 25px rgba(245, 158, 11, 0.45);
}

.global-card-tooltip.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.global-card-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: var(--arrow-x, 50%);
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: rgba(13, 17, 28, 0.96) transparent transparent transparent;
}

.global-card-tooltip.flipped::after {
    top: auto;
    bottom: 100%;
    border-color: transparent transparent rgba(13, 17, 28, 0.96) transparent;
}

.global-card-tooltip img {
    width: 100% !important;
    height: auto !important;
    max-height: 250px !important;
    border-radius: 6px !important;
    display: block !important;
    margin: 0 !important;
    box-shadow: none !important;
    filter: none !important;
    object-fit: contain !important;
}

/* Help Tooltip & Visibility Switch */
.visibility-switch-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.help-tooltip-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s ease, transform 0.15s ease;
    vertical-align: middle;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    padding: 2px;
    border-radius: 50%;
}

.help-tooltip-wrapper:hover,
.help-tooltip-wrapper:focus,
.help-tooltip-wrapper:focus-within,
.help-tooltip-wrapper.active {
    color: var(--primary);
    z-index: 1000;
}

.help-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    transition: transform 0.15s ease, filter 0.15s ease, color 0.15s ease;
}

.help-tooltip-wrapper:hover .help-icon,
.help-tooltip-wrapper:focus .help-icon,
.help-tooltip-wrapper:focus-within .help-icon,
.help-tooltip-wrapper.active .help-icon {
    transform: scale(1.15);
    filter: drop-shadow(0 0 6px rgba(99, 102, 241, 0.6));
}

.help-tooltip-bubble {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(4px) scale(0.96);
    background: rgba(13, 17, 28, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(99, 102, 241, 0.45);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 16px rgba(99, 102, 241, 0.25);
    color: #e2e8f0;
    font-size: 0.85rem;
    font-weight: 400;
    line-height: 1.55;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    width: 320px;
    max-width: 85vw;
    text-align: left;
    white-space: normal;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s;
    z-index: 10000;
}

.help-tooltip-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: rgba(13, 17, 28, 0.98) transparent transparent transparent;
}

.help-tooltip-wrapper:hover .help-tooltip-bubble,
.help-tooltip-wrapper:focus .help-tooltip-bubble,
.help-tooltip-wrapper:focus-within .help-tooltip-bubble,
.help-tooltip-wrapper.active .help-tooltip-bubble {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0) scale(1);
    pointer-events: auto;
}

@media (max-width: 576px) {
    .help-tooltip-bubble {
        left: -100px;
        transform: translateY(4px) scale(0.96);
        width: 280px;
    }

    .help-tooltip-bubble::after {
        left: 108px;
    }

    .help-tooltip-wrapper:hover .help-tooltip-bubble,
    .help-tooltip-wrapper:focus .help-tooltip-bubble,
    .help-tooltip-wrapper:focus-within .help-tooltip-bubble,
    .help-tooltip-wrapper.active .help-tooltip-bubble {
        transform: translateY(0) scale(1);
    }
}

/* Forms & Inputs */
.form-control, .form-select {
    background: rgba(15, 17, 26, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    border-radius: 8px;
    padding: 0.6rem 0.85rem;
    font-family: var(--font-sans);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
    background: rgba(15, 17, 26, 0.95);
    color: #fff;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    color: #fff;
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success);
    color: #000;
    font-weight: 700;
}

.btn-success:hover {
    background: #059669;
    color: #fff;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-outline-primary {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

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

.btn-outline-danger {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
}

.btn-outline-danger:hover {
    background: var(--danger);
    color: #fff;
}

.btn-sm {
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.8rem 1.8rem;
    font-size: 1.1rem;
}

/* Upload Dropzone */
.upload-dropzone {
    position: relative;
    border: 2px dashed rgba(99, 102, 241, 0.4);
    border-radius: 12px;
    padding: 2.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 1.5rem 0;
    background: rgba(99, 102, 241, 0.05);
    overflow: hidden;
}

.upload-dropzone:hover,
.upload-dropzone.drag-over {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.15);
    transform: scale(1.01);
}

.file-input-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 5;
}

.file-input-hidden {
    display: none;
}

.dropzone-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    pointer-events: none;
}

.upload-icon {
    font-size: 3rem;
}

.upload-text {
    font-size: 1.1rem;
}

.upload-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.collection-stats-bar {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 1.25rem;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.5rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--primary);
}

.stat-name {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.gallery-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.5rem;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
}

.tab-btn.active {
    background: var(--primary);
    color: #fff;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 1rem;
    justify-items: center;
}

.gallery-card-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.card-key-tag {
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* Guide Detail Page */
.guide-main-title {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 800;
}

.guide-meta-bar {
    display: flex;
    gap: 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    align-items: center;
    flex-wrap: wrap;
}

.guide-summary-callout {
    background: rgba(99, 102, 241, 0.1);
    border-left: 4px solid var(--primary);
    padding: 1rem;
    border-radius: 0 8px 8px 0;
    font-size: 1.05rem;
}

.guide-match-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    justify-items: center;
    margin-top: 1rem;
}

.item-card-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.item-card-wrapper:hover,
.item-card-wrapper:focus-within {
    z-index: 50;
}

.item-card-wrapper.item-missing {
    opacity: 0.7;
}

.ownership-badge {
    margin-top: 0.35rem;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
}

.ownership-badge.owned {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid var(--success);
}

.ownership-badge.missing {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid var(--danger);
}

.heading-badge {
    font-size: 0.8rem;
    font-weight: 800;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    text-transform: uppercase;
    margin-right: 0.5rem;
}

.req-tag {
    background: var(--accent);
    color: #000;
}

.rec-tag {
    background: var(--primary);
    color: #fff;
}

/* Footer */
.app-footer {
    background: rgba(10, 12, 20, 0.9);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 2rem;
    text-align: center;
    margin-top: auto;
}

.footer-container p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.footer-link {
    color: #818cf8;
    text-decoration: none;
    transition: color 0.2s ease, text-decoration 0.2s ease;
}

.footer-link:hover {
    color: #c7d2fe;
    text-decoration: underline;
}

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem auto;
}

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

.loading-state, .empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}

/* Utility classes */
.ml-auto { margin-left: auto; }
.ml-2 { margin-left: 0.5rem; }
.ml-3 { margin-left: 1rem; }
.mr-2 { margin-right: 0.5rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 3rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 3rem; }
.d-inline-block { display: inline-block; }
.w-auto { width: auto !important; }
.alert {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    font-size: 0.95rem;
}
.alert-info {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid var(--primary);
    color: #c7d2fe;
}
.alert-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid var(--success);
    color: #34d399;
}
.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--danger);
    color: #f87171;
}
.alert-warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid var(--warning);
    color: #fcd34d;
}

/* Loading Progress & Blazor Error UI */
.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: rgba(99, 102, 241, 0.2);
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--primary);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: 600;
    color: var(--text-muted);
    font-family: var(--font-sans);
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading...");
}

#blazor-error-ui {
    background: #2b1d1d;
    color: #f87171;
    border-top: 1px solid var(--danger);
    bottom: 0;
    box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.4);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 10000;
}

#blazor-error-ui .reload {
    color: #fca5a5;
    text-decoration: underline;
    margin-left: 0.5rem;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
    color: #f87171;
}

/* ----------------------------------------------------
   Responsive Mobile Media Queries
   ---------------------------------------------------- */

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

@media (max-width: 768px) {
    /* App Layout & Navbar */
    .app-navbar {
        padding: 0.6rem 0.85rem;
        margin: 0.5rem 0.5rem 1rem 0.5rem;
        border-radius: 12px;
        flex-direction: column;
        align-items: stretch;
        top: 0.5rem;
    }

    .nav-brand-row {
        display: flex;
        width: 100%;
        justify-content: space-between;
        align-items: center;
    }

    .nav-brand-container .brand-link {
        font-size: 1.25rem;
    }

    .nav-actions-mobile {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .desktop-auth {
        display: none !important;
    }

    .btn-mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.15);
        color: #fff;
        font-size: 1.15rem;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .btn-mobile-toggle:hover {
        background: rgba(255, 255, 255, 0.15);
    }

    .btn-google-signin.btn-sm {
        padding: 0.35rem 0.65rem;
        font-size: 0.8rem;
    }

    .mobile-profile-badge {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
        max-width: 150px;
        gap: 0.4rem;
    }

    .mobile-profile-badge .user-name {
        max-width: 80px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        gap: 0.35rem;
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav-links.nav-links-open {
        display: flex !important;
        animation: fadeInMenu 0.2s ease-in-out;
    }

    .nav-item-link {
        width: 100%;
        padding: 0.6rem 0.75rem;
        font-size: 0.95rem;
        border-radius: 8px;
        justify-content: flex-start;
    }

    .mobile-logout-wrapper {
        display: block;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }

    .mobile-logout-wrapper .btn {
        width: 100%;
        text-align: center;
        padding: 0.5rem;
        font-size: 0.85rem;
    }

    /* Main Content & Page Header */
    .app-main-content {
        padding: 0.5rem 0.75rem 2rem 0.75rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        margin-bottom: 1.25rem;
    }

    .page-title {
        font-size: 1.5rem;
        line-height: 1.25;
    }

    .page-subtitle {
        font-size: 0.9rem;
    }

    .page-header-actions {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .page-header-actions .btn {
        width: 100%;
        margin-left: 0 !important;
        justify-content: center;
    }

    .app-footer {
        padding: 1.5rem 1rem;
        margin-top: 2rem;
        font-size: 0.85rem;
    }

    /* Home Page Hero & Features */
    .hero-jumbotron {
        padding: 1.5rem 1rem;
        border-radius: 12px;
        margin-bottom: 1.5rem !important;
    }

    .hero-title {
        font-size: 1.6rem;
        line-height: 1.25;
    }

    .hero-subtitle {
        font-size: 0.95rem;
        margin-top: 0.5rem;
    }

    .hero-meta-badge {
        position: static;
        display: inline-block;
        margin-top: 0.75rem;
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    .hero-buttons {
        display: flex;
        flex-direction: column;
        gap: 0.6rem;
        width: 100%;
        margin-top: 1.25rem;
    }

    .hero-buttons .btn {
        width: 100%;
        margin-left: 0 !important;
        font-size: 0.95rem;
        padding: 0.65rem 1rem;
        justify-content: center;
    }

    .feature-cards-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-bottom: 1.5rem !important;
    }

    .feature-card {
        padding: 1.25rem;
    }

    /* Guides Page & Match Summary */
    .guides-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .guide-card {
        padding: 1rem;
    }

    .match-summary-card {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding: 1rem;
    }

    .summary-playable-count {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        padding: 0.6rem 1rem;
    }

    .count-val {
        font-size: 1.4rem;
    }

    .filter-controls-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 0.85rem;
    }

    .search-field {
        min-width: 0;
        width: 100%;
    }

    .filter-options {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        width: 100%;
    }

    .sort-select-wrapper {
        width: 100%;
        justify-content: space-between;
    }

    .sort-select {
        flex: 1;
        max-width: 180px;
    }

    /* Guide Detail Page */
    .guide-main-title {
        font-size: 1.5rem;
        line-height: 1.25;
    }

    .guide-meta-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .guide-meta-bar .btn {
        margin-left: 0 !important;
        margin-top: 0.5rem;
        width: 100%;
    }

    .guide-match-banner {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 1rem;
    }

    .match-left {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .match-left .badge {
        margin-left: 0 !important;
    }

    .match-right .btn {
        width: 100%;
        justify-content: center;
    }

    .guide-section-block {
        padding: 1rem;
    }

    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 0.6rem;
    }

    .card-display, .hero-display {
        width: 100%;
        max-width: 160px;
        padding: 0.5rem;
    }

    .card-display.compact, .hero-display.compact {
        width: 100%;
        max-width: 130px;
        padding: 0.35rem;
    }

    .card-title, .hero-title {
        font-size: 0.78rem;
    }

    .card-skill, .hero-effect {
        font-size: 0.7rem;
        padding: 0.2rem 0.3rem;
    }

    /* Guide Editor Studio */
    .editor-studio {
        padding: 0.85rem;
    }

    .editor-panes.mode-split {
        grid-template-columns: 1fr;
    }

    .editor-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
        padding: 0.6rem;
    }

    .toolbar-group {
        flex-wrap: wrap;
        width: 100%;
        justify-content: flex-start;
        gap: 0.35rem;
    }

    .toolbar-views {
        width: 100%;
        display: flex;
    }

    .toolbar-views .btn {
        flex: 1;
        text-align: center;
    }

    .markdown-textarea {
        min-height: 240px;
        font-size: 0.88rem;
        padding: 0.75rem;
    }

    .pane-preview {
        padding: 0.75rem;
        max-height: none;
    }

    /* Item Selector List */
    .selector-columns {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .selector-column {
        padding: 1rem;
    }

    .selector-item-card {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.5rem;
    }

    .selector-item-info {
        min-width: 110px;
        flex: 1;
    }

    .selector-item-controls {
        width: 100%;
        justify-content: flex-end;
        padding-top: 0.35rem;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
    }

    /* Collection Import Page */
    .import-box {
        padding: 1rem;
    }

    .upload-dropzone {
        padding: 1.5rem 0.75rem;
        margin: 1rem 0;
    }

    .upload-icon {
        font-size: 2rem;
    }

    .upload-text {
        font-size: 0.95rem;
    }

    .collection-stats-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 0.85rem;
    }

    .stat-item {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        padding-bottom: 0.5rem;
    }

    .stat-item:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }

    .stat-number {
        font-size: 1.3rem;
    }

    .stat-actions {
        width: 100%;
    }

    .stat-actions .btn {
        width: 100%;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(115px, 1fr));
        gap: 0.6rem;
    }

    .gallery-tabs {
        overflow-x: auto;
        width: 100%;
        padding-bottom: 0.35rem;
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    /* Modals & Dialogs */
    .modal-backdrop {
        padding: 0.5rem;
    }

    .markdown-body img.img-float-left,
    .markdown-body img.img-floating-left,
    .markdown-body img.img-float,
    .markdown-body img.img-floating,
    .markdown-body img.img-float-right,
    .markdown-body img.img-floating-right {
        float: none;
        max-width: 100%;
        margin: 1rem auto;
        display: block;
    }

    .modal-dialog {
        padding: 1rem;
        max-height: 90vh;
        width: 100%;
        margin: 0;
    }

    .modal-card-grid {
        grid-template-columns: 1fr;
        gap: 0.6rem;
        max-height: 50vh;
    }

    .picker-mode-switcher {
        flex-direction: column;
    }

    .modal-card-card {
        flex-direction: row;
        align-items: flex-start;
        gap: 0.6rem;
        text-align: left;
        padding: 0.5rem;
    }

    .profile-edit-dialog {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .items-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .brand-title {
        font-size: 1.1rem;
    }

    .card-img {
        max-height: 150px;
    }

    .hero-img {
        max-height: 140px;
    }
}

/* ==========================================================================
   Position Diagram Styles (Markdown Renderer & Modal Editor)
   ========================================================================== */

.position-diagram-wrapper {
    margin: 1.5rem auto;
    max-width: 580px;
    background: linear-gradient(145deg, rgba(20, 24, 38, 0.95), rgba(12, 16, 28, 0.98));
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 16px;
    padding: 1.25rem 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 20px rgba(139, 92, 246, 0.12);
}

.position-diagram-board {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    align-items: center;
    width: 100%;
}

.position-diagram-row {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 1.25rem;
    width: 100%;
    flex-wrap: nowrap;
}

.position-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 90px;
    text-align: center;
    flex-shrink: 0;
}

.position-oval-frame {
    width: 80px;
    height: 106px;
    border-radius: 0;
    overflow: hidden;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    position: relative;
    transition: transform 0.2s ease;
}

.position-oval-frame:hover {
    transform: translateY(-2px);
}

.position-oval-frame.cycle-oval {
    box-shadow: none;
}

.position-oval-frame.golden-oval {
    box-shadow: none;
    background: transparent;
}

.position-oval-frame.golden-oval:hover {
    box-shadow: none;
}

.position-oval-frame.empty-oval {
    border-radius: 50% / 40%;
    border: 2px dashed rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.45);
    box-shadow: none;
}

.position-oval-frame.fallback-oval {
    padding: 0.4rem;
    text-align: center;
    background: rgba(49, 46, 129, 0.4);
    border-radius: 6px;
}

.position-unit-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    transform: scale(1.7);
    transform-origin: 50% -2%;
    display: block;
    pointer-events: none;
    user-select: none;
}

.position-oval-frame.cycle-oval .position-unit-img,
.position-cycle-img,
.cycle-thumb {
    object-fit: contain !important;
    transform: none !important;
}

.position-fallback-text {
    font-size: 0.75rem;
    font-weight: 700;
    color: #e2e8f0;
    word-break: break-word;
    line-height: 1.2;
}

.slot-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.slot-num {
    font-size: 1.1rem;
    font-weight: 700;
    color: rgba(148, 163, 184, 0.6);
    font-family: monospace;
}

.slot-add-icon {
    font-size: 1rem;
    color: rgba(148, 163, 184, 0.4);
    line-height: 1;
}

.position-unit-name {
    font-size: 0.75rem;
    color: #e2e8f0;
    margin-top: 0.4rem;
    line-height: 1.25;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
}

.position-unit-name.golden-unit-name {
    color: #fef08a;
    text-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

.position-empty-name {
    color: rgba(148, 163, 184, 0.5);
    font-style: italic;
}

/* Position Slot Tooltip on Mouseover and Tap */
.position-slot.card-tooltip-wrapper {
    position: relative;
    cursor: pointer;
    outline: none;
}

.position-slot:hover,
.position-slot:focus,
.position-slot:focus-within {
    z-index: 1000;
}

/* Modal Position Editor */
.position-modal-dialog {
    max-width: 680px;
}

.position-editor-board-container {
    background: rgba(10, 14, 26, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1rem;
}

.board-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.board-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
}

.position-editor-board {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.position-row-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #a78bfa;
    margin-bottom: 0.25rem;
}

.position-editor-row {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 1.25rem;
    width: 100%;
}

.position-slot-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 90px;
    text-align: center;
    border-radius: 12px;
    padding: 4px;
    transition: background 0.2s ease;
    user-select: none;
}

.position-slot-box.slot-occupied {
    cursor: grab;
}

.position-slot-box.slot-occupied:active {
    cursor: grabbing;
}

.position-slot-box .position-unit-img {
    pointer-events: none;
    -webkit-user-drag: none;
    user-select: none;
}

.position-slot-box .position-fallback-text,
.position-slot-box .position-unit-name,
.position-slot-box .slot-placeholder {
    pointer-events: none;
    user-select: none;
}

.position-slot-box.slot-dragover {
    background: rgba(56, 189, 248, 0.15);
    outline: 2px dashed #38bdf8;
    border-radius: 12px;
}

.slot-remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(239, 68, 68, 0.85);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease;
    z-index: 5;
}

.slot-remove-btn:hover {
    background: #dc2626;
}

.slot-golden-toggle-btn {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(15, 23, 42, 0.85);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 12px;
    padding: 0.1rem 0.35rem;
    font-size: 0.7rem;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s ease;
    z-index: 5;
}

.slot-golden-toggle-btn:hover {
    background: rgba(245, 158, 11, 0.25);
    color: #fbbf24;
    border-color: #f59e0b;
    transform: scale(1.1);
}

.slot-golden-toggle-btn.active {
    background: rgba(245, 158, 11, 0.35);
    color: #fef08a;
    border-color: #f59e0b;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

.drag-remove-zone {
    border: 2px dashed rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.06);
    border-radius: 8px;
    padding: 0.5rem;
    text-align: center;
    color: #fca5a5;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.drag-remove-zone.remove-zone-active {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #fee2e2;
}

/* Palette Area */
.position-palette-container {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 1rem;
}

.palette-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
}

.cycle-unit-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, rgba(46, 16, 101, 0.4), rgba(15, 23, 42, 0.6));
    border: 1.5px solid rgba(168, 85, 247, 0.4);
    border-radius: 10px;
    cursor: grab;
    transition: all 0.2s ease;
}

.cycle-unit-card:hover {
    border-color: #22d3ee;
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.2);
}

.cycle-unit-card:active {
    cursor: grabbing;
}

.cycle-unit-preview {
    width: 44px;
    height: 56px;
    flex-shrink: 0;
}

.cycle-thumb {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.palette-card-list {
    max-height: 240px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-right: 4px;
}

.palette-card-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
    cursor: grab;
    transition: all 0.15s ease;
}

.palette-card-item:hover,
.palette-card-item:focus-within {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(168, 85, 247, 0.4);
    z-index: 50;
}

.palette-card-item.palette-card-golden {
    border-color: rgba(245, 158, 11, 0.4);
    background: rgba(245, 158, 11, 0.08);
}

.palette-card-item.palette-card-golden:hover {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.2);
}

.golden-wrap {
    border: 1.5px solid #f59e0b !important;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.btn-xs {
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
    line-height: 1.2;
    border-radius: 0.25rem;
}

.palette-card-item:active {
    cursor: grabbing;
}

.palette-card-img-wrap {
    width: 36px;
    height: 48px;
    border-radius: 4px;
    flex-shrink: 0;
    background: #000;
    position: relative;
}

.palette-card-img-wrap:hover,
.palette-card-img-wrap:focus,
.palette-card-img-wrap:focus-within {
    z-index: 100;
}

.palette-card-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.palette-card-details {
    flex: 1;
    min-width: 0;
}

.palette-card-name {
    font-size: 0.85rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.palette-card-tags {
    display: flex;
    gap: 0.3rem;
    margin-top: 2px;
}

.preview-tag-box {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
}

.text-cyan {
    color: #38bdf8;
}

.bg-purple {
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.4);
}

@media (max-width: 576px) {
    .position-diagram-wrapper {
        padding: 0.75rem 0.5rem;
    }

    .position-oval-frame {
        width: 68px;
        height: 90px;
    }

    .position-slot,
    .position-slot-box {
        width: 72px;
    }

    .position-diagram-row,
    .position-editor-row {
        gap: 0.5rem;
    }

    .position-unit-name {
        font-size: 0.68rem;
        max-width: 72px;
    }
}
