/* Reusable UI primitives: buttons, badges, form controls, pips, corner ticks. */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 1px solid transparent;
    background: var(--primary);
    color: var(--primary-foreground);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    height: 2.25rem;
    white-space: nowrap;
    transition: opacity 0.15s ease, background-color 0.15s ease;
}

.btn:hover {
    opacity: 0.9;
}

.btn svg {
    width: 1rem;
    height: 1rem;
}

.btn--outline {
    background: transparent;
    color: var(--foreground);
    border-color: var(--border);
}

.btn--outline:hover {
    background: var(--secondary);
    opacity: 1;
}

.btn--ghost {
    background: transparent;
    color: var(--muted-foreground);
    border-color: transparent;
}

.btn--ghost:hover {
    background: var(--secondary);
    color: var(--foreground);
    opacity: 1;
}

.btn--sm {
    height: 2rem;
    padding: 0 0.75rem;
    font-size: 0.8125rem;
}

.btn--lg {
    height: 2.75rem;
    padding: 0 1.25rem;
    font-size: 0.95rem;
}

.btn--block {
    width: 100%;
}

.btn--start {
    justify-content: flex-start;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Badges */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border: 1px solid transparent;
    background: var(--primary);
    color: var(--primary-foreground);
    font-family: var(--font-mono);
    font-size: 10px;
    padding: 0.15rem 0.45rem;
    white-space: nowrap;
}

.badge svg {
    width: 0.7rem;
    height: 0.7rem;
}

.badge--secondary {
    background: var(--secondary);
    color: var(--foreground);
}

.badge--outline {
    background: transparent;
    color: var(--foreground);
    border-color: var(--border);
}

.badge--danger {
    background: var(--destructive);
    color: var(--foreground);
    border-color: var(--destructive);
}

/* Form fields */

.field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.field--horizontal {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.field label,
.field-title {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--muted-foreground);
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.field-description {
    font-size: 0.8125rem;
    color: var(--muted-foreground);
    line-height: 1.5;
}

.input,
.select,
.textarea {
    width: 100%;
    border: 1px solid var(--input);
    background: var(--card);
    color: var(--foreground);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    height: 2.25rem;
}

.textarea {
    height: auto;
    resize: vertical;
    min-height: 5rem;
    line-height: 1.5;
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.input-icon-wrap {
    position: relative;
}

.input-icon-wrap svg {
    position: absolute;
    left: 0.625rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    color: var(--muted-foreground);
    pointer-events: none;
}

.input-icon-wrap .input {
    padding-left: 2rem;
}

/* Switch */

.switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 2.25rem;
    height: 1.25rem;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid var(--border);
    background: var(--secondary);
    padding: 0;
    border-radius: 999px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.switch::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 1px;
    width: 1rem;
    height: 1rem;
    border-radius: 999px;
    background: var(--muted-foreground);
    transition: transform 0.15s ease, background-color 0.15s ease;
}

.switch:checked,
.switch[aria-checked="true"] {
    background: var(--primary);
    border-color: var(--primary);
}

.switch:checked::after,
.switch[aria-checked="true"]::after {
    transform: translateX(1rem);
    background: var(--primary-foreground);
}

.switch:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Toggle group (role / vibe pickers) */

.toggle-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.toggle-item {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--muted-foreground);
    padding: 0.375rem 0.625rem;
    font-size: 0.8125rem;
}

.toggle-item svg {
    width: 0.875rem;
    height: 0.875rem;
}

.toggle-item.is-active {
    border-color: var(--primary);
    background: rgba(217, 154, 78, 0.12);
    color: var(--primary);
}

/* Range slider */

.range-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

input[type='range'] {
    flex: 1;
    accent-color: var(--primary);
}

/* Separator */

.hr {
    border: none;
    border-top: 1px solid var(--border);
}

/* Corner tick reticle — the one signature decorative motif */

.corner-ticks {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 10;
}

.corner-ticks span {
    position: absolute;
    width: 0.75rem;
    height: 0.75rem;
    border: 2px solid rgba(217, 154, 78, 0.7);
}

.corner-ticks span:nth-child(1) {
    top: 0;
    left: 0;
    border-right: none;
    border-bottom: none;
}

.corner-ticks span:nth-child(2) {
    top: 0;
    right: 0;
    border-left: none;
    border-bottom: none;
}

.corner-ticks span:nth-child(3) {
    bottom: 0;
    left: 0;
    border-right: none;
    border-top: none;
}

.corner-ticks span:nth-child(4) {
    bottom: 0;
    right: 0;
    border-left: none;
    border-top: none;
}

/* Slot pips — squad manifest markers */

.slot-pips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
}

.slot-pip {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border: 1px solid var(--border);
    background: var(--secondary);
    color: var(--foreground);
}

.slot-pip svg {
    width: 0.875rem;
    height: 0.875rem;
}

.slot-pip--lg {
    width: 2.25rem;
    height: 2.25rem;
}

.slot-pip--lg svg {
    width: 1rem;
    height: 1rem;
}


.slot-pip--empty {
    border: 1px dashed rgba(255, 255, 255, 0.2);
    background: transparent;
}

/* Progress bar (player reliability) */

.progress {
    height: 0.5rem;
    border: 1px solid var(--border);
    background: var(--secondary);
    overflow: hidden;
}

.progress__fill {
    height: 100%;
    background: var(--primary);
}

/* Live status dot */

.live-dot {
    position: relative;
    display: flex;
    width: 0.375rem;
    height: 0.375rem;
}

.live-dot::before,
.live-dot::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: var(--signal);
}

.live-dot::before {
    animation: live-ping 1.6s cubic-bezier(0, 0, 0.2, 1) infinite;
    opacity: 0.75;
}

@keyframes live-ping {

    75%,
    100% {
        transform: scale(2.2);
        opacity: 0;
    }
}

/* Dialog (sign-in modal) */

.dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.dialog-overlay.is-open {
    display: flex;
}

.dialog {
    width: 100%;
    max-width: 26rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    border: 1px solid var(--border);
    background: var(--card);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.dialog--wide {
    max-width: 34rem;
}

.dialog-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.dialog-header h2 {
    font-size: 1.25rem;
}

.dialog-header p.desc {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    line-height: 1.5;
}

/* Empty state */

.empty-state {
    border: 1px dashed var(--border);
    padding: 3rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
}

.empty-state h3 {
    font-size: 1.125rem;
}

.empty-state p {
    max-width: 24rem;
    color: var(--muted-foreground);
    font-size: 0.875rem;
}