<?php

declare(strict_types=1);

require_once __DIR__ . '/bootstrap.php';
require_once dirname(__DIR__) . '/modules/fixtures/helpers.php';

function match_share_svg_player_label(array $player): string
{
    $jersey = $player['jersey_number'] !== null && $player['jersey_number'] !== ''
        ? '#' . (string) $player['jersey_number'] . ' '
        : '';
    $firstName = trim((string) ($player['first_name'] ?? ''));
    $lastName = trim((string) ($player['last_name'] ?? ''));
    $firstInitial = $firstName !== '' ? mb_strtoupper(mb_substr($firstName, 0, 1)) . '. ' : '';

    return trim($jersey . $firstInitial . $lastName);
}

function match_share_svg_scorer_name(array $event): string
{
    $playerName = trim((string) (($event['first_name'] ?? '') . ' ' . ($event['last_name'] ?? '')));

    if ($playerName === '') {
        $playerName = (string) ($event['club_name'] ?? 'Unknown');
    }

    return match ((string) ($event['event_type'] ?? '')) {
        'penalty_goal' => $playerName . ' (P)',
        'own_goal' => $playerName . ' (OG)',
        default => $playerName,
    };
}

function match_share_svg_event_minute(array $event): string
{
    $minute = (string) ($event['minute'] ?? '0');
    $extraMinute = isset($event['extra_minute']) && $event['extra_minute'] !== null
        ? '+' . (string) $event['extra_minute']
        : '';

    return trim($minute . $extraMinute) . "'";
}

function match_share_svg_color_value(string $value): string
{
    $value = trim($value);

    if ($value === '') {
        return '#dfe6e1';
    }

    if (preg_match('/^[#(),.%\- a-zA-Z0-9]+$/', $value) === 1) {
        return $value;
    }

    return '#dfe6e1';
}

function match_share_svg_kit_label(array $kit, string $field): string
{
    $value = trim((string) ($kit[$field] ?? ''));
    return $value !== '' ? $value : 'TBC';
}

$fixtureId = isset($_GET['id']) ? (int) $_GET['id'] : 0;

$fixture = null;
$homeLineup = ['starters' => [], 'substitutes' => []];
$awayLineup = ['starters' => [], 'substitutes' => []];
$goalSummary = ['home' => [], 'away' => []];
$homeConfirmedKit = null;
$awayConfirmedKit = null;
$showConfirmedKits = false;
if ($fixtureId > 0) {
    try {
        $fixture = db_fetch_one(
            'SELECT f.id, f.matchday, f.match_date, f.match_time, f.status, f.stage_type, f.group_label, f.knockout_round,
                    hc.id AS home_club_id, ac.id AS away_club_id,
                    hc.name AS home_club, hc.short_name AS home_short_name, hc.logo AS home_logo,
                    ac.name AS away_club, ac.short_name AS away_short_name, ac.logo AS away_logo,
                    c.name AS competition_name, c.type AS competition_type, v.name AS venue_name,
                    mr.home_score, mr.away_score, mr.result_status
             FROM fixtures f
             INNER JOIN clubs hc ON hc.id = f.home_club_id
             INNER JOIN clubs ac ON ac.id = f.away_club_id
             INNER JOIN competitions c ON c.id = f.competition_id
             LEFT JOIN venues v ON v.id = f.venue_id
             LEFT JOIN match_results mr ON mr.fixture_id = f.id
             WHERE f.id = :id
             LIMIT 1',
            ['id' => $fixtureId]
        );

        if ($fixture !== null) {
            $homeConfirmedKit = fixture_kit_record_for_club((int) $fixture['id'], (int) $fixture['home_club_id']);
            $awayConfirmedKit = fixture_kit_record_for_club((int) $fixture['id'], (int) $fixture['away_club_id']);
            $showConfirmedKits = $homeConfirmedKit !== null
                && $awayConfirmedKit !== null
                && !empty($homeConfirmedKit['confirmed_at'])
                && !empty($awayConfirmedKit['confirmed_at']);

            foreach (published_fixture_formations($fixtureId) as $formation) {
                if ((int) $formation['club_id'] === (int) ($fixture['home_club_id'] ?? 0)) {
                    $homeLineup = $formation['lineup'] ?? $homeLineup;
                }

                if ((int) $formation['club_id'] === (int) ($fixture['away_club_id'] ?? 0)) {
                    $awayLineup = $formation['lineup'] ?? $awayLineup;
                }
            }

            foreach (
                db_fetch_all(
                    'SELECT me.club_id, me.event_type, me.minute, me.extra_minute,
                        p.first_name, p.last_name, cl.name AS club_name
                 FROM match_events me
                 LEFT JOIN players p ON p.id = me.player_id
                 INNER JOIN clubs cl ON cl.id = me.club_id
                 WHERE me.fixture_id = :fixture_id
                   AND me.event_type IN ("goal", "penalty_goal", "own_goal")
                 ORDER BY me.minute ASC, me.extra_minute ASC, me.id ASC',
                    ['fixture_id' => $fixtureId]
                ) as $event
            ) {
                $bucket = (int) ($event['club_id'] ?? 0) === (int) ($fixture['home_club_id'] ?? 0) ? 'home' : 'away';
                if ((string) ($event['event_type'] ?? '') === 'own_goal') {
                    $bucket = $bucket === 'home' ? 'away' : 'home';
                }

                $goalSummary[$bucket][] = match_share_svg_scorer_name($event) . ' ' . match_share_svg_event_minute($event);
            }
        }
    } catch (Throwable) {
        $fixture = null;
    }
}

