:root {
    --bg-night: #0f172a;
    --bg-deep: #07142b;
    --ink: #ebf2ff;
    --soft: #93a8c6;
    --accent: #ffb703;
    --accent-2: #fb8500;
    --panel: rgba(12, 23, 43, 0.78);
    --line: rgba(147, 168, 198, 0.24);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 12% 18%, rgba(251, 133, 0, 0.22), transparent 40%),
        radial-gradient(circle at 80% 8%, rgba(255, 183, 3, 0.16), transparent 45%),
        linear-gradient(180deg, var(--bg-deep) 0%, var(--bg-night) 100%);
    color: var(--ink);
    font-family: 'Manrope', sans-serif;
    font-size: 0.96rem;
    overflow-x: hidden;
}

h1,
h2,
h3,
.brand-title {
    font-family: 'Bebas Neue', sans-serif;
    letter-spacing: 0.03em;
}

.app-navbar {
    background: rgba(7, 20, 43, 0.86);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}

.app-navbar .nav-link,
.app-navbar .navbar-brand {
    color: var(--ink) !important;
}

.app-navbar .navbar-toggler {
    border-color: rgba(235, 242, 255, 0.4);
}

.app-navbar .navbar-toggler-icon {
    filter: invert(1);
}

.brand-title {
    font-size: 1.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.dashboard-page {
    font-size: clamp(0.84rem, 0.3vw + 0.78rem, 1rem);
}

.dashboard-page .h4,
.dashboard-page .h5,
.dashboard-page h2 {
    font-size: 1.2rem;
}

.dashboard-page .hero-copy p {
    font-size: 0.92rem;
}

.dashboard-page .history-card h3 {
    font-size: 1.1rem;
}

.dashboard-page .history-card p {
    font-size: 0.86rem;
}

.dashboard-page .stat-list li span {
    font-size: 0.84rem;
}

.dashboard-page .stat-list li strong {
    font-size: 0.98rem;
}

.hero-panel {
    display: grid;
    grid-template-columns: 1.25fr 0.75fr;
    gap: 1rem;
    background: linear-gradient(140deg, rgba(13, 33, 62, 0.9), rgba(10, 22, 39, 0.88));
    border: 1px solid var(--line);
    border-radius: 1rem;
    padding: 1.25rem;
    animation: floatIn 0.65s ease-out;
}

.hero-copy h1 {
    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: 0.95;
    margin-bottom: 0.7rem;
}

.eyebrow {
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 0.3rem;
    font-weight: 700;
}

.hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.hero-badges span {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    font-size: 0.87rem;
}

.hero-media {
    overflow: hidden;
    border-radius: 0.9rem;
    border: 1px solid var(--line);
}

.hero-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.03);
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.9rem;
}

.history-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 0.9rem;
    overflow: hidden;
    animation: revealUp 0.6s ease both;
}

.history-card:nth-child(2) {
    animation-delay: 0.15s;
}

.history-card:nth-child(3) {
    animation-delay: 0.3s;
}

.history-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.history-card h3,
.history-card p {
    padding: 0.75rem 0.9rem;
    margin: 0;
}

.panel-card {
    background: var(--panel);
    border: 1px solid var(--line);
    color: var(--ink);
}

.panel-card .card-body {
    padding: 1.1rem;
}

.table-responsive {
    border-radius: 0.75rem;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--ink);
    --bs-table-border-color: var(--line);
}

.table-dark {
    --bs-table-bg: rgba(2, 10, 24, 0.35);
}

.fixture-table td,
.fixture-table th {
    vertical-align: middle;
}

.fixture-table {
    table-layout: fixed;
    width: 100%;
}

.fixture-table th:nth-child(1),
.fixture-table td:nth-child(1) {
    width: 14%;
}

.fixture-table th:nth-child(2),
.fixture-table td:nth-child(2) {
    width: 9%;
}

.fixture-table th:nth-child(3),
.fixture-table td:nth-child(3) {
    width: 14%;
}

.fixture-table th:nth-child(4),
.fixture-table td:nth-child(4) {
    width: 30%;
}

.fixture-table th:nth-child(5),
.fixture-table td:nth-child(5) {
    width: 12%;
}

.fixture-table th.prediction-col,
.fixture-table td.prediction-col {
    width: 21%;
}

.fixture-table th,
.fixture-table td {
    padding: 0.58rem 0.5rem;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    vertical-align: top;
    overflow: hidden;
}

