:root{
    --bg: #f6f9ff;
    --surface: #ffffff;
    --surface-2: #f1f6ff;
    --text: #0b1220;
    --muted: #5b6b86;
    --border: rgba(15, 23, 42, 0.10);
    --shadow: 0 10px 28px rgba(2, 6, 23, 0.10);
    --shadow-soft: 0 6px 18px rgba(2, 6, 23, 0.08);

    --blue: #2563eb;
    --blue-2: #1d4ed8;
    --blue-ghost: rgba(37, 99, 235, 0.10);
    --focus: rgba(37, 99, 235, 0.30);

    --radius: 16px;
    --radius-sm: 12px;
    --max: 1100px;
}

*{ box-sizing:border-box; }
html, body{ height:100%; }
body{
    margin:0;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
    color: var(--text);
    background:
            radial-gradient(1000px 380px at 20% -10%, rgba(37,99,235,0.16), transparent 60%),
            radial-gradient(900px 420px at 90% 10%, rgba(29,78,216,0.12), transparent 55%),
            var(--bg);
    line-height: 1.35;
}

a{ color: var(--blue-2); text-decoration: none; }
a:hover{ text-decoration: underline; }

/* Layout */
.app{
    min-height:100%;
    display:flex;
    flex-direction:column;
}
.container{
    width: min(100%, var(--max));
    margin: 0 auto;
    padding: 18px 16px 28px;
}
main{ flex:1; }

/* Header */
.topbar{
    position: sticky;
    top:0;
    z-index: 20;
    backdrop-filter: blur(10px);
    background: rgba(246, 249, 255, 0.75);
    border-bottom: 1px solid var(--border);
}
.topbar-inner{
    width: min(100%, var(--max));
    margin: 0 auto;
    padding: 14px 16px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
}
.brand{
    display:flex;
    align-items:center;
    gap:12px;
    min-width: 0;
}
.logo{
    width:42px;
    height:42px;
    border-radius: 14px;
    background:
            linear-gradient(135deg, rgba(37,99,235,1), rgba(29,78,216,1));
    box-shadow: 0 10px 22px rgba(37,99,235,0.25);
    position: relative;
    flex: 0 0 auto;
}
/* simple “chess knight” vibe using a subtle mark */
.logo:after{
    content:"♞";
    position:absolute;
    inset:0;
    display:grid;
    place-items:center;
    color:#fff;
    font-size: 22px;
    transform: translateY(-1px);
}
.title-wrap{
    display:flex;
    flex-direction:column;
    min-width:0;
}
.title{
    margin:0;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.2px;
    white-space: nowrap;
    overflow:hidden;
    text-overflow: ellipsis;
}
.subtitle{
    margin:0;
    color: var(--muted);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow:hidden;
    text-overflow: ellipsis;
}

.nav-actions{
    display:flex;
    align-items:center;
    gap:10px;
    flex: 0 0 auto;
}

/* Cards */
.card{
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    padding: 14px;
}
.card + .card{ margin-top: 14px; }

.section-title{
    margin: 0 0 10px;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.2px;
}

.meta{ color: var(--muted); font-size: 0.92rem; }

/* Buttons */
.btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    padding: 10px 12px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.95rem;
    border: 1px solid transparent;
    cursor:pointer;
    white-space: nowrap;
    text-decoration:none !important;
}
.btn-primary{
    background: linear-gradient(135deg, var(--blue), var(--blue-2));
    color:#fff;
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.20);
}
.btn-primary:hover{ filter: brightness(0.98); }
.btn-ghost{
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}
.btn-ghost:hover{ background: var(--surface-2); }
.btn-soft{
    background: var(--blue-ghost);
    border-color: rgba(37, 99, 235, 0.18);
    color: var(--blue-2);
}
.btn-soft:hover{ background: rgba(37,99,235,0.14); }

/* Filter row */
.filters{
    display:flex;
    flex-wrap: wrap;
    gap:10px;
    align-items:flex-end;
    justify-content:space-between;
}
.fields{
    display:grid;
    grid-template-columns: repeat(2, minmax(140px, 1fr));
    gap:10px;
    width: min(520px, 100%);
}
.field label{
    display:block;
    font-size: 0.85rem;
    color: var(--muted);
    margin: 0 0 6px;
    font-weight: 700;
}
select, input[type="text"]{
    width:100%;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    outline:none;
    box-shadow: 0 1px 0 rgba(2,6,23,0.03);
}
select:focus, input[type="text"]:focus{
    border-color: rgba(37,99,235,0.45);
    box-shadow: 0 0 0 4px var(--focus);
}

.filter-actions{
    display:flex;
    gap:10px;
    align-items:center;
    justify-content:flex-end;
    flex: 1 1 auto;
    min-width: 220px;
}

/* Tournament list */
.group-title{
    margin: 14px 0 10px;
    font-size: 0.95rem;
    color: var(--muted);
    font-weight: 900;
    letter-spacing: 0.35px;
    text-transform: uppercase;
    display:flex;
    align-items:center;
    gap:10px;
}
.group-title:before{
    content:"";
    height: 10px;
    width: 10px;
    border-radius: 999px;
    background: var(--blue);
    box-shadow: 0 0 0 4px rgba(37,99,235,0.12);
}

.tournament{
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(2,6,23,0.06);
    display:grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items:center;
    transition: transform 120ms ease, box-shadow 120ms ease;
}
.tournament:hover{
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(2,6,23,0.09);
}
.tournament + .tournament{ margin-top: 10px; }

.t-name{
    font-size: 1.08rem;
    font-weight: 900;
    margin:0 0 6px;
    line-height:1.2;
}
.t-meta{
    display:flex;
    flex-wrap:wrap;
    gap:10px 14px;
    color: var(--muted);
    font-size: 0.92rem;
}
.pill{
    display:inline-flex;
    align-items:center;
    gap:8px;
    padding: 6px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.t-actions{
    display:flex;
    gap:10px;
    flex-wrap: wrap;
    justify-content:flex-end;
    align-items:center;
}

/* Empty state */
.empty{
    padding: 18px;
    border: 1px dashed rgba(15,23,42,0.22);
    border-radius: var(--radius);
    background: rgba(255,255,255,0.75);
    color: var(--muted);
}

/* Create form */
.form-grid{
    display:grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 10px;
}
.form-grid .field{ margin:0; }
.form-actions{
    margin-top: 12px;
    display:flex;
    justify-content:flex-end;
    gap:10px;
}

/* Footer */
footer{
    border-top: 1px solid var(--border);
    background: rgba(255,255,255,0.65);
    backdrop-filter: blur(8px);
}
.footer-inner{
    width: min(100%, var(--max));
    margin: 0 auto;
    padding: 16px;
    display:flex;
    flex-wrap:wrap;
    gap:10px;
    align-items:center;
    justify-content:space-between;
    color: var(--muted);
    font-size: 0.92rem;
}

/* Responsive */
@media (max-width: 860px){
    .fields{ grid-template-columns: 1fr; width: 100%; }
    .filter-actions{ justify-content: flex-start; min-width: 0; }
    .tournament{ grid-template-columns: 1fr; }
    .t-actions{ justify-content: flex-start; }
    .form-grid{ grid-template-columns: 1fr; }
    .logo{ width:40px; height:40px; border-radius: 14px; }
}

