@import url('../interface/module_base.css');

/* =========================================
   MEMBER RESULTS - SYNCED UI
   ========================================= */

/* --- SHARED EMPTY STATE (MASTER SYNC) --- */
.empty-state {
    position: relative;
    padding: 100px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #0f172a;
    /* Dark sleek background */
    margin: 0;
    /* Flush with header */
    text-align: center;
}

.empty-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent 0%, rgba(15, 23, 42, 0.4) 100%);
    z-index: 1;
}

.empty-content-box {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 800px;
    padding: 20px;
}

.empty-title {
    font-size: 2.2rem;
    font-weight: 800;
    color: #ffffff;
    margin: 0 auto 15px;
    line-height: 1.25;
    opacity: 0.9;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.empty-desc {
    color: #cbd5e1;
    font-size: 1.1rem;
    line-height: 1.6;
    margin: 0;
}

/* --- DATA HERO: SYNCED (Handled by global event-hero) --- */

/* --- MOBILE SYNC OVERRIDES (900px Standard) --- */
@media (max-width: 900px) {
    .empty-state {
        padding: 60px 15px;
        /* Universal Mobile Sync height */
    }

    .empty-title {
        font-size: 1.8rem;
        line-height: 1.3;
        margin-bottom: 12px;
    }

    .empty-desc {
        font-size: 1rem;
        line-height: 1.5;
    }

    .results-hero {
        padding: 40px 20px;
    }
}

/* Layout & Spacing */
.results-content-section {
    background: #f8fafc;
    min-height: calc(100vh - 300px);
}

/* Group Tabs (Swipeable) */
.group-tabs-wrapper {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 70px;
    /* Adjust if header overlaps */
    z-index: 10;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.group-tabs-scroll {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
    gap: 15px;
    padding: 15px 0;
}

.group-tabs-scroll::-webkit-scrollbar {
    display: none;
}

.group-tab {
    white-space: nowrap;
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.95rem;
    color: #64748b;
    background: #f1f5f9;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.group-tab.active {
    background: #eff6ff;
    color: #2563eb;
    border-color: #bfdbfe;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.1);
}

/* Level Chips */
.level-tabs-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 25px 0;
}

.level-chip {
    padding: 8px 16px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #475569;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.level-chip.active {
    background: #334155;
    color: #fff;
    border-color: #334155;
}

/* Gender Sections */
.gender-section-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #1e293b;
    margin: 0 0 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}

/* Gender Split Layout */
.gender-split-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

@media (min-width: 900px) {
    .gender-split-container {
        grid-template-columns: 1fr 1fr;
        gap: 40px;
    }
}

/* Events Grid (Inside the split columns) */
.member-events-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.member-event-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.03);
    border: 1px solid #e2e8f0;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: 0.3s;
    border-left: 4px solid #cbd5e1;
}

.member-event-card[data-gender="Nam"] {
    border-left-color: #3b82f6;
}

.member-event-card[data-gender="Nữ"] {
    border-left-color: #ec4899;
}

.member-event-card.has-results {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.06);
}

.member-event-card.no-results {
    opacity: 0.65;
    background: #f8fafc;
    cursor: not-allowed;
}

.member-event-card.has-results:hover {
    transform: translateY(-3px);
}

.mec-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 12px;
    padding-right: 60px;
}

.mec-tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
}

.mec-tag.nam {
    background: #dbeafe;
    color: #1d4ed8;
}

.mec-tag.nu {
    background: #fce7f3;
    color: #be185d;
}

.mec-status {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
}

.mec-status.done {
    background: #dcfce7;
    color: #166534;
}

.mec-status.wait {
    background: #f1f5f9;
    color: #64748b;
}

/* Leaderboard Modal (Slide from bottom) */
.leaderboard-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    /* flex when active via js */
    justify-content: center;
    align-items: flex-end;
    /* Bottom sheet on mobile */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.leaderboard-modal.show {
    opacity: 1;
    pointer-events: auto;
}

