:root {
    --bg: #1e1f22;
    --panel: #2b2d31;
    --text: #e6e6e6;
    --muted: #9aa0a6;
    --accent: #4f8cff;
    --danger: #d9534f;
    --border: #3a3d44;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.visually-hidden {
    position: absolute !important;
    clip: rect(1px, 1px, 1px, 1px);
    width: 1px; height: 1px;
    overflow: hidden;
}

/* -------- Страница авторизации -------- */
.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    background: var(--panel);
    padding: 32px;
    border-radius: 12px;
    max-width: 460px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.auth-card h1 {
    margin: 0 0 12px;
    font-size: 22px;
}

.auth-hint {
    color: var(--muted);
    font-size: 14px;
    margin: 0 0 20px;
}

.auth-hint code,
.logs-meta code {
    background: #1a1b1e;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

#auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#auth-input,
button {
    font: inherit;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

#auth-input {
    background: #1a1b1e;
    color: var(--text);
}

#auth-input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

button {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    cursor: pointer;
}

button:hover { filter: brightness(1.08); }

.auth-error {
    color: var(--danger);
    font-size: 13px;
    min-height: 1em;
}

/* -------- Хост-страница Ripes -------- */
.ripes-body {
    overflow: hidden;
}

#ripes-root {
    position: fixed;
    inset: 0;
}

#qtcanvas {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--bg);
}

#qtspinner {
    margin: 0;
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: var(--muted);
}

.qt-spinner {
    width: 48px; height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* -------- Оверлей с кнопками -------- */
.ripes-overlay {
    position: fixed;
    top: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: rgba(43, 45, 49, 0.85);
    border: 1px solid var(--border);
    border-radius: 999px;
    backdrop-filter: blur(6px);
    z-index: 1000;
    user-select: none;
    touch-action: none;
}

.ripes-overlay.is-dragging {
    cursor: grabbing;
}

.overlay-grip {
    width: 18px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    cursor: grab;
    font-size: 14px;
    line-height: 1;
    user-select: none;
}
.overlay-grip:active { cursor: grabbing; }

.overlay-user {
    color: var(--muted);
    font-size: 12px;
    padding: 0 6px;
    max-width: 220px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.overlay-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    background: #3a3d44;
    color: var(--text);
    border: none;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 3px;
}

.overlay-btn:hover { background: #4a4d54; }

.overlay-btn--danger {
    background: var(--danger);
    color: white;
}
.overlay-btn--danger:hover { background: #c9302c; }

/* -------- Диалог инструкции -------- */
.info-dialog {
    width: min(920px, calc(100vw - 32px));
    max-width: 920px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
    color: var(--text);
    padding: 0;
}

.info-dialog::backdrop {
    background: rgba(0, 0, 0, 0.5);
}

.info-dialog article {
    padding: 24px;
    max-height: min(820px, calc(100vh - 48px));
    overflow: auto;
}

.info-dialog h2 { margin-top: 0; }

.instruction-intro {
    color: var(--muted);
    margin: 0 0 16px;
}

.instruction-loader {
    margin: 12px 0 18px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--muted);
    background: #1a1b1e;
    font-size: 14px;
}

.instruction-section {
    margin-top: 22px;
}

.instruction-section h3 {
    margin: 0 0 8px;
    font-size: 16px;
}

.instruction-section p {
    margin: 0 0 12px;
    line-height: 1.45;
}

.instruction-img {
    display: block;
    width: 100%;
    max-height: 420px;
    object-fit: contain;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #1a1b1e;
}

/* -------- Страница логов -------- */
.logs-body {
    padding: 24px;
}

.logs-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.logs-header h1 {
    margin: 0 0 6px;
    font-size: 22px;
}

.logs-meta {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.logs-actions {
    display: flex;
    gap: 8px;
}

.logs-actions button {
    padding: 8px 14px;
    border-radius: 8px;
}

.logs-stub {
    border: 1px dashed var(--border);
    border-radius: 10px;
    padding: 24px;
    color: var(--muted);
    text-align: center;
}
