/* Skill Game — Bbc Brand Language
   Typography & grayscale from https://bbc-brandportal.webflow.io/ */

:root {
    /* Graustufen (Bbc) */
    --bg: #f8f8f8;
    --bg-accent: #f0f0f0;
    --surface: #ffffff;
    --text: #000000;
    --text-muted: #5a5a5a;
    --border: #e5e5e5;
    --border-strong: #000000;

    /* Grundfarben (Bbc) — accents */
    --brand-magenta: #AF1280;
    --brand-green: #95C11E;
    --brand-cyan: #4FAEE6;
    --brand-blue: #2C67AE;
    --brand-purple: #302683;

    --primary: #000000;
    --primary-dark: #1a1a1a;
    --success: #009640;
    --danger: #E8393B;
    --tile: #000000;
    --tile-hover: #222222;
    --shadow: none;
    --radius: 0;
    --radius-sm: 0;
    --font: "Titillium Web", sans-serif;
    --brand-font: "Titillium Web", sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    font-weight: 300;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

a:hover {
    color: var(--brand-magenta);
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 1.25rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    line-height: 0;
}

.brand-logo {
    display: block;
    height: clamp(48px, 10vw, 72px);
    width: auto;
}

.site-main {
    width: min(720px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1.5rem 0 3rem;
}

.flash {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-weight: 600;
    border: 1px solid var(--border);
}

.flash-success {
    background: #f0faf3;
    color: #006B47;
    border-color: #b8e0c8;
}

.flash-error {
    background: #fef2f2;
    color: #9b2c2c;
    border-color: #f5c2c2;
}

.flash-info {
    background: #f0f7fc;
    color: var(--brand-blue);
    border-color: #b7d3f5;
}

/* Bbc type hierarchy: Black = keywords/ALL CAPS, Bold = titles */
.page-title {
    text-align: center;
    margin: 0 0 0.35rem;
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.page-sub {
    text-align: center;
    color: var(--text-muted);
    margin: 0 0 1.5rem;
    font-weight: 400;
    line-height: 1.45;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.card h2 {
    margin: 0 0 1rem;
    font-size: 1.15rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

@media (min-width: 560px) {
    .hub-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.hub-tile {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
    min-height: 140px;
    padding: 1.25rem;
    background: var(--tile);
    color: #fff;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.2rem;
    transition: background 0.15s ease, transform 0.15s ease;
}

.hub-tile:hover {
    background: var(--tile-hover);
    color: #fff;
    text-decoration: none;
    transform: translateY(-2px);
}

.hub-tile span {
    font-size: 0.9rem;
    font-weight: 300;
    opacity: 0.85;
}

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

.tile {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 110px;
    padding: 1rem;
    background: var(--tile);
    color: #fff;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.15rem;
    text-align: center;
    transition: background 0.15s ease, transform 0.15s ease;
}

.tile:hover {
    background: var(--tile-hover);
    color: #fff;
    text-decoration: none;
    transform: translateY(-2px);
}

.tile-trophy {
    align-items: center;
    font-size: 2.5rem;
}

.back-link {
    display: inline-block;
    margin-bottom: 1rem;
    font-weight: 600;
    text-decoration: none;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.back-link:hover {
    color: var(--brand-magenta);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    padding-top: 0.35rem;
}

.radio-option {
    display: inline-flex !important;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    margin-bottom: 0 !important;
    cursor: pointer;
}

.radio-option input {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--primary);
}

.form-control,
select.form-control,
textarea.form-control {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit;
    font-weight: 400;
    background: #fff;
    color: var(--text);
}

.form-control:focus {
    outline: 2px solid rgba(0, 0, 0, 0.25);
    border-color: var(--text);
}

.form-row {
    display: grid;
    gap: 1rem;
}

@media (min-width: 560px) {
    .form-row.cols-2 {
        grid-template-columns: 1fr 1fr;
    }
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.7rem 1.1rem;
    border: none;
    border-radius: var(--radius-sm);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    background: var(--primary);
    color: #fff;
}

.btn:hover {
    background: var(--primary-dark);
    color: #fff;
    text-decoration: none;
}

.btn-block {
    width: 100%;
}

.btn-success {
    background: var(--success);
}

.btn-success:hover {
    background: #006B47;
}

.btn-danger {
    background: var(--danger);
}

.btn-danger:hover {
    background: #c42e30;
}

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

.btn-ghost:hover {
    background: var(--bg);
    color: var(--text);
}

.btn-sm {
    padding: 0.45rem 0.75rem;
    font-size: 0.9rem;
}

.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.table-wrap {
    overflow-x: auto;
}

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    font-weight: 400;
}

table.data th,
table.data td {
    padding: 0.65rem 0.5rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

table.data th {
    font-size: 0.75rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.admin-nav a {
    padding: 0.45rem 0.8rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0;
    color: var(--text);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
}

.admin-nav a:hover,
.admin-nav a.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.muted {
    color: var(--text-muted);
}

.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-weight: 300;
}

/* Student search */
.search-results {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.result-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
}

.result-card strong {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.result-meta {
    color: var(--text-muted);
    font-weight: 600;
}

/* Match page */
.match-card {
    padding-bottom: 1.25rem;
}

.match-board {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.match-col {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    min-width: 0;
}

.team-pick {
    display: block;
    margin: 0;
}

.team-select {
    font-weight: 700;
    font-size: 1.05rem;
    text-align: center;
    padding: 0.9rem 0.5rem;
    border-width: 2px;
}

.match-col.side-a .team-select {
    border-color: var(--brand-blue);
    color: var(--brand-blue);
}

.match-col.side-b .team-select {
    border-color: var(--brand-magenta);
    color: var(--brand-magenta);
}

.score-games {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.45rem;
}

@media (min-width: 480px) {
    .score-games {
        grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    }
}

.score-bonus {
    display: grid;
    gap: 0.45rem;
}

.score-btn {
    width: 100%;
    min-height: 2.75rem;
    font-weight: 700;
    padding: 0.65rem 0.5rem;
    line-height: 1.2;
    border: 2px solid transparent;
    transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}

.score-btn-bonus {
    opacity: 0.95;
}

.btn-team-a {
    background: #e8f1fa;
    color: var(--brand-blue);
    border-color: #a8c8e8;
}

.btn-team-a:hover {
    background: #d4e5f5;
}

.btn-team-b {
    background: #f8e8f3;
    color: var(--brand-magenta);
    border-color: #e0a8d0;
}

.btn-team-b:hover {
    background: #f0d4e8;
}

.score-btn.is-winner,
.btn-team-a.score-btn.is-winner,
.btn-team-b.score-btn.is-winner {
    background: var(--success);
    color: #fff;
    border-color: #006B47;
    box-shadow: 0 0 0 3px rgba(0, 150, 64, 0.28);
    transform: scale(1.02);
    font-weight: 900;
}

.score-btn.is-winner:hover,
.btn-team-a.score-btn.is-winner:hover,
.btn-team-b.score-btn.is-winner:hover {
    background: #006B47;
}

.match-hint {
    margin: 1rem 0 0;
    text-align: center;
    font-weight: 300;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.task-ref {
    margin-bottom: 1rem;
}

.task-ref p {
    margin: 0.25rem 0 0;
}

.task-ref p.muted {
    margin: 0.25rem 0;
}

/* Ranking */
.rank-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.rank-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--border);
}

.rank-pos {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 0;
    background: var(--tile);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    flex-shrink: 0;
}

.rank-item:nth-child(1) .rank-pos { background: #d4a017; }
.rank-item:nth-child(2) .rank-pos { background: #8a96a3; }
.rank-item:nth-child(3) .rank-pos { background: #b87333; }

.rank-info {
    flex: 1;
}

.rank-info strong {
    display: block;
    font-weight: 700;
}

.rank-points {
    font-size: 1.35rem;
    font-weight: 900;
}

.actions-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.bulk-bar {
    margin: 0 0 1rem;
    padding: 0.85rem 1rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    transition: border-color 0.15s ease, background 0.15s ease;
}

.bulk-bar.is-active {
    border-style: solid;
    border-color: var(--text);
    background: #fff;
}

.bulk-bar-main {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem 1rem;
}

.bulk-bar-count {
    font-weight: 700;
    min-width: 7rem;
    padding-bottom: 0.65rem;
    color: var(--text-muted);
}

.bulk-bar.is-active .bulk-bar-count {
    color: var(--text);
}

.bulk-bar-house {
    margin: 0;
    min-width: 12rem;
    flex: 1 1 12rem;
}

.bulk-bar-house label {
    margin-bottom: 0.25rem;
}

.bulk-bar-hint {
    margin: 0.55rem 0 0;
    font-size: 0.88rem;
    color: var(--text-muted);
    font-weight: 300;
}

.col-check {
    width: 2.25rem;
    text-align: center;
    vertical-align: middle;
}

.col-check input {
    width: 1.1rem;
    height: 1.1rem;
    cursor: pointer;
}

.select-challenge {
    width: 100%;
    padding: 0.9rem;
    font-size: 1.05rem;
    font-weight: 600;
}

.assignment-badges {
    max-width: 18rem;
}

.assignment-badge {
    display: inline-block;
    font-size: 0.85rem;
    line-height: 1.35;
    color: var(--text-muted);
}

.assignment-table .assignment-sort {
    width: 5rem;
    padding: 0.35rem 0.5rem;
}

.assignment-row.is-assigned {
    background: #fff;
}

.assignment-row label {
    cursor: pointer;
    font-weight: 600;
}

.assignment-form {
    margin-top: 0.5rem;
}
