/* The shell: dock, top bar, view area, overlays. */

.shell {
  display: grid;
  grid-template-columns: var(--dock-w) 1fr;
  gap: var(--gap);
  height: 100%;
  padding: var(--gap);
}

/* Dock --------------------------------------------------------------------- */
.dock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  border-radius: 34px;
  min-height: 0;
  overflow: hidden;
}
.dock-logo {
  display: grid;
  place-items: center;
  margin-bottom: 6px;
  transition: transform 0.5s var(--spring);
}
.dock-logo:hover { transform: rotate(-8deg) scale(1.08); }
.dock-items {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  width: 100%;
}
.dock-items::-webkit-scrollbar { display: none; }
.dock-foot { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 8px; }
.dock-item {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 76px;
  padding: 7px 0 6px;
  border-radius: 22px;
  cursor: pointer;
  color: var(--ink-2);
  font-size: 0.72rem;
  font-weight: 800;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.dock-item .orb { width: 42px; height: 42px; }
.dock-item:hover .orb { animation: jelly 0.7s var(--ease); }
.dock-item.active { color: var(--ink); }
.dock-item.active .orb { transform: scale(1.08); }
.dock-item .badge { position: absolute; top: 3px; right: 10px; z-index: 3; }
.dock-drop {
  position: absolute;
  left: 50%;
  width: 78px;
  margin-left: -39px;
  border-radius: 24px;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(90% 60% at 50% 105%, rgba(255, 255, 255, 0.55), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0.28));
  box-shadow: inset 0 1px 1px #fff, inset 0 0 0 1px rgba(255, 255, 255, 0.6), inset 0 -6px 12px rgba(var(--accent-rgb), 0.18), 0 6px 16px -6px rgba(0, 30, 70, 0.35);
  transition: top 0.55s var(--spring), height 0.55s var(--spring), opacity 0.2s;
}
[data-ink='light'] .dock-drop {
  background: radial-gradient(90% 60% at 50% 105%, rgba(255, 255, 255, 0.25), transparent 70%), linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.08));
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.2), 0 6px 16px -6px rgba(0, 0, 0, 0.5);
}
@keyframes jelly {
  0% { transform: scale(1, 1); }
  25% { transform: scale(1.14, 0.88); }
  45% { transform: scale(0.92, 1.1); }
  65% { transform: scale(1.05, 0.96); }
  100% { transform: scale(1, 1); }
}

.logo-orb {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  background: radial-gradient(circle at 50% 120%, #c9f3ff 0%, transparent 55%), radial-gradient(circle at 50% 30%, #7fd6ff, #1e9bff 55%, #0a4fa8);
  box-shadow: inset 0 -5px 10px rgba(0, 40, 110, 0.45), inset 0 0 0 1px rgba(0, 50, 120, 0.5), 0 6px 16px -4px rgba(0, 90, 200, 0.6);
}
.logo-orb::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 16%;
  right: 16%;
  height: 45%;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.05));
}
.logo-orb svg { position: relative; width: 60%; height: 60%; filter: drop-shadow(0 2px 2px rgba(0, 40, 100, 0.4)); }