@media (min-width: 768px) {
    .leaderboard-modal {
        align-items: center;
    }
}

.lb-modal-content {
    background: #f8fafc;
    width: 100%;
    max-width: 600px;
    height: 90vh;
    /* Leave some space at top */
    border-radius: 20px 20px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

@media (min-width: 768px) {
    .lb-modal-content {
        height: 85vh;
        border-radius: 20px;
    }
}

.lb-header {
    background: #fff;
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    z-index: 2;
}

.btn-close-lb {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    margin-bottom: 15px;
    transition: 0.2s;
}

.btn-close-lb:hover {
    background: #e2e8f0;
}

.lb-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 5px;
}

.lb-subtitle {
    font-size: 0.95rem;
    font-weight: 600;
    color: #64748b;
    margin: 0;
}

.lb-heats-nav {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-width: none;
}

.lb-heats-nav::-webkit-scrollbar {
    display: none;
}

.lb-heat-tab {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    background: #e2e8f0;
    color: #475569;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: 0.2s;
}

.lb-heat-tab.active {
    background: #2563eb;
    color: #fff;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

.lb-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Ranking Cards */
.rank-card {
    background: #fff;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    border: 1px solid #f1f5f9;
    position: relative;
    overflow: hidden;
}

.rank-badge {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 800;
    color: #475569;
    flex-shrink: 0;
}

/* Top 3 styles */
.rank-card.rank-1 {
    border: 1px solid #f6e05e;
    background: #fffff0;
}

.rank-card.rank-1 .rank-badge {
    background: #ecc94b;
    color: #fff;
    box-shadow: 0 4px 10px rgba(236, 201, 75, 0.4);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.rank-card.rank-2 {
    border: 1px solid #cbd5e1;
    background: #f8fafc;
}

.rank-card.rank-2 .rank-badge {
    background: #94a3b8;
    color: #fff;
    box-shadow: 0 4px 10px rgba(148, 163, 184, 0.3);
}

.rank-card.rank-3 {
    border: 1px solid #fbd38d;
    background: #fffaf0;
}

.rank-card.rank-3 .rank-badge {
    background: #ed8936;
    color: #fff;
    box-shadow: 0 4px 10px rgba(237, 137, 54, 0.3);
}

.rc-info {
    flex-grow: 1;
    min-width: 0;
}

.rc-name {
    font-weight: 700;
    font-size: 1.05rem;
    color: #1e293b;
    margin: 0 0 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rc-unit {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rc-score {
    text-align: right;
    min-width: 80px;
    flex-shrink: 0;
}

.rc-time {
    font-weight: 800;
    font-size: 1.1rem;
    color: #0f172a;
    margin: 0 0 5px;
}

.rc-status {
    font-size: 0.8rem;
    font-weight: 700;
    color: #dc2626;
}

/* Global Ranking Styles */
.global-rank-btn {
    background: #0f172a;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.2);
    transition: 0.3s;
}

.global-rank-btn:hover {
    background: #1e293b;
    transform: translateY(-2px);
}

.medal-tally-header {
    display: flex;
    align-items: center;
    background: #e2e8f0;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-weight: 700;
    color: #475569;
    font-size: 0.9rem;
}

.mth-rank {
    width: 50px;
    text-align: center;
    flex-shrink: 0;
}

.mth-name {
    flex-grow: 1;
    min-width: 0;
}

.mth-medals {
    display: flex;
    gap: 15px;
    width: 120px;
    justify-content: flex-end;
    font-size: 1.2rem;
}

.tally-card {
    background: #fff;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    border: 1px solid #e2e8f0;
    transition: 0.2s;
}

.tally-card.rank-1 {
    border: 2px solid #fbbf24;
    background: #fffcf0;
}

.tally-card.rank-2 {
    border: 1px solid #94a3b8;
}

.tally-card.rank-3 {
    border: 1px solid #f59e0b;
}

.tc-rank {
    width: 50px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 800;
    color: #64748b;
    flex-shrink: 0;
}

.tally-card.rank-1 .tc-rank {
    color: #fbbf24;
    font-size: 1.5rem;
}

.tally-card.rank-2 .tc-rank {
    color: #94a3b8;
}

.tally-card.rank-3 .tc-rank {
    color: #f59e0b;
}

.tc-name {
    flex-grow: 1;
    font-weight: 700;
    font-size: 1.05rem;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 15px;
}

.tc-medals {
    display: flex;
    gap: 15px;
    width: 120px;
    justify-content: flex-end;
}

.tc-medals span {
    width: 25px;
    text-align: center;
    font-weight: 800;
    color: #334155;
    font-size: 1.1rem;
}

/* Certificate Card Styles */
.certificate-card {
    width: 720px;
    min-height: 500px; /* Cân đối và gọn gàng hơn */
    max-width: 95vw;
    border-radius: 4px;
    padding: 40px 60px;
    position: relative;
    overflow: hidden;
    color: #1e293b;
    font-family: 'Times New Roman', Times, serif;
    background: #fff url('../../assets/images/certificate_bg.jpg') no-repeat center center;
    background-size: 100% 100% !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
    animation: certPopIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1) forwards;
    transform-origin: center center;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Elegant Double-Line Border */
.certificate-card::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    bottom: 15px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    pointer-events: none;
    z-index: 1;
}

.cert-content {
    position: relative;
    z-index: 2;
    height: 100%;
}

/* Sweeping Metal Glare Effect */
.certificate-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 35%;
    height: 100%;
    background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.6) 50%, rgba(255, 255, 255, 0) 100%);
    transform: skewX(-25deg);
    z-index: 10;
    animation: metallicShine 5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    pointer-events: none;
}

