:root {
  --c-bg: #0a0a0a;
  --c-surface: #161616;
  --c-surface-2: #1f1f1f;
  --c-surface-hover: #2c2c2c;
  --c-border: #262626;
  --c-text: #ffffff;
  --c-text-dim: #999999;
  --c-text-faint: #71717a;
  --c-accent: #ffffff;
  --c-text-secondary: #ddd;
  --c-bg-image: none;
}

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

body {
  background: var(--c-bg);
  color: var(--c-text-secondary);
  font-family: "Inter", system-ui, sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#menu-btn {
  position: fixed;
  top: 110px;
  left: 13px;
  z-index: 200;
  width: 40px;
  height: 40px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  color: var(--c-text);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
#menu-btn:hover { background: var(--c-surface-hover); }
#menu-btn.hidden { display: none; }

#sidebar {
  position: fixed;
  top: 96px;
  left: 0;
  height: calc(100vh - 96px);
  width: 240px;
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  z-index: 199;
  transform: translateX(-100%);
  transition: transform 0.2s ease;
  padding: 24px 16px 16px;
}
#sidebar.open { transform: translateX(0); }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--c-text-dim);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

#sidebar-close {
  color: var(--c-text-dim);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  font-weight: bold;
  text-transform: none;
}
#sidebar-close:hover { color: var(--c-text); }

.sidebar-item {
  display: flex;
  align-items: center;
  color: var(--c-text-secondary);
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  margin-bottom: 4px;
}
.sidebar-item:hover { background: var(--c-surface-2); }
.sidebar-item i { margin-right: 8px; color: var(--c-text-dim); }

.sidebar-group {
  border-top: 1px solid var(--c-border);
  border-bottom: 1px solid var(--c-border);
  padding: 8px 0;
}

.sidebar-group .sidebar-item {
  margin-bottom: 0;
}

.sidebar-group .sidebar-item:not(:last-child) {
  margin-bottom: 4px;
}

#tabbar {
  display: flex;
  align-items: center;
  background: var(--c-surface);
  padding: 6px 8px 0 8px;
  border-bottom: 1px solid var(--c-border);
}

#tabs { display: flex; flex: 1; overflow-x: auto; }

.tab {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--c-surface-2);
  color: var(--c-text-secondary);
  padding: 10px 16px;
  margin-right: 6px;
  border-radius: 10px 10px 0 0;
  cursor: pointer;
  font-size: 14px;
  max-width: 220px;
  min-width: 120px;
}
.tab.active { background: var(--c-bg); color: var(--c-accent); }

.tab-icon {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-dim);
  font-size: 12px;
}

.tab-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.close-btn {
  flex-shrink: 0;
  color: #777;
  font-weight: bold;
  padding: 0 4px;
}
.close-btn:hover { color: var(--c-text); }

.tab.dragging { opacity: 0.4; }
.tab.drag-over { border-left: 2px solid var(--c-accent); }

#newtab-btn {
  background: none; border: none; color: var(--c-text-dim);
  font-size: 14px; cursor: pointer; padding: 4px 12px;
}
#newtab-btn:hover { color: var(--c-text); }

#toolbar {
  display: flex; align-items: center; gap: 6px;
  background: var(--c-surface); padding: 8px; border-bottom: 1px solid var(--c-border);
}

#toolbar button {
  background: var(--c-surface-2); border: none; color: var(--c-text-secondary);
  border-radius: 6px; width: 32px; height: 32px; cursor: pointer;
  font-size: 13px; flex-shrink: 0;
}
#toolbar button:hover { background: var(--c-surface-hover); }

#address-bar {
  flex: 1; background: var(--c-surface-2); border: 1px solid var(--c-border);
  border-radius: 20px; padding: 8px 16px; color: var(--c-text-secondary);
  outline: none; font-size: 14px;
}

#tabcontent { flex: 1; position: relative; }

#tabcontent iframe {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%; border: none; background: #fff;
}

.newtab-page {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), var(--c-bg-image) center/cover no-repeat, var(--c-bg);
  padding: 40px 20px;
}

.nt-clock {
  font-size: 4rem;
  font-weight: 600;
  letter-spacing: -2px;
  color: var(--c-text);
}

.nt-date {
  font-size: 14px;
  color: var(--c-text-faint);
  margin-bottom: 32px;
}

.nt-searchbar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  padding: 12px 16px;
  width: 100%;
  max-width: 500px;
  margin-bottom: 40px;
}

.nt-searchbar i { color: var(--c-text-faint); font-size: 14px; }

.nt-searchbar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--c-text-secondary);
  font-size: 14px;
  font-family: inherit;
}

.nt-searchbar select {
  background: var(--c-surface-2);
  border: none;
  border-radius: 6px;
  color: var(--c-text-faint);
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  outline: none;
}

.nt-shortcuts {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  max-width: 500px;
  width: 100%;
}

