/* ════════════════════════════════════════════════════════════════════════
   MAGICIUM ONE — Launcher Styles
   ════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700;900&family=Fira+Code:wght@300;400;500&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #07020f;
  --bg2:       #0a0318;
  --bg3:       #0d0520;
  --border:    #4a1d9628;
  --border2:   #4a1d9650;
  --purple:    #7c3aed;
  --purple2:   #a78bfa;
  --purple3:   #c4b5fd;
  --dim:       #4a2d70;
  --dimmer:    #3a1d60;
  --dimmest:   #2a1050;
  --text:      #e2d8ff;
  --topbar-h:  52px;
  --sidebar-w: 220px;
  --bottombar-h: 64px;
  --font:      'Cinzel', serif;
  --mono:      'Fira Code', monospace;
}

html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--text);
  font-family: var(--font);
  user-select: none;
  -webkit-user-select: none;
}

/* ── Layout shell ─────────────────────────────────────────────── */
#m1-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: var(--topbar-h) 1fr var(--bottombar-h);
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-areas:
    "topbar topbar"
    "sidebar main"
    "bottombar bottombar";
  width: 100vw; height: 100vh;
}

/* ── Top bar ──────────────────────────────────────────────────── */
#m1-topbar {
  grid-area: topbar;
  background: #050110;
  border-bottom: 1px solid var(--border2);
  display: flex; align-items: center; gap: 14px;
  padding: 0 18px;
  z-index: 100;
  box-shadow: 0 2px 20px #00000060;
}

