:root {
  color-scheme: dark;
  --rqle-bg: #070913;
  --rqle-panel: #10152a;
  --rqle-panel-2: #171e38;
  --rqle-border: rgba(159, 184, 255, .22);
  --rqle-text: #f5f7ff;
  --rqle-muted: #9aa6c8;
  --rqle-accent: #72d9ff;
  --rqle-gold: #ffd766;
  --rqle-danger: #ff7b8a;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; background: var(--rqle-bg); color: var(--rqle-text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, select, input { font: inherit; }
button { cursor: pointer; }
.rqle-app { min-height: 100vh; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.rqle-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 18px; border-bottom: 1px solid var(--rqle-border); background: linear-gradient(180deg, #151a32, #0c1021); box-shadow: 0 8px 30px rgba(0,0,0,.25); z-index: 10; }
.rqle-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.rqle-brand img { width: 44px; height: 44px; object-fit: contain; }
.rqle-brand span { display: block; color: var(--rqle-gold); font-size: .7rem; font-weight: 900; letter-spacing: .18em; text-transform: uppercase; }
.rqle-brand h1 { margin: 2px 0 0; font-size: clamp(1.08rem, 2vw, 1.48rem); line-height: 1; }
.rqle-header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.rqle-button { min-height: 38px; padding: 8px 13px; border: 1px solid var(--rqle-border); border-radius: 9px; background: #1b2341; color: var(--rqle-text); font-weight: 850; box-shadow: inset 0 1px rgba(255,255,255,.05); }
.rqle-button:hover { border-color: rgba(114,217,255,.62); background: #222d50; }
.rqle-button.primary { border-color: #8f6b12; background: linear-gradient(#ffe27d, #cf941e); color: #171008; }
.rqle-button.danger { border-color: rgba(255,123,138,.5); color: #ffdce1; background: rgba(104,25,39,.65); }
.rqle-button:disabled { opacity: .46; cursor: not-allowed; }
.rqle-main { min-height: 0; display: grid; grid-template-columns: 310px minmax(0,1fr) 330px; }
.rqle-sidebar { min-height: 0; overflow: auto; padding: 14px; background: var(--rqle-panel); border-right: 1px solid var(--rqle-border); }
.rqle-sidebar.right { border-right: 0; border-left: 1px solid var(--rqle-border); }
.rqle-section { margin-bottom: 14px; padding: 13px; border: 1px solid var(--rqle-border); border-radius: 12px; background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.012)); }
.rqle-section h2 { margin: 0 0 10px; color: var(--rqle-gold); font-size: .74rem; letter-spacing: .13em; text-transform: uppercase; }
.rqle-field { display: grid; gap: 5px; margin-top: 9px; }
.rqle-field:first-child { margin-top: 0; }
.rqle-field > span { color: var(--rqle-muted); font-size: .72rem; font-weight: 800; }
.rqle-field select, .rqle-field input[type="number"] { width: 100%; min-height: 38px; border: 1px solid var(--rqle-border); border-radius: 8px; background: #090d1d; color: var(--rqle-text); padding: 7px 9px; }
.rqle-state-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.rqle-state-tabs button { padding: 8px 4px; border: 1px solid var(--rqle-border); border-radius: 8px; background: #090d1d; color: var(--rqle-muted); font-size: .66rem; font-weight: 900; text-transform: uppercase; }
.rqle-state-tabs button.active { color: #07101b; background: var(--rqle-accent); border-color: #b8edff; }
.rqle-element-list { display: grid; gap: 5px; }
.rqle-element-button { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 36px; padding: 7px 9px; border: 1px solid transparent; border-radius: 8px; background: rgba(255,255,255,.035); color: var(--rqle-text); text-align: left; }
.rqle-element-button small { color: var(--rqle-muted); }
.rqle-element-button:hover, .rqle-element-button.active { border-color: rgba(114,217,255,.68); background: rgba(114,217,255,.09); }
.rqle-element-button.missing { opacity: .38; }
.rqle-help { color: var(--rqle-muted); font-size: .76rem; line-height: 1.48; }
.rqle-workspace { min-width: 0; min-height: 0; overflow: auto; display: grid; place-items: center; padding: 24px; background-color: #050711; background-image: linear-gradient(rgba(127,152,220,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(127,152,220,.07) 1px, transparent 1px); background-size: 20px 20px; }
.rqle-device-wrap { position: relative; padding: 13px; border-radius: 24px; background: linear-gradient(145deg, #3b4257, #0c0f18 30%, #272d40); box-shadow: 0 30px 80px rgba(0,0,0,.55), inset 0 1px rgba(255,255,255,.2); }
.rqle-device-wrap::before { content: ''; position: absolute; top: 4px; left: 50%; width: 58px; height: 5px; transform: translateX(-50%); border-radius: 999px; background: #05060a; }
.rqle-screen { position: relative; overflow: hidden; border-radius: 13px; background: #000; box-shadow: 0 0 0 1px rgba(255,255,255,.12); transform-origin: center; }
.rqle-screen iframe { display: block; width: 100%; height: 100%; border: 0; background: #02040a; }
.rqle-safe-area { position: absolute; inset: 6px; pointer-events: none; border: 1px dashed rgba(255,215,102,.62); border-radius: 8px; z-index: 5; }
.rqle-safe-area::after { content: 'SAFE AREA'; position: absolute; top: 2px; right: 4px; color: rgba(255,215,102,.86); font-size: 8px; font-weight: 900; letter-spacing: .1em; }
.rqle-loading { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(3,5,14,.9); color: #dce7ff; font-weight: 900; letter-spacing: .08em; z-index: 20; }
.rqle-loading.hidden { display: none; }
.rqle-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.rqle-check { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; color: var(--rqle-muted); font-size: .78rem; font-weight: 800; }
.rqle-check input { width: 19px; height: 19px; accent-color: var(--rqle-accent); }
.rqle-range { width: 100%; accent-color: var(--rqle-accent); }
.rqle-selected-name { min-height: 42px; padding: 10px; border-radius: 9px; background: #090d1d; color: #fff; font-weight: 900; }
.rqle-inline-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 10px; }
.rqle-status { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%) translateY(20px); z-index: 1000; max-width: min(620px, calc(100vw - 32px)); padding: 11px 16px; border: 1px solid rgba(114,217,255,.45); border-radius: 999px; background: rgba(8,13,30,.94); color: #eaf8ff; box-shadow: 0 14px 40px rgba(0,0,0,.4); opacity: 0; pointer-events: none; transition: .2s ease; }
.rqle-status.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.rqle-status.error { border-color: rgba(255,123,138,.65); color: #ffe6ea; }
.rqle-auth { min-height: 100vh; display: grid; place-items: center; padding: 30px; }
.rqle-auth-card { max-width: 520px; padding: 26px; border: 1px solid var(--rqle-border); border-radius: 18px; background: var(--rqle-panel); text-align: center; }
.rqle-auth-card h1 { margin-top: 0; }
.rqle-auth-card p { color: var(--rqle-muted); }
@media (max-width: 1180px) {
  .rqle-main { grid-template-columns: 260px minmax(0,1fr) 290px; }
}
@media (max-width: 900px) {
  .rqle-main { grid-template-columns: 1fr; }
  .rqle-sidebar { border: 0; border-bottom: 1px solid var(--rqle-border); }
  .rqle-sidebar.right { border: 0; border-top: 1px solid var(--rqle-border); }
  .rqle-workspace { min-height: 520px; }
}
