* {
    box-sizing: border-box;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    overflow: hidden;
    font-family: -apple-system, Roboto, "Segoe UI", sans-serif;
    color: #fff;
}

#root {
    position: fixed;
    inset: 0;
}

.hidden {
    display: none !important;
}

.overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
}

.panel {
    width: min(86vw, 460px);
    background: #14161c;
    border: 1px solid #2a2f3a;
    border-radius: 16px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6);
    overflow: hidden;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: linear-gradient(180deg, #1b1e26, #14161c);
    border-bottom: 1px solid #2a2f3a;
}

.panel-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.panel-close {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 10px;
    background: #232733;
    color: #fff;
    font-size: 22px;
    line-height: 1;
}

.panel-balance {
    padding: 12px 18px;
    color: #c9cfdb;
    font-size: 14px;
}

.panel-balance b {
    color: #ffd15c;
}

.panel-body {
    padding: 8px 18px 18px;
    max-height: 52vh;
    overflow-y: auto;
}

.item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #21252f;
}

.item:last-child {
    border-bottom: none;
}

.item-name {
    font-size: 15px;
}

.item-buy {
    padding: 8px 16px;
    border: none;
    border-radius: 10px;
    background: #ffd15c;
    color: #1a1400;
    font-weight: 700;
    font-size: 14px;
}

.item-buy:active {
    transform: scale(0.96);
}

/* --- полноэкранный слой --- */
.fullscreen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    /* непрозрачный фон + сетка: сразу видно, перекрыт ли игровой худ */
    background:
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 40px),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 40px),
        linear-gradient(160deg, #10131a, #05070b);
}

.fs-corner {
    position: absolute;
    padding: 4px 8px;
    background: #ffd15c;
    color: #1a1400;
    font-size: 11px;
    font-weight: 700;
    border-radius: 6px;
    z-index: 2;
}

.fs-tl { left: 6px; top: 6px; }
.fs-tr { right: 6px; top: 6px; }
.fs-bl { left: 6px; bottom: 6px; }
.fs-br { right: 6px; bottom: 6px; }

.fs-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* по бокам оставляем место под вырезы/скругления, но не душим узкие экраны */
    padding: 14px clamp(16px, 6vw, 70px);
    border-bottom: 1px solid #2a2f3a;
    background: rgba(20, 22, 28, 0.75);
}

.fs-title {
    font-size: 17px;
    font-weight: 700;
}

.fs-close {
    padding: 9px 18px;
    border: none;
    border-radius: 10px;
    background: #232733;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}

.fs-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 16px clamp(16px, 6vw, 70px) clamp(20px, 5vh, 40px);
}

.fs-player {
    font-size: 15px;
    margin-bottom: 4px;
}

.fs-env {
    font-size: 12px;
    color: #7f8798;
    margin-bottom: 14px;
}

.fs-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.fs-controls .field {
    flex: 1 1 140px;
    min-width: 0;
    margin-bottom: 0;
}

.fs-controls .btn-primary {
    width: auto;
    flex: 0 0 auto;
}

.fs-body .log {
    flex: 1;
    min-height: 0;
    max-height: none;
}

/* --- вкладки стенда --- */
.fs-tabs {
    display: flex;
    gap: 8px;
    padding: 10px clamp(16px, 6vw, 70px) 0;
}

.tab {
    padding: 9px 16px;
    border: 1px solid #2a2f3a;
    border-radius: 10px 10px 0 0;
    border-bottom: none;
    background: #171b23;
    color: #8d95a6;
    font-size: 14px;
    font-weight: 700;
}

.tab-active {
    background: #232733;
    color: #ffd15c;
}

.pane {
    flex: 1;
    min-height: 0;
}

/* Вкладка «Связь»: лог сам тянется на всю высоту и скроллится внутри. */
#pane-link {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#pane-link .log {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

