:root {
  --lunar-bg0:rgb(12, 12, 18);
  --lunar-bg1:rgb(18, 18, 28);
  --lunar-panel: rgba(22, 22, 32, 0.92);
  --lunar-stroke: rgba(255, 255, 255, 0.1);
  --lunar-accent:rgb(136, 92, 255);
  --lunar-accent2:rgb(92, 194, 255);
  --lunar-text: rgba(255, 255, 255, 0.94);
  --lunar-muted: rgba(255, 255, 255, 0.45);
  --lunar-radius: 14px;
  --lunar-footer-h: 40px;
  --lunar-touch: 48px;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  color: var(--lunar-text);
  background: linear-gradient(165deg, var(--lunar-bg0) 0%, var(--lunar-bg1) 50%, #0e0c14 100%);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
}

body.strawberry-adblock-lock {
  overflow: hidden;
}

body.strawberry-adblock-lock #lunar-app {
  pointer-events: none;
  user-select: none;
  filter: blur(10px);
}

.strawberry-adblock-wall {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom))
    max(20px, env(safe-area-inset-left));
  box-sizing: border-box;
  background: rgba(6, 8, 14, 0.88);
  backdrop-filter: blur(8px);
}

.strawberry-adblock-wall[hidden] {
  display: none !important;
}

.strawberry-adblock-dialog {
  width: 100%;
  max-width: 420px;
  padding: 28px 24px;
  border-radius: var(--lunar-radius);
  border: 1px solid var(--lunar-stroke);
  background: var(--lunar-panel);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  text-align: center;
}

.strawberry-adblock-title {
  margin: 0 0 12px;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.strawberry-adblock-text,
.strawberry-adblock-hint {
  margin: 0 0 12px;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--lunar-text);
  opacity: 0.92;
}

.strawberry-adblock-hint {
  font-size: 0.82rem;
  opacity: 0.85;
}

.strawberry-adblock-retry {
  margin-top: 16px;
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(136, 92, 255, 0.55);
  background: linear-gradient(145deg, rgba(136, 92, 255, 0.4), rgba(92, 194, 255, 0.18));
  color: var(--lunar-text);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.strawberry-adblock-retry:hover {
  filter: brightness(1.06);
}

.strawberry-adblock-escape {
  margin: 18px 0 0;
  font-size: 0.75rem;
  color: var(--lunar-muted);
  line-height: 1.4;
}

.strawberry-adblock-linkish {
  display: inline;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  color: var(--lunar-accent2);
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
}

body.lunar-light {
  --lunar-bg0:rgb(240, 242, 248);
  --lunar-bg1:rgb(228, 232, 240);
  --lunar-panel: rgba(255, 255, 255, 0.94);
  --lunar-stroke: rgba(0, 0, 0, 0.08);
  --lunar-text: rgba(20, 22, 32, 0.95);
  --lunar-muted: rgba(20, 22, 32, 0.45);
  background: linear-gradient(165deg, var(--lunar-bg0), var(--lunar-bg1));
}

a {
  color: inherit;
}

.alert {
  margin: 0 16px;
  padding: 10px 14px;
  border-radius: 10px;
}

.alert-danger {
  border: 1px solid rgba(255, 85, 85, 0.35);
  background: rgba(255, 45, 45, 0.12);
  color: rgba(255, 220, 220, 0.95);
}

.legacy {
  display: none !important;
}

.input-group-text,
.disable-text {
  cursor: default;
  user-select: none;
}

/* ——— Lunar shell ——— */
.lunar-app {
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 0;
  box-sizing: border-box;
}

@supports (height: 100dvh) {
  .lunar-app {
    height: 100dvh;
    max-height: 100dvh;
  }
}

.lunar-chrome {
  position: relative;
  z-index: 300;
  flex-shrink: 0;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px 12px;
  padding: 10px 14px;
  padding-top: max(10px, env(safe-area-inset-top, 0px));
  background: var(--lunar-panel);
  border-bottom: 1px solid var(--lunar-stroke);
  backdrop-filter: blur(12px);
}

.lunar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.lunar-brand-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 8px;
  filter: drop-shadow(0 0 8px rgba(136, 92, 255, 0.35));
}

.lunar-brand-text {
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.05rem;
}

.lunar-ver {
  font-size: 0.7rem;
  opacity: 0.5;
  padding: 2px 6px;
  border: 1px solid var(--lunar-stroke);
  border-radius: 6px;
}

