@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;700&display=swap');

:root {
  --red: #e60012;
  --red-dark: #9b000d;
  --accent: #ff4d5e;
  --bg: #0c0c0c;
  --surface: #fafafa;
  --text: #1c1c1c;
  --muted: #888;
  --shadow: 0 14px 28px rgba(0, 0, 0, 0.12);
  --glow: 0 0 30px rgba(230, 0, 18, 0.45);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
  background: radial-gradient(circle at 80% 10%, #2b0005 0%, #000 40%, #121212 100%);
  font-family: 'Kanit', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  min-height: 100vh;
}

.phone {
  width: 100%;
  max-width: 420px;
  height: 800px;
  max-height: 92vh;
  background: url('BG.png') center/cover no-repeat;
  border-radius: 36px;
  box-shadow: 0 0 80px rgba(230, 0, 18, 0.35), inset 0 0 0 6px #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.app-header {
  display: flex;
  align-items: center;
  padding: 24px 24px 14px;
  gap: 14px;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--red), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  box-shadow: 0 8px 18px rgba(230, 0, 18, 0.35);
}

.user-meta { flex: 1; }
.greet { font-size: 13px; color: var(--muted); margin: 0; }
.name { font-size: 17px; font-weight: 700; margin: 0; color: var(--text); }

.hero {
  margin: 0 0 18px;
  padding: 26px;
  border-radius: 0 0 24px 24px;
  min-height: 120px;
  background: linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.45));
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: var(--glow);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero h1 {
  font-size: 22px;
  margin: 0 0 6px;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.hero p { margin: 0; font-size: 14px; opacity: 0.88; }
.hero .brand {
  position: absolute;
  right: 16px;
  bottom: 12px;
  font-size: 34px;
  font-weight: 800;
  opacity: 0.12;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(26px);
  opacity: 0.5;
  animation: float 7s ease-in-out infinite;
}
.orb-1 {
  width: 130px;
  height: 130px;
  background: #ff6b6b;
  top: -40px;
  right: -30px;
}
.orb-2 {
  width: 90px;
  height: 90px;
  background: #fff;
  bottom: -30px;
  left: -30px;
  opacity: 0.16;
  animation-delay: -3s;
}

.shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, 0.15) 50%, transparent 62%);
  background-size: 220% 100%;
  animation: shimmer 3.5s infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

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

.grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 0 20px 20px;
  align-content: start;
  align-content: safe center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.grid::-webkit-scrollbar { display: none; }

.card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.80), rgba(255, 255, 255, 0.55));
  border-radius: 16px;
  padding: 10px 8px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.10),
    inset 0 1px 2px rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px) saturate(110%);
  -webkit-backdrop-filter: blur(12px) saturate(110%);
  position: relative;
  overflow: hidden;
  opacity: 0;
  transition: transform 0.25s, box-shadow 0.25s;
}

.phone.loaded .card:nth-child(odd) {
  animation: slideFromLeft 0.8s cubic-bezier(0.25, 0.8, 0.25, 1) calc(0.4s + var(--i, 0) * 120ms) forwards;
}
.phone.loaded .card:nth-child(even) {
  animation: slideFromRight 0.8s cubic-bezier(0.25, 0.8, 0.25, 1) calc(0.4s + var(--i, 0) * 120ms) forwards;
}
.card:hover {
  transform: translateY(-6px) scale(1.03);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.65));
  box-shadow:
    0 18px 36px rgba(0, 0, 0, 0.18),
    0 0 24px rgba(230, 0, 18, 0.2),
    inset 0 1px 2px rgba(255, 255, 255, 0.95);
}

.card-icon {
  width: 36px;
  height: 36px;
  margin: 0 auto 6px;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.50), rgba(255, 255, 255, 0.15));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow:
    0 6px 12px rgba(0, 0, 0, 0.15),
    inset 0 1px 2px rgba(255, 255, 255, 0.65),
    inset 0 -2px 4px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.25));
  transition: transform 0.25s;
}
.card:hover .card-icon {
  transform: translateY(-4px) scale(1.12);
}

.card-title { font-size: 13px; font-weight: 600; margin: 0 0 2px; }
.card-desc { font-size: 10px; color: var(--muted); margin: 0; }

@keyframes slideFromLeft {
  from { opacity: 0; transform: translateX(-500px) scale(0.85); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes slideFromRight {
  from { opacity: 0; transform: translateX(500px) scale(0.85); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

.bottom-nav {
  margin-top: auto;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 14px 20px;
  background: rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.2);
}
.nav-item {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: 0.2s;
}
.nav-item:hover, .nav-item.active { color: var(--red); }

.nav-plus {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--red), var(--accent));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  text-decoration: none;
  box-shadow: var(--glow);
  transform: translateY(-10px);
  transition: 0.25s;
}
.nav-plus:hover { transform: translateY(-14px) scale(1.1); }

.empty {
  padding: 40px;
  text-align: center;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  grid-column: 1 / -1;
}

.loader {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: transparent;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
.phone.loaded .loader {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-logo {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.05em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  margin-bottom: 28px;
  animation: pulse 2s ease-in-out infinite;
}

.loader-bar {
  width: 55%;
  height: 4px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.loader-progress {
  width: 0%;
  height: 100%;
  border-radius: 2px;
  background: #000;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
  transition: width 0.08s linear;
}

.loader-percent {
  width: 55%;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  text-align: right;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  font-variant-numeric: tabular-nums;
}

.hero, .grid, .bottom-nav {
  opacity: 0;
  transform: translateY(30px);
}

.phone.loaded .hero,
.phone.loaded .grid,
.phone.loaded .bottom-nav {
  animation: fadeUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.phone.loaded .hero { animation-delay: 0.15s; }
.phone.loaded .grid { animation-delay: 0.3s; }
.phone.loaded .bottom-nav { animation-delay: 0.45s; }

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

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.97); }
}

.loader-logo.explode {
  animation: explode 0.5s ease-in forwards;
}

@keyframes explode {
  0% { transform: scale(1); opacity: 1; }
  70% { transform: scale(22); opacity: 1; }
  100% { transform: scale(25); opacity: 0; }
}

@media (max-width: 480px) {
  body { padding: 0; }
  .phone {
    width: 100%;
    max-width: none;
    height: 100vh;
    max-height: none;
    border-radius: 0;
    box-shadow: none;
  }
}
