:root {
  --bg: #f2f2f7;
  --bg-elevated: rgba(255, 255, 255, 0.72);
  --text: #1c1c1e;
  --text-secondary: #8e8e93;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
  --radius-icon: 22.5%;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

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

html,
body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* Soft mesh background for depth */
.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(255, 159, 10, 0.12), transparent 50%),
    radial-gradient(ellipse 60% 40% at 90% 0%, rgba(10, 132, 255, 0.1), transparent 45%),
    radial-gradient(ellipse 50% 40% at 50% 100%, rgba(191, 90, 242, 0.08), transparent 50%),
    var(--bg);
}

.app {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding:
    calc(20px + var(--safe-top))
    calc(20px + var(--safe-right))
    calc(32px + var(--safe-bottom))
    calc(20px + var(--safe-left));
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 28px;
  padding-top: 8px;
}

.logo-wrap {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 14px;
}

.logo-wrap img {
  width: 82%;
  height: 82%;
  object-fit: contain;
}

.brand {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.subtitle {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 2px;
  letter-spacing: -0.01em;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px 16px;
  justify-items: center;
  flex: 1;
  align-content: start;
  padding: 8px 4px 24px;
}

@media (min-width: 480px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 28px 24px;
  }
}

@media (min-width: 700px) {
  .grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.app-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 96px;
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: transform 0.15s ease;
}

.app-tile:active {
  transform: scale(0.92);
}

.app-icon {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-icon);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow:
    0 10px 20px rgba(0, 0, 0, 0.12),
    0 2px 6px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  position: relative;
  overflow: hidden;
}

.app-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.28) 0%,
    rgba(255, 255, 255, 0) 45%
  );
  pointer-events: none;
}

.app-label {
  font-size: 0.75rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--text);
  max-width: 100%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

footer {
  margin-top: auto;
  text-align: center;
  padding-top: 16px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.hint {
  margin-top: 6px;
  font-size: 0.6875rem;
  color: #aeaeb2;
  font-weight: 400;
}

@media (min-width: 480px) {
  .app-icon {
    width: 84px;
    height: 84px;
    font-size: 2.35rem;
  }
  .app-tile {
    max-width: 110px;
  }
  .app-label {
    font-size: 0.8125rem;
  }
  .logo-wrap {
    width: 80px;
    height: 80px;
    border-radius: 20px;
  }
}
