* {
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

:root {
    --bg: #080808;
    --bg-soft: #0f0f10;
    --panel: #141416;
    --panel-soft: #1a1a1d;
    --panel-hover: #202024;
    --border: #2a2a2f;
    --red: #d20f24;
    --red-strong: #ff1934;
    --red-dark: #8f0c1b;
    --text: #f5f5f7;
    --text-soft: #c6c6cb;
    --muted: #8f8f98;
    --shadow: 0 14px 38px rgba(0,0,0,.34);
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(circle at 15% 0%, rgba(181,9,31,.22), transparent 28%),
        radial-gradient(circle at 85% 10%, rgba(105,0,18,.18), transparent 24%),
        linear-gradient(180deg, #090909 0%, #0b0b0d 42%, #070708 100%);
}

header {
    position: relative;
    overflow: hidden;
    padding: 28px 20px 25px;
    text-align: center;
    color: white;
    background: linear-gradient(135deg, #090909 0%, #17080b 55%, #090909 100%);
    border-bottom: 1px solid rgba(255,25,52,.28);
    box-shadow: 0 12px 35px rgba(0,0,0,.34);
}

header h1 {
    margin: 0;
    font-size: 30px;
    font-weight: 800;
    letter-spacing: .3px;
}

header p {
    margin: 7px 0 0;
    font-size: 13px;
    color: #b8b8bd;
    letter-spacing: .8px;
}

.controls {
    margin: 20px 18px 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    background: linear-gradient(145deg, rgba(24,24,27,.96), rgba(15,15,17,.96));
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 14px;
    box-shadow: var(--shadow);
}

input[type="date"],
input[type="text"] {
    min-height: 42px;
    padding: 10px 12px;
    color: var(--text);
    background: #0d0d0f;
    border: 1px solid #34343a;
    border-radius: 8px;
    outline: none;
    font-size: 14px;
}

input[type="text"] {
    flex: 1 1 260px;
}

input[type="date"]:focus,
input[type="text"]:focus {
    border-color: var(--red);
    background: #111114;
    box-shadow: 0 0 0 3px rgba(210,15,36,.12);
}

input::placeholder {
    color: #777780;
}

button {
    min-height: 42px;
    padding: 10px 17px;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 9px;
    cursor: pointer;
    color: white;
    background: linear-gradient(135deg, #b40d20 0%, #e2142d 100%);
    box-shadow: 0 7px 18px rgba(170,4,29,.22);
    font-size: 13px;
    font-weight: 700;
    transition: .18s;
}

button:hover {
    transform: translateY(-1px);
    filter: brightness(1.08);
    box-shadow: 0 9px 24px rgba(210,15,36,.30);
}

.matches,
.analysis {
    margin: 18px;
    padding: 18px;
    background: linear-gradient(145deg, rgba(20,20,22,.98), rgba(13,13,15,.98));
    border: 1px solid rgba(255,255,255,.065);
    border-radius: 15px;
    box-shadow: var(--shadow);
}

.matches h2,
.analysis h2 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #fafafa;
    font-size: 20px;
    font-weight: 800;
}

.matches h2::after,
.analysis h2::after {
    content: "";
    display: block;
    width: 48px;
    height: 3px;
    margin-top: 7px;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--red-strong), var(--red-dark));
}

#matchesContainer {
    display: grid;
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 12px;
}

.match-card {
    min-width: 0;
    height: 100%;
    padding: 13px 14px;
    margin-bottom: 0;
    color: var(--text);
    background: linear-gradient(155deg, #19191c 0%, #111113 100%);
    border: 1px solid #2c2c31;
    border-radius: 11px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,.18);
    transition: .2s;
}

.match-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255,25,52,.56);
    background: linear-gradient(155deg, #20191c 0%, #141416 100%);
}

.match-card.selected {
    border: 1px solid var(--red-strong);
    box-shadow: 0 0 0 2px rgba(255,25,52,.12), 0 10px 25px rgba(160,0,24,.20);
}

.match-info {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
}

.match-info strong {
    color: #f6f6f8;
    font-size: 14px;
    line-height: 1.35;
}

.match-info span {
    color: var(--muted);
    font-size: 12px;
}

.analyze-btn {
    margin-top: auto;
    align-self: flex-start;
    padding: 8px 12px;
    min-height: 36px;
    font-size: 12px;
}