@keyframes certPopIn {
    0% {
        opacity: 0;
        transform: scale(0.5) rotateX(15deg) translateY(40px);
    }

    100% {
        opacity: 1;
        transform: scale(1) rotateX(0deg) translateY(0);
    }
}

@keyframes bgShift {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 100% 50%;
    }
}

@keyframes metallicShine {
    0% {
        left: -120%;
    }

    90% {
        left: 200%;
    }

    100% {
        left: 200%;
    }
}

/* Rank 1 (Gold) - Elegant */
.certificate-card.cert-rank-1 {
    background: linear-gradient(135deg, #fffdfa 0%, #fef9c3 100%);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1), inset 0 0 0 6px #eab308;
    color: #422006;
}

.certificate-card.cert-rank-1::before {
    border: 2px double #ca8a04;
}

.certificate-card.cert-rank-1 .cert-rank-title {
    background-image: linear-gradient(to right,
            #854d0e 0%,
            #ca8a04 20%,
            #fde047 40%,
            #fef9c3 50%,
            #fde047 60%,
            #ca8a04 80%,
            #854d0e 100%);
}

.certificate-card.cert-rank-1 .cert-event-name,
.certificate-card.cert-rank-1 .cert-group-name,
.certificate-card.cert-rank-1 .cert-level-name,
.certificate-card.cert-rank-1 .cert-val,
.certificate-card.cert-rank-1 .cert-info span {
    color: #854d0e;
}

.certificate-card.cert-rank-1 .cert-time {
    color: #a16207;
}

.certificate-card.cert-rank-1 .fw-bold {
    font-weight: 800;
    color: #431407;
}



/* Rank 2 (Silver) - Elegant */
.certificate-card.cert-rank-2 {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1), inset 0 0 0 6px #94a3b8;
    color: #1e293b;
}

.certificate-card.cert-rank-2::before {
    border: 2px double #64748b;
}

.certificate-card.cert-rank-2 .cert-rank-title {
    background-image: linear-gradient(to right,
            #1e293b 0%,
            #475569 20%,
            #94a3b8 40%,
            #f8fafc 50%,
            #94a3b8 60%,
            #475569 80%,
            #1e293b 100%);
}

.certificate-card.cert-rank-2 .cert-event-name,
.certificate-card.cert-rank-2 .cert-group-name,
.certificate-card.cert-rank-2 .cert-level-name,
.certificate-card.cert-rank-2 .cert-val,
.certificate-card.cert-rank-2 .cert-info span {
    color: #334155;
}

.certificate-card.cert-rank-2 .cert-time {
    color: #475569;
}

.certificate-card.cert-rank-2 .fw-bold {
    font-weight: 800;
    color: #0f172a;
}



/* Rank 3 (Bronze) - Elegant */
.certificate-card.cert-rank-3 {
    background: linear-gradient(135deg, #fffaf5 0%, #ffedd5 100%);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1), inset 0 0 0 6px #f97316;
    color: #7c2d12;
}

.certificate-card.cert-rank-3::before {
    border: 2px double #c2410c;
}

.certificate-card.cert-rank-3 .cert-rank-title {
    background-image: linear-gradient(to right,
            #7c2d12 0%,
            #9a3412 20%,
            #f97316 40%,
            #ffedd5 50%,
            #f97316 60%,
            #9a3412 80%,
            #7c2d12 100%);
}

.certificate-card.cert-rank-3 .cert-event-name,
.certificate-card.cert-rank-3 .cert-group-name,
.certificate-card.cert-rank-3 .cert-level-name,
.certificate-card.cert-rank-3 .cert-val,
.certificate-card.cert-rank-3 .cert-info span {
    color: #9a3412;
}

.certificate-card.cert-rank-3 .cert-time {
    color: #c2410c;
}

.certificate-card.cert-rank-3 .fw-bold {
    font-weight: 800;
    color: #431407;
}



.cert-watermark {
    position: absolute;
    right: -100px;
    /* Pushed deeper right */
    bottom: -60px;
    /* Pushed deeper down */
    height: 100%;
    width: auto;
    opacity: 0.45;
    mix-blend-mode: multiply;
    pointer-events: none;
    z-index: 1;
    transform-origin: center center;
    animation: medalSway 10s ease-in-out infinite;
}

@keyframes medalSway {
    0% {
        transform: rotate(-3deg);
    }

    50% {
        transform: rotate(3deg);
    }

    100% {
        transform: rotate(-3deg);
    }
}

.cert-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.cert-header {
    margin-bottom: 25px;
    text-align: left;
    /* Default back to left for the whole header */
}

.cert-tournament-name {
    font-size: clamp(0.6rem, 2vw, 0.95rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    opacity: 0.8;
    text-align: center;
    white-space: pre;
    /* Forces respect for DB newlines, blocks auto-wrapping */
    line-height: 1.4;
}

.cert-rank-title {
    font-size: clamp(1.5rem, 4vw, 2.3rem);
    white-space: nowrap;
    font-family: 'Times New Roman', Times, serif;
    font-weight: 900;
    text-transform: uppercase;
    margin: 0 0 15px 0;
    line-height: 1.1;
    letter-spacing: 2px;
    text-align: center;
    width: 100%;
    /* Metallic Shine Effect Base */
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    /* Standard property for compatibility */
    -webkit-text-fill-color: transparent;
    animation: textShine 4s linear infinite;
    display: block;
}

@keyframes textShine {
    0% {
        background-position: 0% center;
    }

    100% {
        background-position: 200% center;
    }
}

.cert-group-name,
.cert-level-name {
    font-size: 0.95rem;
    font-weight: 700;
    font-family: 'Times New Roman', Times, serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
    text-align: left;
    margin-bottom: 2px;
    /* Compact spacing */
}

.cert-level-name {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    /* Compact spacing */
    opacity: 0.9;
}

@media (max-width: 480px) {
    .cert-group-name {
        font-size: 0.85rem;
    }

    .cert-level-name {
        font-size: 0.75rem;
        margin-bottom: 10px;
    }
}

.cert-event-name {
    font-size: 1.7rem;
    font-weight: 900;
    margin-top: 5px;
    margin-bottom: 4px;
    /* Compact spacing */
    letter-spacing: 1px;
    text-transform: uppercase;
    font-family: 'Times New Roman', Times, serif;
    text-align: left;
    color: #1e40af;
}

.cert-time {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 15px;
    /* Space before body */
}

/* New Certificate Layout */
.cert-header-full {
    width: 100%;
    margin-bottom: 15px;
    text-align: center;
}

.cert-body-flex {
    display: flex;
    gap: 25px;
    align-items: center;
    width: 100%;
}

.cert-left-col {
    flex-shrink: 0;
}

.cert-right-col {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    text-align: left;
}

.cert-athlete-section {
    margin-bottom: 12px;
    font-size: 1.05rem;
    color: #334155;
}

.pinyon-script {
    font-family: 'Pinyon Script', cursive;
    font-size: clamp(1.2rem, 5vw, 3rem);
    white-space: nowrap;
    font-weight: 400;
    display: block;
    line-height: 1.1;
    margin-top: 5px;
}

.cert-info-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 1.05rem;
}

.cert-row-detail {
    line-height: 1.4;
    color: #334155;
}

.cert-row-detail .fw-bold {
    font-weight: 700;
    color: #0f172a;
}

.cert-photo {
    width: 110px;
    height: 146px;
    /* 3x4 ratio */
    object-fit: cover;
    border: 3px solid #fff;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    background: #e2e8f0;
}

/* Rank-specific colors applied to right column text */
.certificate-card.cert-rank-1 .pinyon-script {
    color: #854d0e;
}

.certificate-card.cert-rank-2 .pinyon-script {
    color: #1e293b;
}

.certificate-card.cert-rank-3 .pinyon-script {
    color: #7c2d12;
}

.certificate-card.cert-rank-1 .cert-row-detail .fw-bold {
    color: #854d0e;
}

.certificate-card.cert-rank-2 .cert-row-detail .fw-bold {
    color: #1e293b;
}

.certificate-card.cert-rank-3 .cert-row-detail .fw-bold {
    color: #9a3412;
}

.cert-watermark-mobile-fix {
    display: none;
}

@media (max-width: 480px) {
    .cert-watermark {
        height: 75% !important;
        /* Even smaller to fit corner */
        right: -80px !important;
        /* Deeper into right corner */
        bottom: -20px !important;
        /* Bottom right */
        top: auto !important;
        /* Clear top positioning */
        opacity: 0.35 !important;
    }

    .cert-rank-title {
        font-size: 2.2rem !important;
        white-space: normal !important;
        line-height: 1.2 !important;
        -webkit-background-clip: text !important;
        background-clip: text !important;
        -webkit-text-fill-color: transparent !important;
        display: block !important;
        text-align: center !important;
    }

    .cert-event-name {
        font-size: 1.3rem;
    }

    .cert-tournament-name {
        font-size: clamp(0.4rem, 2.2vw, 0.95rem) !important;
        line-height: 1.4;
        white-space: pre !important;
        /* Forces respect for DB newlines, blocks auto-wrapping */
        display: block;
        width: 100%;
        text-align: center !important;
    }

    .certificate-card {
        width: 100%;
        /* Flexible on mobile */
        max-width: 95vw;
        padding: 30px 20px;
        min-height: auto;
        aspect-ratio: auto;
        justify-content: flex-start;
    }

    /* Mobile specific layout fixes to keep photo on left */
    .cert-body-flex {
        gap: 15px;
    }

    .cert-photo {
        width: 75px;
        height: 100px;
    }

    .pinyon-script {
        font-size: clamp(0.8rem, 6.2vw, 2.2rem) !important;
        white-space: nowrap !important;
    }

    .cert-athlete-section {
        margin-bottom: 10px;
        padding-bottom: 0;
    }

    .cert-info-list {
        font-size: 0.85rem;
    }

    .cert-group-row {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .cert-dot-spacer {
        display: none;
    }
}