/* Панель инструктора — стиль Ватрушкин PRO (b2b-equipment) */

:root {
    --bg: #030304;
    --bg-elevated: #0a0a0f;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-hover: rgba(255, 255, 255, 0.07);
    --stroke: rgba(255, 255, 255, 0.08);
    --stroke-strong: rgba(255, 255, 255, 0.14);
    --text: #f8f8fa;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;
    --red: #ef4444;
    --red-bright: #ff3b3b;
    --red-glow: rgba(239, 68, 68, 0.45);
    --red-dim: rgba(239, 68, 68, 0.12);
    --cyan: #38bdf8;
    --cyan-dim: rgba(56, 189, 248, 0.15);
    --gold: #fbbf24;
    --gold-dim: rgba(251, 191, 36, 0.12);
    --radius: 20px;
    --radius-sm: 14px;
    --radius-lg: 28px;
    --font: "Inter", system-ui, sans-serif;
    --display: "Bricolage Grotesque", var(--font);
    --mono: "JetBrains Mono", ui-monospace, monospace;
    --touch: 52px;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.4);
    --instr-dock-h: 88px;
}

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

html { -webkit-text-size-adjust: 100%; }

body.instr-page,
body.instr-login-page {
    margin: 0;
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

/* Ambient */
.instr-ambient {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.instr-ambient__orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.45;
    animation: instr-orb 20s var(--ease-out) infinite alternate;
}

.instr-ambient__orb--1 {
    width: min(80vw, 520px);
    height: min(80vw, 520px);
    top: -18%;
    left: 50%;
    margin-left: -40vw;
    background: radial-gradient(circle, rgba(239, 68, 68, 0.32) 0%, transparent 70%);
}

.instr-ambient__orb--2 {
    width: 360px;
    height: 360px;
    bottom: 8%;
    right: -12%;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.14) 0%, transparent 70%);
    animation-delay: -8s;
}

.instr-ambient__grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(ellipse 90% 50% at 50% 0%, black 15%, transparent 70%);
    opacity: 0.35;
}

@keyframes instr-orb {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(2%, 4%) scale(1.06); }
}

.instr-wrap {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    max-width: 980px;
    margin: 0 auto;
    padding:
        max(12px, env(safe-area-inset-top))
        max(16px, env(safe-area-inset-right))
        calc(var(--instr-dock-h) + max(20px, env(safe-area-inset-bottom)))
        max(16px, env(safe-area-inset-left));
}

/* Brand header */
.instr-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 18px;
    margin-bottom: 20px;
    padding: 14px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--stroke);
    background: rgba(10, 10, 15, 0.65);
    backdrop-filter: blur(16px) saturate(1.15);
    -webkit-backdrop-filter: blur(16px) saturate(1.15);
    box-shadow: var(--shadow-soft);
}

.instr-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.instr-brand__mark {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 13px;
    background: linear-gradient(145deg, #ff4d4d 0%, #b91c1c 100%);
    display: grid;
    place-items: center;
    font-size: 1.1rem;
    color: #fff;
    box-shadow: 0 8px 28px var(--red-glow), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.instr-brand__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.instr-brand__name {
    font-family: var(--display);
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.instr-brand__tag {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.instr-header__meta {
    flex: 1;
    min-width: 140px;
}

.instr-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--stroke);
    background: var(--surface);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.instr-status::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-tertiary);
    box-shadow: 0 0 0 2px rgba(113, 113, 122, 0.25);
}

.instr-status.is-live::before {
    background: var(--red-bright);
    box-shadow: 0 0 12px var(--red-glow);
    animation: instr-pulse 1.4s ease-in-out infinite;
}

.instr-status.is-pause::before {
    background: var(--gold);
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.4);
}

@keyframes instr-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.65; transform: scale(0.9); }
}