.m1-logo {
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.m1-logo-hex {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #4a1d94, #7c3aed);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
  box-shadow: 0 0 16px #7c3aed60;
}
.m1-logo-text {
  font-size: 13px; font-weight: 700; color: var(--purple3);
  letter-spacing: .15em; line-height: 1;
}
.m1-logo-sub {
  font-size: 7px; color: var(--dim); letter-spacing: .2em; margin-top: 3px;
}
.m1-logo-divider {
  width: 1px; height: 28px; background: var(--border2); margin: 0 4px;
}

.m1-nav { display: flex; gap: 2px; flex: 1; }
.m1-nav-btn {
  padding: 6px 12px; background: transparent;
  border: none; border-radius: 6px;
  font-family: var(--font); font-size: 8px; color: var(--dim);
  cursor: pointer; letter-spacing: .08em;
  transition: all .15s;
}
.m1-nav-btn:hover  { color: var(--purple2); background: #7c3aed12; }
.m1-nav-btn.active { color: var(--purple2); background: #7c3aed18; }

.m1-topbar-right {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.m1-user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px; background: #7c3aed12;
  border: 1px solid var(--border2); border-radius: 20px;
  cursor: pointer; transition: all .15s;
}
.m1-user-chip:hover { background: #7c3aed20; border-color: #7c3aed50; }
.m1-user-avatar { font-size: 14px; }
.m1-user-name { font-size: 9px; color: var(--purple2); letter-spacing: .06em; }
.m1-settings-btn {
  width: 32px; height: 32px; background: transparent;
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--dim); font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.m1-settings-btn:hover { border-color: var(--border2); color: var(--purple2); }

/* ── Sidebar ──────────────────────────────────────────────────── */
#m1-sidebar {
  grid-area: sidebar;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}

.m1-sidebar-search {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.m1-sidebar-search input {
  width: 100%; background: var(--bg3);
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--purple3); font-family: var(--font); font-size: 9px;
  padding: 7px 10px; outline: none;
  transition: border-color .15s;
}
.m1-sidebar-search input:focus { border-color: #7c3aed60; }
.m1-sidebar-search input::placeholder { color: var(--dimmer); }

.m1-cat-bar {
  display: flex; gap: 4px; padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap; flex-shrink: 0;
}
.m1-cat-btn {
  padding: 3px 8px; background: transparent;
  border: 1px solid transparent; border-radius: 10px;
  font-family: var(--font); font-size: 7px; color: var(--dimmer);
  cursor: pointer; transition: all .15s;
}
.m1-cat-btn:hover  { color: var(--dim); border-color: var(--border); }
.m1-cat-btn.active { color: var(--purple2); background: #7c3aed18; border-color: #7c3aed40; }

.m1-app-list {
  flex: 1; overflow-y: auto; padding: 6px 8px;
  scrollbar-width: thin; scrollbar-color: var(--border2) transparent;
}

.m1-app-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 10px;
  cursor: pointer; transition: all .15s; margin-bottom: 2px;
  border: 1px solid transparent;
  position: relative;
}
.m1-app-item:hover  { background: #7c3aed10; border-color: var(--border); }
.m1-app-item.active { background: #7c3aed18; border-color: #7c3aed40; }
.m1-app-item.active::before {
  content: ''; position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 3px; background: var(--purple); border-radius: 0 2px 2px 0;
}

.m1-app-item-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
  border: 1px solid transparent;
  transition: all .15s;
}
.m1-app-item.active .m1-app-item-icon { box-shadow: 0 0 12px var(--glow, #7c3aed40); }

.m1-app-item-info { flex: 1; min-width: 0; }
.m1-app-item-name { font-size: 9px; color: var(--purple3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m1-app-item-ver  { font-size: 7px; color: var(--dimmer); margin-top: 2px; }

.m1-app-tag {
  font-size: 6px; padding: 2px 5px; border-radius: 4px;
  letter-spacing: .06em; flex-shrink: 0; font-weight: 700;
}

.m1-sidebar-footer {
  padding: 10px 12px; border-top: 1px solid var(--border);
  font-size: 7px; color: var(--dimmest); letter-spacing: .1em;
  flex-shrink: 0;
}

/* ── Main panel ───────────────────────────────────────────────── */
#m1-main {
  grid-area: main;
  display: flex; flex-direction: column;
  overflow: hidden; position: relative;
}

/* Animated bg particles */
#m1-canvas-bg {
  position: absolute; inset: 0; z-index: 0;
  pointer-events: none;
}

.m1-main-inner {
  position: relative; z-index: 1;
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden;
}

/* App banner */
.m1-banner {
  height: 240px; flex-shrink: 0; position: relative; overflow: hidden;
}
.m1-banner-bg {
  position: absolute; inset: 0;
  transition: background 0.4s ease;
}
.m1-banner-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.02) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, transparent, black 30%, black 70%, transparent);
}
.m1-banner-glow {
  position: absolute; inset: 0;
  transition: background 0.4s ease;
}
.m1-banner-content {
  position: absolute; inset: 0;
  display: flex; align-items: flex-end;
  padding: 24px 28px;
  background: linear-gradient(to top, #07020f 0%, transparent 60%);
}
.m1-banner-icon {
  font-size: 52px; margin-right: 20px; flex-shrink: 0;
  filter: drop-shadow(0 0 20px var(--accent, #7c3aed));
}
.m1-banner-text { flex: 1; }
.m1-banner-name {
  font-size: 28px; font-weight: 900; letter-spacing: .08em;
  color: #fff; line-height: 1;
  text-shadow: 0 0 30px var(--accent, #7c3aed);
}
.m1-banner-sub { font-size: 10px; color: var(--purple2); margin-top: 5px; letter-spacing: .12em; }
.m1-banner-badges { display: flex; gap: 8px; margin-top: 8px; }
.m1-banner-badge {
  font-size: 8px; padding: 3px 10px; border-radius: 12px;
  letter-spacing: .08em; font-weight: 700;
}
.m1-banner-ver-badge {
  background: #ffffff18; border: 1px solid #ffffff30;
  color: #ffffff90; font-size: 8px; padding: 3px 10px;
  border-radius: 12px; letter-spacing: .06em;
}

/* App detail scroll area */
.m1-detail {
  flex: 1; overflow-y: auto;
  padding: 20px 28px;
  scrollbar-width: thin; scrollbar-color: var(--border2) transparent;
  display: grid; grid-template-columns: 1fr 280px; gap: 20px;
}

.m1-desc {
  font-family: system-ui, sans-serif; font-size: 13px;
  color: #8b7ab8; line-height: 1.8; margin-bottom: 18px;
}

.m1-section-label {
  font-size: 8px; color: var(--dim); letter-spacing: .15em;
  margin-bottom: 10px; border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

.m1-features { display: flex; flex-direction: column; gap: 5px; }
.m1-feature-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; background: #7c3aed08;
  border: 1px solid var(--border); border-radius: 8px;
  font-family: system-ui, sans-serif; font-size: 11px; color: #7a6a9a;
  transition: all .15s;
}
.m1-feature-item:hover { background: #7c3aed14; border-color: var(--border2); color: var(--purple3); }

/* Changelog sidebar */
.m1-sidebar-right {
  display: flex; flex-direction: column; gap: 14px;
}

.m1-changelog-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px; overflow: hidden;
}
.m1-changelog-item {
  padding: 7px 0; border-bottom: 1px solid var(--border);
  font-family: system-ui, sans-serif;
}
.m1-changelog-item:last-child { border-bottom: none; padding-bottom: 0; }
.m1-changelog-ver  { font-family: var(--mono); font-size: 9px; color: var(--purple2); }
.m1-changelog-date { font-size: 8px; color: var(--dimmer); }
.m1-changelog-note { font-size: 10px; color: #6b5a8a; margin-top: 3px; line-height: 1.5; }

.m1-info-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px;
}
.m1-info-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 0; font-size: 9px;
  border-bottom: 1px solid var(--border);
}
.m1-info-row:last-child { border-bottom: none; }
.m1-info-label { color: var(--dim); font-family: system-ui; }
.m1-info-val   { color: var(--purple3); }

/* Coming soon overlay */
.m1-coming-soon-banner {
  background: linear-gradient(135deg, #7c3aed18, #4a1d9418);
  border: 1px solid #7c3aed30; border-radius: 10px;
  padding: 12px 16px; margin-bottom: 16px;
  font-size: 10px; color: var(--purple2);
  display: flex; align-items: center; gap: 10px;
}

/* ── Bottom bar ───────────────────────────────────────────────── */
#m1-bottombar {
  grid-area: bottombar;
  background: #050110;
  border-top: 1px solid var(--border2);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  z-index: 100;
  box-shadow: 0 -2px 20px #00000060;
}

.m1-launch-btn {
  height: 40px; min-width: 160px;
  background: linear-gradient(135deg, #4a1d94, #7c3aed);
  border: none; border-radius: 10px;
  font-family: var(--font); font-size: 11px; font-weight: 700;
  color: #fff; cursor: pointer; letter-spacing: .12em;
  transition: all .2s;
  box-shadow: 0 0 20px #7c3aed40;
  position: relative; overflow: hidden;
  flex-shrink: 0;
}
.m1-launch-btn::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, #ffffff20, transparent);
  opacity: 0; transition: opacity .2s;
}
.m1-launch-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 24px #7c3aed60; }
.m1-launch-btn:hover::after { opacity: 1; }
.m1-launch-btn:active { transform: translateY(0); }
.m1-launch-btn.disabled {
  background: #2a1a4a; color: var(--dimmer); cursor: default;
  box-shadow: none; transform: none;
}
.m1-launch-btn.coming-soon {
  background: linear-gradient(135deg, #1a1040, #2a1a50);
  color: var(--dim); cursor: default; box-shadow: none;
}
.m1-launch-btn[data-accent] { background: var(--btn-bg, linear-gradient(135deg,#4a1d94,#7c3aed)); }

.m1-status-area { flex: 1; }
.m1-status-line {
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
}
.m1-status-dot {
  width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
}
.m1-status-dot.ready   { background: #4ade80; box-shadow: 0 0 6px #4ade80; }
.m1-status-dot.loading { background: #f59e0b; animation: pulse 1s infinite; }
.m1-status-dot.error   { background: #f87171; }
.m1-status-dot.soon    { background: var(--dim); }

.m1-status-text { font-size: 9px; color: var(--dim); letter-spacing: .06em; }
.m1-progress-bar {
  height: 3px; background: var(--border);
  border-radius: 2px; overflow: hidden;
}
.m1-progress-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--purple), #c4b5fd);
  border-radius: 2px; transition: width .3s ease;
}

.m1-bottombar-right {
  display: flex; align-items: center; gap: 12px; flex-shrink: 0;
}
.m1-version-chip {
  font-family: var(--mono); font-size: 8px; color: var(--dimmer);
  letter-spacing: .06em;
}

/* ── Particles / animations ───────────────────────────────────── */
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.4; } }
@keyframes float {
  0%,100% { transform: translateY(0px); }
  50%      { transform: translateY(-6px); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

.m1-anim-in { animation: fadeIn .25s ease forwards; }

/* ── News ticker ──────────────────────────────────────────────── */
.m1-ticker-wrap {
  flex: 1; overflow: hidden; position: relative;
  height: 18px;
}
.m1-ticker {
  display: flex; gap: 40px;
  animation: ticker 30s linear infinite;
  white-space: nowrap;
}
.m1-ticker:hover { animation-play-state: paused; }
@keyframes ticker { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }
.m1-ticker-item { font-size: 8px; color: var(--dimmer); letter-spacing: .06em; }
.m1-ticker-item span { color: var(--dim); }

/* ── Scrollbars ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--purple); }

/* ── Responsive tweaks ────────────────────────────────────────── */
@media (max-width: 700px) {
  :root { --sidebar-w: 60px; }
  .m1-app-item-info, .m1-app-tag { display: none; }
  .m1-app-item { justify-content: center; padding: 10px 0; }
  .m1-logo-text, .m1-logo-sub { display: none; }
  .m1-sidebar-search, .m1-cat-bar { display: none; }
  .m1-detail { grid-template-columns: 1fr; }
  .m1-sidebar-right { display: none; }
}
