:root {
  --studio-bg: #111716;
  --studio-surface: #192321;
  --studio-surface-2: #24302d;
  --studio-border: rgba(125, 216, 216, 0.19);
  --studio-text: #f8fafa;
  --studio-soft: #a8dede;
  --studio-muted: #68a9a9;
  --studio-teal: #45c5c5;
  --studio-gold: #d2b35b;
  --studio-green: #5bd68a;
  --studio-danger: #f28b82;
  --header-height: 76px;
  color-scheme: dark;
}

html.studio-light {
  --studio-bg: #eef7f6;
  --studio-surface: #ffffff;
  --studio-surface-2: #e3f1ef;
  --studio-border: rgba(26, 138, 138, 0.2);
  --studio-text: #173535;
  --studio-soft: #315f5f;
  --studio-muted: #598383;
  --studio-teal: #137f7f;
  --studio-gold: #96751e;
  --studio-green: #237c49;
  --studio-danger: #b43a32;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--studio-bg);
  color: var(--studio-text);
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}
button, input { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.studio-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 30;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 28px;
  background: color-mix(in srgb, var(--studio-bg) 94%, transparent);
  border-bottom: 1px solid var(--studio-border);
  backdrop-filter: blur(18px);
}

.studio-brand { display: inline-flex; align-items: center; gap: 12px; min-width: 0; }
.studio-brand strong { display: block; font-family: 'Oswald', sans-serif; font-size: 18px; font-weight: 600; line-height: 1.15; }
.studio-brand small { display: block; margin-top: 4px; color: var(--studio-muted); font-size: 11px; }
.studio-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  border: 1px solid color-mix(in srgb, var(--studio-teal) 65%, transparent);
  background: color-mix(in srgb, var(--studio-teal) 12%, var(--studio-surface));
  color: var(--studio-teal);
  font-family: 'Oswald', sans-serif;
  font-size: 14px;
  font-weight: 700;
}

.header-actions { display: flex; align-items: center; gap: 10px; }
.icon-button, .account-button {
  border: 1px solid var(--studio-border);
  background: var(--studio-surface);
  color: var(--studio-soft);
  cursor: pointer;
}
.icon-button { width: 40px; height: 40px; display: grid; place-items: center; padding: 0; }
.icon-button svg { width: 18px; height: 18px; }
.icon-button:hover, .account-button:hover { border-color: var(--studio-teal); color: var(--studio-text); }
.studio-light .theme-sun-icon, html:not(.studio-light) .theme-moon-icon { display: none; }
.account-button { min-height: 40px; display: flex; align-items: center; gap: 8px; padding: 6px 11px; white-space: nowrap; }
.account-button svg { width: 15px; height: 15px; }
.account-avatar { width: 27px; height: 27px; display: grid; place-items: center; background: var(--studio-teal); color: var(--studio-bg); font-weight: 900; }
.account-email { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }

.studio-layout { min-height: 100vh; padding-top: var(--header-height); display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.studio-sidebar { position: fixed; top: var(--header-height); bottom: 0; left: 0; width: 220px; display: flex; flex-direction: column; justify-content: space-between; padding: 26px 16px; border-right: 1px solid var(--studio-border); }
.nav-item { display: flex; align-items: center; gap: 11px; min-height: 43px; padding: 0 12px; color: var(--studio-muted); font-size: 14px; font-weight: 800; }
.nav-item svg { width: 18px; height: 18px; }
.nav-item.active { background: color-mix(in srgb, var(--studio-teal) 10%, transparent); color: var(--studio-teal); border-left: 2px solid var(--studio-teal); }
.sidebar-note { display: flex; align-items: center; gap: 9px; padding: 0 12px; color: var(--studio-muted); font-size: 12px; }
.status-dot { width: 7px; height: 7px; background: var(--studio-green); box-shadow: 0 0 0 4px color-mix(in srgb, var(--studio-green) 13%, transparent); }

.studio-main { grid-column: 2; width: min(1120px, 100%); padding: 54px 52px 80px; }
.studio-intro { display: flex; justify-content: space-between; align-items: end; gap: 32px; padding-bottom: 36px; border-bottom: 1px solid var(--studio-border); }
.eyebrow { margin: 0 0 10px; color: var(--studio-teal); font-family: 'Oswald', sans-serif; font-size: 12px; font-weight: 600; text-transform: uppercase; }
.studio-intro h1 { max-width: 780px; margin: 0; font-family: 'Oswald', sans-serif; font-size: 38px; line-height: 1.12; font-weight: 600; }
.intro-copy { max-width: 660px; margin: 14px 0 0; color: var(--studio-muted); font-size: 16px; line-height: 1.7; }

.studio-notice { display: flex; align-items: flex-start; gap: 12px; margin-top: 24px; padding: 15px 17px; border: 1px solid color-mix(in srgb, var(--studio-green) 42%, transparent); background: color-mix(in srgb, var(--studio-green) 8%, transparent); }
.studio-notice > svg { width: 20px; flex: 0 0 20px; color: var(--studio-green); }
.studio-notice strong, .studio-notice span { display: block; }
.studio-notice strong { color: var(--studio-text); font-size: 14px; }
.studio-notice span { margin-top: 3px; color: var(--studio-muted); font-size: 12px; line-height: 1.5; }

.device-progress { margin-top: 24px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 15px 17px; border: 1px solid color-mix(in srgb, var(--studio-gold) 40%, transparent); background: color-mix(in srgb, var(--studio-gold) 7%, transparent); }
.device-progress > svg { width: 20px; color: var(--studio-gold); }
.device-progress strong, .device-progress span { display: block; }
.device-progress strong { font-size: 14px; }
.device-progress span { margin-top: 2px; color: var(--studio-muted); font-size: 12px; }
.text-button { color: var(--studio-teal); font-size: 13px; font-weight: 900; }

.apps-section { padding-top: 42px; }
.apps-section .app-card + .app-card { margin-top: 18px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-heading h2 { margin: 0; font-family: 'Oswald', sans-serif; font-size: 24px; font-weight: 600; }
.app-count { color: var(--studio-muted); font-size: 12px; }
.app-card { display: grid; grid-template-columns: minmax(300px, 42%) minmax(0, 1fr); min-height: 330px; overflow: hidden; border: 1px solid var(--studio-border); background: var(--studio-surface); }
.app-preview { position: relative; min-height: 330px; overflow: hidden; background: #0d2828; border-right: 1px solid var(--studio-border); }
.app-preview img { width: 100%; height: 100%; object-fit: cover; object-position: left top; display: block; }
.locked-cover { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(5, 20, 20, 0.66); backdrop-filter: blur(4px); }
.lock-icon { width: 54px; height: 54px; display: grid; place-items: center; background: rgba(8, 28, 28, 0.9); color: #f8fafa; border: 1px solid rgba(248, 250, 250, 0.25); }
.lock-icon svg { width: 23px; height: 23px; }
.app-details { padding: 30px; display: flex; flex-direction: column; }
.app-title-row { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.access-label { display: inline-block; margin-bottom: 8px; color: var(--studio-gold); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.access-label.unlocked { color: var(--studio-green); }
.app-title-row h3 { margin: 0; font-family: 'Oswald', sans-serif; font-size: 30px; font-weight: 600; }
.app-icon { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 42px; color: var(--studio-teal); background: color-mix(in srgb, var(--studio-teal) 10%, transparent); border: 1px solid var(--studio-border); }
.app-icon svg { width: 20px; height: 20px; }
.app-details > p { margin: 15px 0 18px; color: var(--studio-muted); line-height: 1.65; }
.app-status { display: flex; align-items: center; gap: 9px; color: var(--studio-soft); font-size: 13px; }
.app-status svg { width: 16px; height: 16px; color: var(--studio-gold); flex: 0 0 16px; }
.app-status.unlocked svg { color: var(--studio-green); }
.app-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; padding-top: 28px; }
.primary-button, .secondary-button { min-height: 43px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 16px; border: 1px solid transparent; cursor: pointer; font-weight: 900; font-size: 14px; }
.primary-button { background: var(--studio-teal); color: #071f1f; }
.primary-button:hover { background: color-mix(in srgb, var(--studio-teal) 86%, white); }
.secondary-button { border-color: var(--studio-border); color: var(--studio-soft); background: transparent; }
.secondary-button:hover { border-color: var(--studio-teal); color: var(--studio-text); }
.primary-button svg, .secondary-button svg { width: 17px; height: 17px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(2, 12, 12, 0.78); backdrop-filter: blur(7px); }
.auth-dialog { position: relative; width: min(450px, 100%); padding: 34px; border: 1px solid var(--studio-border); background: var(--studio-surface); box-shadow: 0 28px 80px rgba(0, 0, 0, 0.35); }
.auth-dialog h2 { margin: 0; font-family: 'Oswald', sans-serif; font-size: 30px; font-weight: 600; }
.auth-intro { margin: 9px 0 24px; color: var(--studio-muted); line-height: 1.6; }
.modal-close { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 22px; border-bottom: 1px solid var(--studio-border); }
.auth-tab { padding: 10px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--studio-muted); cursor: pointer; font-weight: 800; }
.auth-tab.active { color: var(--studio-teal); border-bottom-color: var(--studio-teal); }
.auth-dialog label { display: block; margin: 14px 0 7px; color: var(--studio-soft); font-size: 13px; font-weight: 800; }
.auth-dialog input { width: 100%; height: 46px; padding: 0 13px; border: 1px solid var(--studio-border); background: var(--studio-bg); color: var(--studio-text); outline: 0; }
.auth-dialog input:focus { border-color: var(--studio-teal); }
.auth-submit { width: 100%; margin-top: 18px; border: 0; }
.auth-message { min-height: 20px; margin: 12px 0 0; color: var(--studio-muted); font-size: 13px; line-height: 1.5; }
.auth-message.error { color: var(--studio-danger); }
.auth-message.success { color: var(--studio-green); }
.settings-email { margin: -10px 0 6px; color: var(--studio-soft); font-size: 12px; word-break: break-word; }

.account-menu { position: fixed; top: 66px; right: 28px; z-index: 50; width: 260px; padding: 8px; border: 1px solid var(--studio-border); background: var(--studio-surface); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28); }
.account-menu-email { padding: 10px 11px 12px; color: var(--studio-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.account-menu a, .account-menu button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 11px; border: 0; background: transparent; color: var(--studio-soft); cursor: pointer; text-align: left; }
.account-menu a:hover, .account-menu button:hover { background: color-mix(in srgb, var(--studio-teal) 8%, transparent); color: var(--studio-text); }
.account-menu svg { width: 16px; height: 16px; }

@media (max-width: 780px) {
  :root { --header-height: 66px; }
  .studio-header { padding: 0 16px; }
  .studio-brand strong { font-size: 15px; }
  .studio-brand small { display: none; }
  .studio-mark { width: 34px; height: 34px; flex-basis: 34px; }
  .account-email, .account-button > svg:last-child { display: none; }
  .studio-layout { display: block; }
  .studio-sidebar { display: none; }
  .studio-main { width: 100%; padding: 34px 18px 60px; }
  .studio-intro h1 { font-size: 31px; }
  .app-card { grid-template-columns: 1fr; }
  .app-preview { min-height: 220px; max-height: 260px; border-right: 0; border-bottom: 1px solid var(--studio-border); }
  .app-details { padding: 24px 20px; }
  .app-actions { flex-direction: column; }
  .primary-button, .secondary-button { width: 100%; }
  .device-progress { grid-template-columns: auto 1fr; }
  .device-progress .text-button { grid-column: 2; }
  .account-menu { right: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
