:root {
    --uwb-purple: #4b2e83;
    --uwb-gold: #b7a57a;
    --uwb-black: #000000;
    --white: #ffffff;
    --light-gray: #f4f4f4;
    --danger: #d32f2f;
    --success: #2e7d32;
}

body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background-color: var(--light-gray); color: var(--uwb-black); margin: 0; padding-bottom: 90px; } 

/* --- PREMIUM HEADER --- */
.premium-header {
    background: linear-gradient(135deg, var(--uwb-purple), #2a154f);
    color: var(--white);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(75, 46, 131, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
}
.app-title { display: flex; align-items: center; }
.premium-admin-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(183, 165, 122, 0.5); /* Semi-transparent gold */
    color: var(--uwb-gold);
    padding: 6px 14px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0;
    width: auto;
}
.premium-admin-btn:hover { background: rgba(183, 165, 122, 0.2); border-color: var(--uwb-gold); }

/* --- PREMIUM NAV BAR --- */
.premium-nav-bar {
    position: fixed;
    bottom: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px); /* For iOS Safari */
    display: flex;
    justify-content: space-around;
    padding: 12px 0 18px 0; /* Extra bottom padding for modern rounded phones */
    box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
    border-top: 1px solid rgba(0,0,0,0.05);
    z-index: 100;
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #999;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Creates a subtle bounce effect */
    flex: 1;
    -webkit-tap-highlight-color: transparent; /* Removes blue tap box on mobile */
}
.nav-icon {
    font-size: 1.4rem;
    margin-bottom: 4px;
    filter: grayscale(100%) opacity(0.5);
    transition: all 0.2s ease;
}
.nav-label { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.3px; }

/* Active Tab Styles */
.nav-item.active { transform: translateY(-4px); color: var(--uwb-purple); }
.nav-item.active .nav-icon { filter: none; transform: scale(1.15); }
.nav-item.active .nav-label { color: var(--uwb-purple); font-weight: 800; }