.lunar-urlbar-wrap {
  flex: 1;
  min-width: 0;
}

.lunar-urlbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--lunar-radius);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--lunar-stroke);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

body.lunar-light .lunar-urlbar {
  background: rgba(255, 255, 255, 0.85);
}

.lunar-scheme {
  flex-shrink: 0;
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  color: var(--lunar-accent2);
  opacity: 0.95;
}

.lunar-path-hint {
  flex-shrink: 0;
  font-size: 0.78rem;
  color: var(--lunar-muted);
  margin-right: -4px;
}

.lunar-url-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: inherit;
  font-size: 0.9rem;
  outline: none;
}

.lunar-go {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(136, 92, 255, 0.45);
  background: linear-gradient(145deg, rgba(136, 92, 255, 0.35), rgba(92, 194, 255, 0.15));
  color: var(--lunar-text);
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 0;
}

.lunar-go:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 16px rgba(136, 92, 255, 0.35);
}

.lunar-go,
.lunar-shortcut {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.lunar-menu-toggle {
  flex-shrink: 0;
  width: var(--lunar-touch);
  min-width: var(--lunar-touch);
  height: var(--lunar-touch);
  border-radius: 12px;
  border: 1px solid var(--lunar-stroke);
  background: rgba(0, 0, 0, 0.2);
  color: inherit;
  font-size: 1.25rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 0;
}

.lunar-icon {
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}

.lunar-menu-toggle:hover {
  border-color: rgba(136, 92, 255, 0.4);
}

.lunar-error {
  flex-shrink: 0;
}

.lunar-password {
  padding: 0 16px 8px;
}

.lunar-password-input {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  display: block;
  padding: 10px 14px;
  border-radius: var(--lunar-radius);
  border: 1px solid var(--lunar-stroke);
  background: rgba(0, 0, 0, 0.25);
  color: inherit;
  box-sizing: border-box;
}

.lunar-main {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
}

.lunar-tabbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--lunar-stroke);
  background: rgba(0, 0, 0, 0.28);
  overflow-x: auto;
}

.lunar-tabbar[hidden] {
  display: none !important;
}

