/* =========================================================
   PlayMarket – Ultra Enhanced UI/UX
   Modern Play Store–inspired · glass · motion · polish
   ========================================================= */

:root {
  --bg: #f0f2f5;
  --bg-elevated: #f8f9fb;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --ink: #1a1c1e;
  --ink-2: #3c4043;
  --muted: #5f6368;
  --muted-2: #80868b;
  --line: #e4e7eb;
  --line-soft: #eef0f3;
  --green: #01875f;
  --green-hover: #016b4c;
  --green-soft: #e6f4ef;
  --green-glow: rgba(1, 135, 95, 0.18);
  --chip: #eef0f2;
  --chip-hover: #e4e7eb;
  --danger: #d93025;
  --warning: #f9ab00;
  --shadow-xs: 0 1px 2px rgba(60, 64, 67, 0.06);
  --shadow: 0 1px 3px rgba(60, 64, 67, 0.1), 0 4px 8px rgba(60, 64, 67, 0.06);
  --shadow-md: 0 4px 12px rgba(60, 64, 67, 0.12), 0 2px 4px rgba(60, 64, 67, 0.06);
  --shadow-lg: 0 8px 24px rgba(60, 64, 67, 0.14), 0 2px 6px rgba(60, 64, 67, 0.06);
  --shadow-xl: 0 16px 40px rgba(60, 64, 67, 0.16);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --radius-pill: 999px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --nav-h: 68px;
  --max-w: 1280px;
  --header-h: 60px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
  height: 100%;
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: "Roboto", "Google Sans", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100%;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
textarea {
  font-family: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: var(--green-soft);
  color: var(--green);
}

/* ---------- App Shell ---------- */
#app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: var(--max-w);
  margin: 0 auto;
  background: var(--bg);
  position: relative;
}

/* ---------- Top Bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  padding-top: calc(10px + var(--safe-t));
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(228, 231, 235, 0.7);
  min-height: var(--header-h);
  transition: box-shadow 0.25s var(--ease);
}

.topbar.scrolled {
  box-shadow: var(--shadow-xs);
}

.brand {
  display: none;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 19px;
  color: var(--green);
  white-space: nowrap;
  letter-spacing: -0.3px;
  transition: opacity 0.15s;
}

.brand:hover {
  opacity: 0.85;
}

.brand .logo-mark {
  width: 32px;
  height: 32px;
  background: linear-gradient(145deg, #01a06f, #01875f 50%, #016b4c);
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 2px 8px var(--green-glow);
}

.search-trigger {
  flex: 1;
  height: 46px;
  background: #e9eef6;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  cursor: pointer;
  transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease), transform 0.15s;
  border: 1px solid transparent;
}

.search-trigger:hover {
  background: #dde5f0;
  box-shadow: var(--shadow-xs);
}

.search-trigger:active {
  transform: scale(0.99);
}

.search-trigger .material-symbols-outlined {
  font-size: 22px;
  color: var(--ink-2);
}

.search-trigger p {
  color: var(--muted);
  font-size: 15px;
  font-weight: 400;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4285f4, #34a853 60%, #fbbc05);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
  border: 2px solid var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s var(--spring), box-shadow 0.2s;
}

.avatar:hover {
  transform: scale(1.06);
  box-shadow: var(--shadow-md);
}

.avatar:active {
  transform: scale(0.96);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- Pills / Tabs ---------- */
.pills {
  display: flex;
  gap: 8px;
  padding: 10px 16px 14px;
  overflow-x: auto;
  scrollbar-width: none;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
  flex-shrink: 0;
  position: sticky;
  top: var(--header-h);
  z-index: 40;
}

.pills::-webkit-scrollbar {
  display: none;
}

.pill {
  border: none;
  background: transparent;
  color: var(--ink-2);
  font: 500 13.5px/1 "Roboto", sans-serif;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s, transform 0.15s var(--spring);
  position: relative;
}

.pill:hover {
  background: var(--chip);
}

.pill:active {
  transform: scale(0.96);
}

.pill.on {
  background: var(--green-soft);
  color: var(--green);
  font-weight: 600;
  box-shadow: 0 1px 0 rgba(1, 135, 95, 0.08);
}

/* ---------- Main Content ---------- */
.main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 20px);
  scroll-behavior: smooth;
  animation: fadeIn 0.35s var(--ease-out);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ---------- Sections ---------- */
.sec {
  margin-bottom: 32px;
  animation: slideUp 0.4s var(--ease-out) both;
}

.sec:nth-child(2) {
  animation-delay: 0.05s;
}
.sec:nth-child(3) {
  animation-delay: 0.1s;
}
.sec:nth-child(4) {
  animation-delay: 0.15s;
}

.sec-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 14px;
}

.sec-h h2,
.sec-h h3 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.35px;
  color: var(--ink);
}