/* Main column ---------------------------------------------------------------- */
.main {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  min-width: 0;
  min-height: 0;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 16px;
  border-radius: 999px;
  flex: none;
  z-index: 5;
}
.topbar-title { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 0 1 auto; }
.topbar-title h1 { font-size: 1.35rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-search {
  flex: 1 1 260px;
  max-width: 420px;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  height: 42px;
  border-radius: 999px;
}
.topbar-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  color: var(--ink);
  text-shadow: none;
}
.topbar-search input::placeholder { color: var(--ink-3); }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.bubbles-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 14px 0 6px;
  border-radius: 999px;
  font-weight: 900;
  cursor: pointer;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.25) 50%, rgba(255, 255, 255, 0.1) 51%, rgba(255, 255, 255, 0.3));
  box-shadow: inset 0 1px 0 #fff, inset 0 0 0 1px rgba(var(--ink-rgb), 0.1), 0 3px 10px -3px rgba(0, 40, 90, 0.3);
  transition: transform 0.35s var(--spring);
}
[data-ink='light'] .bubbles-chip { background: linear-gradient(180deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.08) 50%, rgba(255, 255, 255, 0.02) 51%, rgba(255, 255, 255, 0.1)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.15); }
.bubbles-chip:hover { transform: scale(1.05); }
.bubbles-chip.bump { animation: jelly 0.6s var(--ease); }
.bubble-coin {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex: none;
  background: radial-gradient(circle at 32% 28%, #fff 0 12%, rgba(255, 255, 255, 0.4) 18%, transparent 30%), radial-gradient(circle at 50% 50%, rgba(160, 235, 255, 0.35) 45%, rgba(40, 170, 240, 0.8) 72%, #1e7fd8 100%);
  box-shadow: inset 0 -2px 4px rgba(0, 60, 140, 0.4), 0 2px 5px rgba(0, 80, 160, 0.35);
  position: relative;
}
.bubble-coin::after {
  content: '';
  position: absolute;
  right: 22%;
  bottom: 20%;
  width: 18%;
  height: 18%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
}
.bubble-coin.sm { width: 18px; height: 18px; }
.bubble-coin.lg { width: 44px; height: 44px; }
.checkin-btn { position: relative; }
.checkin-btn .pulse {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid #ffb703;
  animation: pulse 1.6s ease-out infinite;
  pointer-events: none;
}
@keyframes pulse { from { transform: scale(0.9); opacity: 1; } to { transform: scale(1.35); opacity: 0; } }
.icon-btn .badge { position: absolute; top: -3px; right: -4px; }
.me-btn { padding: 0; border: 0; background: none; cursor: pointer; border-radius: 50%; transition: transform 0.35s var(--spring); }
.me-btn:hover { transform: scale(1.07); }

/* View area ------------------------------------------------------------------ */
.view {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: var(--r-xl);
  scroll-behavior: smooth;
  padding: 2px 4px 40px;
  margin: -2px -4px;
  /* No mask, filter or opacity here: any of them would become the backdrop
     root and every glass pane inside would stop seeing the wallpaper. */
}
.view.no-scroll { overflow: hidden; padding-bottom: 4px; }
.view-enter { animation: view-in 0.5s var(--ease); }
@keyframes view-in { from { transform: translateY(14px) scale(0.985); } to { transform: none; } }

.page { display: flex; flex-direction: column; gap: var(--gap); max-width: 1180px; margin: 0 auto; }
.page.narrow { max-width: 760px; }
.columns { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--gap); align-items: start; }
.side { display: flex; flex-direction: column; gap: var(--gap); position: sticky; top: 0; }

.card { padding: 18px 20px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { flex: 1; min-width: 0; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 6px 4px 0; }
.section-title h2 { flex: 1; }

.list { display: flex; flex-direction: column; gap: 2px; }
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 16px;
  cursor: pointer;
  transition: background 0.2s, transform 0.3s var(--spring);
  min-width: 0;
}
.list-item:hover { background: rgba(255, 255, 255, 0.28); }
[data-ink='light'] .list-item:hover { background: rgba(255, 255, 255, 0.08); }
.list-item.active {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.35));
  box-shadow: inset 0 1px 0 #fff, 0 3px 10px -4px rgba(0, 30, 70, 0.3);
}
[data-ink='light'] .list-item.active { background: linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.07)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.list-item .meta { flex: 1; min-width: 0; }
.list-item .meta > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tabs-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--gap); }
.grid-cards.sm { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

/* Overlays ------------------------------------------------------------------- */
#layer-modals { position: relative; z-index: 50; }
.modal-back {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4, 20, 45, 0.3);
  animation: back-in 0.25s ease;
}
.modal-back.out { animation: back-out 0.25s ease forwards; }
@keyframes back-in { from { background: rgba(4, 20, 45, 0); } }
@keyframes back-out { to { background: rgba(4, 20, 45, 0); } }
.modal {
  width: min(480px, 100%);
  max-height: calc(100vh - 36px);
  max-height: calc(100dvh - 36px);
  display: flex;
  flex-direction: column;
  border-radius: 30px;
  --glass-a: calc(var(--glass-a-base, 0.34) + 0.3);
  animation: modal-in 0.5s var(--spring);
}
.modal.wide { width: min(880px, 100%); }
.modal-back.out .modal { animation: modal-out 0.22s ease forwards; }
@keyframes modal-in { from { transform: translateY(24px) scale(0.9); } }
@keyframes modal-out { to { transform: translateY(12px) scale(0.94); visibility: hidden; } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px 6px; }
.modal-head h2 { flex: 1; font-size: 1.25rem; }
.modal-body { padding: 12px 20px 16px; overflow-y: auto; min-height: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 6px 20px 20px; flex-wrap: wrap; }