.result-box {
    padding: 15px;
    background: linear-gradient(145deg, #111113, #0d0d0f);
    border: 1px solid #29292e;
    border-radius: 12px;
}

.result-box > h3 {
    margin-top: 0;
}

.analysis-match-header {
    margin-bottom: 13px;
    padding: 8px 10px 13px;
    text-align: center;
    border-bottom: 1px solid rgba(255,25,52,.20);
}

.analysis-match-header h3 {
    margin: 0;
    color: #fff;
    font-size: 20px;
    font-weight: 800;
}

.analysis-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 12px;
    align-items: stretch;
}

.analysis-card {
    position: relative;
    min-width: 0;
    padding: 13px;
    color: var(--text-soft);
    background: linear-gradient(150deg, #1a1a1d 0%, #111113 100%);
    border: 1px solid #2d2d32;
    border-radius: 11px;
    box-shadow: 0 8px 20px rgba(0,0,0,.18);
    overflow: hidden;
}

.analysis-card::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, rgba(255,25,52,.85), rgba(104,5,19,.16));
}

.analysis-card h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #fff;
    font-size: 16px;
    font-weight: 800;
}

.analysis-card p {
    margin: 5px 0;
    font-size: 13px;
    line-height: 1.4;
}

.analysis-card strong {
    color: #fff;
    font-weight: 800;
}

.shots-card {
    position: relative;
    overflow: hidden;
}

.shots-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 2px;
    right: 0;
    height: 3px;
}

.shots-target-card::before,
.shots-total-card::before {
    background: linear-gradient(90deg, #ff1733, #8d0a19);
}

.shots-target-card,
.shots-total-card {
    background: linear-gradient(155deg, #1b1518 0%, #111113 52%, #0e0e10 100%);
}

.shots-subtitle {
    margin-top: 12px;
    margin-bottom: 5px;
    padding: 7px 8px;
    border: 1px solid rgba(255,25,52,.16);
    border-radius: 7px;
    color: #d6d6da;
    background: rgba(210,15,36,.08);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.shots-team-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 8px;
    margin-top: 10px;
}

.shots-team-box {
    min-width: 0;
    padding: 8px;
    border: 1px solid #303036;
    border-radius: 8px;
    background: rgba(8,8,9,.58);
}

.shots-team-box .shots-subtitle {
    margin-top: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.market-lines.compact {
    margin-top: 3px;
    padding-top: 3px;
    border-top: none;
}

.market-lines.compact p {
    margin: 3px 0;
    font-size: 12px;
}

.coverage-line {
    margin-top: 10px !important;
    padding-top: 8px;
    border-top: 1px dashed #37373c;
    color: #85858e;
}

.analysis-card.wide {
    grid-column: span 1;
}

.analysis-meta {
    margin-top: 13px;
    padding: 10px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    color: #aaaab2;
    background: linear-gradient(135deg, rgba(27,27,30,.95), rgba(17,17,19,.95));
    border: 1px solid #2c2c31;
    border-radius: 9px;
    font-size: 12px;
}

.analysis-meta p {
    margin: 0;
}

.analysis-meta strong {
    color: #fff;
}

.market-lines {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #303036;
}

.market-lines p {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.market-lines p strong {
    color: #ff4258;
}

.unavailable {
    color: #777780;
}

.unavailable strong {
    color: #a8a8af;
}

.loading {
    font-weight: bold;
    color: #ff3149;
}

#pagination {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

#pagination button {
    margin: 0;
    padding: 8px 12px;
    min-height: 35px;
    color: #dcdce0;
    background: #171719;
    border: 1px solid #313136;
    box-shadow: none;
    font-size: 12px;
}

#pagination button:hover {
    color: #fff;
    background: #261216;
    border-color: var(--red);
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #09090a;
}

::-webkit-scrollbar-thumb {
    background: #37373c;
    border-radius: 10px;
    border: 2px solid #09090a;
}

::-webkit-scrollbar-thumb:hover {
    background: #8e1020;
}

::selection {
    color: #fff;
    background: #a90d20;
}

@media (max-width: 1100px) {
    .analysis-grid,
    #matchesContainer {
        grid-template-columns: repeat(2, minmax(0,1fr));
    }
}

@media (max-width: 700px) {
    header {
        padding: 22px 15px 20px;
    }

    header h1 {
        font-size: 23px;
    }

    .controls,
    .matches,
    .analysis {
        margin: 10px;
    }

    .controls {
        padding: 12px;
    }

    .controls input,
    .controls button {
        width: 100%;
    }

    .analysis-grid,
    #matchesContainer,
    .shots-team-grid {
        grid-template-columns: 1fr;
    }

    .analysis-card {
        padding: 11px;
    }
}