.sec-h .more {
  border: 0;
  background: transparent;
  color: var(--green);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  transition: background 0.15s;
}

.sec-h .more:hover {
  background: var(--green-soft);
}

/* ---------- Horizontal Rows ---------- */
.row {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 0 16px 8px;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.row::-webkit-scrollbar {
  display: none;
}

/* ---------- App Card ---------- */
.app-card {
  width: 110px;
  flex-shrink: 0;
  cursor: pointer;
  scroll-snap-align: start;
  transition: transform 0.22s var(--ease);
  border-radius: var(--radius-sm);
}

.app-card:hover {
  transform: translateY(-3px);
}

.app-card:active {
  transform: scale(0.96);
}

.app-icon {
  width: 110px;
  height: 110px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  font-size: 38px;
  font-weight: 700;
  color: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
  background: #c5c8cd;
  position: relative;
  transition: box-shadow 0.25s var(--ease), transform 0.25s var(--ease);
}

.app-card:hover .app-icon {
  box-shadow: var(--shadow-md);
}

.app-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s var(--ease);
}

.app-card:hover .app-icon img {
  transform: scale(1.04);
}

.app-name {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 34px;
  letter-spacing: -0.1px;
}

.app-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.app-meta .material-symbols-outlined {
  font-size: 13px;
  font-variation-settings: "FILL" 1;
  color: #f9ab00;
}

/* ---------- List Item (Top Charts) ---------- */
.list {
  padding: 0 16px;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  cursor: pointer;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.15s;
  border-radius: var(--radius-xs);
  margin: 0 -8px;
  padding-left: 8px;
  padding-right: 8px;
}

.list-item:last-child {
  border-bottom: none;
}

.list-item:hover {
  background: rgba(0, 0, 0, 0.02);
}

.list-item:active {
  background: rgba(0, 0, 0, 0.04);
}

.list-item .rank {
  width: 24px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.list-item .sm-icon {
  width: 58px;
  height: 58px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 22px;
  flex-shrink: 0;
  overflow: hidden;
  background: #c5c8cd;
  box-shadow: var(--shadow-xs);
}

.list-item .sm-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.list-item .info {
  flex: 1;
  min-width: 0;
}

.list-item .info b {
  display: block;
  font-size: 14.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.15px;
}

.list-item .info span {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
  display: block;
}

.btn-install {
  border: 0;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.4px;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  text-transform: uppercase;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s var(--spring), box-shadow 0.2s;
}

.btn-install:hover {
  background: #d0e9df;
  box-shadow: 0 2px 8px var(--green-glow);
}

.btn-install:active {
  transform: scale(0.95);
}

.btn-install:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ---------- Hero / Featured ---------- */
.hero {
  margin: 14px 16px 24px;
  height: 200px;
  border-radius: 22px;
  position: relative;
  overflow: hidden;
  color: #fff;
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  cursor: pointer;
  background: linear-gradient(135deg, #0d1b4a, #1a237e 35%, #3949ab 70%, #5c6bc0);
  box-shadow: var(--shadow-md);
  transition: transform 0.25s var(--ease), box-shadow 0.25s;
}

.hero:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.hero:active {
  transform: scale(0.99);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.65) 0%, rgba(0, 0, 0, 0.2) 45%, transparent 70%);
  pointer-events: none;
}

.hero .hero-content {
  position: relative;
  z-index: 1;
}

.hero .tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  letter-spacing: 0.5px;
  opacity: 0.95;
  text-transform: uppercase;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  margin-bottom: 6px;
}