/* Вкладки «Снапшоты» и «HUD»: контента больше экрана, поэтому скроллится
   сама вкладка целиком, а внутренние блоки высоту не ограничивают —
   иначе на телефоне получаются вложенные скроллы и палец не попадает в нужный. */
#pane-snap,
#pane-hud {
    display: block;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-bottom: 24px;
}

#pane-snap .log,
#pane-hud .log {
    max-height: none;
    overflow: visible;
}

.row-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.btn-sm {
    padding: 9px 14px;
    border: 1px solid #2a2f3a;
    border-radius: 9px;
    background: #232733;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

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

.btn-off {
    background: #14161c;
    color: #6b7385;
}

.hint {
    font-size: 12px;
    color: #7f8798;
    margin-bottom: 10px;
    word-break: break-word;
}

/* --- форма ручного рендера --- */
.snap-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.field-sm {
    padding: 9px 10px;
    border: 1px solid #2a2f3a;
    border-radius: 9px;
    background: #0e1015;
    color: #fff;
    font-size: 14px;
    outline: none;
    -webkit-user-select: text;
    user-select: text;
}

.f-model {
    flex: 1 1 120px;
    min-width: 0;
}

.f-num {
    width: 68px;
    flex: 0 0 auto;
    text-align: center;
}

.btn-go {
    background: #ffd15c;
    color: #1a1400;
    border-color: #ffd15c;
}

.snap-custom {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    margin-bottom: 14px;
    background: #14161c;
    border: 1px solid #2a2f3a;
    border-radius: 12px;
}

.snap-big {
    width: 150px;
    height: 150px;
    flex: 0 0 auto;
    object-fit: contain;
    background: #0b0d12;
    border-radius: 10px;
}

/* --- сетка снапшотов --- */
.snap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.snap-card {
    padding: 8px;
    background: #14161c;
    border: 1px solid #2a2f3a;
    border-radius: 12px;
    text-align: center;
}

.snap-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background: #0b0d12;
    border-radius: 8px;
    display: block;
}

.snap-title {
    margin-top: 6px;
    font-size: 12px;
    font-weight: 700;
    word-break: break-word;
}

.snap-state {
    margin-top: 2px;
    font-size: 11px;
    color: #7f8798;
    word-break: break-word;
}

.snap-ok {
    color: #6ddc7a;
}

.snap-err {
    color: #ff6b6b;
}

.log-warn .log-tag {
    color: #ffa53c;
}

/* --- тестовая панель --- */
.field {
    width: 100%;
    padding: 12px 14px;
    margin-bottom: 10px;
    border: 1px solid #2a2f3a;
    border-radius: 10px;
    background: #0e1015;
    color: #fff;
    font-size: 15px;
    outline: none;
    -webkit-user-select: text;
    user-select: text;
}

.field::placeholder {
    color: #5c6472;
}

.btn-primary {
    width: 100%;
    padding: 13px 16px;
    border: none;
    border-radius: 10px;
    background: #ffd15c;
    color: #1a1400;
    font-weight: 700;
    font-size: 15px;
}

.btn-primary:active {
    transform: scale(0.98);
}

.log {
    margin-top: 12px;
    max-height: 30vh;
    overflow-y: auto;
    font-size: 12px;
    line-height: 1.45;
}

.log-row {
    display: flex;
    gap: 8px;
    padding: 5px 0;
    border-bottom: 1px solid #1c2029;
    word-break: break-word;
}

.log-tag {
    flex: 0 0 auto;
    font-weight: 700;
}

.log-out .log-tag {
    color: #ffd15c;
}

.log-in .log-tag {
    color: #6ddc7a;
}

.log-msg {
    color: #c9cfdb;
}

.toast {
    position: fixed;
    left: 50%;
    top: 6%;
    transform: translateX(-50%);
    max-width: 80vw;
    padding: 12px 18px;
    background: rgba(20, 22, 28, 0.92);
    border: 1px solid #2a2f3a;
    border-radius: 12px;
    font-size: 14px;
    text-align: center;
}