.nt-shortcut {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.nt-shortcut-icon {
  width: 52px;
  height: 52px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.nt-shortcut:hover .nt-shortcut-icon {
  background: var(--c-surface-2);
  transform: translateY(-2px);
}

.nt-shortcut-icon img {
  width: 22px;
  height: 22px;
  filter: brightness(0) invert(0.7);
}

.nt-shortcut-icon i { font-size: 20px; color: var(--c-text-faint); }

.nt-shortcut-label {
  font-size: 11px;
  color: var(--c-text-faint);
  text-align: center;
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nt-shortcut:hover .nt-shortcut-label { color: var(--c-text-secondary); }

.nt-quote {
  position: absolute;
  bottom: 24px;
  font-size: 13px;
  color: var(--c-text-faint);
  max-width: 400px;
  text-align: center;
}

.online-badge {
  position: absolute;
  top: 14px;
  right: 13px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: 8px;
  color: var(--c-text-secondary);
  font-size: 13px;
  font-weight: 500;
  user-select: none;
  pointer-events: none;
}

.online-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-accent);
  box-shadow: 0 0 6px var(--c-accent);
  animation: online-pulse 2s infinite;
}

.online-badge.offline .dot {
  background: var(--c-text-faint);
  box-shadow: none;
  animation: none;
}

@keyframes online-pulse {
  50% { opacity: 0.4; }
}

.content-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 700px;
  margin-bottom: 24px;
}

.content-toolbar.wide { max-width: 1400px; }

.content-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  padding: 10px 14px;
}

.content-search i { color: var(--c-text-faint); font-size: 13px; }

.content-search input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--c-text-secondary);
  font-size: 14px;
  font-family: inherit;
}

.content-sort-select {
  background: var(--c-surface);
  color: var(--c-text-secondary);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
  outline: none;
  flex-shrink: 0;
}

.content-empty {
  color: var(--c-text-faint);
  font-size: 14px;
  text-align: center;
  margin-top: 40px;
  width: 100%;
}

.content-page {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center;
  padding: 60px 20px;
  background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), var(--c-bg-image) center/cover no-repeat, var(--c-bg);
  overflow-y: auto;
}

.content-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: 8px;
}

.content-subtitle {
  font-size: 14px;
  color: var(--c-text-faint);
  margin-bottom: 36px;
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 14px;
  width: 100%;
  max-width: 1400px;
}

.apps-grid .activity-card { aspect-ratio: 1 / 1; }

.activities-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 14px;
  width: 100%;
  max-width: 1400px;
}

.activity-card {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  transition: transform 0.15s ease;
}
.activity-card:hover { transform: translateY(-3px); }

.activity-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.activity-label {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85), rgba(0,0,0,0));
  color: #fff;
  font-size: 12px;
  padding: 20px 8px 6px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-fav-star {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  z-index: 2;
  transition: background 0.15s ease;
}
.activity-fav-star:hover { background: rgba(0, 0, 0, 0.75); }
.activity-fav-star.active { color: #facc15; }

.launch-loading {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: var(--c-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.launch-loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--c-border);
  border-top-color: var(--c-accent);
  border-radius: 50%;
  animation: launch-spin 0.8s linear infinite;
}

@keyframes launch-spin {
  to { transform: rotate(360deg); }
}

.launch-loading-text {
  color: var(--c-text-secondary);
  font-size: 15px;
  font-weight: 600;
}

.launch-loading-subtext {
  color: var(--c-text-faint);
  font-size: 13px;
  text-align: center;
  max-width: 320px;
}

.launch-loading-subtext kbd {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
  color: var(--c-text-secondary);
}

.settings-page {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  display: flex;
  background: var(--c-bg);
  overflow: hidden;
}

.settings-nav {
  width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--c-border);
  padding: 24px 16px;
  overflow-y: auto;
}

.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  cursor: pointer;
  color: var(--c-text-secondary);
  font-size: 14px;
  transition: background 0.15s ease;
}
.settings-nav-item:hover { background: var(--c-surface-2); }
.settings-nav-item.active { background: var(--c-surface-2); border-color: var(--c-text-dim); }

.settings-nav-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--c-surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-secondary);
  font-size: 14px;
  flex-shrink: 0;
}

.settings-content {
  flex: 1;
  padding: 40px 48px 80px;
  overflow-y: auto;
  position: relative;
}

.settings-close {
  position: absolute;
  top: 24px;
  right: 32px;
  color: var(--c-text-dim);
  font-size: 22px;
  cursor: pointer;
}
.settings-close:hover { color: var(--c-text); }

.settings-content-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: 8px;
}

.settings-content-subtitle {
  font-size: 14px;
  color: var(--c-text-faint);
  margin-bottom: 24px;
}

.settings-divider {
  border: none;
  border-top: 1px solid var(--c-border);
  margin-bottom: 24px;
}