.hero h2 {
  font-size: 24px;
  font-weight: 700;
  margin: 2px 0 8px;
  letter-spacing: -0.4px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.hero .meta {
  font-size: 13px;
  opacity: 0.92;
  font-weight: 400;
}

.hero img.banner {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- Bottom Navigation ---------- */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border-top: 1px solid rgba(228, 231, 235, 0.8);
  display: flex;
  z-index: 60;
  max-width: var(--max-w);
  margin: 0 auto;
  box-shadow: 0 -4px 20px rgba(60, 64, 67, 0.06);
}

.bottom-nav button {
  flex: 1;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  padding-top: 8px;
  transition: color 0.2s var(--ease), transform 0.15s var(--spring);
  position: relative;
}

.bottom-nav button:active {
  transform: scale(0.92);
}

.bottom-nav button.on {
  color: var(--green);
  font-weight: 600;
}

.bottom-nav .material-symbols-outlined {
  font-size: 26px;
  transition: transform 0.2s var(--spring);
}

.bottom-nav button.on .material-symbols-outlined {
  font-variation-settings: "FILL" 1;
  transform: scale(1.08);
}

.bottom-nav button.on::after {
  content: "";
  position: absolute;
  top: 4px;
  width: 28px;
  height: 3px;
  background: var(--green);
  border-radius: 2px;
  opacity: 0.9;
}

/* ---------- Overlays (Search / Detail) ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 100;
  display: none;
  flex-direction: column;
  max-width: var(--max-w);
  margin: 0 auto;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.28s var(--ease-out), transform 0.28s var(--ease-out);
}

.overlay.show {
  display: flex;
  opacity: 1;
  transform: translateY(0);
  animation: overlayIn 0.3s var(--ease-out);
}

@keyframes overlayIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ov-header {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px 8px 6px;
  padding-top: calc(8px + var(--safe-t));
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
  min-height: var(--header-h);
}

.icon-btn {
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--ink-2);
  flex-shrink: 0;
  transition: background 0.15s, transform 0.15s var(--spring);
}

.icon-btn:hover {
  background: var(--chip);
}

.icon-btn:active {
  transform: scale(0.92);
}

.ov-search-input {
  flex: 1;
  height: 44px;
  border: 0;
  background: transparent;
  font-size: 16px;
  outline: none;
  color: var(--ink);
  font-weight: 400;
}

.ov-search-input::placeholder {
  color: var(--muted-2);
}

.suggest {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
}

.suggest-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 0;
  background: transparent;
  text-align: left;
  font-size: 15px;
  color: var(--ink-2);
  cursor: pointer;
  border-radius: 14px;
  transition: background 0.15s;
}

.suggest-item:hover {
  background: #eef1f4;
}

.suggest-item:active {
  background: #e4e8ed;
}

.suggest-item .material-symbols-outlined {
  color: var(--muted);
}

.suggest-item .sm-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  box-shadow: var(--shadow-xs);
}

.suggest-item .sm-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- App Detail ---------- */
.detail-scroll {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 40px;
  -webkit-overflow-scrolling: touch;
}

.detail-hero {
  height: 240px;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 20px;
  color: #fff;
  background: linear-gradient(145deg, #0d1b4a, #3949ab);
}

.detail-hero .banner {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.25) 50%, transparent 80%);
  pointer-events: none;
}

.detail-hero .back-btn {
  position: absolute;
  top: calc(12px + var(--safe-t));
  left: 10px;
  z-index: 5;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  backdrop-filter: blur(8px);
}

.detail-hero .back-btn:hover {
  background: rgba(0, 0, 0, 0.5);
}

.detail-hero .dh {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 16px;
  align-items: flex-end;
  width: 100%;
}

.d-icon {
  width: 88px;
  height: 88px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 36px;
  font-weight: 700;
  color: #fff;
  background: #5c6bc0;
}

.d-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.d-title h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.d-title .dev {
  font-size: 13px;
  opacity: 0.9;
}

.cta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line-soft);
  position: sticky;
  top: 0;
  z-index: 10;
}

.btn-download {
  flex: 1;
  height: 48px;
  border: 0;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.3px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  box-shadow: 0 4px 14px var(--green-glow);
  transition: background 0.2s, transform 0.15s var(--spring), box-shadow 0.2s;
}

.btn-download:hover {
  background: var(--green-hover);
  box-shadow: 0 6px 18px var(--green-glow);
}

.btn-download:active {
  transform: scale(0.97);
}

.btn-download:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-fav {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.2s var(--ease);
}

.btn-fav:hover {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-soft);
}

.btn-fav.on {
  color: #e91e63;
  border-color: #fce4ec;
  background: #fce4ec;
}

.btn-fav.on .material-symbols-outlined {
  font-variation-settings: "FILL" 1;
}

.stats-row {
  display: flex;
  justify-content: space-around;
  padding: 20px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line-soft);
}

.stat {
  text-align: center;
  flex: 1;
}

.stat .val {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.2px;
}

.stat .lbl {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.shots {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 12px 16px 20px;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
}

.shots::-webkit-scrollbar {
  display: none;
}

.shots img {
  width: 148px;
  height: 264px;
  object-fit: cover;
  border-radius: 16px;
  flex-shrink: 0;
  scroll-snap-align: start;
  box-shadow: var(--shadow);
  transition: transform 0.25s var(--ease);
}

.shots img:hover {
  transform: scale(1.02);
}

.shot-ph {
  width: 148px;
  height: 264px;
  border-radius: 16px;
  background: linear-gradient(145deg, #e8eaed, #f1f3f4);
  flex-shrink: 0;
}

.about {
  padding: 8px 20px 28px;
}

.about h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -0.2px;
}

.about p {
  font-size: 14.5px;
  color: var(--ink-2);
  line-height: 1.6;
  white-space: pre-wrap;
}

.about .whats-new {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-b) + 20px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #323232;
  color: #fff;
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
  box-shadow: var(--shadow-lg);
  max-width: calc(100% - 32px);
  text-align: center;
}