/* Timer */
.instr-timer-card {
    margin-bottom: 22px;
    padding: 18px 16px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--stroke);
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
    box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.instr-timer-card__label {
    margin: 0 0 12px;
    font-family: var(--display);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.instr-timer-card__label span {
    color: var(--cyan);
    font-family: var(--mono);
}

.timer-strip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.timer {
    font-family: var(--mono);
    font-size: clamp(2.75rem, 14vw, 4rem);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
    line-height: 1;
    min-width: 5.5ch;
    text-align: center;
    background: linear-gradient(180deg, #fff 30%, rgba(248, 248, 250, 0.75) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 0 40px rgba(239, 68, 68, 0.2));
}

/* Buttons — совместимость .ux-btn и .btn */
.btn,
.ux-btn {
    touch-action: manipulation;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 22px;
    min-height: var(--touch);
    border-radius: 999px;
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    border: 1px solid var(--stroke-strong);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: transform 0.25s var(--ease-spring), box-shadow 0.3s var(--ease-out), background 0.2s;
    box-shadow: var(--shadow-soft);
}

.btn:active,
.ux-btn:active { transform: scale(0.97); }

.btn--primary,
.ux-btn.primary {
    border: none;
    background: linear-gradient(180deg, #ff5555 0%, #dc2626 100%);
    color: #fff;
    box-shadow: 0 4px 24px var(--red-glow), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn--warn,
.ux-btn.warn {
    border-color: rgba(251, 191, 36, 0.45);
    color: #fde68a;
    background: var(--gold-dim);
}

.btn--ghost,
.ux-btn.ux-btn--ghost {
    background: var(--surface);
    border-color: var(--stroke-strong);
}

.ux-btn--icon,
.btn--icon {
    min-width: var(--touch);
    width: var(--touch);
    padding: 0;
    font-size: 1.5rem;
    font-family: var(--mono);
    line-height: 1;
    border-radius: 16px;
}

.ux-btn--block,
.btn--block { width: 100%; }

.controls-main {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    position: fixed;
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    z-index: 70;
    max-width: 948px;
    margin-inline: auto;
    padding: 10px;
    border-radius: var(--radius);
    border: 1px solid var(--stroke-strong);
    background: rgba(8, 8, 12, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
}

@media (min-width: 980px) {
    .controls-main {
        left: 50%;
        right: auto;
        width: min(920px, calc(100vw - 32px));
        transform: translateX(-50%);
    }
}

.section-label {
    font-family: var(--display);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin: 0 0 10px;
}

.muted {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.45;
}

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

.instr-hint {
    margin: -4px 0 16px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--stroke);
    background: var(--surface);
    font-size: 0.8125rem;
}

/* Slots */
.slots {
    display: grid;
    gap: 14px;
    grid-template-columns: 1fr;
}

@media (min-width: 600px) {
    .slots { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
    .slots { grid-template-columns: repeat(3, 1fr); }
}

.slot {
    border: 1px solid var(--stroke);
    border-radius: var(--radius);
    padding: clamp(16px, 4vw, 20px);
    min-height: clamp(140px, 36vw, 188px);
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow-soft);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.slot:hover {
    border-color: var(--stroke-strong);
}

.slot-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.slot-head__slot {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.slot-head__kart {
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--cyan);
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--cyan-dim);
    border: 1px solid rgba(56, 189, 248, 0.25);
}

.slot.empty {
    border-style: dashed;
    border-color: rgba(113, 113, 122, 0.35);
    color: var(--text-tertiary);
    justify-content: center;
    align-items: center;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    text-align: center;
}

.slot b {
    font-family: var(--display);
    font-size: clamp(0.95rem, 3.5vw, 1.15rem);
    font-weight: 700;
    line-height: 1.25;
    word-break: break-word;
}

.slot .muted { font-size: 0.75rem; }

.slot-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
    padding-top: 8px;
}

.slot-actions .ux-btn,
.slot-actions .btn {
    min-height: 46px;
    padding: 12px 16px;
    font-size: 0.72rem;
}

/* Telemetry table */
.tel-panel {
    margin-top: 24px;
    border: 1px solid var(--stroke);
    border-radius: var(--radius);
    overflow: hidden;
    background: rgba(10, 10, 15, 0.6);
    box-shadow: var(--shadow-soft);
}

.tel-head {
    padding: 14px 18px;
    font-family: var(--display);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    border-bottom: 1px solid var(--stroke);
    background: var(--surface);
}

.tel-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tel-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    min-width: 420px;
}

.tel-table th,
.tel-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--stroke);
}

.tel-table th {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    white-space: nowrap;
}

.tel-table td {
    font-family: var(--mono);
    font-size: 0.8rem;
}

.tel-table tr:last-child td { border-bottom: none; }

/* Notice */
.notice {
    position: fixed;
    top: max(14px, env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    padding: 14px 22px;
    border-radius: 999px;
    border: 1px solid rgba(239, 68, 68, 0.4);
    background: rgba(10, 10, 14, 0.95);
    backdrop-filter: blur(12px);
    font-size: 0.8125rem;
    font-weight: 600;
    max-width: min(420px, calc(100vw - 24px));
    text-align: center;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 24px var(--red-dim);
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(3, 3, 4, 0.82);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 8000;
    padding: max(12px, env(safe-area-inset-top)) 16px 16px;
}

.modal.on { display: flex; }

.modal-inner {
    width: min(520px, 100%);
    max-height: min(85vh, 720px);
    overflow: auto;
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--stroke-strong);
    background: linear-gradient(165deg, #121218 0%, #0a0a0f 100%);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
}

.modal-inner h2,
.modal-inner .modal-title {
    margin: 0 0 8px;
    font-family: var(--display);
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.kart-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 16px;
}

@media (min-width: 400px) {
    .kart-grid { grid-template-columns: repeat(3, 1fr); }
}

.kart-btn {
    touch-action: manipulation;
    min-height: 52px;
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--stroke-strong);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-family: var(--mono);
    font-weight: 600;
    font-size: 0.95rem;
    transition: transform 0.2s var(--ease-spring), border-color 0.2s, background 0.2s;
}

.kart-btn:hover {
    border-color: var(--cyan);
    background: var(--cyan-dim);
}

.kart-btn:active { transform: scale(0.97); }

/* Login */
body.instr-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.instr-login-wrap {
    position: relative;
    z-index: 1;
    width: min(440px, 100%);
}

.instr-login-card {
    padding: 32px 28px 28px;
    border-radius: var(--radius-lg, 28px);
    border: 1px solid var(--stroke-strong);
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
    box-shadow: var(--shadow-soft), 0 0 80px -30px var(--red-glow);
}

.instr-login-card .instr-brand {
    margin-bottom: 22px;
}

.instr-login-card h1 {
    margin: 0 0 8px;
    font-family: var(--display);
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.instr-login-card .lead {
    margin: 0 0 24px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

.instr-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.instr-field input {
    width: 100%;
    margin-bottom: 14px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--stroke-strong);
    background: rgba(0, 0, 0, 0.35);
    color: var(--text);
    font-family: var(--font);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.instr-field input:focus {
    outline: none;
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 0 0 3px var(--red-dim);
}

.instr-login-card .btn--primary {
    width: 100%;
    margin-top: 6px;
    min-height: 52px;
}

.instr-err {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(239, 68, 68, 0.35);
    background: var(--red-dim);
    font-size: 0.8125rem;
    font-weight: 600;
    color: #fca5a5;
}

.instr-login-footer {
    margin-top: 20px;
    text-align: center;
}

.instr-login-footer a {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-tertiary);
    text-decoration: none;
    transition: color 0.2s;
}

.instr-login-footer a:hover { color: var(--text); }