.fixture-table thead th {
    white-space: normal;
}

.fixture-table th {
    font-size: 0.8rem;
    font-weight: 700;
}

.fixture-table td {
    font-size: 0.78rem;
    line-height: 1.3;
}

.fixture-table td strong {
    font-size: 0.82rem;
    display: inline;
}

.match-teams {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.18rem;
}

.vs-tag {
    font-size: 0.76em;
    color: var(--soft);
    font-weight: 600;
}

.fixture-table .badge {
    font-size: 0.64rem;
    display: inline-block;
    max-width: 100%;
    white-space: normal;
    text-wrap: balance;
    padding: 0.28rem 0.5rem;
}

.fixture-table small,
.fixture-table .text-secondary {
    font-size: 0.66rem;
}

.group-badge,
.phase-badge,
.result-badge {
    white-space: nowrap !important;
    overflow-wrap: normal !important;
    word-break: keep-all !important;
    line-height: 1.1;
}

.group-badge {
    font-size: 0.64rem !important;
    padding: 0.22rem 0.34rem !important;
}

.phase-badge {
    font-size: 0.62rem !important;
    padding: 0.2rem 0.3rem !important;
}

.result-badge {
    font-size: 0.92rem !important;
    padding: 0.3rem 0.45rem !important;
}

.score-inputs input {
    max-width: 66px;
    text-align: center;
}

.prediction-score-input {
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    font-weight: 700;
    font-size: 0.86rem;
}

.fixture-table .score-inputs {
    gap: 0.16rem !important;
}

.fixture-table td.prediction-col .text-secondary {
    display: block;
    margin-top: 0.3rem;
}

.floating-save-actions {
    position: sticky;
    bottom: 1rem;
    z-index: 20;
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
    padding-top: 0.25rem;
}

.floating-save-button {
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
    font-size: 0.9rem;
}

.score-inputs {
    flex-wrap: nowrap;
}

.stat-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.45rem 0;
    border-bottom: 1px dashed var(--line);
}

.auth-wrap {
    min-height: calc(100vh - 150px);
    display: flex;
    justify-content: center;
    align-items: center;
}

.auth-card {
    width: min(560px, 95%);
    border-radius: 1rem;
    border: 1px solid var(--line);
    padding: 1.2rem;
}

.glass {
    background: linear-gradient(150deg, rgba(11, 28, 49, 0.92), rgba(10, 16, 31, 0.86));
    backdrop-filter: blur(10px);
}

.btn-warning {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border: none;
    color: #151515;
    font-weight: 700;
}

.form-control,
.form-select {
    background-color: rgba(255, 255, 255, 0.92);
}