.toast.on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- States ---------- */
.state-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 28px;
  text-align: center;
  min-height: 240px;
}

.state-box .material-symbols-outlined {
  font-size: 52px;
  color: var(--muted-2);
  margin-bottom: 16px;
  opacity: 0.7;
}

.state-box h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.2px;
}

.state-box p {
  font-size: 14px;
  color: var(--muted);
  max-width: 280px;
  line-height: 1.5;
}

/* ---------- Skeleton ---------- */
.skeleton {
  background: linear-gradient(90deg, #e8eaed 25%, #f1f3f4 50%, #e8eaed 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 8px;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.sk-card {
  width: 110px;
  flex-shrink: 0;
}

.sk-icon {
  width: 110px;
  height: 110px;
  border-radius: 24px;
}

.sk-line {
  height: 12px;
  margin-top: 10px;
  border-radius: 6px;
}

.sk-line.short {
  width: 60%;
  margin-top: 6px;
}

/* ---------- Grid (desktop / category) ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 18px;
  padding: 8px 16px 28px;
}

.load-more-wrap {
  text-align: center;
  padding: 20px;
}

.btn-load-more {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-weight: 600;
  font-size: 14px;
  padding: 12px 28px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.15s;
}

.btn-load-more:hover {
  background: var(--chip);
  box-shadow: var(--shadow-xs);
}

.btn-load-more:active {
  transform: scale(0.97);
}

.btn-load-more:disabled {
  opacity: 0.5;
}

/* ---------- Category chips ---------- */
.cat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 8px 16px 28px;
}

.cat-card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  padding: 18px;
  cursor: pointer;
  text-align: left;
  transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease), border-color 0.2s;
}

.cat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: transparent;
}

.cat-card:active {
  transform: scale(0.98);
}

.cat-card .material-symbols-outlined {
  font-size: 30px;
  color: var(--green);
  margin-bottom: 10px;
}

.cat-card b {
  display: block;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.15px;
}

.cat-card span {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 3px;
  display: block;
}

/* ---------- Profile / Favorites pages ---------- */
.page-header {
  padding: 20px 16px 12px;
}

.page-header h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.page-header p {
  color: var(--muted);
  font-size: 14px;
  margin-top: 4px;
}

.profile-card {
  margin: 8px 16px 24px;
  background: var(--surface);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}

.profile-card .p-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4285f4, #34a853);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
}

.profile-card .p-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-card .p-info h2 {
  font-size: 18px;
  font-weight: 600;
}

.profile-card .p-info p {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.menu-list {
  margin: 0 16px 24px;
  background: var(--surface);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-size: 15px;
  color: var(--ink);
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.15s;
}

.menu-item:last-child {
  border-bottom: none;
}

.menu-item:hover {
  background: var(--bg-elevated);
}

.menu-item .material-symbols-outlined {
  color: var(--muted);
  font-size: 22px;
}

.menu-item.danger {
  color: var(--danger);
}

.menu-item.danger .material-symbols-outlined {
  color: var(--danger);
}

/* ---------- Auth buttons ---------- */
.btn-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  margin-top: 10px;
}

.btn-auth:hover {
  background: var(--chip);
  box-shadow: var(--shadow-xs);
}

.btn-auth.primary {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.btn-auth.primary:hover {
  background: var(--green-hover);
}

.divider {
  text-align: center;
  position: relative;
  margin: 20px 0;
  color: var(--muted);
  font-size: 13px;
}

.divider::before,
.divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--line);
}

.divider::before {
  left: 0;
}

.divider::after {
  right: 0;
}

/* ---------- Desktop nav (hidden on mobile) ---------- */
.desktop-nav {
  display: none;
}

.desktop-nav button {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font: 500 14px/1 "Roboto", sans-serif;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.desktop-nav button:hover {
  background: var(--chip);
}

.desktop-nav button.on {
  background: var(--green-soft);
  color: var(--green);
  font-weight: 600;
}

/* ---------- Utility ---------- */
.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Smooth scrollbar for desktop */
.main::-webkit-scrollbar,
.detail-scroll::-webkit-scrollbar,
.suggest::-webkit-scrollbar {
  width: 8px;
}

.main::-webkit-scrollbar-track,
.detail-scroll::-webkit-scrollbar-track,
.suggest::-webkit-scrollbar-track {
  background: transparent;
}

.main::-webkit-scrollbar-thumb,
.detail-scroll::-webkit-scrollbar-thumb,
.suggest::-webkit-scrollbar-thumb {
  background: #c5c8cd;
  border-radius: 4px;
}

.main::-webkit-scrollbar-thumb:hover,
.detail-scroll::-webkit-scrollbar-thumb:hover,
.suggest::-webkit-scrollbar-thumb:hover {
  background: #9aa0a6;
}