#layer-toasts {
  position: fixed;
  z-index: 60;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: min(460px, calc(100% - 24px));
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 8px;
  border-radius: 999px;
  font-weight: 800;
  --glass-a: calc(var(--glass-a-base, 0.34) + 0.35);
  animation: toast-in 0.5s var(--spring);
  cursor: pointer;
  max-width: 100%;
}
.toast.out { animation: toast-out 0.3s ease forwards; }
.toast-orb { width: 30px; height: 30px; }
.toast-orb { --o: #1e9bff; display: inline-grid; place-items: center; border-radius: 50%; color: #fff; flex: none; background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--o) 60%, white), var(--o) 60%, color-mix(in srgb, var(--o) 70%, black)); box-shadow: inset 0 -3px 5px rgba(0, 0, 0, 0.2); }
.toast-orb.orb-ok { --o: #3fb62f; }
.toast-orb.orb-error { --o: #e2405a; }
.toast-orb.orb-bubbles { --o: #00b3c7; }
.toast-orb.orb-love { --o: #ff4f9a; }
.toast-orb.orb-mail { --o: #ff9a1f; }
.toast-orb.orb-badge { --o: #f0b400; }
.toast-text { min-width: 0; }
@keyframes toast-in { from { transform: translateY(-30px) scale(0.8); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(-20px) scale(0.9); opacity: 0; } }

.menu, .popover {
  position: fixed;
  z-index: 70;
  border-radius: 20px;
  --glass-a: calc(var(--glass-a-base, 0.34) + 0.4);
  animation: pop-in 0.35s var(--spring);
}
.menu { padding: 6px; min-width: 190px; }
.popover { padding: 12px; max-width: calc(100vw - 16px); }
@keyframes pop-in { from { transform: scale(0.9) translateY(-6px); opacity: 0; } }
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 14px;
  background: none;
  cursor: pointer;
  font-weight: 700;
  text-align: left;
  color: var(--ink);
}
.menu-item:hover { background: rgba(var(--accent-rgb), 0.16); }
.menu-item.danger { color: #d62c48; }
.menu-sep { margin: 4px 8px; }

.spinner { display: flex; gap: 8px; justify-content: center; padding: 30px; }
.spinner span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #9be7ff 45%, #1e9bff);
  box-shadow: 0 2px 6px rgba(0, 60, 140, 0.35);
  animation: spin-bob 0.9s var(--ease) infinite alternate;
}
.spinner span:nth-child(2) { animation-delay: 0.15s; }
.spinner span:nth-child(3) { animation-delay: 0.3s; }
@keyframes spin-bob { to { transform: translateY(-12px); } }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 30px 16px; }
.empty .pip { animation: pip-bob 2.4s ease-in-out infinite; }
@keyframes pip-bob { 50% { transform: translateY(-8px) rotate(-3deg); } }

.burst-bubble {
  position: fixed;
  z-index: 80;
  pointer-events: none;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 32% 28%, #fff 0 14%, transparent 26%), radial-gradient(circle, color-mix(in srgb, var(--c) 20%, transparent) 50%, var(--c) 100%);
  box-shadow: 0 0 6px color-mix(in srgb, var(--c) 60%, transparent);
  animation: burst 1s var(--ease) forwards;
}
@keyframes burst {
  0% { transform: translate(-50%, -50%) scale(0.2); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1); opacity: 0; }
}

.shaking { animation: shake 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
@keyframes shake {
  10%, 90% { transform: translate(-2px, 1px); }
  20%, 80% { transform: translate(5px, -2px); }
  30%, 50%, 70% { transform: translate(-9px, 3px) rotate(-0.6deg); }
  40%, 60% { transform: translate(9px, -3px) rotate(0.6deg); }
}

.trail-bubble {
  position: fixed;
  z-index: 90;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #fff 0 16%, transparent 28%), radial-gradient(circle, rgba(155, 231, 255, 0.15) 45%, rgba(80, 190, 255, 0.75));
  animation: trail 0.9s ease-out forwards;
}
@keyframes trail { to { transform: translateY(-30px) scale(0.3); opacity: 0; } }

/* Responsive ---------------------------------------------------------------- */
@media (max-width: 1100px) {
  .columns { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; }
}

@media (max-width: 820px) {
  :root { --gap: 12px; }
  .shell { grid-template-columns: 1fr; padding: 10px 10px 0; }
  .main { padding-bottom: 92px; }
  .dock {
    position: fixed;
    z-index: 20;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    flex-direction: row;
    padding: 6px;
    border-radius: 30px;
    height: 72px;
  }
  .dock-logo, .dock-foot { display: none; }
  .dock-items { flex-direction: row; justify-content: space-around; overflow: visible; height: 100%; }
  .dock-item { width: auto; flex: 1; padding: 5px 0 3px; font-size: 0.66rem; }
  .dock-item .orb { width: 36px; height: 36px; }
  .dock-item .ic { width: 18px; height: 18px; }
  .dock-item.desktop-only { display: none; }
  .dock-item.mobile-only { display: flex; }
  .dock-drop { top: 0 !important; height: 100% !important; width: 64px; margin-left: -32px; transition: left 0.55s var(--spring), opacity 0.2s; }
  .topbar { padding: 6px 8px 6px 12px; gap: 8px; }
  .topbar-title h1 { font-size: 1.1rem; }
  .topbar-title .orb { display: none; }
  .topbar-search { display: none; }
  .topbar-search.open { display: flex; position: fixed; left: 10px; right: 10px; top: 72px; max-width: none; z-index: 30; }
  .search-toggle { display: inline-grid !important; }
  .bubbles-chip { padding: 0 10px 0 4px; height: 36px; }
  .bubble-coin { width: 24px; height: 24px; }
  .view { padding-bottom: 20px; }
  .card { padding: 14px 15px; }
  .hide-mobile { display: none !important; }
}
.search-toggle { display: none !important; }
.dock-item.mobile-only { display: none; }
@media (min-width: 821px) {
  .hide-desktop { display: none !important; }
}

/* Retro status strip + glossy nav ------------------------------------------ */
.shell-wrap { display: flex; flex-direction: column; height: 100%; }
.shell-wrap > .shell { flex: 1 1 auto; min-height: 0; height: auto; }
.retro-bar { display: none; }
[data-retro='on'] .retro-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: none;
  height: 26px;
  padding: 0 16px;
  font-family: 'DotGothic16', 'Silkscreen', ui-monospace, monospace;
  font-size: 13px;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  color: #fff;
  text-shadow: 0 1px 0 rgba(0, 40, 100, 0.6), 0 0 6px rgba(0, 60, 140, 0.35);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.08) 50%, rgba(0, 40, 110, 0.14) 51%, rgba(0, 40, 110, 0.04));
  border-bottom: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 1px 0 rgba(0, 40, 100, 0.18);
  white-space: nowrap;
  overflow: hidden;
}
[data-ink='dark'][data-retro='on'] .retro-bar { background: linear-gradient(180deg, rgba(20, 90, 190, 0.6), rgba(20, 90, 190, 0.42) 50%, rgba(8, 50, 130, 0.5) 51%, rgba(8, 50, 130, 0.4)); }
[data-retro='on'] .retro-bar + .shell { padding-top: 10px; }
.rb-cell { display: inline-flex; align-items: center; gap: 7px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.rb-user { overflow: hidden; text-overflow: ellipsis; }
.rb-sep { flex: none; width: 1px; height: 12px; background: rgba(255, 255, 255, 0.75); box-shadow: 1px 0 0 rgba(0, 40, 100, 0.3); }
.rb-signal { display: inline-flex; align-items: flex-end; gap: 1.5px; height: 10px; flex: none; }
.rb-signal i { width: 3px; background: #fff; box-shadow: 0 1px 0 rgba(0, 40, 100, 0.5); }
.rb-batt { position: relative; flex: none; width: 24px; height: 12px; border: 1.5px solid #fff; border-radius: 3px; padding: 1px; box-shadow: 0 1px 0 rgba(0, 40, 100, 0.45); }
.rb-batt::after { content: ''; position: absolute; right: -4.5px; top: 2.5px; width: 2.5px; height: 4px; background: #fff; border-radius: 0 1px 1px 0; }
.rb-batt-fill { display: block; height: 100%; width: calc(var(--lvl, 0.8) * 100%); border-radius: 1px; background: linear-gradient(#c8ff9a, #3fc41c); }
.rb-batt.low .rb-batt-fill { background: linear-gradient(#ffb8b8, #e02b3a); }
.rb-batt.charging .rb-batt-fill { animation: rb-charge 1.6s steps(4) infinite; }
@keyframes rb-charge { from { width: 25%; } to { width: 100%; } }

.aero-slot { position: relative; display: grid; place-items: center; width: 46px; height: 46px; transition: transform 0.45s var(--spring); }
.aero-ic { display: block; overflow: visible; filter: drop-shadow(0 3px 2.5px rgba(0, 40, 100, 0.38)); }
.dock-item:hover .aero-slot { animation: jelly 0.7s var(--ease); }
.dock-item.active .aero-slot { transform: scale(1.1) translateY(-1px); }
.dock-item.active .aero-ic { filter: drop-shadow(0 4px 3px rgba(0, 40, 100, 0.4)) drop-shadow(0 0 8px rgba(255, 255, 255, 0.55)); }
.dock-foot .aero-slot { width: 40px; height: 40px; }

/* Pixel Mono: lowercase chrome, like a 2008 phone. User content keeps its case. */
[data-font='pixelmono'] body { font-synthesis-weight: none; letter-spacing: 0.01em; }
[data-font='pixelmono'] :is(.dock-label, .topbar-title h1, .btn, .tab, .tabs, .chip, .seg, h1, h2, h3, h4, .section-label, .pill-tab) { text-transform: lowercase; }

@media (max-width: 820px) {
  [data-retro='on'] .retro-bar { font-size: 12px; gap: 8px; padding: 0 10px; height: 24px; }
  [data-retro='on'] .retro-bar + .shell { padding-top: 8px; }
  .dock { height: 74px; border-radius: 28px; }
  .dock-item .aero-slot { width: 38px; height: 38px; }
  .dock-item .aero-ic { width: 34px; height: 34px; }
  .dock-item .badge { right: calc(50% - 26px); }
}
