﻿/* Challonge Portal Styles - mobile-first refresh with BPC Brno palette */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
    --primary: #c11224;
    --primary-strong: #8e0f1c;
    --accent: #2f7d3a;
    --surface: rgba(255, 255, 255, 0.92);
    --surface-strong: #ffffff;
    --border: #e5e7eb;
    --shadow: 0 20px 60px rgba(13, 16, 24, 0.16);
    --text: #0b1221;
    --muted: #5b6475;
    --success: #2f7d3a;
    --warning: #d97706;
    --danger: #d73030;
    --radius: 18px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
    background: radial-gradient(circle at 18% 20%, #ffe2e2 0, transparent 32%),
        radial-gradient(circle at 82% 0%, #d7f5df 0, transparent 28%),
        linear-gradient(180deg, #f7f9fc, #f2f4f8 55%, #f6f6f6);
    color: var(--text);
    min-height: 100vh;
}

.page-shell {
    position: relative;
    overflow: hidden;
    min-height: 100vh;
}

.accent-blob {
    position: absolute;
    width: 420px;
    height: 420px;
    filter: blur(80px);
    opacity: 0.35;
    z-index: 0;
}

.blob-1 {
    background: #f3b2b2;
    top: -120px;
    left: -80px;
}

.blob-2 {
    background: #c3edcc;
    bottom: -140px;
    right: -120px;
}

.container {
    position: relative;
    z-index: 1;
    width: min(1080px, 100% - 1.5rem);
    margin: 0 auto;
    padding: 1.5rem 0 2.5rem;
}

.hero {
    margin-bottom: 1.5rem;
    display: grid;
    gap: 0.75rem;
    position: relative;
    overflow: hidden;
}

.hero-top {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    position: relative;
    z-index: 1;
}

.hero-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.hero h1 {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    line-height: 1.2;
    letter-spacing: -0.03em;
}

.lede {
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

.hero-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.eyebrow {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    font-weight: 700;
}

.eyebrow.small {
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.hero-tournament {
    color: var(--text);
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.hero::after {
    content: "";
    position: absolute;
    inset: -10% 0 0 0;
    background: url('../img/logo_transparent.png') center right / min(380px, 40%) no-repeat;
    opacity: 0.15;
    filter: saturate(0.9);
    transform: rotate(6deg);
    transform-origin: center;
    pointer-events: none;
    z-index: 0;
}

.remaining-info {
    margin-top: 0.15rem;
    font-weight: 700;
    color: var(--muted);
}

.remaining-info.tone-info { color: var(--accent); }
.remaining-info.tone-warning { color: var(--warning); }
.remaining-info.tone-danger { color: var(--danger); }

.content-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.card {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--radius);
    padding: 1.4rem;
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.card.focus {
    border-color: rgba(193, 18, 36, 0.25);
    box-shadow: 0 25px 70px rgba(193, 18, 36, 0.18);
}

.card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.card h2 {
    font-size: 1.35rem;
    letter-spacing: -0.01em;
}

.stack {
    display: grid;
    gap: 0.9rem;
}

.field {
    display: grid;
    gap: 0.35rem;
    font-weight: 600;
    color: var(--text);
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    font-size: 1rem;
    background: var(--surface-strong);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(193, 18, 36, 0.16);
}

.field input:disabled,
.field select:disabled {
    background: #f1f5f9;
    color: var(--muted);
}

.score-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

.button-group {
    display: grid;
    gap: 0.6rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.btn {
    border: none;
    border-radius: 14px;
    font-weight: 700;
    font-size: 1rem;
    padding: 0.9rem 1.1rem;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn.primary {
    background: linear-gradient(120deg, var(--primary), var(--primary-strong));
    color: #fff;
    box-shadow: 0 15px 35px rgba(193, 18, 36, 0.25);
}

.btn.primary:hover {
    box-shadow: 0 20px 40px rgba(193, 18, 36, 0.3);
}

.btn.ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn.small {
    padding: 0.55rem 0.9rem;
    font-size: 0.95rem;
    border: 1px solid var(--border);
    background: var(--surface-strong);
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    background: rgba(193, 18, 36, 0.12);
    color: #6f0d16;
}

.pill.live {
    background: rgba(47, 125, 58, 0.16);
    color: #1f5a2f;
}

.pill.mobile {
    background: rgba(193, 18, 36, 0.16);
    color: #6f0d16;
}

.pill.subtle {
    background: rgba(100, 116, 139, 0.12);
    color: var(--muted);
}

.bracket-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--muted);
    font-weight: 600;
}

.status-indicator {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2f7d3a, #256d30);
    box-shadow: 0 0 0 8px rgba(47, 125, 58, 0.18);
    animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.93); opacity: 0.7; }
}

.text-muted {
    color: var(--muted);
    font-size: 0.95rem;
}

.alert,
.error-message,
.success-message,
.warning-message {
    border-radius: 12px;
    padding: 0.9rem 1rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.alert.error,
.error-message {
    background: #fff1f1;
    color: var(--danger);
    border-color: #ffd0d0;
}

.alert.success,
.success-message {
    background: #e9f8ee;
    color: var(--success);
    border-color: #c9edd3;
}

.alert.warning,
.warning-message {
    background: #fffbeb;
    color: #c2410c;
    border-color: #fef3c7;
}

.hidden {
    display: none !important;
}

.history-list {
    display: grid;
    gap: 0.75rem;
}

.submission-item {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.85rem 1rem;
}

.submission-item .status {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

.submission-item .status.accepted { background: #e4f7e8; color: #256d30; }
.submission-item .status.pending { background: #fff7ed; color: #b45309; }
.submission-item .status.rejected { background: #ffe6e6; color: #b91c1c; }

.submission-item .details {
    margin-top: 0.35rem;
    color: var(--muted);
    font-size: 0.92rem;
}

.bracket-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.bracket-actions {
    display: flex;
    gap: 0.5rem;
}

.bracket-wrapper {
    position: relative;
    width: 100%;
    background: linear-gradient(145deg, #1a0b0b, #0c0f18);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
    min-height: 60vh;
}

.loading-state {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    gap: 0.4rem;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    padding: 1rem;
}

.loading-state .spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

#bracket-iframe {
    width: 100%;
    height: clamp(65vh, 80vw, 900px);
    border: none;
    background: #0b1221;
}

#submission-history {
    max-height: 520px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

#loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 15, 28, 0.6);
    display: grid;
    place-items: center;
    gap: 0.75rem;
    z-index: 999;
    color: #fff;
    text-align: center;
    padding: 1rem;
}

#loading-overlay .spinner {
    width: 56px;
    height: 56px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

footer {
    text-align: center;
    margin-top: 2rem;
    color: var(--muted);
    font-size: 0.95rem;
}

@media (min-width: 960px) {
    .content-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #bracket-section,
    #history-section {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .container { padding-top: 1rem; }
    .card { padding: 1.1rem; }
    .hero { margin-bottom: 1rem; }
    .hero-top { align-items: flex-start; }
    .bracket-wrapper { min-height: 55vh; }
    #bracket-iframe { height: 70vh; }
}
