/* Android design. Every rule here starts with html[data-os="android"] (set by js/platform.js),
   so iPhones keep the iOS design exactly as it is. Same colours, logo and tone; Android-style
   controls, a full-width bottom bar, a floating + button, flatter surfaces and less rounding. */

/* ---------- 1. No frosted glass: solid surfaces scroll smoothly on every phone ---------- */
html[data-os="android"] * { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
html[data-os="android"] .glass {
  background: var(--sheet);
  border: 1px solid var(--surfaceBorder);
  box-shadow: 0 1px 2px var(--shadow), 0 6px 16px -10px var(--shadow);
}
html[data-os="android"] .icon-btn.glass { background: var(--track); border-color: transparent; box-shadow: none; }
html[data-os="android"] .orb-glass::after { display: none; } /* the glassy shine */
/* The logo's colour comes from the blurred core behind its glass: keep that glass see-through */
html[data-os="android"] .logo-glass.glass { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.35); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 10px 30px -8px var(--shadow); }
/* + menu icons: a solid tinted circle instead of glass */
html[data-os="android"] .orb-glass { background: var(--sheet); box-shadow: inset 0 0 0 100px color-mix(in srgb, var(--tint) 14%, transparent), 0 6px 14px -6px var(--shadow); }
html[data-os="android"] .quick { background: rgba(10, 8, 30, 0.45); }
/* Things that slide over other content were see-through glass: make them solid, so nothing behind shows */
html[data-os="android"] .sheet, html[data-os="android"] .picker-sheet, html[data-os="android"] .mail-banner {
  background: linear-gradient(var(--sheet), var(--sheet)), var(--bgMid);
}
html[data-os="android"] .sheet-backdrop, html[data-os="android"] .picker { background: rgba(10, 8, 30, 0.5); }
html[data-os="android"] .menu-item.soon::after { background: color-mix(in srgb, var(--sheet) 88%, transparent); }

/* ---------- 2. Less rounding ---------- */
html[data-os="android"] .card { border-radius: 18px; }
html[data-os="android"] .set-list { border-radius: 16px; }
html[data-os="android"] .promise li { border-radius: 14px; }
html[data-os="android"] .menu-item { border-radius: 16px; }
html[data-os="android"] .sheet { border-radius: 28px 28px 0 0; }
html[data-os="android"] .pad button { border-radius: 14px; }
html[data-os="android"] .au-cells i { border-radius: 12px; }
html[data-os="android"] .au-human { border-radius: 12px; }

/* Buttons: filled ones are full pills, the second choice is an outlined button */
html[data-os="android"] .save-btn { border-radius: 99px; box-shadow: 0 6px 16px -8px var(--purple); }
html[data-os="android"] .au-alt { border-radius: 99px; background: transparent; border: 1px solid color-mix(in srgb, var(--textMuted) 55%, transparent); }

