/* ============================================================
   Tournament Bracket Generator — tool-specific styles.
   Shared look comes from base.css (.spin-tool, .spin-btn,
   .spin-input, .spin-textarea, .spin-label). No :root/theme here.
   ============================================================ */

.tb-tool { background: var(--bg); transition: background 0.5s; }
.tb-tool .tool-instructions-wrapper { text-align: center; margin-bottom: 24px; }
.tb-tool .tool-section-title {
    font-family: var(--font-head); font-weight: 800;
    font-size: clamp(1.6rem, 4vw, 2.4rem); color: var(--text);
    margin: 0 0 12px; letter-spacing: -0.3px;
}
.tb-tool .text-primary-red { color: var(--accent-2); }
.tb-tool .tool-section-texte {
    color: var(--text-muted); font-size: 0.95rem; line-height: 1.7;
    max-width: 720px; margin: 0 auto;
}

/* ---------- Controls ---------- */
.tb-controls {
    background: var(--panel-bg); border: 1px solid var(--panel-border);
    border-radius: var(--radius); box-shadow: var(--shadow-soft);
    padding: 22px; margin-bottom: 22px;
}
.tb-controls-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 768px) { .tb-controls-grid { grid-template-columns: 1fr; } }

.tb-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.tb-field--players .spin-textarea { min-height: 200px; }

.tb-radio {
    display: flex; align-items: center; gap: 8px; color: var(--text);
    font-size: 0.92rem; font-weight: 600; padding: 8px 0; cursor: pointer;
}
.tb-radio input { width: 18px; height: 18px; accent-color: var(--purple); cursor: pointer; }
.tb-hint { font-size: 0.78rem; color: var(--text-muted); margin: 4px 0 0; line-height: 1.5; }

.tb-actions { display: flex; gap: 10px; margin-top: 10px; }
.tb-actions .spin-btn { margin: 0; }

/* ---------- Champion banner ---------- */
.tb-result {
    display: flex; align-items: center; justify-content: center; gap: 12px;
    background: var(--gradient-result); color: #fff;
    padding: 16px 24px; border-radius: var(--radius);
    box-shadow: var(--shadow-soft); margin-bottom: 22px; text-align: center;
}
.tb-result-label { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.9; }
.tb-result-name { font-size: 1.4rem; font-weight: 800; }

/* ---------- Bracket ---------- */
.tb-bracket-scroll { overflow-x: auto; padding-bottom: 12px; }
.tb-bracket { display: inline-flex; gap: 40px; min-width: 100%; padding: 8px; }

.tb-round { display: flex; flex-direction: column; justify-content: space-around; min-width: 190px; }
.tb-round-title {
    font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--accent-2); text-align: center; margin-bottom: 14px;
}

.tb-match {
    display: flex; flex-direction: column; gap: 4px;
    margin: 10px 0; position: relative; flex: 1 0 auto; justify-content: center;
}

.tb-slot {
    display: flex; align-items: center; gap: 8px;
    background: var(--card-bg); border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); padding: 10px 12px; cursor: pointer;
    transition: var(--transition); min-height: 42px;
}
.tb-slot:hover:not(.tb-empty) { border-color: var(--accent-2); transform: translateX(2px); }
.tb-slot.tb-winner {
    background: var(--gradient-result); border-color: transparent; color: #fff;
    box-shadow: 0 4px 14px rgba(168,85,247,0.3);
}
.tb-slot.tb-empty { cursor: default; opacity: 0.55; }

.tb-seed {
    flex: 0 0 22px; width: 22px; height: 22px; border-radius: 6px;
    background: var(--panel-bg); color: var(--text-muted);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.72rem; font-weight: 800;
}
.tb-slot.tb-winner .tb-seed { background: rgba(255,255,255,0.25); color: #fff; }
.tb-name { font-size: 0.9rem; font-weight: 600; word-break: break-word; }
.tb-slot.tb-empty .tb-name { font-style: italic; }

/* connector line between the two slots of a match */
.tb-match::after {
    content: ''; position: absolute; right: -20px; top: 25%; bottom: 25%;
    width: 20px; border-right: 2px solid var(--border-color);
    border-top: 2px solid var(--border-color); border-bottom: 2px solid var(--border-color);
    border-radius: 0 6px 6px 0;
}
.tb-round:last-child .tb-match::after { display: none; }

.tb-tip, .tb-tool .tb-tip {
    text-align: center; font-size: 0.82rem; color: var(--text-muted);
    margin-top: 14px; line-height: 1.5;
}

/* ---------- Toast ---------- */
.tb-toast {
    position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px);
    background: var(--panel-bg); color: var(--text); border: 1px solid var(--border-color);
    border-left: 4px solid var(--success); padding: 12px 18px; border-radius: var(--radius-sm);
    font-size: 0.88rem; font-weight: 600; box-shadow: var(--shadow);
    opacity: 0; pointer-events: none; transition: all 0.3s ease; z-index: 9999; max-width: 90vw;
}
.tb-toast.show { opacity: 1; transform: translate(-50%, 0); }
.tb-toast.error { border-left-color: var(--accent); }

.tb-hidden { display: none !important; }

@media print {
    .tb-controls, .tb-tip, .tb-toast, .tool-instructions-wrapper { display: none !important; }
    .tb-bracket-scroll { overflow: visible; }
}