#c {
    display: block;
    width: 100%;
    height: 100%;
    outline: none;
}

#c.opening-edit-active {
    cursor: crosshair;
    touch-action: none;
}

#c:focus-visible {
    outline: 3px solid #38bdf8;
    outline-offset: -4px;
}

.opening-hud {
    position: fixed;
    z-index: 70;
    transform: translate(-50%, calc(-100% - 12px));
    max-width: min(320px, calc(100vw - 24px));
    padding: 7px 10px;
    border: 1px solid rgba(125, 211, 252, .75);
    border-radius: 7px;
    background: rgba(2, 6, 23, .9);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
    color: #f8fafc;
    font: 600 12px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    white-space: nowrap;
    pointer-events: none;
}

.opening-field-row {
    display: grid;
    grid-template-columns: minmax(84px, 1fr) 32px minmax(92px, 1fr) 32px;
    gap: 5px;
    align-items: center;
}

.opening-field-row label {
    color: #cbd5e1;
    font-size: 12px;
}

.opening-field-row input {
    min-width: 0;
    height: 34px;
    padding: 5px 7px;
    border: 1px solid #64748b;
    border-radius: 5px;
    background: rgba(15, 23, 42, .9);
    color: white;
    font: 600 12px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    text-align: center;
}

.opening-field-row button {
    width: 32px;
    height: 32px;
    border: 1px solid #475569;
    border-radius: 5px;
    background: #334155;
    color: white;
    font-size: 18px;
    line-height: 1;
}

.opening-field-row button:hover,
.opening-field-row button:focus-visible {
    border-color: #38bdf8;
    background: #0369a1;
    outline: none;
}

@media (max-width: 767px) {
    .opening-hud { display: none !important; }
    .opening-field-row { grid-template-columns: minmax(92px, 1fr) 44px minmax(100px, 1fr) 44px; }
    .opening-field-row button { width: 44px; height: 44px; }
    .opening-field-row input { height: 44px; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .opening-hud, #c { transition: none !important; }
}
/* Keep every configurator tab inside the viewport. The tab bar owns a fixed
   edge; only this inner region scrolls, so Advice actions never fall offscreen. */
#configurator-panel {
    min-height: 0;
    max-height: 100dvh;
}

#panel-content-wrapper {
    flex: 1 1 auto;
    min-height: 0;
    max-height: min(72dvh, 680px);
    overflow: hidden;
}

#panel-content-wrapper:not(.hidden) {
    display: flex;
    flex-direction: column;
}

#panel-scroll-region {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    padding-right: 3px;
}

.advice-panel {
    min-height: 0;
}

.advice-toolbar {
    position: sticky;
    z-index: 3;
    top: 0;
    margin-bottom: 12px;
    padding: 2px 0 12px;
    border-bottom: 1px solid rgba(148, 163, 184, .28);
    background: rgba(2, 6, 23, .96);
    box-shadow: 0 10px 18px rgba(2, 6, 23, .72);
}

.advice-implement-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    padding: 9px 12px;
    border: 1px solid rgba(251, 191, 36, .72);
    border-radius: 8px;
    background: linear-gradient(135deg, #d97706, #b45309);
    box-shadow: 0 8px 20px rgba(180, 83, 9, .25);
    color: white;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
}

.advice-implement-button:hover:not(:disabled),
.advice-implement-button:focus-visible:not(:disabled) {
    background: linear-gradient(135deg, #f59e0b, #c2410c);
}

.advice-implement-button:disabled {
    border-color: rgba(100, 116, 139, .45);
    background: #334155;
    box-shadow: none;
    color: #cbd5e1;
    cursor: not-allowed;
    opacity: .72;
}

.advice-action-count {
    display: inline-grid;
    min-width: 22px;
    height: 22px;
    place-items: center;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(15, 23, 42, .72);
    font-size: 11px;
}

.advice-action-status {
    min-height: 18px;
    margin-top: 7px;
    color: #bae6fd;
    font-size: 12px;
    line-height: 1.35;
}

@media (min-width: 768px) {
    #panel-content-wrapper {
        height: auto !important;
        max-height: none;
    }
}
