.taskbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--taskbar-h);
  z-index: var(--z-taskbar);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  background: var(--bg-mica);
  backdrop-filter: blur(40px) saturate(1.6);
  border-top: 1px solid var(--border);
  box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.04);
}

.taskbar-center {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.taskbar-center::-webkit-scrollbar { display: none; }

.taskbar-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  position: relative;
  transition: background 0.12s ease;
  flex-shrink: 0;
}

.taskbar-btn:hover {
  background: var(--bg-hover);
}

.taskbar-btn.active {
  background: var(--bg-active);
}

.taskbar-btn.open::after {
  content: "";
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 3px;
  border-radius: 2px;
  background: var(--text-secondary);
}

.taskbar-btn.open.active::after,
.taskbar-btn.open.focused::after {
  width: 16px;
  background: var(--accent);
}

.taskbar-btn .icon {
  font-size: 22px;
  line-height: 1;
}

.taskbar-start-icon {
  width: 22px;
  height: 22px;
}

.taskbar-tray {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  height: 40px;
  padding: 0 6px;
  border-radius: var(--radius-md);
}

.taskbar-tray:hover {
  background: var(--bg-hover);
}

.tray-item {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 32px;
  padding: 0 4px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
}

.tray-clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.15;
  font-size: 12px;
  padding: 0 8px;
  min-width: 64px;
}

.tray-clock .date {
  color: var(--text-secondary);
  font-size: 11px;
}

/* Start menu */
.start-menu {
  position: absolute;
  left: 50%;
  bottom: calc(var(--taskbar-h) + 12px);
  transform: translateX(-50%);
  z-index: var(--z-start);
  width: min(640px, calc(100vw - 16px));
  max-height: min(720px, calc(100vh - var(--taskbar-h) - 32px));
  background: var(--bg-mica);
  backdrop-filter: blur(60px) saturate(1.8);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: start-in 0.18s ease;
}

.start-menu[hidden] {
  display: none !important;
}

@keyframes start-in {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.start-search {
  padding: 20px 24px 12px;
}

.start-search input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 40px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%235d5d5d' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.656a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E") 14px center no-repeat;
  outline: none;
  color: var(--text);
}

.start-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.start-section {
  padding: 8px 24px 16px;
  overflow-y: auto;
}

.start-section-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.start-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 4px;
}

.start-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: var(--radius-md);
  transition: background 0.12s ease;
}

.start-app:hover {
  background: var(--bg-hover);
}

.start-app-icon {
  font-size: 28px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
}

.start-app-name {
  font-size: 12px;
  text-align: center;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.start-footer {
  margin-top: auto;
  padding: 10px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] .start-footer {
  background: rgba(0, 0, 0, 0.2);
}

.start-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
}

.start-user:hover {
  background: var(--bg-hover);
}

.start-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 13px;
}

.start-power {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  font-size: 18px;
  display: grid;
  place-items: center;
}

.start-power:hover {
  background: var(--bg-hover);
}

/* Context menu */
.context-menu {
  position: fixed;
  z-index: var(--z-context);
  min-width: 200px;
  padding: 4px;
  background: var(--bg-mica);
  backdrop-filter: blur(40px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.context-menu[hidden] {
  display: none !important;
}

.ctx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  text-align: left;
  font-size: 13px;
}

.ctx-item:hover:not(:disabled) {
  background: var(--bg-hover);
}

.ctx-item:disabled {
  opacity: 0.45;
  cursor: default;
}

.ctx-sep {
  height: 1px;
  margin: 4px 8px;
  background: var(--border);
}

/* Quick settings flyout */
.flyout {
  position: absolute;
  bottom: calc(var(--taskbar-h) + 12px);
  right: 12px;
  z-index: var(--z-start);
  width: min(360px, calc(100vw - 24px));
  background: var(--bg-mica);
  backdrop-filter: blur(50px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 16px;
  animation: start-in 0.18s ease;
}

.flyout[hidden] {
  display: none !important;
}

.qs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.qs-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  text-align: left;
  min-height: 72px;
}

.qs-tile.on {
  background: color-mix(in srgb, var(--accent) 18%, var(--bg-card));
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.qs-tile .label {
  font-size: 12px;
}

.qs-slider {
  width: 100%;
  margin-top: 4px;
}

.qs-slider input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

@media (max-width: 700px) {
  .taskbar-tray .tray-clock .date {
    display: none;
  }
  .start-menu {
    left: 8px;
    right: 8px;
    width: auto;
    transform: none;
  }
  @keyframes start-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
  }
}
