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

:root {
  --accent-hue: 210;
  --accent-sat: 90%;
  --accent: hsl(var(--accent-hue) var(--accent-sat) 55%);
  --accent-soft: hsla(var(--accent-hue), 90%, 60%, 0.14);

  --bg: #050508;
  --bg-elevated: rgba(17, 18, 24, 0.96);
  --bg-elevated-soft: rgba(19, 21, 30, 0.65);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text-main: #f8f8fb;
  --text-muted: rgba(240, 240, 250, 0.7);
  --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.6);

  --radius-xl: 20px;
  --radius-pill: 999px;

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  --font-base-size: 16px;
}

[data-theme="light"] {
  --bg: #f4f5fb;
  --bg-elevated: #ffffff;
  --bg-elevated-soft: #fdfdff;
  --border-subtle: rgba(15, 18, 30, 0.06);
  --border-strong: rgba(15, 18, 30, 0.14);
  --text-main: #151625;
  --text-muted: rgba(20, 20, 40, 0.7);
  --shadow-soft: 0 16px 35px rgba(5, 10, 30, 0.08);
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  background: radial-gradient(circle at top left, #151628 0, #050509 40%, #050508 100%);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body.has-wallpaper {
  /* When wallpaper is active, we use inline style for the image
     and keep things simple here. You can add subtle overlays if you want. */
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top bar */

.top-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.75rem;
  backdrop-filter: blur(26px);
  background: linear-gradient(to bottom, rgba(6, 7, 13, 0.92), rgba(6, 7, 13, 0.6), transparent);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 14px;
  background: radial-gradient(circle at top left, var(--accent) 0, #111320 52%, #05060b 100%);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.66);
  color: var(--text-main); /* used by the SVG strokes */
}

.brand-icon {
  width: 18px;
  height: 18px;
  display: block;
}

.brand-text {
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Buttons */

.btn {
  font-family: inherit;
  font-size: 0.85rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  padding: 0.5rem 0.95rem;
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition:
    background 140ms ease,
    color 140ms ease,
    border-color 140ms ease,
    transform 100ms ease,
    box-shadow 140ms ease;
  white-space: nowrap;
}

.btn.ghost {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(10, 10, 15, 0.56);
}

.btn.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), hsl(var(--accent-hue) 95% 68%));
  color: #050609;
  box-shadow: 0 14px 35px hsla(var(--accent-hue), 85%, 55%, 0.4);
}

.btn.tiny {
  font-size: 0.75rem;
  padding: 0.3rem 0.7rem;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn.primary:hover {
  box-shadow: 0 16px 42px hsla(var(--accent-hue), 85%, 55%, 0.5);
  filter: brightness(1.03);
}

.btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.top-controls {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

/* Desktop */

.desktop {
  flex: 1;
  padding: 0 1.8rem 1.8rem;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

.desktop-header {
  padding: 1.25rem 0 0.75rem;
  text-align: left;         /* inherits to headline/subhead */
}

.headline {
  font-size: clamp(1.8rem, 2.9vw, 2.4rem);
  letter-spacing: -0.03em;
  margin: 0 0 0.4rem;
}

.subhead {
  margin: 0.4rem 0 0;       /* no auto centering */
  max-width: 40rem;         /* keeps it from getting too wide */
  font-size: 0.95rem;
  text-align: left;
  color: var(--text-muted);
}

.desktop-header-content {
  max-width: 48rem;
  margin: 0 auto 0.75rem;
}

.desktop-intro-text {
  margin: 0.6rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.desktop-header-list {
  margin: 0.9rem 0 0;
  padding-left: 0;
  list-style: none;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: left;
  max-width: 40rem;
  margin-left: auto;
  margin-right: auto;
}

.desktop-header-list li + li {
  margin-top: 0.25rem;
}

.desktop-header-toggle {
  display: inline-flex;
  margin-top: 0.1rem;
}

/* Collapsed state: hide only the content, keep the button */
.desktop-header.collapsed #desktop-header-content {
  display: none;
}

.desktop-header-text {
  width: 100%;
  max-width: 44rem;
}

.desktop-header-actions {
  width: 100%;
  display: flex;
  flex-direction: row;         /* tip + button on one line */
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.desktop-header-tip {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: left;
}

.desktop-header-list {
  margin: 0.75rem 0 0;
  padding-left: 1.1rem;
  list-style: none;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.desktop-header-list li + li {
  margin-top: 0.25rem;
}


.desktop-header-list li + li {
  margin-top: 0.25rem;
}

.desktop-header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  min-width: 220px;
}

.desktop-header-tip {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: right;
}

/* Collapsed state */

.desktop-header.collapsed .desktop-header-inner {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transition:
    max-height 200ms ease,
    opacity 160ms ease;
}

.desktop-header:not(.collapsed) .desktop-header-inner {
  transition:
    max-height 200ms ease,
    opacity 160ms ease;
}

.desktop-header.collapsed {
  padding-bottom: 0.3rem;
}


.headline {
  font-size: clamp(1.8rem, 2.9vw, 2.4rem);
  letter-spacing: -0.03em;
  margin: 0 0 0.3rem;
}

.subhead {
  margin: 0;
  color: var(--text-muted);
  max-width: 36rem;
  font-size: 0.95rem;
}

/* Panel grid */

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.35rem;
  padding: 1.25rem 0 2.5rem;
}

.panel {
  position: relative;
  border-radius: var(--radius-xl);
  background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.06), transparent 55%),
    var(--bg-elevated-soft);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  padding: 1.2rem 1.15rem 1.1rem;
  display: flex;
  flex-direction: column;
  min-height: 180px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.panel-title {
  margin: 0;
  font-size: 0.96rem;
  letter-spacing: -0.01em;
}

.panel-subtitle {
  margin: 0.15rem 0 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.panel-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: radial-gradient(circle at top left, var(--accent-soft), transparent 80%);
}

.panel-tools {
  display: flex;
  gap: 0.3rem;
  align-items: center;
}

.icon-btn {
  border: none;
  background: transparent;
  padding: 0.15rem;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  transition: background 120ms ease, color 120ms ease, transform 80ms ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  transform: translateY(-0.5px);
}

.icon-btn:active {
  transform: translateY(0);
}

/* Links – OS-style launcher grid */

.link-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 1rem 1rem;
  margin: 0;
  padding: 0.4rem 0 0.2rem;
  list-style: none;
}

.link-item {
  display: flex;
  justify-content: center;
}

.link-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.4rem;                         /* tighter spacing */
  width: 100%;
  max-width: 110px;                    /* was 130px */
  min-height: 90px;                    /* was 120px */
  padding: 0.55rem 0.5rem 0.5rem;      /* less padding */
  border-radius: 16px;                 /* slightly smaller corners */
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.16), transparent 55%),
    rgba(10, 10, 18, 0.96);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);  /* a bit softer */
  font-size: 0.78rem;                  /* slightly smaller label */
  color: var(--text-main);
  text-decoration: none;
  text-align: center;
  overflow: hidden;
  transition:
    transform 120ms ease,
    box-shadow 150ms ease,
    border-color 130ms ease,
    background 150ms ease;
}