.lunar-tab-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.lunar-tab {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid var(--lunar-stroke);
  background: rgba(0, 0, 0, 0.2);
  color: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.lunar-tab.is-active {
  border-color: rgba(136, 92, 255, 0.55);
  box-shadow: 0 0 14px rgba(136, 92, 255, 0.2);
}

.lunar-tab-close {
  border: none;
  background: transparent;
  color: var(--lunar-muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
}

.lunar-tab-close:hover {
  color: inherit;
  background: rgba(255, 255, 255, 0.08);
}

.lunar-frame-stack {
  flex: 1;
  min-height: 0;
  position: relative;
}

/* On the start page, collapse the frame stack so it does not share height 50/50 with #lunar-home
   (that was clipping Quick links + banner). When browsing, #lunar-home has .is-hidden and this rule does not apply. */
#lunar-home:not(.is-hidden) ~ #lunar-frame-stack {
  flex: 0 0 0;
  max-height: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
}

.lunar-frame-stack .lunar-frame {
  position: absolute;
  inset: 0;
}

.lunar-home {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  padding: 24px;
  padding-bottom: max(32px, env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Homepage: quick links + leaderboard ad block */
.lunar-quicklinks-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  width: 100%;
  max-width: 728px;
}

.lunar-quick-heading {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--lunar-muted);
}

.lunar-home .lunar-shortcuts {
  margin: 0;
}

.lunar-home-ad-leaderboard {
  width: 100%;
  max-width: 728px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  margin-top: 0.75rem;
  padding: 12px 0 8px;
  box-sizing: border-box;
}

.strawberry-leaderboard-frame {
  width: 100%;
  max-width: 728px;
  min-width: 0;
  min-height: 90px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}

.strawberry-leaderboard-frame iframe {
  display: block;
  max-width: 100%;
  border: none;
}

/* Adsterra skyscrapers: fixed L/R, centered vertically; hidden on smaller viewports */
.strawberry-ad-sky {
  display: none;
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 35;
  pointer-events: auto;
  box-sizing: border-box;
}

.strawberry-ad-sky--left {
  left: max(12px, env(safe-area-inset-left, 0px));
}

.strawberry-ad-sky--right {
  right: max(12px, env(safe-area-inset-right, 0px));
}

.strawberry-ad-sky-inner {
  width: 160px;
  height: 600px;
  max-width: 160px;
  max-height: 600px;
  overflow: hidden;
  border-radius: var(--lunar-radius);
  border: 1px solid var(--lunar-stroke);
  background: rgba(0, 0, 0, 0.12);
  box-sizing: border-box;
}

body.lunar-light .strawberry-ad-sky-inner {
  background: rgba(255, 255, 255, 0.5);
}

@media (min-width: 1280px) {
  .strawberry-ad-sky {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Reserve horizontal space so shell content does not sit under fixed skyscrapers */
  body:has(#lunar-home:not(.is-hidden)) .lunar-app {
    padding-left: calc(160px + max(12px, env(safe-area-inset-left, 0px)) + 24px);
    padding-right: calc(160px + max(12px, env(safe-area-inset-right, 0px)) + 24px);
    box-sizing: border-box;
  }
}

/* Hide sky ads on tablet/mobile; gutters only apply at 1280px+ via rules above */
@media (max-width: 1279px) {
  .strawberry-ad-sky {
    display: none !important;
  }
}

body:has(#lunar-home.is-hidden) .strawberry-ad-sky {
  display: none !important;
}

body:has(#lunar-home.is-hidden) .lunar-app {
  padding-left: 0;
  padding-right: 0;
}

.lunar-home.is-hidden {
  display: none;
}

.lunar-clock-wrap {
  text-align: center;
}

.lunar-clock {
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 200;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 40px rgba(136, 92, 255, 0.25);
}

.lunar-tagline {
  margin-top: 8px;
  font-size: 0.95rem;
  color: var(--lunar-muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.lunar-shortcuts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  max-width: 520px;
}

.lunar-shortcut {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 76px;
  padding: 14px 10px;
  border-radius: var(--lunar-radius);
  border: 1px solid var(--lunar-stroke);
  background: rgba(0, 0, 0, 0.22);
  color: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

body.lunar-light .lunar-shortcut {
  background: rgba(255, 255, 255, 0.75);
}

.lunar-shortcut:hover {
  transform: translateY(-2px);
  border-color: rgba(136, 92, 255, 0.5);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.lunar-sic {
  font-size: 1.35rem;
  opacity: 0.9;
}

.lunar-slabel {
  font-size: 0.68rem;
  color: var(--lunar-muted);
}

.lunar-frame {
  display: none;
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

.lunar-frame.is-visible {
  display: block;
}

.lunar-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: min(320px, calc(100vw - 16px));
  height: 100%;
  max-height: 100%;
  background: var(--lunar-panel);
  border-left: 1px solid var(--lunar-stroke);
  transform: translateX(100%);
  transition: transform 0.24s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 200;
  backdrop-filter: blur(14px);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-sizing: border-box;
}

@supports (height: 100dvh) {
  .lunar-sidebar {
    height: 100dvh;
    max-height: 100dvh;
  }
}

.lunar-sidebar.is-open {
  transform: translateX(0);
}

.lunar-side-inner {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top, 0px));
  padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
  overflow: hidden;
  box-sizing: border-box;
}

.lunar-side-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--lunar-stroke);
}

.lunar-side-head .lunar-side-title {
  margin: 0;
}

.lunar-sidebar-close {
  flex-shrink: 0;
  width: var(--lunar-touch);
  min-width: var(--lunar-touch);
  height: var(--lunar-touch);
  border-radius: 12px;
  border: 1px solid var(--lunar-stroke);
  background: rgba(0, 0, 0, 0.2);
  color: inherit;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.lunar-sidebar-close:hover {
  border-color: rgba(136, 92, 255, 0.5);
  background: rgba(136, 92, 255, 0.12);
}

body.lunar-light .lunar-sidebar-close {
  background: rgba(255, 255, 255, 0.55);
}

.lunar-side-title {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--lunar-muted);
  font-weight: 600;
}

.lunar-side-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 8px;
}