/* Text fields: outlined, with a thicker coloured outline while typing */
html[data-os="android"] .lf-input { border-radius: 12px; background: transparent; border: 1px solid color-mix(in srgb, var(--textMuted) 55%, transparent); box-shadow: none; }
html[data-os="android"] .lf-input:focus { border-color: var(--purple); box-shadow: inset 0 0 0 1px var(--purple); }
html[data-os="android"] .lf-input.bad { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
html[data-os="android"] .money-field { background: transparent; border: 1px solid color-mix(in srgb, var(--textMuted) 55%, transparent); box-shadow: none; }
html[data-os="android"] .money-field:focus-within { border-color: var(--purple); box-shadow: inset 0 0 0 1px var(--purple); }

/* ---------- 3. Android switches: outlined track when off, a bigger thumb (with a tick) when on ---------- */
html[data-os="android"] .lf-switch { width: 52px; height: 32px; background: var(--track); box-shadow: inset 0 0 0 2px var(--textMuted); }
html[data-os="android"] .lf-switch::after {
  top: 8px; left: 8px; width: 16px; height: 16px; background: var(--textMuted); box-shadow: none;
  transition: transform 0.25s var(--ease-out), width 0.2s ease, height 0.2s ease, top 0.2s ease, left 0.2s ease, background 0.2s ease;
}
html[data-os="android"] .lf-toggle input:checked + .lf-switch { background: var(--purple); box-shadow: none; }
html[data-os="android"] .lf-toggle input:checked + .lf-switch::after {
  top: 4px; left: 4px; width: 24px; height: 24px; transform: translateX(20px); background: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237c5cff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E");
  background-size: 16px; background-position: center; background-repeat: no-repeat;
}

/* ---------- 4. Taps: a ripple from your finger (js/android.js) instead of the iOS shrink ---------- */
html[data-os="android"] .rip-host { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; pointer-events: none; }
html[data-os="android"] .rip { position: absolute; border-radius: 50%; background: currentColor; opacity: 0.18; transform: scale(0); animation: rip 0.55s ease-out forwards; }
@keyframes rip { to { transform: scale(1); opacity: 0; } }
html[data-os="android"] .jelly, html[data-os="android"] .add-btn.jelly { animation: none; }
html[data-os="android"] .cal-arrow:active, html[data-os="android"] .cal-day:not(.blank):not(:disabled):active, html[data-os="android"] .mode-opt:active,
html[data-os="android"] .pad button:active, html[data-os="android"] .pad button.press, html[data-os="android"] .save-btn:active, html[data-os="android"] .bank-chip:active,
html[data-os="android"] .bank-tile:active, html[data-os="android"] .more-banks:active, html[data-os="android"] .picker-opt:active, html[data-os="android"] .del-btn:active,
html[data-os="android"] .menu-item:active, html[data-os="android"] .bud-row:active, html[data-os="android"] .bud-other:active, html[data-os="android"] .home-bud:active,
html[data-os="android"] .loan-row:active, html[data-os="android"] .goal-card:active, html[data-os="android"] .au-alt:active, html[data-os="android"] .tour-next:active { transform: none; }

@media (max-width: 767px) {
  /* ---------- 5. Bottom bar: full width, on the bottom edge, a pill behind the active tab ---------- */
  html[data-os="android"] .tabbar {
    left: 0; right: 0; bottom: 0; transform: none; width: 100%;
    height: calc(76px + env(safe-area-inset-bottom)); padding: 0 8px env(safe-area-inset-bottom);
    grid-template-columns: repeat(4, 1fr); border-radius: 0; border: 0; border-top: 1px solid var(--surfaceBorder);
    background: linear-gradient(var(--sheet), var(--sheet)), var(--bgBottom); /* fully solid, nothing shows through */
    box-shadow: 0 -4px 14px -10px var(--shadow);
  }
  html[data-os="android"] body:not(.ready) .tabbar { transform: translateY(20px); }
  html[data-os="android"] .tab { position: relative; height: 76px; gap: 6px; font-size: 12px; font-weight: 700; border-radius: 16px; }
  html[data-os="android"] .tab > .i, html[data-os="android"] .tab > .avatar-wrap, html[data-os="android"] .tab > span:last-child { position: relative; z-index: 1; }
  html[data-os="android"] .tab.active { color: var(--text); }
  html[data-os="android"] .tab.active::before {
    content: ''; position: absolute; z-index: 0; top: 12px; left: 50%; width: 60px; height: 32px; margin-left: -30px; border-radius: 99px;
    background: color-mix(in srgb, var(--purple) 22%, transparent);
  }

  /* The + button floats bottom-right, above the bar */
  html[data-os="android"] .tab-add {
    position: fixed; right: 16px; bottom: calc(76px + 16px + env(safe-area-inset-bottom)); z-index: 21;
    width: 60px; height: 60px; border-radius: 18px;
  }
  html[data-os="android"] .tab-add .add-btn {
    width: 60px; height: 60px; border-radius: 18px; transform: none;
    box-shadow: 0 8px 18px -6px rgba(0, 0, 0, 0.4), 0 12px 26px -12px var(--purple);
  }
  /* Its menu (Income, Scan bill, Expense) opens upwards from it, Expense closest to your thumb */
  html[data-os="android"] .quick-items {
    left: auto; right: 20px; transform: none; width: auto; height: auto;
    bottom: calc(76px + 16px + 60px + 18px + env(safe-area-inset-bottom));
    display: flex; flex-direction: column; align-items: flex-end; gap: 14px;
  }
  html[data-os="android"] .quick-item { position: static; flex-direction: row-reverse; gap: 12px; --dx: 0px; --dy: 24px; }
  html[data-os="android"] .quick-item .orb { width: 52px; height: 52px; }
  html[data-os="android"] .quick-item .orb .i { width: 24px; height: 24px; }
  html[data-os="android"] .quick-item > span:last-child { padding: 7px 12px; border-radius: 10px; }

  /* Room for the bar and the floating button */
  html[data-os="android"] .app { padding-bottom: calc(env(safe-area-inset-bottom) + 170px); }


  /* Phones: the snackbar sits above the floating + button */
  html[data-os="android"] .toast, html[data-os="android"] .toast.glass { bottom: calc(76px + 16px + 60px + 14px + env(safe-area-inset-bottom)); width: min(436px, calc(100% - 24px)); }
}

/* ---------- 6. Messages: an Android "snackbar" (dark, square-ish, with a coloured action) ---------- */
html[data-os="android"] .toast, html[data-os="android"] .toast.glass {
  border-radius: 8px; border: 0; color: #f4eff4; background: #313033; box-shadow: 0 6px 18px -4px rgba(0, 0, 0, 0.45);
}
html[data-os="android"] .toast-btn { background: none; color: #d0bcff; padding: 8px 10px; }
html[data-os="android"] body.auth-open .toast { bottom: calc(20px + env(safe-area-inset-bottom)); }

/* ---------- 6b. Android tablets (768–1023px): a side rail with the + at the top ---------- */
@media (min-width: 768px) and (max-width: 1023px) {
  html[data-os="android"] { --side: 88px; }
  html[data-os="android"] .tabbar {
    left: 0; top: 0; bottom: 0; transform: none; width: var(--side); height: auto;
    display: flex; flex-direction: column; align-items: center; gap: 10px; padding: calc(env(safe-area-inset-top) + 20px) 0 20px;
    border-radius: 0; border: 0; border-right: 1px solid var(--surfaceBorder);
    background: linear-gradient(var(--sheet), var(--sheet)), var(--bgMid);
  }
  html[data-os="android"] body:not(.ready) .tabbar { transform: translateX(-20px); }
  html[data-os="android"] .tab { position: relative; flex: none; width: var(--side); height: 62px; gap: 4px; font-size: 12px; font-weight: 700; }
  html[data-os="android"] .tab > .i, html[data-os="android"] .tab > .avatar-wrap, html[data-os="android"] .tab > span:last-child { position: relative; z-index: 1; }
  html[data-os="android"] .tab.active { color: var(--text); }
  html[data-os="android"] .tab.active::before {
    content: ''; position: absolute; z-index: 0; top: 5px; left: 50%; width: 56px; height: 32px; margin-left: -28px; border-radius: 99px;
    background: color-mix(in srgb, var(--purple) 22%, transparent);
  }
  html[data-os="android"] .tab-profile { margin-top: auto; }
  html[data-os="android"] .tab-add { order: -1; width: 56px; height: 56px; margin-bottom: 16px; border-radius: 16px; }
  html[data-os="android"] .tab-add .add-btn { width: 56px; height: 56px; border-radius: 16px; transform: none; box-shadow: 0 8px 18px -6px rgba(0, 0, 0, 0.4); }
  html[data-os="android"] .add-btn.jelly { animation: none; }
  html[data-os="android"] .quick-items {
    left: calc(var(--side) + 8px); top: calc(env(safe-area-inset-top) + 20px); bottom: auto; right: auto; transform: none; width: auto; height: auto;
    display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
  }
  html[data-os="android"] .quick .quick-item { position: static; flex-direction: row; gap: 12px; --dx: -30px; --dy: 0px; }
  html[data-os="android"] .app { margin-left: var(--side); padding-bottom: 48px; }
  html[data-os="android"] .toast, html[data-os="android"] .toast.glass { left: calc(var(--side) + (100% - var(--side)) / 2); bottom: 24px; }
  html[data-os="android"] .sheet { left: calc(var(--side) + (100% - var(--side)) / 2); }
}

/* Laptop-size Android screens use the sidebar from css/wide.css, kept flat and solid */
@media (min-width: 1024px) {
  html[data-os="android"] .tabbar { background: linear-gradient(var(--sheet), var(--sheet)), var(--bgMid); border-radius: 24px; }
  html[data-os="android"] .tab { border-radius: 99px; }
  html[data-os="android"] .tab-add .add-btn { border-radius: 16px; }
}

/* ---------- 7. Small things ---------- */
html[data-os="android"] .mail-banner { border-radius: 16px; }
html[data-os="android"] .tour-card { border-radius: 20px; }
html[data-os="android"] .tour-next { border-radius: 99px; }