/* LAYOUT */
.container { display: none; padding: 15px; }
.container.active { display: block; }
.card { background: var(--white); border-radius: 8px; padding: 15px; margin-bottom: 15px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
h2 { color: var(--uwb-purple); border-bottom: 2px solid var(--uwb-gold); padding-bottom: 5px; margin-top: 0; }
h3 { margin-top: 0; color: var(--uwb-black); }

/* ELEMENTS */
input, select, textarea { width: 100%; padding: 12px; margin: 8px 0; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; font-size: 16px; }
button { background-color: var(--uwb-purple); color: var(--white); border: none; padding: 12px; border-radius: 4px; font-size: 1rem; width: 100%; margin-top: 10px; cursor: pointer; font-weight: bold; }
button.secondary { background-color: #666; }
button.danger { background-color: var(--danger); }
button.gold { background-color: var(--uwb-gold); color: var(--uwb-black); }
button.small-btn { padding: 5px 10px; width: auto; margin: 0; font-size: 0.8rem; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

/* TABLES */
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th { background: var(--uwb-purple); color: var(--white); padding: 8px; text-align: left; }
td { border-bottom: 1px solid #ddd; padding: 8px; }
.win-tag { color: var(--success); font-weight: bold; }
.loss-tag { color: var(--danger); }

/* --- MATCH CARDS (DASHBOARD) --- */
.match-card { background: var(--white); border-radius: 12px; box-shadow: 0 4px 10px rgba(0,0,0,0.06); margin-bottom: 16px; padding: 16px; cursor: pointer; border: 1px solid #eaeaea; transition: transform 0.2s ease, box-shadow 0.2s ease; }
.match-card:hover { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(0,0,0,0.1); }
.match-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; border-bottom: 1px solid #f0f0f0; padding-bottom: 10px; }
.match-status { font-size: 0.7rem; font-weight: 700; padding: 4px 8px; border-radius: 4px; letter-spacing: 0.5px; }
.status-live { background: #ffebee; color: var(--danger); animation: pulse 2s infinite; }
.status-completed { background: #f0f0f0; color: #666; }
.match-date-wrap { display: flex; align-items: center; gap: 10px; }
.match-date { font-size: 0.8rem; color: #888; font-weight: 500;}
.delete-match-btn { background: #fff0f0; color: var(--danger); border: 1px solid #ffcdd2; border-radius: 6px; padding: 4px 8px; font-size: 0.75rem; font-weight: bold; cursor: pointer; transition: 0.2s; }
.delete-match-btn:hover { background: var(--danger); color: white; }

.match-teams-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.match-team-col { flex: 1; }
.match-team-col.right-align { text-align: right; }
.match-team-name { font-size: 0.95rem; font-weight: 700; color: var(--uwb-black); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.match-team-score { font-size: 1.4rem; font-weight: 800; color: var(--uwb-purple); }
.match-team-wickets { font-size: 1rem; color: #666; font-weight: 600; }
.match-team-overs { font-size: 0.8rem; color: #888; font-weight: 500; margin-left: 4px; }
.match-vs { font-size: 0.85rem; font-weight: 700; color: #bbb; background: #f8f9fa; padding: 6px 8px; border-radius: 50%; margin: 0 10px; }
.match-result-bar { background: #faf8fc; padding: 10px; border-radius: 6px; text-align: center; font-size: 0.85rem; font-weight: 600; color: var(--uwb-purple); }

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

/* --- MODERN STANDINGS TABLE --- */
.modern-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; background: white; text-align:center; white-space: nowrap; }
.modern-table th { background: #f8f9fa; color: #888; padding: 12px 6px; text-transform: uppercase; font-size: 0.7rem; border-bottom: 2px solid #eaeaea; letter-spacing: 0.5px; }
.modern-table th:first-child { text-align: left; padding-left: 12px;}
.modern-table td { border-bottom: 1px solid #f0f0f0; padding: 12px 6px; vertical-align: middle; }
.modern-table .team-name-cell { text-align: left; color: var(--uwb-purple); font-size: 0.95rem; padding-left: 12px; white-space: normal; line-height: 1.3; }
.modern-table .pts-cell { font-weight: bold; font-size: 1rem; color: var(--uwb-purple); background: #faf8fc; }
.modern-table .chevron-cell { color: #ccc; font-size: 1.4rem; font-weight: 300; padding-left:0; padding-right:12px; text-align: right; }

.clickable-row { cursor: pointer; transition: background-color 0.2s ease; }
.clickable-row:hover { background-color: #f4f0fa; }
.clickable-row:active { background-color: #e6dcf5; }

/* --- TOSS TOGGLE UI --- */
.toss-toggle { display: flex; gap: 10px; margin-bottom: 15px; }
.toss-option { 
    flex: 1; 
    text-align: center; 
    padding: 12px; 
    background: #e0e0e0; 
    color: #888; 
    border-radius: 6px; 
    cursor: pointer; 
    font-weight: bold; 
    border: 2px solid transparent; 
    transition: all 0.2s ease; 
    user-select: none; 
}
.toss-option.active { 
    background: var(--uwb-purple); 
    color: white; 
    border-color: var(--uwb-gold); 
    box-shadow: 0 4px 10px rgba(75, 46, 131, 0.3); 
}
.toss-option:not(.active):hover { 
    background: #d0d0d0; 
    color: #555; 
}

/* SCORING */
.score-header { text-align: center; padding: 10px; background: var(--uwb-purple); color: var(--white); border-radius: 8px; margin-bottom: 10px; position: relative; }
.big-score { font-size: 2.5rem; font-weight: bold; line-height: 1; }
.run-rate { font-size: 0.8rem; opacity: 0.8; }
.target-display { background: var(--uwb-gold); color: black; font-weight: bold; padding: 5px; border-radius: 4px; margin-top: 5px; display: none; }

.batter-strip { display: flex; justify-content: space-between; margin-bottom: 10px; font-weight: bold; }
.batter-strip div { padding: 5px; border-radius: 4px; flex:1; text-align: center; }
.batter-strip div.active { color: var(--uwb-purple); border-bottom: 3px solid var(--uwb-gold); background: rgba(75, 46, 131, 0.1); }

.control-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.control-btn { padding: 15px 0; font-size: 1.2rem; background: var(--uwb-gold); color: black; border-radius: 4px; border: none; font-weight: bold; }
.control-btn.wide { grid-column: span 2; }
.control-btn.wicket { background: var(--danger); color: white; }

/* --- MATCH SCREEN TOP NAV --- */
.match-top-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; padding: 0 5px; gap: 10px; }
.match-top-nav-right { display: flex; align-items: center; gap: 8px; }
.back-btn { background: #e0e0e0; border: none; color: var(--uwb-black); font-weight: 600; padding: 6px 12px; border-radius: 20px; font-size: 0.85rem; cursor: pointer; display: flex; align-items: center; width: auto; margin: 0; transition: background 0.2s; }
.back-btn:hover { background: #d0d0d0; }

.admin-pin-badge { background: #ffebee; color: var(--danger); border: 1px solid #ffcdd2; padding: 6px 12px; border-radius: 20px; font-size: 0.85rem; font-weight: 700; }

/* Share button in scoring view header */
.share-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: linear-gradient(135deg, var(--uwb-purple), #6a3fb1);
    color: white; border: none;
    padding: 7px 14px; border-radius: 20px;
    font-size: 0.8rem; font-weight: 700; letter-spacing: 0.3px;
    cursor: pointer; transition: transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 6px rgba(75, 46, 131, 0.25);
    width: auto; margin: 0;
    min-height: 36px;
}
.share-btn:hover { box-shadow: 0 3px 10px rgba(75, 46, 131, 0.35); }
.share-btn:active { transform: scale(0.96); }
.share-btn svg { display: block; }

/* Tiny share icon button on match cards */
.card-share-btn {
    display: inline-flex; align-items: center; justify-content: center;
    background: #ede7f6; color: var(--uwb-purple);
    border: 1px solid #d4c8eb;
    width: 30px; height: 30px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    padding: 0; margin: 0;
}
.card-share-btn:hover { background: var(--uwb-purple); color: white; }
.card-share-btn:active { transform: scale(0.92); }
.card-share-btn svg { display: block; }

/* Toast notification */
.toast {
    position: fixed;
    left: 50%;
    bottom: 100px; /* Above the bottom-nav */
    transform: translate(-50%, 20px);
    background: rgba(20, 12, 40, 0.96);
    color: white;
    padding: 12px 20px;
    border-radius: 24px;
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    opacity: 0;
    pointer-events: none;
    z-index: 9999;
    transition: opacity 0.25s ease, transform 0.25s ease;
    max-width: calc(100vw - 32px);
    text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Refined to sit beautifully inside the purple header */
.match-meta-text {
    font-size: 0.75rem; 
    color: rgba(255, 255, 255, 0.9); 
    font-weight: 500; 
    background: rgba(0, 0, 0, 0.2); 
    padding: 6px 12px; 
    border-radius: 12px; 
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: inline-block;
    margin-bottom: 15px;
    letter-spacing: 0.5px;
}

/* --- PLAYOFFS BRACKET --- */
.playoff-match-box { background: #f9f9f9; border: 1px solid #ddd; border-radius: 8px; margin-bottom: 15px; overflow: hidden; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.playoff-match-title { background: var(--uwb-purple); color: white; font-size: 0.75rem; font-weight: bold; padding: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.playoff-teams { padding: 12px; display: flex; justify-content: space-between; align-items: center; font-size: 0.95rem; color: var(--uwb-black); background: white; }
.playoff-teams strong { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.playoff-teams span { font-size: 0.75rem; color: #888; font-weight: bold; padding: 0 10px; }

/* --- PLAYOFF WINNERS --- */
.playoff-winner { color: #2e7d32; font-weight: 900; }
.playoff-loser { opacity: 0.4; text-decoration: line-through; }

/* --- MATCH CARD STAGES --- */
.match-card.stage-semi { border: 2px solid var(--uwb-purple); }
.match-card.stage-third { border: 2px solid #cd7f32; } /* Bronze */
.match-card.stage-final { border: 2px solid var(--uwb-gold); box-shadow: 0 4px 15px rgba(183, 165, 122, 0.4); background-color: #fffdf5; }

.admin-stage-select { padding: 4px; font-size: 0.7rem; border-radius: 4px; border: 1px solid #ccc; background: white; cursor: pointer; margin: 0; width: auto; color: var(--uwb-purple); font-weight: bold;}
.stage-badge { font-size: 0.7rem; font-weight: 700; padding: 4px 8px; border-radius: 4px; letter-spacing: 0.5px; margin-right: 5px; }
.badge-semi { background: #e6e0f8; color: var(--uwb-purple); }
.badge-third { background: #fdf2e9; color: #cd7f32; }
.badge-final { background: #fff8e1; color: #b7950b; }

/* --- STAGE TOGGLE (GROUPS VS PLAYOFFS) --- */
.stage-toggle { display: flex; gap: 8px; margin: 0 10px 15px 10px; background: #e0e0e0; border-radius: 8px; padding: 4px; }
.stage-option { 
    flex: 1; text-align: center; padding: 8px; border-radius: 6px; 
    font-size: 0.85rem; font-weight: 700; color: #666; cursor: pointer; transition: 0.2s; 
    -webkit-tap-highlight-color: transparent;
}
.stage-option.active { background: white; color: var(--uwb-purple); box-shadow: 0 2px 5px rgba(0,0,0,0.1); }

/* --- STANDINGS GROUP HEADER --- */
.group-header { 
    background: var(--uwb-purple); 
    color: white; 
    padding: 8px 12px; 
    font-size: 0.8rem; 
    font-weight: bold; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
}

/* --- FIX: DASHBOARD CARD RIGHT ALIGNMENT --- */
.match-team-col.right-align { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }

/* --- PREMIUM SCORE HEADER --- */
.score-header { 
    text-align: center; 
    padding: 20px 15px 15px 15px; 
    background: linear-gradient(135deg, var(--uwb-purple), #311b5e); 
    color: var(--white); 
    border-radius: 12px; 
    margin-bottom: 20px; 
    position: relative; 
    box-shadow: 0 6px 15px rgba(75, 46, 131, 0.25);
}

/* SCORECARD */
.scorecard-section { margin-top: 25px; }
.scorecard-block { margin-bottom: 20px; border: 1px solid #ddd; border-radius: 6px; overflow: hidden; background: white; }
.scorecard-header { background: var(--uwb-purple); color: white; padding: 10px; font-weight: bold; font-size: 0.9rem; }
.scorecard-table { width: 100%; border-collapse: collapse; }
.scorecard-table th { background: #f9f9f9; color: #555; text-transform: uppercase; font-size: 0.75rem; text-align: right; padding: 8px 10px; border-bottom: 2px solid #eee; }
.scorecard-table th:first-child { text-align: left; }
.scorecard-table td { padding: 10px; border-bottom: 1px solid #eee; text-align: right; font-size: 0.9rem; }
.scorecard-table td:first-child { text-align: left; font-weight: 600; color: var(--uwb-purple); width: 45%; }
.scorecard-table tr:last-child td { border-bottom: none; }

/* MODALS */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 200; display: none; align-items: center; justify-content: center; }
.modal { background: white; width: 90%; max-width: 400px; padding: 20px; border-radius: 8px; max-height: 80vh; overflow-y: auto; }
.player-select-btn { margin: 5px 0; background: var(--light-gray); color: black; text-align: left; }
.hidden { display: none !important; }
.edit-controls { display: flex; gap: 5px; justify-content: flex-end; }

/* --- PRO SCORECARD OVERRIDE --- */
.scorecard-section { margin-top: 30px; }
.scorecard-block { 
    margin-bottom: 24px; 
    background: var(--white); 
    border-radius: 12px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.05); 
    overflow: hidden; 
    border: 1px solid #eaeaea;
}
.scorecard-header { 
    background: #f1f3f4; 
    color: #444; 
    padding: 14px 16px; 
    font-weight: 700; 
    font-size: 0.95rem; 
    text-align: center; 
    border-bottom: 1px solid #e0e0e0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.table-responsive { width: 100%; overflow-x: auto; }
.scorecard-table { width: 100%; min-width: 340px; border-collapse: collapse; }
.scorecard-table th { 
    background: #ffffff;
    color: #888; 
    font-size: 0.7rem; 
    text-transform: uppercase; 
    font-weight: 500; 
    padding: 12px 10px; 
    border-bottom: 2px solid #f0f0f0; 
    text-align: right; 
}
.scorecard-table th:first-child { text-align: left; padding-left: 16px; }
.scorecard-table td { 
    padding: 12px 10px; 
    border-bottom: 1px solid #f5f5f5; 
    text-align: right; 
    font-size: 0.95rem; 
    color: var(--uwb-black);
    white-space: nowrap; /* Prevents awkward column squeezing */
}
.scorecard-table tr:last-child td { border-bottom: none; }
.scorecard-table td:first-child { text-align: left; padding-left: 16px; }

/* FIX: Mobile typography & layout */
.batter-name-cell { text-align: left; vertical-align: middle; }
.p-name { 
    color: var(--uwb-purple); 
    font-weight: 600; 
    font-size: 0.95rem; 
    display: block; 
    line-height: 1.2; 
}
/* Update this specific rule at the bottom of your CSS file */
.dismissal-text { 
    font-size: 0.8rem; 
    color: #888; 
    text-transform: lowercase; 
    display: inline; 
    margin-left: 6px; 
    font-weight: normal;
}
.bold-stat { font-weight: 700; }

/* --- MATCH TABS --- */
.match-tabs { display: flex; justify-content: space-around; background: #e0e0e0; border-radius: 8px; margin: 20px 0; overflow: hidden;}
.tab-btn { flex: 1; background: transparent; color: #555; padding: 12px; border: none; font-weight: bold; cursor: pointer; border-radius: 0; margin: 0; }
.tab-btn.active { background: var(--uwb-purple); color: white; }
.match-tab-content { display: none; }
.match-tab-content.active { display: block; animation: fadeIn 0.3s; }

/* --- INNING TABS --- */
.inning-tabs { display: flex; gap: 10px; margin-bottom: 15px; }
.inning-btn { flex: 1; background: white; border: 2px solid var(--uwb-purple); color: var(--uwb-purple); padding: 8px; border-radius: 20px; font-weight: bold; cursor: pointer; margin: 0; }
.inning-btn.active { background: var(--uwb-purple); color: white; }

/* --- SUMMARY TAB --- */
.summary-potm-box { background: var(--uwb-gold); color: var(--uwb-black); padding: 15px; text-align: center; border-radius: 8px; font-weight: bold; margin-bottom: 20px; }
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.summary-team-header { grid-column: span 2; font-size: 0.85rem; text-transform: uppercase; color: #666; font-weight: bold; border-bottom: 1px solid #ddd; padding-bottom: 5px; margin-top: 10px;}
.summary-card { background: white; padding: 10px; border-radius: 8px; border: 1px solid #eaeaea; }
.summary-card-title { font-size: 0.7rem; color: #888; text-transform: uppercase; margin-bottom: 8px; }
.summary-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.9rem; margin-bottom: 6px; }
.summary-name { color: var(--uwb-purple); font-weight: bold; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; padding-right: 10px; }

/* --- COMMENTARY TAB PRO --- */
.comm-list { background: white; border-radius: 8px; border: 1px solid #eaeaea; overflow: hidden; }

/* New Circular Badges */
.comm-ball { display: flex; padding: 14px 15px; border-bottom: 1px solid #f0f0f0; align-items: flex-start; }
.run-circle { min-width: 34px; height: 34px; padding: 0 6px; box-sizing: border-box; border-radius: 17px; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 0.85rem; color: #444; background: #f0f0f0; flex-shrink: 0; margin-right: 15px; border: 1px solid #ddd; }
.rc-w { background: var(--danger); color: white; border-color: var(--danger); }
.rc-4 { background: #1b5e20; color: white; border-color: #1b5e20; }
.rc-6 { background: #2e7d32; color: white; border-color: #2e7d32; }
.rc-0 { background: #e0e0e0; color: #666; border-color: #ccc; }
.rc-extra { background: var(--uwb-gold); color: black; border-color: #a09068; font-size: 0.75rem; }

.comm-text { flex: 1; font-size: 0.95rem; line-height: 1.4; padding-top: 6px;}

/* End of Over Block */
.comm-eoo { background: #f9f9f9; border-top: 1px solid #eaeaea; border-bottom: 1px solid #eaeaea; padding: 12px 15px; margin: 0; font-size: 0.95rem;}
.comm-eoo-header { display: flex; justify-content: space-between; font-weight: bold; margin-bottom: 2px; color: var(--uwb-black); }
.comm-eoo-runs { font-size: 0.85rem; color: #555; margin-bottom: 12px; }
.comm-eoo-grid { display: flex; justify-content: space-between; border-top: 1px solid #eaeaea; padding-top: 10px; align-items: center; }
.comm-eoo-batters { flex: 1; border-right: 1px solid #eaeaea; padding-right: 10px; min-width: 0; }
.comm-eoo-bowler { flex: 1; padding-left: 10px; text-align: right; min-width: 0; }
.comm-eoo-player { display: flex; justify-content: space-between; margin-bottom: 4px; font-size: 0.9rem; flex-wrap: nowrap; align-items: center; }
.comm-eoo-player > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.comm-eoo-player > span:last-child { white-space: nowrap; flex-shrink: 0; margin-left: 5px; text-align: right; }

/* End of Innings Block */
.comm-eoi { background: var(--uwb-purple); color: white; padding: 18px 15px; text-align: center; border-bottom: 1px solid #eaeaea; font-size: 0.95rem;}
.comm-eoi .target { background: var(--uwb-gold); color: black; padding: 6px 12px; border-radius: 6px; display: inline-block; margin-top: 10px; font-size: 0.85rem; font-weight:bold; letter-spacing: 0.5px;}

/* --- MOBILE RESPONSIVENESS OVERRIDES --- */
/* BALL-BY-BALL TIMELINE SLIDER */
.timeline-slider {
    margin-top: 10px;
    background: #eee;
    padding: 12px 10px;
    border-radius: 6px;
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    gap: 12px;
    align-items: center;
    scrollbar-width: none; /* Hides scrollbar in Firefox */
    -ms-overflow-style: none;  /* Hides scrollbar in IE/Edge */
    border: 1px solid #e0e0e0;
}
.timeline-slider::-webkit-scrollbar {
    display: none; /* Hides scrollbar in Safari/Chrome for clean app look */
}

/* --- COMMON TYPOGRAPHY --- */
.section-sub { font-size: 0.78rem; color: #777; margin: 4px 0 12px 0; line-height: 1.4; }

/* Quick Match badge */
.stage-badge.badge-quick { background: #e7f1fb; color: #1d4e89; border: 1px solid #c9def4; }
.match-card.stage-quick { border: 1px dashed #c9def4; }

/* Status pill (active / archived) */
.status-pill { font-size: 0.7rem; font-weight: 700; padding: 4px 10px; border-radius: 12px; letter-spacing: 0.5px; text-transform: uppercase; }
.status-pill.active { background: #e8f5e9; color: #2e7d32; }
.status-pill.archived { background: #f0f0f0; color: #888; }

/* --- TOURNAMENT CARDS (landing list) --- */
.tournament-card {
    background: var(--white);
    border-radius: 12px;
    border: 1px solid #eaeaea;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    padding: 14px 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.tournament-card:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(75, 46, 131, 0.08); }
.tournament-card.archived { background: #fafafa; opacity: 0.85; }
.tournament-card .tc-name { font-size: 1rem; font-weight: 700; color: var(--uwb-purple); margin-bottom: 4px; line-height: 1.2; }
.tournament-card .tc-meta { font-size: 0.75rem; color: #666; }
.tournament-card .tc-arrow { color: #ccc; font-size: 1.4rem; flex-shrink: 0; }

/* Admin row in setup view: smaller cards */
.admin-tournament-row {
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}
.admin-tournament-row:hover { background: #f4f0fa; }

/* --- MATCH FILTER --- */
#match-filter { border: 1px solid #ddd; background: white; border-radius: 8px; font-weight: 600; color: var(--uwb-purple); }

/* Empty-state messaging */
.empty-state { text-align: center; padding: 22px 14px; color: #888; font-size: 0.9rem; background: #fafafa; border: 1px dashed #e0e0e0; border-radius: 10px; }
.empty-state strong { color: var(--uwb-purple); display: block; margin-bottom: 4px; font-size: 1rem; }
.empty-state span { display: block; }

/* "+ Start New Match" inline button on the tournament Matches sub-tab */
.small-btn { width: auto; padding: 7px 14px; margin: 0; font-size: 0.75rem; border-radius: 18px; font-weight: 700; letter-spacing: 0.3px; }
.small-btn.gold { background: linear-gradient(135deg, var(--uwb-gold), #9c8d62); color: var(--uwb-purple); border: none; }

/* Back button alignment in tournament detail */
.back-btn { width: auto; }

/* PIN badge styling */
.admin-pin-badge { letter-spacing: 0.5px; }

/* --- MOBILE RESPONSIVENESS OVERRIDES --- */
@media (max-width: 600px) {
    /* Stack Summary Boxes vertically instead of side-by-side */
    .summary-grid { grid-template-columns: 1fr; gap: 15px; } 

    /* Shrink Header Text so team names don't overlap */
    #head-team1-score, #head-team2-score { font-size: 1.3rem; }
    #head-team1-name, #head-team2-name { font-size: 0.75rem; white-space: normal; }

    /* Compress Scorecard Table Padding & Force Layout Grid */
    .scorecard-table { min-width: 100%; table-layout: fixed; } 
    .scorecard-table th, .scorecard-table td { padding: 8px 1px; font-size: 0.75rem; text-align: center; }
    .scorecard-table th:first-child, .scorecard-table td:first-child { padding-left: 5px; width: 36%; text-align: left; white-space: normal; word-wrap: break-word; }
    
    /* Allow Batting Names to wrap and force Dismissal text to a new line */
    .p-name { font-size: 0.8rem; line-height: 1.2; } 
    .dismissal-text { display: block; margin-left: 0; margin-top: 2px; font-size: 0.65rem; line-height: 1.1; }
    
    /* Shrink circular run badges slightly */
    /* Shrink circular run badges slightly, allowing pill-shape for extras */
    .run-circle { min-width: 28px; height: 28px; padding: 0 5px; border-radius: 14px; font-size: 0.75rem; margin-right: 10px; }
    .comm-text { font-size: 0.85rem; }

    /* Shrink the name truncation threshold further on phones so scores never wrap */
    .comm-eoo-player > span:first-child { max-width: 90px; }

    /* Shrink Modern Standings Table for Mobile */
    .modern-table th, .modern-table td { padding: 10px 4px; font-size: 0.8rem; }
    .modern-table .team-name-cell { font-size: 0.85rem; padding-left: 8px; }
    .modern-table .pts-cell { font-size: 0.9rem; }

    /* Admin Inputs on Mobile */
    #admin-team-controls input, #admin-team-controls select {
        padding: 8px;
        font-size: 0.9rem;
    }

    /* Mobile Match Card adjustments */
    .match-team-name { max-width: 110px; font-size: 0.85rem; }
    .match-team-score { font-size: 1.2rem; }
    .match-team-wickets { font-size: 0.9rem; }
    .match-vs { padding: 4px 6px; font-size: 0.75rem; }

    /* Mobile Match Header adjustments */
    .match-meta-text { font-size: 0.7rem; padding: 4px 8px; white-space: normal; line-height: 1.2; }
    .score-header { padding: 15px 10px 10px 10px; }

    /* Mobile tournament sub-tabs - allow up to 5 tabs without overflow */
    #tournament-sub-tabs { gap: 2px; }
    #tournament-sub-tabs .tab-btn { padding: 9px 1px; font-size: 0.7rem; letter-spacing: 0; }

    /* Share button compacts to icon-only on narrow screens */
    .share-btn { padding: 7px 11px; font-size: 0.75rem; }
    .share-btn span { display: none; }

    /* Match card admin row wraps so the share button doesn't overflow */
    .match-date-wrap { flex-wrap: wrap; justify-content: flex-end; gap: 6px; }

    /* Toast sits above bottom nav on mobile */
    .toast { bottom: 105px; font-size: 0.82rem; padding: 11px 18px; }

    /* Tournament cards on mobile */
    .tournament-card { padding: 12px 14px; }
    .tournament-card .tc-name { font-size: 0.95rem; }
    .tournament-card .tc-meta { font-size: 0.7rem; }
}