.hub-v2 {
  height: var(--ui-vh, 100dvh);
  min-height: var(--ui-vh, 100dvh);
  max-height: var(--ui-vh, 100dvh);
  overflow: hidden;
  background: var(--bs-topbar);
  opacity: var(--tablet-shell-opacity, 1);
  transition: opacity 160ms ease;
}

.hub-v2-screen {
  position: relative;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hub-v2-screen [hidden] {
  display: none !important;
}

.hub-v2-body {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hub-v2-screen.is-locked .hub-v2-body {
  justify-content: flex-start;
}

.hub-v2-screen.is-unlocking .hub-v2-body {
  justify-content: flex-end;
}

/* ─── Wallpaper (BetterState night scene) ─── */
.hub-v2-wallpaper {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(circle at 72% 18%, rgba(177, 18, 38, 0.12), transparent 28%),
    linear-gradient(180deg, #1a2128 0%, var(--bs-bg) 42%, #12181d 100%);
}

.hub-v2-scene {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hub-v2-scene__stars {
  position: absolute;
  inset: 0;
  opacity: 0.45;
  background-image:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.85) 0 1px, transparent 1px),
    radial-gradient(circle at 28% 12%, rgba(255, 255, 255, 0.65) 0 1px, transparent 1px),
    radial-gradient(circle at 46% 22%, rgba(255, 255, 255, 0.55) 0 1px, transparent 1px),
    radial-gradient(circle at 63% 10%, rgba(255, 255, 255, 0.75) 0 1px, transparent 1px),
    radial-gradient(circle at 81% 16%, rgba(255, 255, 255, 0.5) 0 1px, transparent 1px),
    radial-gradient(circle at 90% 28%, rgba(255, 255, 255, 0.6) 0 1px, transparent 1px);
}

.hub-v2-scene__moon {
  position: absolute;
  top: 18%;
  right: 22%;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: radial-gradient(circle at 35% 35%, #d8dee3, #9aa3ab 70%, transparent 71%);
  opacity: 0.55;
  box-shadow: 0 0 24px rgba(216, 222, 227, 0.12);
}

.hub-v2-scene__mountains {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 34%;
  background:
    linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.08) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 320' preserveAspectRatio='none'%3E%3Cpath fill='%2310181e' d='M0 320 L0 210 L120 170 L240 220 L360 150 L500 200 L640 120 L780 190 L920 140 L1080 210 L1200 160 L1200 320 Z'/%3E%3Cpath fill='%230c1217' d='M0 320 L0 250 L180 210 L320 260 L480 190 L640 240 L820 180 L980 230 L1200 200 L1200 320 Z'/%3E%3C/svg%3E")
      center bottom / 100% 100% no-repeat;
  opacity: 0.95;
}

.hub-v2-wallpaper[data-wallpaper="sunset"] {
  background:
    radial-gradient(circle at 70% 12%, rgba(224, 24, 48, 0.22), transparent 35%),
    linear-gradient(180deg, #24161a 0%, #151015 100%);
}

.hub-v2-wallpaper[data-wallpaper="ocean"] {
  background:
    radial-gradient(circle at 30% 10%, rgba(59, 130, 246, 0.2), transparent 40%),
    linear-gradient(180deg, #121820 0%, var(--bs-bg) 100%);
}

.hub-v2-wallpaper[data-wallpaper="forest"] {
  background:
    radial-gradient(circle at 20% 20%, rgba(69, 196, 106, 0.12), transparent 40%),
    linear-gradient(180deg, #101812 0%, var(--bs-bg) 100%);
}

.hub-v2-wallpaper[data-wallpaper="midnight"] {
  background: linear-gradient(180deg, #0a0e12 0%, #10161b 100%);
}

.hub-v2-wallpaper[data-wallpaper="dune"] {
  background:
    radial-gradient(circle at 60% 15%, rgba(177, 18, 38, 0.15), transparent 35%),
    linear-gradient(180deg, #1a1512 0%, #12100e 100%);
}

/* ─── Status bar (iPad-like) ─── */
.hub-v2-status,
.hub-v2-body,
.hub-v2-settings {
  position: relative;
  z-index: 1;
}

.hub-v2-status {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: var(--tui-status-h);
  padding: 10px 22px 6px;
  font-size: 0.72rem;
  font-weight: 500;
  color: rgba(232, 237, 240, 0.88);
}

.hub-v2-status__brand {
  justify-self: start;
  letter-spacing: 0.01em;
}

.hub-v2-opacity {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: min(220px, 34vw);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(232, 237, 240, 0.78);
  cursor: pointer;
}

.hub-v2-opacity__icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  opacity: 0.85;
}

.hub-v2-opacity__range {
  width: min(132px, 22vw);
  height: 18px;
  margin: 0;
  padding: 0;
  accent-color: rgba(244, 244, 247, 0.92);
  cursor: grab;
  background: transparent;
}

.hub-v2-opacity__range:active {
  cursor: grabbing;
}

.hub-v2-status__end {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.hub-v2-status__refresh {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(232, 237, 240, 0.88);
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.hub-v2-status__refresh:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.hub-v2-status__refresh:disabled {
  opacity: 0.55;
  cursor: wait;
}

.hub-v2-status__refresh svg {
  width: 14px;
  height: 14px;
  display: block;
}

.hub-v2-status__refresh.is-busy svg {
  animation: hub-status-refresh-spin 0.8s linear infinite;
}

@keyframes hub-status-refresh-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hub-v2-status__refresh.is-busy svg {
    animation: none;
  }
}

.hub-v2-status__datetime {
  font-variant-numeric: tabular-nums;
  color: rgba(232, 237, 240, 0.82);
}

/* ─── Lock layer (notifications — slides away on unlock) ─── */
.hub-v2-lock-layer {
  position: relative;
  z-index: 2;
  flex: 1 1 0;
  min-height: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
  pointer-events: auto;
  will-change: transform, opacity;
}

.hub-v2-screen.is-locked .hub-v2-lock-layer,
.hub-v2-screen.is-unlocking .hub-v2-lock-layer {
  display: flex;
}

.hub-v2-screen.is-lock-enter .hub-v2-lock-layer {
  animation: hubLockEnter 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hub-v2-screen.is-unlocking .hub-v2-lock-layer {
  animation: hubLockChromeOut 420ms cubic-bezier(0.32, 0.72, 0, 1) forwards;
  pointer-events: none;
}

@keyframes hubLockEnter {
  from {
    opacity: 0;
    transform: translate3d(0, 8%, 0);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes hubLockExit {
  from {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }

  to {
    opacity: 0;
    transform: translate3d(0, -22%, 0);
  }
}

@keyframes hubLockChromeOut {
  from {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }

  to {
    opacity: 0;
    transform: translate3d(0, -18%, 0);
  }
}

/* ─── Hero clock (reference: upper third, not dead center) ─── */
.hub-v2-hero {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  padding: clamp(28px, 6vh, 72px) 24px 0;
}

.hub-v2-screen.is-locked .hub-v2-hero {
  padding-top: clamp(20px, 4vh, 48px);
  padding-bottom: 8px;
  cursor: pointer;
}

.hub-v2-screen.is-locked .hub-v2-lock-layer {
  cursor: pointer;
}

.hub-v2-screen.is-locked .hub-v2-hero__time {
  font-size: clamp(3.2rem, 8vw, 5rem);
}

.hub-v2-hero__date {
  margin: 0 0 8px;
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: clamp(1rem, 2.2vw, 1.35rem);
  font-weight: 600;
  color: rgba(245, 245, 248, 0.9);
  letter-spacing: -0.01em;
  text-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
}

.hub-v2-hero__time {
  display: block;
  margin: 0;
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: clamp(4rem, 10vw, 6.25rem);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.02em;
  color: rgba(244, 244, 247, 0.98);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.22),
    0 12px 28px rgba(0, 0, 0, 0.34);
}

/* ─── Lock notifications ─── */
.hub-v2-lock-feed {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: min(460px, calc(100% - 48px));
  margin: 4px auto 0;
  padding-bottom: 4px;
}

.hub-v2-lock-feed::before,
.hub-v2-lock-feed::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 22px;
  pointer-events: none;
  z-index: 1;
}

.hub-v2-lock-feed::before {
  top: 0;
  background: linear-gradient(180deg, rgba(18, 24, 29, 0.72), transparent);
}

.hub-v2-lock-feed::after {
  bottom: 0;
  background: linear-gradient(0deg, rgba(18, 24, 29, 0.82), transparent);
}

.hub-v2-lock-notes {
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(46vh, 420px);
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.65rem;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 4px 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
  pointer-events: auto;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.hub-v2-lock-notes-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 88px;
  padding: 16px 20px;
  border-radius: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.86rem;
  color: rgba(232, 237, 240, 0.58);
  text-align: center;
}

.hub-v2-lock-notes::-webkit-scrollbar {
  width: 4px;
}

.hub-v2-lock-notes::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
}

.hub-v2-lock-note {
  display: block;
  flex: 0 0 auto;
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(27, 35, 42, 0.92);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease;
  pointer-events: auto;
  user-select: none;
  touch-action: manipulation;
}

.hub-v2-lock-note:hover {
  background: rgba(35, 44, 52, 0.96);
  border-color: rgba(255, 255, 255, 0.2);
}

.hub-v2-lock-note:active {
  background: rgba(40, 50, 58, 0.98);
}

.hub-v2-lock-note__row {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.85rem 0.9rem;
}

.hub-v2-lock-note__icon {
  display: flex;
  width: 2.35rem;
  height: 2.35rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--bs-ruby);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.hub-v2-lock-note__icon svg {
  width: 18px;
  height: 18px;
}

.hub-v2-lock-note--mail .hub-v2-lock-note__icon {
  background: linear-gradient(145deg, #3d7dd6, #2563b8);
}

.hub-v2-lock-note--banking .hub-v2-lock-note__icon {
  background: linear-gradient(145deg, #34d399, #059669);
}

.hub-v2-lock-note--ads .hub-v2-lock-note__icon {
  background: linear-gradient(145deg, #fbbf24, #d97706);
}

.hub-v2-lock-note--calendar .hub-v2-lock-note__icon {
  background: linear-gradient(145deg, #ec4899, #be185d);
}

.hub-v2-lock-note__copy {
  min-width: 0;
  flex: 1 1 auto;
}

.hub-v2-lock-note__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.hub-v2-lock-note__title {
  font-size: 0.86rem;
  font-weight: 650;
  color: rgba(244, 244, 247, 0.96);
}

.hub-v2-lock-note__time {
  flex-shrink: 0;
  font-size: 0.72rem;
  color: rgba(232, 237, 240, 0.62);
}

.hub-v2-lock-note__body {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.78rem;
  line-height: 1.35;
  color: rgba(232, 237, 240, 0.78);
}

/* ─── Unlock affordance ─── */
.hub-v2-unlock {
  position: relative;
  z-index: 4;
  flex: 0 0 auto;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 64px;
  padding: 10px 24px clamp(14px, 2.4vh, 28px);
  border: none;
  background: transparent;
  cursor: grab;
  touch-action: manipulation;
  user-select: none;
  transition: transform 160ms ease;
}

.hub-v2-unlock:active {
  cursor: grabbing;
}

.hub-v2-unlock.is-dragging {
  transition: none;
}

.hub-v2-screen:not(.is-locked):not(.is-unlocking) .hub-v2-unlock {
  display: none;
}

.hub-v2-unlock__chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 20px;
  color: rgba(244, 244, 247, 0.78);
  animation: hubUnlockNudge 1.8s ease-in-out infinite;
  pointer-events: none;
}

.hub-v2-unlock__chevron svg {
  width: 22px;
  height: 22px;
}

.hub-v2-unlock.is-dragging .hub-v2-unlock__chevron,
.hub-v2-screen.is-unlocking .hub-v2-unlock__chevron {
  animation: none;
}

@keyframes hubUnlockNudge {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.55;
  }

  50% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

.hub-v2-unlock__hint {
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: rgba(232, 237, 240, 0.78);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.55);
}

.hub-v2-unlock__bar {
  display: block;
  width: min(148px, 22vw);
  height: 5px;
  border-radius: 999px;
  background: rgba(244, 244, 247, 0.9);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.hub-v2-screen.is-unlocking .hub-v2-unlock {
  animation: hubLockChromeOut 420ms cubic-bezier(0.32, 0.72, 0, 1) forwards;
  pointer-events: none;
}

.hub-v2-screen.is-unlocking .hub-v2-hero {
  animation: hubLockChromeOut 420ms cubic-bezier(0.32, 0.72, 0, 1) forwards;
  pointer-events: none;
}

.hub-v2-screen.is-locked .hub-v2-home {
  display: none;
}

.hub-v2-screen.is-unlocking .hub-v2-home {
  display: flex;
  pointer-events: none;
  animation: hubHomeEnter 420ms cubic-bezier(0.32, 0.72, 0, 1) both;
}

@keyframes hubHomeEnter {
  from {
    opacity: 0;
    transform: translate3d(0, 10%, 0);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

/* ─── Enterpage (unlocked) ─── */
.hub-v2-home {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  margin-top: auto;
  margin-bottom: clamp(16vh, 20vh, 24vh);
  padding: 0;
}

.hub-v2-home-indicator {
  position: absolute;
  left: 50%;
  bottom: clamp(12px, 2.4vh, 24px);
  transform: translateX(-50%);
  z-index: 2;
  width: min(320px, 36vw);
  height: 4px;
  border-radius: 999px;
  background: rgba(244, 244, 247, 0.92);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.hub-v2-screen.is-locked .hub-v2-home-indicator,
.hub-v2-screen.is-unlocking .hub-v2-home-indicator {
  display: none;
}

.hub-v2-apps {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: clamp(40px, 6.5vw, 72px);
  padding: 0 clamp(32px, 5vw, 64px) clamp(16px, 2.5vh, 28px);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  max-width: 100%;
}

.hub-v2-apps .tui-app-icon {
  gap: 10px;
}

.hub-v2-apps .tui-app-icon__tile {
  width: clamp(72px, 9vw, 84px);
  height: clamp(72px, 9vw, 84px);
  border-radius: clamp(17px, 2.2vw, 21px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.38);
}

.hub-v2-apps .tui-app-icon__tile svg {
  width: clamp(34px, 4.2vw, 40px);
  height: clamp(34px, 4.2vw, 40px);
}

.hub-v2-apps .tui-app-icon__label {
  font-size: clamp(0.74rem, 1.35vw, 0.86rem);
  font-weight: 500;
  max-width: 96px;
  color: rgba(244, 244, 247, 0.94);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

.hub-v2-apps::-webkit-scrollbar {
  display: none;
}

/* ─── Settings sheet ─── */
.hub-v2-settings__profile {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.hub-v2-settings__profile strong {
  display: block;
  font-size: 0.95rem;
}

.hub-v2-settings__profile span {
  display: block;
  font-size: 0.78rem;
  color: var(--tui-text-muted);
}

.hub-v2-settings__avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--tui-accent-soft);
  color: var(--bs-ruby-bright);
  font-weight: 700;
}

.hub-v2-settings__refresh {
  width: 100%;
  margin-bottom: 14px;
}

.hub-v2-settings__label {
  margin: 0 0 8px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--tui-text-muted);
}

.hub-v2-wallpaper-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.hub-v2-wallpaper-tile {
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid transparent;
  background: transparent;
  cursor: pointer;
}

.hub-v2-wallpaper-tile.is-selected {
  border-color: var(--bs-ruby-bright);
}

.hub-v2-wallpaper-tile__preview {
  display: block;
  height: 52px;
  border-radius: 10px;
  background: linear-gradient(180deg, #1a2128, var(--bs-bg));
}

.hub-v2-wallpaper-tile[data-wallpaper="sunset"] .hub-v2-wallpaper-tile__preview {
  background: linear-gradient(145deg, var(--bs-ruby-bright), #451a03);
}

.hub-v2-wallpaper-tile[data-wallpaper="ocean"] .hub-v2-wallpaper-tile__preview {
  background: linear-gradient(145deg, #2563eb, #0f172a);
}

.hub-v2-wallpaper-tile[data-wallpaper="forest"] .hub-v2-wallpaper-tile__preview {
  background: linear-gradient(145deg, #059669, #052e16);
}

.hub-v2-wallpaper-tile[data-wallpaper="midnight"] .hub-v2-wallpaper-tile__preview {
  background: linear-gradient(145deg, #10161b, #020617);
}

.hub-v2-wallpaper-tile[data-wallpaper="dune"] .hub-v2-wallpaper-tile__preview {
  background: linear-gradient(145deg, #92400e, #291508);
}

.hub-v2-wallpaper-tile[data-wallpaper="default"] .hub-v2-wallpaper-tile__preview {
  background: linear-gradient(145deg, #1a2128, var(--bs-bg));
}

.hub-v2-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.84rem;
  margin-bottom: 14px;
}

.hub-v2-settings__links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hub-v2-link {
  color: var(--bs-ruby-bright);
  text-decoration: none;
  font-size: 0.82rem;
}

.hub-v2-link:hover {
  text-decoration: underline;
}
