@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("assets/fonts/PlusJakartaSans-Variable.ttf") format("truetype");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("assets/fonts/Inter-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Samsung Sharp Sans";
  src: url("assets/fonts/samsungsharpsans-bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --accent: #29b6f6;
  --accent-soft: rgba(41, 182, 246, 0.22);
  --bg: #090d14;
  --glass: rgba(14, 21, 34, 0.84);
  --glass-card: rgba(20, 29, 46, 0.88);
  --border: rgba(255, 255, 255, 0.14);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --font-family: "Plus Jakarta Sans", "Inter", system-ui, -apple-system, sans-serif;
  --font-size: 13px;
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: var(--font-family); font-size: var(--font-size);
  overflow: hidden; user-select: none;
}

.hidden { display: none !important; }
.mt-6 { margin-top: 6px; }
.mt-10 { margin-top: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.row-gap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.muted-note { color: var(--muted); font-size: 0.9em; margin-top: 4px; }

.glass-card {
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(135%);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.48);
}
.glass-subcard {
  background: rgba(18, 27, 42, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  padding: 16px;
}
.glass-bar {
  background: rgba(12, 18, 30, 0.84);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: transform 240ms var(--ease-spring), opacity 220ms ease;
}

.reduce-quality .glass-card,
.reduce-quality .glass-bar,
.reduce-quality .glass-popup,
.reduce-quality .widget-card {
  backdrop-filter: none !important;
  box-shadow: none !important;
  transition: none !important;
}

.app-root { display: flex; flex-direction: column; width: 100%; height: 100%; position: relative; }

/* Top Bar */
.top-bar {
  height: 44px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between;
  border-radius: 0; border-left: 0; border-right: 0; border-top: 0; z-index: 40;
}
.top-bar.autohidden { position: fixed; top: 0; left: 0; right: 0; transform: translateY(-40px); opacity: 0.15; }
.top-bar.autohidden:hover { transform: translateY(0); opacity: 1; }
.bar-left, .bar-right, .bar-center { display: flex; align-items: center; gap: 8px; }
.brand-mini { width: 24px; height: 24px; border-radius: 7px; }
.device-badge { font-weight: 700; color: #f8fafc; padding: 3px 8px; background: rgba(255,255,255,0.06); border-radius: 8px; }
.stat-pill { font-size: 11px; color: var(--muted); padding: 3px 8px; border-radius: 8px; background: rgba(255,255,255,0.04); }

.mode-pill { display: flex; background: rgba(255,255,255,0.06); border-radius: 9px; padding: 2px; border: 1px solid rgba(255,255,255,0.08); }
.seg-btn {
  background: transparent; color: var(--muted); border: none; padding: 5px 12px;
  border-radius: 7px; font-weight: 600; cursor: pointer; font-family: inherit; font-size: 12px;
}
.seg-btn.active { background: var(--accent); color: #04101c; }

.icon-pill, .btn-tiny, .btn-primary, .btn-secondary {
  border-radius: 9px; border: 1px solid var(--border); padding: 6px 12px;
  font-family: inherit; font-weight: 600; cursor: pointer; font-size: 12px;
  transition: transform 120ms ease, background 150ms ease, border-color 150ms ease;
}
.icon-pill, .btn-secondary, .btn-tiny { background: rgba(26, 37, 58, 0.85); color: var(--text); }
.icon-pill:hover, .btn-secondary:hover, .btn-tiny:hover { background: rgba(38, 53, 82, 0.95); border-color: var(--accent); }
.btn-tiny { padding: 4px 10px; font-size: 11.5px; }
.btn-primary { background: var(--accent); color: #051320; border-color: transparent; font-weight: 700; }
.btn-primary:hover { filter: brightness(1.08); }
.icon-pill.danger { border-color: rgba(239, 68, 68, 0.4); color: #fca5a5; }
.icon-pill.danger:hover { background: rgba(220, 38, 38, 0.35); }

input, select {
  background: rgba(11, 17, 29, 0.9); color: var(--text); border: 1px solid var(--border);
  border-radius: 9px; padding: 7px 10px; font-family: inherit; font-size: inherit; outline: none;
}
input:focus, select:focus { border-color: var(--accent); }

/* Stage & Welcome */
.stage { flex: 1; position: relative; overflow: hidden; }
.welcome-view {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: radial-gradient(circle at 20% 20%, rgba(41,182,246,0.14), transparent 55%), #070b12;
  overflow: auto;
}
.welcome-card { width: min(980px, 100%); padding: 26px; animation: popIn 260ms var(--ease-spring); }
.welcome-hero { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.hero-logo { width: 58px; height: 58px; border-radius: 16px; }
.title-row { display: flex; align-items: center; gap: 10px; }
.title-row h1 { margin: 0; font-size: 26px; font-weight: 800; }
.version-pill { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: 2px 10px; font-size: 11px; font-weight: 700; }
.subtitle { margin: 4px 0 0; color: var(--muted); }
.welcome-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 780px) { .welcome-grid { grid-template-columns: 1fr; } }

.seg-group { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.seg-group.compact { grid-template-columns: 1fr 1fr; background: rgba(255,255,255,0.05); padding: 4px; border-radius: 11px; }
.seg-card {
  text-align: left; background: rgba(15, 22, 36, 0.85); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; cursor: pointer;
}
.seg-card b { display: block; margin-bottom: 4px; }
.seg-card span { color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.seg-card.active { border-color: var(--accent); background: var(--accent-soft); }

.preset-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.preset-pill { background: rgba(17,25,40,0.85); color: var(--muted); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; cursor: pointer; font-weight: 700; font-family: inherit; }
.preset-pill.active { background: var(--accent); color: #051320; border-color: transparent; }
.field-label { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; margin-top: 10px; }
.quick-actions-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.input-row { display: flex; gap: 6px; }
.input-row input { flex: 1; }
.devices-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 14px; max-height: 185px; overflow-y: auto; }
.device-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-radius: 12px; background: rgba(12, 18, 30, 0.88); border: 1px solid var(--border);
}

/* Desktop Session & Widgets */
.session-view { position: relative; width: 100%; height: 100%; }
.wallpaper-layer, .wallpaper-dim, .desktop-canvas, .stream-wrap {
  position: absolute; inset: 0; width: 100%; height: 100%;
}
.wallpaper-layer { background-size: cover; background-position: center; background-color: #0b1120; }
.wallpaper-dim { background: rgba(4, 8, 16, 0.18); pointer-events: none; }
.desktop-canvas { z-index: 5; overflow: hidden; }
.stream-wrap { z-index: 12; display: flex; align-items: center; justify-content: center; background: #000; }
.stream-wrap canvas { max-width: 100%; max-height: 100%; outline: none; cursor: default; }

.shortcut-tile {
  position: absolute; width: 82px; display: flex; flex-direction: column; align-items: center;
  gap: 5px; padding: 8px 4px; border-radius: 14px; cursor: pointer; transition: background 150ms ease;
}
.shortcut-tile:hover { background: rgba(255,255,255,0.12); }
.shortcut-icon {
  width: 46px; height: 46px; border-radius: 13px; background: rgba(20, 31, 52, 0.92);
  border: 1px solid rgba(255,255,255,0.18); display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px; overflow: hidden;
}
.shortcut-icon img { width: 100%; height: 100%; object-fit: cover; }
.shortcut-label { font-size: 11.5px; text-align: center; text-shadow: 0 1px 4px #000; max-width: 78px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Authentic Material You Desktop Widgets */
.widget-card {
  position: absolute; background: rgba(16, 24, 38, 0.84); backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,0.14); border-radius: 20px; padding: 12px 14px;
  color: var(--text); box-shadow: 0 10px 28px rgba(0,0,0,0.35);
  transition: border-color 150ms ease, transform 160ms var(--ease-spring);
}
.widget-card:hover { border-color: var(--accent); }
.widget-card.borderless { background: transparent; border-color: transparent; box-shadow: none; backdrop-filter: none; }
.widget-card.notes-amber { background: rgba(34, 28, 16, 0.88); border-color: rgba(250, 204, 21, 0.35); }
.widget-card.weather-sky { background: linear-gradient(155deg, rgba(22,42,74,0.88), rgba(13,25,44,0.92)); }
.widget-pill-btn {
  background: rgba(255,255,255,0.09); border: 1px solid rgba(255,255,255,0.15); color: var(--text);
  border-radius: 10px; padding: 4px 10px; font-size: 11px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.widget-pill-btn.primary { background: var(--accent); color: #051320; border-color: transparent; }
.widget-pill-btn:hover { filter: brightness(1.12); }

.calc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 8px; }
.calc-disp { background: rgba(7, 11, 20, 0.9); border: 1px solid rgba(255,255,255,0.12); border-radius: 10px; padding: 7px 10px; text-align: right; font-size: 20px; font-weight: 700; }
.calc-btn { border: none; border-radius: 9px; padding: 8px 0; font-weight: 700; font-size: 13px; cursor: pointer; background: rgba(255,255,255,0.1); color: #f8fafc; font-family: inherit; }
.calc-btn.op { background: var(--accent); color: #051320; }
.calc-btn.wide { grid-column: span 2; }

/* Dock */
.bottom-dock {
  height: 52px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between;
  border-radius: 0; border-left: 0; border-right: 0; border-bottom: 0; z-index: 40;
}
.dock-left, .dock-pinned, .dock-right { display: flex; align-items: center; gap: 8px; }
.dock-btn {
  background: rgba(255,255,255,0.07); color: var(--text); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 11px; padding: 6px 12px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.dock-btn.accent { background: var(--accent); color: #051320; border-color: transparent; }
.dock-btn:hover { border-color: var(--accent); }
.dock-clock { font-weight: 700; padding: 0 6px; }
.badge { background: var(--accent); color: #051320; border-radius: 999px; padding: 1px 6px; font-size: 10.5px; font-weight: 800; }

/* Popups & Modals */
.glass-popup {
  position: fixed; z-index: 60; background: var(--glass); backdrop-filter: blur(24px);
  border: 1px solid var(--border); border-radius: 18px; padding: 14px;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.58); animation: popIn 180ms var(--ease-spring);
}
.launcher-popup { bottom: 60px; left: 14px; width: 420px; max-height: 460px; display: flex; flex-direction: column; }
.qs-popup { bottom: 60px; right: 14px; width: 320px; }
.notif-popup { bottom: 60px; right: 14px; width: 350px; max-height: 440px; display: flex; flex-direction: column; }
.popup-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.apps-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; overflow-y: auto; padding-right: 4px; }
.app-cell { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 4px; border-radius: 12px; cursor: pointer; text-align: center; font-size: 11.5px; }
.app-cell:hover { background: rgba(255,255,255,0.1); }
.qs-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.qs-tile { padding: 10px 6px; border-radius: 12px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08); text-align: center; cursor: pointer; font-weight: 600; font-size: 11.5px; }
.qs-tile.active { background: var(--accent); color: #051320; border-color: transparent; }
.qs-sliders { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; font-size: 12px; }
.qs-sliders input { width: 100%; margin-top: 4px; }
.notif-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.notif-row { background: rgba(255,255,255,0.06); border-radius: 11px; padding: 9px 11px; display: flex; justify-content: space-between; gap: 8px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(4, 7, 14, 0.72); display: flex; align-items: center; justify-content: center; padding: 18px; }
.modal-card { width: min(680px, 100%); max-height: 86vh; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.modal-card.wide { width: min(920px, 100%); }
.modal-head, .modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.widget-catalog-list { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; max-height: 56vh; padding-right: 4px; }
.widget-catalog-card {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: 14px; background: rgba(22, 31, 48, 0.85); border: 1px solid rgba(255,255,255,0.1);
}
.widget-preview-box {
  width: 136px; height: 76px; flex-shrink: 0; border-radius: 12px;
  background: rgba(9, 14, 24, 0.9); border: 1px solid rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 4px;
}

.settings-layout { display: flex; gap: 14px; min-height: 360px; overflow: hidden; }
.settings-nav { width: 190px; display: flex; flex-direction: column; gap: 6px; }
.snav-btn { text-align: left; background: transparent; color: var(--muted); border: 1px solid transparent; padding: 9px 12px; border-radius: 10px; cursor: pointer; font-weight: 600; font-family: inherit; }
.snav-btn.active { background: var(--accent-soft); color: #f8fafc; border-color: var(--accent); }
.settings-body { flex: 1; overflow-y: auto; padding-right: 6px; }
.stab-pane { display: none; }
.stab-pane.active { display: block; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.check-col { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.font-preview-box { background: rgba(255,255,255,0.06); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.swatch.active { border-color: #fff; }
.wall-thumb { width: 60px; height: 38px; border-radius: 8px; border: 2px solid transparent; padding: 0; overflow: hidden; cursor: pointer; }
.wall-thumb.active { border-color: var(--accent); }
.wall-thumb img { width: 100%; height: 100%; object-fit: cover; }

.keymap-overlay { position: absolute; inset: 0; pointer-events: none; z-index: 20; }
.keymap-node-pin {
  position: absolute; transform: translate(-50%, -50%); min-width: 34px; height: 34px;
  padding: 0 8px; border-radius: 50%; background: rgba(12, 18, 30, 0.8);
  border: 2px solid var(--accent); color: #fff; display: flex; align-items: center;
  justify-content: center; font-weight: 800; font-size: 11px;
}
.keymap-overlay.editing { pointer-events: auto; background: rgba(0,0,0,0.22); }
.keymap-overlay.editing .keymap-node-pin { cursor: grab; }
.editor-bar { position: fixed; top: 52px; left: 50%; transform: translateX(-50%); z-index: 55; border-radius: 14px; padding: 7px 14px; display: flex; align-items: center; gap: 10px; }

.context-menu { position: fixed; z-index: 95; min-width: 195px; padding: 6px; border-radius: 14px; display: flex; flex-direction: column; gap: 2px; }
.ctx-item { background: transparent; border: none; color: var(--text); text-align: left; padding: 8px 12px; border-radius: 9px; cursor: pointer; font-family: inherit; }
.ctx-item:hover { background: var(--accent-soft); }

.drop-overlay { position: fixed; inset: 0; z-index: 90; background: rgba(9, 13, 20, 0.78); display: flex; align-items: center; justify-content: center; pointer-events: none; }
.drop-box { border: 2px dashed var(--accent); border-radius: 20px; padding: 36px 48px; font-size: 18px; font-weight: 700; }

.toast-area { position: fixed; top: 54px; right: 16px; z-index: 99; display: flex; flex-direction: column; gap: 8px; }
.toast-msg { background: var(--glass); border: 1px solid var(--accent); border-radius: 12px; padding: 10px 14px; font-weight: 600; animation: popIn 180ms var(--ease-spring); }

@keyframes popIn {
  from { opacity: 0; transform: scale(0.96) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