.theme-select {
  background: var(--c-surface);
  color: var(--c-text-secondary);
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
  outline: none;
  min-width: 220px;
}

.theme-preview-strip {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.theme-swatch {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
}

.theme-preview-image {
  width: 100%;
  max-width: 320px;
  height: 90px;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  margin-top: 20px;
  border: 1px solid var(--c-border);
}

.misc-section {
  max-width: 700px;
  margin: 0 auto 28px;
  text-align: center;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 16px;
  padding: 28px 32px;
}

.misc-section-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: 24px;
}

.misc-section-divider {
  display: none;
}

.contributors-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  text-align: left;
}

.contributor-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  padding: 14px 16px;
}

.contributor-name {
  font-weight: 700;
  color: var(--c-text);
  font-size: 14px;
}

.contributor-role {
  color: var(--c-text-faint);
  font-size: 12px;
  margin-top: 2px;
}

.support-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: 8px;
}

.support-subtitle {
  font-size: 13px;
  color: var(--c-text-faint);
  margin-bottom: 20px;
}

.discord-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(88, 101, 242, 0.15);
  border: 1px solid rgba(88, 101, 242, 0.4);
  color: #8ea1ff;
  padding: 12px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.discord-btn:hover { background: rgba(88, 101, 242, 0.25); }

.legal-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 16px;
}

.legal-link {
  color: var(--c-text-faint);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
}
.legal-link:hover { color: var(--c-text-secondary); }

.legal-date {
  color: var(--c-text-faint);
  font-size: 12px;
}

.legal-page {
  align-items: flex-start;
  padding-top: 60px;
}

.legal-page-close {
  position: absolute;
  top: 24px;
  right: 32px;
  color: var(--c-text-dim);
  font-size: 20px;
  cursor: pointer;
  z-index: 2;
}
.legal-page-close:hover { color: var(--c-text); }

.legal-page-body {
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  color: var(--c-text-secondary);
  font-size: 14px;
  line-height: 1.7;
}

.legal-page-body h1,
.legal-page-body h2,
.legal-page-body h3 {
  color: var(--c-text);
  margin: 24px 0 12px;
}
.legal-page-body h1:first-child,
.legal-page-body h2:first-child,
.legal-page-body h3:first-child { margin-top: 0; }

.legal-page-body p { margin-bottom: 14px; }

.legal-page-body a {
  color: var(--c-accent);
}

.credits-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 700px;
}

.credits-entry {
  color: var(--c-text-secondary);
  font-size: 15px;
  line-height: 1.5;
}

.credits-name {
  text-decoration: underline;
  font-weight: 500;
}

.sw-status {
  color: var(--c-text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
}

.sw-unregister-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
  padding: 12px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.sw-unregister-btn:hover { background: rgba(239, 68, 68, 0.25); }
.sw-unregister-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sw-hint {
  color: var(--c-text-faint);
  font-size: 12px;
  margin-top: 12px;
}

.engine-select {
  background: var(--c-surface);
  color: var(--c-text-secondary);
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
  outline: none;
  min-width: 220px;
  margin-bottom: 12px;
  display: block;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 900px;
}

.history-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.history-entry:hover { background: var(--c-surface-2); }

.history-entry-url {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--c-text-secondary);
  font-size: 14px;
}

.history-entry-time {
  color: var(--c-text-faint);
  font-size: 12px;
  flex-shrink: 0;
}

.history-entry-remove {
  color: var(--c-text-dim);
  font-size: 14px;
  flex-shrink: 0;
  padding: 4px;
}
.history-entry-remove:hover { color: var(--c-text); }

.history-clear-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
}
.history-clear-btn:hover { background: rgba(239, 68, 68, 0.25); }

.updatelog-btn {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 150;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  color: var(--c-text-secondary);
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease;
}
.updatelog-btn:hover { background: var(--c-surface-hover); }

.updatelog-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.updatelog-card {
  width: 480px;
  max-width: 90vw;
  max-height: 80vh;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.updatelog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--c-accent);
  padding: 18px 22px;
}

.updatelog-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--c-bg);
  display: flex;
  gap: 8px;
  align-items: center;
}

.updatelog-close {
  color: var(--c-bg);
  font-size: 18px;
  cursor: pointer;
  opacity: 0.8;
}
.updatelog-close:hover { opacity: 1; }

.updatelog-body {
  padding: 20px 22px;
  overflow-y: auto;
}

.updatelog-section-label {
  font-weight: 700;
  color: var(--c-text);
  margin: 18px 0 10px;
  font-size: 14px;
}
.updatelog-section-label:first-child { margin-top: 0; }

.updatelog-entry {
  background: var(--c-accent);
  color: var(--c-bg);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
}
.updatelog-entry.soon {
  background: var(--c-surface-2);
  color: var(--c-text-secondary);
  font-weight: 400;
}
