:root {
  color-scheme: dark;
  --bg: #090c12;
  --surface: #111722;
  --surface-2: #171e2b;
  --line: rgba(255, 255, 255, .09);
  --text: #f5f7fb;
  --muted: #929daf;
  --green: #70e7a0;
  --green-strong: #31ce77;
  --red: #ff707a;
  --blue: #7b9fff;
  --shadow: 0 30px 80px rgba(0, 0, 0, .32);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login-shell {
  width: min(100% - 2rem, 430px);
}

.login-card {
  padding: 2rem;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(16, 24, 40, .12);
}

.login-brand { margin-bottom: 2.5rem; }
.login-card h1 { margin-bottom: .6rem; font-size: clamp(36px, 8vw, 52px); }
.login-copy { color: var(--muted); margin-bottom: 1.5rem; }
.login-form { display: grid; gap: .75rem; }
.login-form input { margin-bottom: .5rem; }
.login-form .button { margin-top: .75rem; }

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 80% 0%, rgba(67, 115, 255, .14), transparent 27rem),
    radial-gradient(circle at 15% 20%, rgba(49, 206, 119, .08), transparent 22rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }

.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }

.topbar {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand { color: var(--text); text-decoration: none; display: flex; gap: 12px; align-items: center; font-weight: 720; }
.brand-mark { width: 28px; height: 28px; display: flex; align-items: end; gap: 3px; padding: 6px; border-radius: 8px; background: var(--green); }
.brand-mark span { width: 4px; border-radius: 2px; background: #08120d; }
.brand-mark span:nth-child(1) { height: 8px; }
.brand-mark span:nth-child(2) { height: 14px; }
.brand-mark span:nth-child(3) { height: 11px; }

.node-state { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 14px; }
.status-dot, .profile-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #586273; }
.node-state.online .status-dot { background: var(--green); box-shadow: 0 0 0 5px rgba(112, 231, 160, .1); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, .65fr);
  gap: 70px;
  align-items: center;
  padding: 80px 0 88px;
}

.eyebrow { margin: 0 0 14px; color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
h1 { max-width: 760px; margin: 0; font-size: clamp(44px, 6vw, 78px); line-height: .99; letter-spacing: -.055em; }
h1 span { color: #94a0b3; }
.hero-copy { max-width: 650px; margin: 28px 0 0; color: var(--muted); font-size: 18px; line-height: 1.65; }

.active-card { padding: 26px; border: 1px solid var(--line); border-radius: 22px; background: linear-gradient(145deg, rgba(28, 38, 54, .96), rgba(14, 19, 28, .96)); box-shadow: var(--shadow); }
.active-card-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.label { color: var(--muted); font-size: 13px; }
.live-badge { padding: 6px 9px; color: var(--muted); background: rgba(255,255,255,.05); border-radius: 999px; font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.live-badge.live { color: var(--green); background: rgba(112, 231, 160, .1); }
.active-name { min-height: 60px; margin-top: 28px; overflow-wrap: anywhere; font-size: 25px; font-weight: 760; letter-spacing: -.025em; }
.active-meta { min-height: 21px; margin: 5px 0 28px; color: var(--muted); font-size: 14px; }

.toolbar { display: flex; align-items: end; justify-content: space-between; padding: 0 0 28px; border-bottom: 1px solid var(--line); }
h2 { margin: 0; font-size: 31px; letter-spacing: -.035em; }

.button { min-height: 44px; padding: 0 18px; border: 1px solid transparent; border-radius: 11px; color: var(--text); font-weight: 720; transition: transform .15s ease, background .15s ease, border-color .15s ease; }
.button:not(:disabled):hover { transform: translateY(-1px); }
.button.primary { color: #07110b; background: var(--green); }
.button.primary:hover { background: #8af0b2; }
.button.secondary { background: rgba(123, 159, 255, .12); border-color: rgba(123, 159, 255, .24); color: #b9caff; }
.button.danger { background: rgba(255, 112, 122, .1); border-color: rgba(255, 112, 122, .23); color: #ff9aa1; }
.button.ghost { background: transparent; border-color: var(--line); }
.button.full { width: 100%; }

.notice { margin: 22px 0 0; padding: 14px 16px; border: 1px solid rgba(112, 231, 160, .2); border-radius: 12px; color: var(--green); background: rgba(112, 231, 160, .07); }
.notice.error { border-color: rgba(255, 112, 122, .22); color: #ff9aa1; background: rgba(255, 112, 122, .07); }

.remote-section { padding: 0 0 78px; }
.remote-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding-bottom: 24px; }
.remote-hint { color: var(--muted); font-size: 13px; }
.remote-layout { display: grid; grid-template-columns: minmax(280px, 430px) minmax(280px, 1fr); gap: 34px; align-items: center; padding: 30px; border: 1px solid var(--line); border-radius: 24px; background: rgba(17, 23, 34, .78); }
.live-device { position: relative; display: flex; min-height: 560px; max-height: 680px; align-items: center; justify-content: center; overflow: hidden; outline: none; border: 5px solid #30394a; border-radius: 27px; background: #030507; box-shadow: 0 25px 60px rgba(0,0,0,.4); touch-action: none; }
.live-device:focus { border-color: var(--green); box-shadow: 0 0 0 4px rgba(112,231,160,.12), 0 25px 60px rgba(0,0,0,.4); }
.live-device img { display: block; width: auto; max-width: 100%; height: auto; max-height: 670px; user-select: none; -webkit-user-drag: none; }
.screen-loading { position: absolute; inset: 0; display: grid; place-items: center; padding: 30px; color: var(--muted); background: #030507; text-align: center; }
.screen-loading[hidden] { display: none; }
.remote-controls { display: grid; gap: 26px; }
.nav-controls, .utility-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.utility-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.remote-text-form > div { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.remote-text-form input { min-width: 0; }

.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; padding: 28px 0 80px; }
.profile-card { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 28px; min-height: 250px; padding: 24px; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: rgba(17, 23, 34, .78); }
.profile-card.active { border-color: rgba(112, 231, 160, .3); background: linear-gradient(135deg, rgba(24, 46, 39, .72), rgba(17, 23, 34, .9)); }
.device-preview { display: flex; align-items: center; justify-content: center; }
.device-screen { position: relative; width: 112px; height: 205px; overflow: hidden; border: 5px solid #30394a; border-radius: 20px; background: radial-gradient(circle at 65% 32%, rgba(123,159,255,.85), transparent 25%), linear-gradient(155deg, #18243f 5%, #101723 52%, #192c26); box-shadow: 0 18px 38px rgba(0,0,0,.35); }
.device-screen::before { content: ""; position: absolute; top: 5px; left: 50%; width: 31px; height: 6px; border-radius: 0 0 7px 7px; background: #30394a; transform: translateX(-50%); }
.device-time { position: absolute; top: 17px; left: 11px; color: rgba(255,255,255,.8); font-size: 7px; }
.device-orb { position: absolute; width: 92px; height: 92px; right: -35px; bottom: 45px; border-radius: 50%; background: rgba(112,231,160,.22); filter: blur(1px); }
.device-dock { position: absolute; left: 13px; right: 13px; bottom: 14px; height: 25px; border-radius: 9px; background: rgba(255,255,255,.14); }
.profile-info { min-width: 0; display: flex; flex-direction: column; align-items: start; justify-content: center; }
.profile-heading { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.profile-card.active .profile-status-dot { background: var(--green); box-shadow: 0 0 0 4px rgba(112,231,160,.1); }
.profile-card.active .profile-state { color: var(--green); }
.profile-info h3 { max-width: 100%; margin: 14px 0 7px; overflow-wrap: anywhere; font-size: 20px; line-height: 1.25; }
.profile-info p { margin: 0 0 22px; color: var(--muted); font-size: 13px; line-height: 1.5; }

footer { display: flex; justify-content: space-between; padding: 25px 0 40px; border-top: 1px solid var(--line); color: #6f7a8c; font-size: 12px; }

dialog { width: min(500px, calc(100% - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 20px; color: var(--text); background: #121925; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(2, 5, 9, .75); backdrop-filter: blur(6px); }
dialog form { padding: 28px; }
.dialog-head { display: flex; justify-content: space-between; align-items: start; margin-bottom: 30px; }
.icon-button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: transparent; font-size: 22px; }
label { display: block; margin-bottom: 9px; color: #c8cfdb; font-size: 13px; font-weight: 700; }
input, select { width: 100%; height: 49px; padding: 0 14px; outline: none; border: 1px solid var(--line); border-radius: 11px; color: var(--text); background: #0c1119; }
input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(112,231,160,.1); }
.model-label { margin-top: 24px; }
.field-help { margin: 9px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.dialog-actions { display: flex; justify-content: end; gap: 10px; margin-top: 30px; }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 42px; padding: 55px 0 65px; }
  .profile-grid { grid-template-columns: 1fr; }
  .remote-heading { align-items: start; flex-direction: column; }
  .remote-layout { grid-template-columns: 1fr; }
  .remote-controls { order: -1; }
  .live-device { min-height: 480px; }
}

@media (max-width: 540px) {
  .shell { width: min(100% - 24px, 1180px); }
  .topbar { min-height: 68px; }
  .node-state { font-size: 0; }
  .hero { padding-top: 42px; }
  h1 { font-size: 43px; }
  .hero-copy { font-size: 16px; }
  .toolbar { align-items: center; }
  .button.primary { padding: 0 13px; }
  .profile-card { grid-template-columns: 100px minmax(0, 1fr); gap: 19px; padding: 18px; }
  .device-screen { width: 82px; height: 154px; border-radius: 15px; }
  .remote-layout { padding: 14px; border-radius: 18px; }
  .live-device { min-height: 440px; border-radius: 20px; }
  .nav-controls { grid-template-columns: 1fr; }
  .remote-text-form > div { grid-template-columns: 1fr; }
  footer { flex-direction: column; gap: 8px; }
}