.lunar-side-btn {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  margin: 0;
  padding: 13px 14px;
  min-height: var(--lunar-touch);
  box-sizing: border-box;
  border-radius: 12px;
  border: 1px solid var(--lunar-stroke);
  background: rgba(0, 0, 0, 0.12);
  color: inherit;
  cursor: pointer;
  font-size: 0.9rem;
  text-align: left;
  flex-shrink: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.lunar-side-btn--action-only {
  justify-content: center;
}

.lunar-side-label {
  flex: 1;
  min-width: 0;
  text-align: left;
  font-weight: 500;
  line-height: 1.25;
}

.lunar-side-btn--action-only .lunar-side-label {
  flex: none;
  text-align: center;
}

.lunar-side-keys {
  flex-shrink: 0;
  font-size: 0.6rem;
  letter-spacing: 0.02em;
  opacity: 0.5;
  white-space: nowrap;
  text-align: right;
}

.lunar-side-keys kbd {
  font-size: inherit;
  font-family: ui-monospace, monospace;
  opacity: 1;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
}

body.lunar-light .lunar-side-btn {
  background: rgba(255, 255, 255, 0.72);
}

.lunar-side-btn:hover {
  border-color: rgba(136, 92, 255, 0.4);
}

/* Toggle items (theme, cloak): isolated row, no visual collision */
.lunar-side-btn--toggle {
  position: relative;
}

.lunar-side-btn--toggle[aria-pressed='true'] {
  border: 1px solid rgba(136, 92, 255, 0.85);
  background: rgba(136, 92, 255, 0.2);
  box-shadow:
    inset 0 0 0 1px rgba(136, 92, 255, 0.12),
    0 1px 0 rgba(255, 255, 255, 0.04);
}

body.lunar-light .lunar-side-btn--toggle[aria-pressed='true'] {
  background: rgba(136, 92, 255, 0.14);
  border-color: rgba(106, 72, 220, 0.6);
}

.lunar-side-btn--toggle[aria-pressed='false'] {
  border-color: var(--lunar-stroke);
  background: rgba(0, 0, 0, 0.08);
  opacity: 1;
  box-shadow: none;
}

body.lunar-light .lunar-side-btn--toggle[aria-pressed='false'] {
  background: rgba(255, 255, 255, 0.55);
}

.lunar-side-btn--toggle[aria-pressed='true'] .lunar-side-label::after {
  content: ' · On';
  font-size: 0.82em;
  font-weight: 700;
  color: var(--lunar-accent2);
}

.lunar-side-btn--toggle[aria-pressed='false'] .lunar-side-label::after {
  content: ' · Off';
  font-size: 0.82em;
  font-weight: 600;
  color: var(--lunar-muted);
}

.lunar-footer {
  position: relative;
  z-index: 280;
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: var(--lunar-footer-h);
  padding: 8px 16px;
  padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
  font-size: 0.72rem;
  color: var(--lunar-muted);
  border-top: 1px solid var(--lunar-stroke);
  background: rgba(0, 0, 0, 0.28);
}

body.lunar-light .lunar-footer {
  background: rgba(255, 255, 255, 0.85);
}

.lunar-footer-left,
.lunar-footer-right {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* Tablet / small desktop: stack url bar for breathing room */
@media (max-width: 860px) {
  .lunar-chrome {
    flex-wrap: wrap;
  }

  .lunar-brand {
    order: 1;
  }

  .lunar-menu-toggle {
    order: 2;
    margin-left: auto;
  }

  .lunar-urlbar-wrap {
    order: 3;
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .lunar-brand-text {
    display: none;
  }

  .lunar-path-hint {
    display: none;
  }

  .lunar-chrome {
    padding-left: max(10px, env(safe-area-inset-left, 0px));
    padding-right: max(10px, env(safe-area-inset-right, 0px));
  }

  .lunar-scheme {
    display: none;
  }

  .lunar-url-input {
    font-size: 16px;
  }

  /* Prevent iOS zoom on focus; keeps tap targets usable */

  .lunar-footer {
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
  }

  .lunar-shortcuts {
    gap: 10px;
    max-width: 100%;
  }

  .lunar-shortcut {
    width: 44%;
    max-width: 120px;
    min-width: 0;
  }

  .lunar-tabbar {
    padding-left: max(8px, env(safe-area-inset-left, 0px));
  }
}

/* Phone drawer: full-width sheet, clearer separation */
@media (max-width: 480px) {
  .lunar-sidebar {
    width: 100%;
    max-width: 100%;
    border-left: none;
  }

  .lunar-side-keys {
    display: none;
  }

  .lunar-side-btn {
    padding: 14px 16px;
    min-height: 52px;
  }
}