[data-theme="light"] .link-chip {
  background:
    radial-gradient(circle at top left, rgba(0, 0, 0, 0.05), transparent 55%),
    #ffffff;
}

.link-chip span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.link-chip:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
  border-color: var(--accent-soft);
  background:
    radial-gradient(circle at top left, var(--accent-soft), transparent 60%),
    rgba(10, 10, 18, 0.98);
}

.link-chip:active {
  transform: translateY(-2px) scale(0.98);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.55);
}

/* Icon inside each "app" */

.link-favicon {
  width: 36px;              /* was 48px */
  height: 36px;             /* was 48px */
  border-radius: 12px;      /* slightly smaller corner */
  background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.18), transparent 70%);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.55);
  object-fit: cover;
}


/* Modals */

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(3, 4, 8, 0.7);
  backdrop-filter: blur(18px);
  z-index: 40;
}

.modal-backdrop.hidden {
  display: none;
}

.modal {
  width: min(540px, 100% - 2.5rem);
  border-radius: 22px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-soft);
  padding: 1.1rem 1.15rem 1.05rem;
}

.modal-header {
  padding: 0.3rem 0 0.7rem;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.02rem;
}

.modal-body {
  padding: 0.1rem 0 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding-top: 0.35rem;
}

/* Form controls */

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
}

.field-label {
  color: var(--text-muted);
  font-weight: 500;
}

.field-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.input {
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.45rem 0.6rem;
  border-radius: 11px;
  border: 1px solid var(--border-subtle);
  background: rgba(10, 10, 16, 0.85);
  color: var(--text-main);
  outline: none;
  min-width: 0;
}

[data-theme="light"] .input {
  background: rgba(255, 255, 255, 0.9);
}

.input:focus {
  border-color: hsla(var(--accent-hue), 95%, 64%, 0.9);
  box-shadow: 0 0 0 1px hsla(var(--accent-hue), 95%, 64%, 0.6);
}

.input[type="range"] {
  padding: 0;
  background: transparent;
}

/* Links editor */

.links-editor {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.1rem;
}

.link-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.8fr) auto;
  gap: 0.35rem;
  align-items: center;
}

/* Responsive adjustments */

@media (max-width: 720px) {
  .top-bar {
    padding-inline: 1rem;
  }

  .brand-text {
    display: none; /* icon only on tiny screens */
  }

  .desktop {
    padding-inline: 1rem;
  }

  .desktop-header {
    padding-top: 0.9rem;
  }

  .headline {
    font-size: 1.4rem;
  }

  .subhead {
    max-width: 100%;
    font-size: 0.9rem;
  }

  .panel-grid {
    grid-template-columns: minmax(0, 1fr); /* single column */
    gap: 0.9rem;
  }

  .panel {
    padding: 0.9rem;
    grid-column: auto !important; /* 🔑 force 1-column width on mobile */
  }

  .link-list {
    grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
    gap: 0.7rem;
  }

  .link-chip {
    max-width: none;
    min-height: 80px;
    padding: 0.45rem 0.4rem; 
  }

  .link-favicon {
    width: 32px;
    height: 32px;
  }

  .link-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .modal {
    width: calc(100% - 2rem);
  }
}

.link-item.dragging {
  opacity: 0.3;
}

.link-item.placeholder {
  border: 1px dashed var(--accent);
  background: rgba(255,255,255,0.05);
  height: 72px;
  border-radius: 14px;
}