$competitionName = $fixture['competition_name'] ?? league_short_name();
$homeClub = $fixture['home_club'] ?? 'Home Club';
$awayClub = $fixture['away_club'] ?? 'Away Club';
$homeShort = $fixture['home_short_name'] ?? mb_substr((string) $homeClub, 0, 3);
$awayShort = $fixture['away_short_name'] ?? mb_substr((string) $awayClub, 0, 3);
$homeLogoUrl = !empty($fixture['home_logo']) ? absolute_url((string) $fixture['home_logo']) : null;
$awayLogoUrl = !empty($fixture['away_logo']) ? absolute_url((string) $fixture['away_logo']) : null;
$stageLabel = $fixture === null ? 'Match Banner' : competition_stage_label($fixture);
$scoreLabel = ($fixture !== null && $fixture['home_score'] !== null && $fixture['away_score'] !== null)
    ? ((string) $fixture['home_score'] . ' - ' . (string) $fixture['away_score'])
    : 'VS';
$venueLabel = $fixture['venue_name'] ?? 'Venue TBC';
$timeLabel = format_time_12h($fixture['match_time'] ?? null, 'Time TBC');
$dateLabel = $fixture['match_date'] ?? 'Date TBC';
$statusLabel = ucfirst((string) ($fixture['result_status'] ?? ($fixture['status'] ?? 'scheduled')));
$hasPublishedLineups = $homeLineup['starters'] !== [] || $homeLineup['substitutes'] !== [] || $awayLineup['starters'] !== [] || $awayLineup['substitutes'] !== [];
$hasGoalSummary = $goalSummary['home'] !== [] || $goalSummary['away'] !== [];
$imageHeight = $hasPublishedLineups ? 1240 : ($showConfirmedKits ? ($hasGoalSummary ? 1020 : 900) : ($hasGoalSummary ? 760 : 630));
$pitchY = $hasPublishedLineups ? 1250 : ($showConfirmedKits ? ($hasGoalSummary ? 1030 : 920) : ($hasGoalSummary ? 770 : 640));
$pitchLift = $showConfirmedKits ? 120 : 340;

header('Content-Type: image/svg+xml; charset=UTF-8');
header('Cache-Control: public, max-age=300');

echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="<?php echo e((string) $imageHeight); ?>" viewBox="0 0 1200 <?php echo e((string) $imageHeight); ?>" role="img" aria-label="<?php echo e($competitionName); ?> match banner">
    <defs>
        <linearGradient id="sky" x1="0" y1="0" x2="0" y2="1">
            <stop offset="0%" stop-color="#145ea2" />
            <stop offset="48%" stop-color="#0b4f93" />
            <stop offset="100%" stop-color="#0d6738" />
        </linearGradient>
        <linearGradient id="ribbonLeft" x1="0" y1="0" x2="1" y2="0">
            <stop offset="0%" stop-color="#f28a1a" />
            <stop offset="100%" stop-color="#eea32d" />
        </linearGradient>
        <linearGradient id="ribbonRight" x1="0" y1="0" x2="1" y2="0">
            <stop offset="0%" stop-color="#eea32d" />
            <stop offset="100%" stop-color="#f28a1a" />
        </linearGradient>
        <radialGradient id="light" cx="50%" cy="0%" r="65%">
            <stop offset="0%" stop-color="rgba(255,255,255,0.9)" />
            <stop offset="38%" stop-color="rgba(255,255,255,0.22)" />
            <stop offset="100%" stop-color="rgba(255,255,255,0)" />
        </radialGradient>
    </defs>

    <rect width="1200" height="<?php echo e((string) $imageHeight); ?>" fill="url(#sky)" rx="28" />
    <ellipse cx="260" cy="58" rx="260" ry="110" fill="url(#light)" opacity="0.78" />
    <ellipse cx="940" cy="58" rx="260" ry="110" fill="url(#light)" opacity="0.78" />

    <text x="600" y="78" text-anchor="middle" fill="#dce9f4" font-family="Arial, sans-serif" font-size="24" letter-spacing="8"><?php echo e(strtoupper(league_short_name() . ' OFFICIAL')); ?></text>
    <text x="600" y="150" text-anchor="middle" fill="#ffffff" font-family="Arial Black, Arial, sans-serif" font-size="72"><?php echo e(mb_strtoupper($competitionName)); ?></text>
    <text x="600" y="188" text-anchor="middle" fill="#d9ecff" font-family="Arial, sans-serif" font-size="24" letter-spacing="4"><?php echo e(mb_strtoupper($stageLabel)); ?></text>

    <g transform="translate(100 250)">
        <polygon points="0,0 370,0 336,72 0,72" fill="url(#ribbonLeft)" />
        <polygon points="630,0 1000,0 1000,72 664,72" fill="url(#ribbonRight)" />
        <polygon points="390,0 610,0 640,28 612,96 388,96 360,28" fill="#f2f2f2" />
        <text x="185" y="26" text-anchor="middle" fill="#fff5df" font-family="Arial, sans-serif" font-size="18" letter-spacing="3">HOME TEAM</text>
        <text x="185" y="60" text-anchor="middle" fill="#ffffff" font-family="Arial Black, Arial, sans-serif" font-size="34"><?php echo e(mb_strtoupper($homeClub)); ?></text>
        <text x="815" y="26" text-anchor="middle" fill="#fff5df" font-family="Arial, sans-serif" font-size="18" letter-spacing="3">AWAY TEAM</text>
        <text x="815" y="60" text-anchor="middle" fill="#ffffff" font-family="Arial Black, Arial, sans-serif" font-size="34"><?php echo e(mb_strtoupper($awayClub)); ?></text>
        <text x="500" y="58" text-anchor="middle" fill="#111111" font-family="Arial Black, Arial, sans-serif" font-size="52"><?php echo e($scoreLabel); ?></text>
    </g>

    <text x="600" y="390" text-anchor="middle" fill="#ffffff" font-family="Arial Black, Arial, sans-serif" font-size="42"><?php echo e(mb_strtoupper($venueLabel)); ?></text>
    <line x1="160" y1="408" x2="500" y2="408" stroke="rgba(255,255,255,0.78)" stroke-width="2" />
    <line x1="700" y1="408" x2="1040" y2="408" stroke="rgba(255,255,255,0.78)" stroke-width="2" />
    <text x="600" y="470" text-anchor="middle" fill="#ffffff" font-family="Arial Black, Arial, sans-serif" font-size="64"><?php echo e($timeLabel); ?></text>
    <text x="600" y="512" text-anchor="middle" fill="#e5f5eb" font-family="Arial, sans-serif" font-size="26"><?php echo e($dateLabel . ' · ' . $statusLabel); ?></text>

    <?php if ($hasGoalSummary): ?>
        <g transform="translate(100 552)">
            <text x="500" y="0" text-anchor="middle" fill="#dfefff" font-family="Arial, sans-serif" font-size="20" letter-spacing="6">GOALSCORERS</text>
            <g transform="translate(0 28)">
                <rect width="452" height="112" rx="20" fill="rgba(4,19,12,0.28)" stroke="rgba(255,255,255,0.14)" />
                <text x="24" y="30" fill="#ffffff" font-family="Arial Black, Arial, sans-serif" font-size="22"><?php echo e(mb_strtoupper($homeClub)); ?></text>
                <text x="24" y="62" fill="rgba(255,255,255,0.9)" font-family="Arial, sans-serif" font-size="16"><?php echo e($goalSummary['home'] !== [] ? implode(' , ', $goalSummary['home']) : 'No scorers recorded'); ?></text>
            </g>
            <g transform="translate(548 28)">
                <rect width="452" height="112" rx="20" fill="rgba(4,19,12,0.28)" stroke="rgba(255,255,255,0.14)" />
                <text x="428" y="30" text-anchor="end" fill="#ffffff" font-family="Arial Black, Arial, sans-serif" font-size="22"><?php echo e(mb_strtoupper($awayClub)); ?></text>
                <text x="428" y="62" text-anchor="end" fill="rgba(255,255,255,0.9)" font-family="Arial, sans-serif" font-size="16"><?php echo e($goalSummary['away'] !== [] ? implode(' , ', $goalSummary['away']) : 'No scorers recorded'); ?></text>
            </g>
        </g>
    <?php endif; ?>

    <?php if ($showConfirmedKits): ?>
        <g transform="translate(84 <?php echo e((string) ($hasGoalSummary ? 720 : 548)); ?>)">
            <text x="516" y="0" text-anchor="middle" fill="#dfefff" font-family="Arial, sans-serif" font-size="22" letter-spacing="6">OFFICIALLY CONFIRMED KITS</text>
            <g transform="translate(0 32)">
                <rect width="488" height="150" rx="24" fill="rgba(4,19,12,0.34)" stroke="rgba(255,255,255,0.14)" />
                <text x="28" y="36" fill="#ffffff" font-family="Arial Black, Arial, sans-serif" font-size="24"><?php echo e(mb_strtoupper($homeClub)); ?></text>
                <circle cx="44" cy="72" r="12" fill="<?php echo e(match_share_svg_color_value(match_share_svg_kit_label($homeConfirmedKit ?? [], 'shirt_color'))); ?>" stroke="rgba(255,255,255,0.55)" stroke-width="2" />
                <text x="68" y="78" fill="#ffffff" font-family="Arial, sans-serif" font-size="18">Shirt: <?php echo e(match_share_svg_kit_label($homeConfirmedKit ?? [], 'shirt_color')); ?></text>
                <circle cx="44" cy="104" r="12" fill="<?php echo e(match_share_svg_color_value(match_share_svg_kit_label($homeConfirmedKit ?? [], 'shorts_color'))); ?>" stroke="rgba(255,255,255,0.55)" stroke-width="2" />
                <text x="68" y="110" fill="#ffffff" font-family="Arial, sans-serif" font-size="18">Shorts: <?php echo e(match_share_svg_kit_label($homeConfirmedKit ?? [], 'shorts_color')); ?></text>
                <circle cx="44" cy="136" r="12" fill="<?php echo e(match_share_svg_color_value(match_share_svg_kit_label($homeConfirmedKit ?? [], 'socks_color'))); ?>" stroke="rgba(255,255,255,0.55)" stroke-width="2" />
                <text x="68" y="142" fill="#ffffff" font-family="Arial, sans-serif" font-size="18">Socks: <?php echo e(match_share_svg_kit_label($homeConfirmedKit ?? [], 'socks_color')); ?></text>
                <text x="272" y="78" fill="#f4df97" font-family="Arial, sans-serif" font-size="16" letter-spacing="2">GOALKEEPER</text>
                <circle cx="286" cy="104" r="12" fill="<?php echo e(match_share_svg_color_value(match_share_svg_kit_label($homeConfirmedKit ?? [], 'goalkeeper_shirt_color'))); ?>" stroke="rgba(255,255,255,0.55)" stroke-width="2" />
                <text x="310" y="110" fill="#ffffff" font-family="Arial, sans-serif" font-size="18"><?php echo e(match_share_svg_kit_label($homeConfirmedKit ?? [], 'goalkeeper_shirt_color')); ?> / <?php echo e(match_share_svg_kit_label($homeConfirmedKit ?? [], 'goalkeeper_shorts_color')); ?></text>
            </g>
            <g transform="translate(544 32)">
                <rect width="488" height="150" rx="24" fill="rgba(4,19,12,0.34)" stroke="rgba(255,255,255,0.14)" />
                <text x="460" y="36" text-anchor="end" fill="#ffffff" font-family="Arial Black, Arial, sans-serif" font-size="24"><?php echo e(mb_strtoupper($awayClub)); ?></text>
                <circle cx="444" cy="72" r="12" fill="<?php echo e(match_share_svg_color_value(match_share_svg_kit_label($awayConfirmedKit ?? [], 'shirt_color'))); ?>" stroke="rgba(255,255,255,0.55)" stroke-width="2" />
                <text x="420" y="78" text-anchor="end" fill="#ffffff" font-family="Arial, sans-serif" font-size="18">Shirt: <?php echo e(match_share_svg_kit_label($awayConfirmedKit ?? [], 'shirt_color')); ?></text>
                <circle cx="444" cy="104" r="12" fill="<?php echo e(match_share_svg_color_value(match_share_svg_kit_label($awayConfirmedKit ?? [], 'shorts_color'))); ?>" stroke="rgba(255,255,255,0.55)" stroke-width="2" />
                <text x="420" y="110" text-anchor="end" fill="#ffffff" font-family="Arial, sans-serif" font-size="18">Shorts: <?php echo e(match_share_svg_kit_label($awayConfirmedKit ?? [], 'shorts_color')); ?></text>
                <circle cx="444" cy="136" r="12" fill="<?php echo e(match_share_svg_color_value(match_share_svg_kit_label($awayConfirmedKit ?? [], 'socks_color'))); ?>" stroke="rgba(255,255,255,0.55)" stroke-width="2" />
                <text x="420" y="142" text-anchor="end" fill="#ffffff" font-family="Arial, sans-serif" font-size="18">Socks: <?php echo e(match_share_svg_kit_label($awayConfirmedKit ?? [], 'socks_color')); ?></text>
                <text x="216" y="78" text-anchor="end" fill="#f4df97" font-family="Arial, sans-serif" font-size="16" letter-spacing="2">GOALKEEPER</text>
                <circle cx="202" cy="104" r="12" fill="<?php echo e(match_share_svg_color_value(match_share_svg_kit_label($awayConfirmedKit ?? [], 'goalkeeper_shirt_color'))); ?>" stroke="rgba(255,255,255,0.55)" stroke-width="2" />
                <text x="178" y="110" text-anchor="end" fill="#ffffff" font-family="Arial, sans-serif" font-size="18"><?php echo e(match_share_svg_kit_label($awayConfirmedKit ?? [], 'goalkeeper_shirt_color')); ?> / <?php echo e(match_share_svg_kit_label($awayConfirmedKit ?? [], 'goalkeeper_shorts_color')); ?></text>
            </g>
        </g>
    <?php endif; ?>

    <?php if ($hasPublishedLineups): ?>
        <g transform="translate(84 <?php echo e((string) ($showConfirmedKits ? ($hasGoalSummary ? 918 : 746) : 548)); ?>)">
            <text x="516" y="0" text-anchor="middle" fill="#dfefff" font-family="Arial, sans-serif" font-size="22" letter-spacing="6">STARTING XI AND SUBSTITUTES</text>
            <g transform="translate(0 34)">
                <rect width="488" height="352" rx="24" fill="rgba(4,19,12,0.34)" stroke="rgba(255,255,255,0.14)" />
                <text x="28" y="38" fill="#ffffff" font-family="Arial Black, Arial, sans-serif" font-size="26"><?php echo e(mb_strtoupper($homeClub)); ?></text>
                <text x="28" y="62" fill="#f4df97" font-family="Arial, sans-serif" font-size="14" letter-spacing="2">STARTING XI</text>
                <?php foreach (array_values($homeLineup['starters']) as $index => $player): ?>
                    <text x="28" y="<?php echo e((string) (88 + ($index * 18))); ?>" fill="#ffffff" font-family="Arial, sans-serif" font-size="16"><?php echo e(match_share_svg_player_label($player)); ?></text>
                <?php endforeach; ?>
                <?php if ($homeLineup['starters'] === []): ?>
                    <text x="28" y="92" fill="rgba(255,255,255,0.8)" font-family="Arial, sans-serif" font-size="16">Lineup pending</text>
                <?php endif; ?>
                <text x="28" y="286" fill="#f4df97" font-family="Arial, sans-serif" font-size="14" letter-spacing="2">SUBSTITUTES</text>
                <?php foreach (array_values($homeLineup['substitutes']) as $index => $player): ?>
                    <text x="28" y="<?php echo e((string) (312 + ($index * 18))); ?>" fill="rgba(255,255,255,0.88)" font-family="Arial, sans-serif" font-size="16"><?php echo e(match_share_svg_player_label($player)); ?></text>
                <?php endforeach; ?>
                <?php if ($homeLineup['substitutes'] === []): ?>
                    <text x="28" y="316" fill="rgba(255,255,255,0.72)" font-family="Arial, sans-serif" font-size="16">Bench pending</text>
                <?php endif; ?>
            </g>
            <g transform="translate(544 34)">
                <rect width="488" height="352" rx="24" fill="rgba(4,19,12,0.34)" stroke="rgba(255,255,255,0.14)" />
                <text x="460" y="38" text-anchor="end" fill="#ffffff" font-family="Arial Black, Arial, sans-serif" font-size="26"><?php echo e(mb_strtoupper($awayClub)); ?></text>
                <text x="460" y="62" text-anchor="end" fill="#f4df97" font-family="Arial, sans-serif" font-size="14" letter-spacing="2">STARTING XI</text>
                <?php foreach (array_values($awayLineup['starters']) as $index => $player): ?>
                    <text x="460" y="<?php echo e((string) (88 + ($index * 18))); ?>" text-anchor="end" fill="#ffffff" font-family="Arial, sans-serif" font-size="16"><?php echo e(match_share_svg_player_label($player)); ?></text>
                <?php endforeach; ?>
                <?php if ($awayLineup['starters'] === []): ?>
                    <text x="460" y="92" text-anchor="end" fill="rgba(255,255,255,0.8)" font-family="Arial, sans-serif" font-size="16">Lineup pending</text>
                <?php endif; ?>
                <text x="460" y="286" text-anchor="end" fill="#f4df97" font-family="Arial, sans-serif" font-size="14" letter-spacing="2">SUBSTITUTES</text>
                <?php foreach (array_values($awayLineup['substitutes']) as $index => $player): ?>
                    <text x="460" y="<?php echo e((string) (312 + ($index * 18))); ?>" text-anchor="end" fill="rgba(255,255,255,0.88)" font-family="Arial, sans-serif" font-size="16"><?php echo e(match_share_svg_player_label($player)); ?></text>
                <?php endforeach; ?>
                <?php if ($awayLineup['substitutes'] === []): ?>
                    <text x="460" y="316" text-anchor="end" fill="rgba(255,255,255,0.72)" font-family="Arial, sans-serif" font-size="16">Bench pending</text>
                <?php endif; ?>
            </g>
        </g>
    <?php endif; ?>

    <path d="M 80 <?php echo e((string) $pitchY); ?> Q 600 <?php echo e((string) ($pitchY - $pitchLift)); ?> 1120 <?php echo e((string) $pitchY); ?>" fill="none" stroke="rgba(255,255,255,0.92)" stroke-width="14" />
    <circle cx="600" cy="<?php echo e((string) $pitchY); ?>" r="120" fill="none" stroke="rgba(255,255,255,0.92)" stroke-width="14" />

    <g transform="translate(165 292)">
        <?php if ($homeLogoUrl !== null): ?>
            <image href="<?php echo e($homeLogoUrl); ?>" x="0" y="0" width="78" height="78" preserveAspectRatio="xMidYMid meet" />
        <?php else: ?>
            <text x="39" y="49" text-anchor="middle" fill="#ffffff" font-family="Arial Black, Arial, sans-serif" font-size="28"><?php echo e(mb_strtoupper($homeShort)); ?></text>
        <?php endif; ?>
    </g>
    <g transform="translate(957 292)">
        <?php if ($awayLogoUrl !== null): ?>
            <image href="<?php echo e($awayLogoUrl); ?>" x="0" y="0" width="78" height="78" preserveAspectRatio="xMidYMid meet" />
        <?php else: ?>
            <text x="39" y="49" text-anchor="middle" fill="#ffffff" font-family="Arial Black, Arial, sans-serif" font-size="28"><?php echo e(mb_strtoupper($awayShort)); ?></text>
        <?php endif; ?>
    </g>
</svg>