.loto-lab { display: grid; gap: 16px; color: var(--text-main); }
.loto-lab-heading { display: flex; align-items: center; gap: 18px; }
.loto-lab-heading > a { flex: 0 0 auto; color: var(--text-muted); font-size: 13px; text-decoration: none; }
.loto-lab-heading > a:hover { color: var(--accent); }
.loto-lab-heading h1 { margin: 0 0 5px; }
.loto-lab-heading p { margin: 0; color: var(--text-muted); font-size: 13px; }
.loto-lab-view { position: relative; display: grid; grid-template-columns: clamp(112px, 22%, 238px) minmax(0, 1fr) 190px; align-items: center; min-height: min(62vh, 580px); overflow: hidden; background: #222; border: 1px solid var(--border-color); border-radius: var(--radius-lg); }
.loto-lab-view canvas { display: block; grid-column: 1 / 3; grid-row: 1; width: 100%; height: min(62vh, 580px); min-height: min(62vh, 580px); touch-action: none; }
.loto-lab-result-window { position: absolute; z-index: 1; top: 50%; left: 10px; display: grid; align-content: start; justify-items: center; width: min(calc(100% - 20px), 220px); aspect-ratio: 1; padding: 12px 8px; transform: translateY(-50%); border: 1px solid #484b4f; border-radius: 12px; background: transparent; box-shadow: 0 8px 28px rgb(0 0 0 / 24%); pointer-events: none; }
.loto-lab-result-title { color: var(--text-main); font-size: 12px; font-weight: 600; }
.loto-lab-result-hint { margin-top: auto; margin-bottom: 8px; color: var(--text-muted); font-size: 10px; }
.loto-lab-hand-panel { display: grid; grid-column: 3; grid-row: 1; place-items: center; min-height: 100%; border-left: 1px solid var(--border-color); background: #202020; }
.loto-lab-hand { width: 184px; height: 184px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: grab; touch-action: none; }
.loto-lab-hand:active { cursor: grabbing; }
.loto-lab-view canvas { cursor: grab; }
.loto-lab-view canvas.loto-lab-handle-hover { cursor: grab; }
.loto-lab-view canvas.loto-lab-handle-drag { cursor: grabbing; }
.loto-lab-hand svg { display: block; width: 100%; height: 100%; overflow: visible; }
.loto-lab-hand-track { fill: none; stroke: #4b4e52; stroke-width: 3; }
.loto-lab-hand-hub { fill: var(--accent); }
.loto-lab-hand-shaft { stroke: #aeb1b5; stroke-width: 6; stroke-linecap: round; }
.loto-lab-hand-grip { fill: #777b80; stroke: #adb1b6; stroke-width: 2; }
.loto-lab-hand:hover .loto-lab-hand-grip { fill: var(--accent); stroke: #ffe477; filter: drop-shadow(0 0 5px rgb(255 204 0 / 55%)); }
.loto-lab-state { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-muted); font-size: 14px; pointer-events: none; }
.loto-lab-state:empty { display: none; }
.loto-lab-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; padding: 14px 16px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); }
.loto-lab-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.loto-lab-primary { color: #17130a; background: var(--accent); border-color: var(--accent); }
.loto-lab-speed { display: grid; grid-template-columns: auto minmax(100px, 180px) auto; align-items: center; gap: 9px; color: var(--text-muted); font-size: 13px; }
.loto-lab-speed input { accent-color: var(--accent); }
.loto-lab-speed output { min-width: 78px; color: var(--text-main); font-variant-numeric: tabular-nums; }
.loto-lab-debug { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 13px; }
.loto-lab-debug input { accent-color: var(--accent); }
.loto-lab-stats { flex: 1 1 100%; color: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
html.loto-lab-embedded,
html.loto-lab-embedded body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: #222; }
html.loto-lab-embedded .header,
html.loto-lab-embedded footer,
html.loto-lab-embedded .connection-bar { display: none !important; }
html.loto-lab-embedded .loto-lab-embedded-main { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; margin: 0; padding: 0; overflow: hidden; }
html.loto-lab-embedded .games-wrapper.loto-lab { position: relative; display: grid; grid-template-rows: minmax(0, 1fr) minmax(230px, 0.82fr); gap: 0; width: 100%; height: 100%; max-width: none; margin: 0; padding: 0; overflow: hidden; }
html.loto-lab-embedded .loto-lab-heading,
html.loto-lab-embedded .loto-lab-controls,
html.loto-lab-embedded .loto-lab-hand-panel,
html.loto-lab-embedded .loto-lab-result-title,
html.loto-lab-embedded .loto-lab-result-hint { display: none !important; }
html.loto-lab-embedded .games-wrapper.loto-lab > #lotoLabCanvas { position: absolute; z-index: 3; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; pointer-events: none; }
html.loto-lab-embedded .loto-lab-view { position: relative; z-index: 0; display: grid; grid-template-columns: clamp(110px, 24%, 210px) minmax(0, 1fr); grid-row: 1; width: 100%; height: 100%; min-height: 0; border: 0; border-radius: 0; }
html.loto-lab-embedded .loto-lab-result-window { top: 50%; left: 8px; width: min(calc(100% - 16px), 210px); border: 1px solid #383b3f; border-radius: 12px; box-shadow: none; background: rgb(25 25 25 / 20%); pointer-events: none; }
html.loto-lab-embedded .loto-lab-state { z-index: 4; background: #222; }
html.loto-lab-embedded .loto-ticket-gallery { position: relative; z-index: 1; grid-row: 2; min-height: 0; overflow: auto; padding: 10px 12px 14px; border-top: 1px solid var(--border-color); }
html.loto-lab-embedded .loto-cards { max-height: none; overflow: visible; }
@media (max-width: 560px) {
    .loto-lab-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
    .loto-lab-view { grid-template-columns: minmax(0, 1fr) 112px; grid-template-rows: minmax(0, 46vh) 112px; min-height: calc(46vh + 112px); }
    .loto-lab-view canvas { grid-column: 1 / 3; grid-row: 1 / 3; height: 100%; min-height: 100%; }
    .loto-lab-result-window { position: relative; top: auto; left: auto; grid-column: 1; grid-row: 2; justify-self: center; align-self: center; width: 100px; padding: 8px 3px; transform: none; }
    .loto-lab-result-title { font-size: 10px; }
    .loto-lab-result-hint { font-size: 8px; text-align: center; }
    .loto-lab-hand-panel { grid-column: 2; grid-row: 2; height: 100%; min-height: 0; }
    .loto-lab-hand { width: 104px; height: 104px; }
    .loto-lab-controls { align-items: flex-start; }
    .loto-lab-speed { grid-template-columns: auto 1fr auto; width: 100%; }
    html.loto-lab-embedded .games-wrapper.loto-lab { grid-template-rows: minmax(0, 1fr) minmax(190px, 0.9fr); }
    html.loto-lab-embedded .loto-lab-view { grid-template-columns: clamp(96px, 28%, 150px) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); min-height: 0; }
    html.loto-lab-embedded .loto-lab-view canvas { height: 100%; min-height: 0; }
    html.loto-lab-embedded .loto-lab-result-window { position: absolute; top: 50%; left: 5px; grid-column: 1; grid-row: 1; justify-self: initial; align-self: initial; width: min(calc(100% - 10px), 130px); padding: 0; transform: translateY(-50%); }
}