@keyframes floatIn {
    from {
        opacity: 0;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes revealUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 991px) {
    main.container-xl {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .app-navbar .navbar-nav {
        margin-top: 0.6rem;
        gap: 0.45rem;
        align-items: stretch !important;
    }

    .app-navbar .nav-link,
    .app-navbar .btn,
    .app-navbar .badge {
        width: 100%;
        display: block;
        text-align: center;
    }

    .app-navbar .nav-user {
        width: 100%;
    }

    .dashboard-page {
        font-size: 0.82rem;
    }

    .dashboard-page .h4,
    .dashboard-page .h5,
    .dashboard-page h2 {
        font-size: 1.05rem;
    }

    .hero-panel {
        grid-template-columns: 1fr;
        padding: 1rem;
    }

    .history-grid {
        grid-template-columns: 1fr;
    }

    .hero-media {
        min-height: 220px;
    }

    .history-card img {
        height: 210px;
    }

    .fixture-table,
    .table.table-dark {
        font-size: 0.82rem;
    }

    .fixture-table td,
    .fixture-table th {
        white-space: normal;
    }

    .prediction-score-input {
        width: 42px;
        min-width: 42px;
        max-width: 42px;
        font-size: 0.88rem;
    }

    .result-badge {
        font-size: 0.95rem !important;
    }

    .fixture-table .score-inputs {
        gap: 0.3rem !important;
    }

    .floating-save-actions {
        bottom: 0.75rem;
    }

    .floating-save-button {
        width: 100%;
    }

    .auth-wrap {
        min-height: auto;
        padding: 1rem 0;
        align-items: flex-start;
    }

    .auth-card {
        width: 100%;
        padding: 1rem;
    }
}

@media (max-width: 767px) {
    .brand-title {
        font-size: 1.25rem;
    }

    .hero-copy h1 {
        font-size: clamp(1.6rem, 8vw, 2.1rem);
        line-height: 1;
    }

    .dashboard-page {
        font-size: 0.74rem;
    }

    .dashboard-page .h4,
    .dashboard-page .h5,
    .dashboard-page h2 {
        font-size: 0.95rem;
    }

    .hero-badges span {
        font-size: 0.8rem;
    }

    .panel-card .card-body {
        padding: 0.9rem;
    }

    .fixture-table th {
        font-size: 0.7rem;
    }

    .fixture-table td {
        font-size: 0.67rem;
    }

    .fixture-table td strong {
        font-size: 0.72rem;
    }

    .fixture-table .badge {
        font-size: 0.6rem;
        padding: 0.2rem 0.4rem;
    }

    .group-badge,
    .phase-badge,
    .result-badge {
        white-space: nowrap !important;
    }

    .fixture-table small,
    .fixture-table .text-secondary {
        font-size: 0.6rem;
    }

    .fixture-table td:nth-child(4) {
        max-width: 140px;
    }

    /* En telefonos ocultamos columnas secundarias para mejorar legibilidad */
    .fixture-table th:nth-child(2),
    .fixture-table td:nth-child(2),
    .fixture-table th:nth-child(3),
    .fixture-table td:nth-child(3) {
        display: none;
    }

    .fixture-table th:nth-child(1),
    .fixture-table td:nth-child(1) {
        width: 24%;
    }

    .fixture-table th:nth-child(4),
    .fixture-table td:nth-child(4) {
        width: 36%;
        max-width: none;
    }

    .fixture-table th:nth-child(5),
    .fixture-table td:nth-child(5) {
        display: table-cell !important;
        width: 18%;
    }

    .fixture-table th.prediction-col,
    .fixture-table td.prediction-col {
        width: 22%;
    }

    .prediction-score-input {
        width: 44px;
        min-width: 44px;
        max-width: 44px;
        height: 34px;
        font-size: 0.82rem;
        padding-left: 0.15rem;
        padding-right: 0.15rem;
    }

    .fixture-table .score-inputs {
        gap: 0.14rem !important;
    }

    .fixture-table td.prediction-col .text-secondary {
        font-size: 0.56rem;
        line-height: 1.2;
    }

    .floating-save-actions {
        bottom: 0.5rem;
    }
}

@media (max-width: 480px) {
    main.container-xl {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .panel-card .card-body {
        padding: 0.75rem;
    }

    .dashboard-page {
        font-size: 0.68rem;
    }

    .dashboard-page .h4,
    .dashboard-page .h5,
    .dashboard-page h2 {
        font-size: 0.88rem;
    }

    .history-card img {
        height: 180px;
    }

    .fixture-table,
    .table.table-dark {
        font-size: 0.74rem;
    }

    .fixture-table th,
    .fixture-table td {
        padding: 0.5rem 0.4rem;
    }

    .fixture-table th:nth-child(1),
    .fixture-table td:nth-child(1) {
        width: 23%;
    }

    .fixture-table th:nth-child(4),
    .fixture-table td:nth-child(4) {
        width: 35%;
    }

    .fixture-table th:nth-child(5),
    .fixture-table td:nth-child(5) {
        display: table-cell !important;
        width: 18%;
    }

    .fixture-table th.prediction-col,
    .fixture-table td.prediction-col {
        width: 24%;
    }

    .prediction-score-input {
        width: 40px;
        min-width: 40px;
        max-width: 40px;
        height: 32px;
        font-size: 0.78rem;
        padding-left: 0.1rem;
        padding-right: 0.1rem;
    }

    .fixture-table .score-inputs {
        gap: 0.12rem !important;
    }

    .fixture-table th {
        font-size: 0.64rem;
    }

    .fixture-table td {
        font-size: 0.62rem;
    }

    .fixture-table td strong {
        font-size: 0.7rem;
    }

    .fixture-table .badge {
        font-size: 0.58rem;
    }

    .result-badge {
        font-size: 0.84rem !important;
        padding: 0.28rem 0.42rem !important;
    }

    .floating-save-button {
        font-size: 0.88rem;
        padding-top: 0.6rem;
        padding-bottom: 0.6rem;
    }
}
