/* The shared Pixel Mini Apps palette. Keep these variable names — the Pixel
   Space panel and any future shared UI read them, which is what makes
   embedded surfaces feel native to your app's theme. */

:root {
  color-scheme: light;
  --paper: #f8f7f4;
  --panel: #f1efea;
  --card: #fff;
  --ink: #26231e;
  --on-ink: #fff;
  --soft-ink: #68645d;
  --muted: #8b877f;
  --line: #e9e6df;
  --line-strong: #d5d1c9;
  --accent: #d18b38;
  --danger: #bd514b;
  --hover-bg: rgba(240, 237, 231, .6);
  --danger-bg: rgba(189, 81, 75, .08);
  --shadow-sm: 0 1px 2px rgba(35, 32, 28, .06), 0 5px 18px rgba(35, 32, 28, .035);
  --shadow-drag: 0 3px 8px rgba(35, 32, 28, .1), 0 14px 38px rgba(35, 32, 28, .16);
  --wall-top: #cfe1f4;
  --wall-mid: #e6eef7;
  --wall-bot: #d2e0ef;
  --wall-glow: rgba(255, 255, 255, .65);
  --sb-ink: rgba(20, 32, 50, .86);
  --sb-muted: rgba(20, 32, 50, .55);
  --sb-label-shadow: 0 1px 2px rgba(255, 255, 255, .75);
  --sb-dot: rgba(20, 32, 50, .35);
  --sb-dot-active: rgba(20, 32, 50, .85);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #1a1917;
    --panel: #211f1d;
    --card: #2a2725;
    --ink: #e8e5e0;
    --on-ink: #1a1917;
    --soft-ink: #b3ada4;
    --muted: #8f8a81;
    --line: #33302c;
    --line-strong: #3d3934;
    --danger: #e07570;
    --hover-bg: rgba(255, 255, 255, .05);
    --danger-bg: rgba(224, 117, 112, .1);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4), 0 5px 18px rgba(0, 0, 0, .25);
    --shadow-drag: 0 3px 8px rgba(0, 0, 0, .45), 0 14px 38px rgba(0, 0, 0, .5);
    --wall-top: #0b111e;
    --wall-mid: #131e33;
    --wall-bot: #0a101b;
    --wall-glow: rgba(74, 144, 226, .16);
    --sb-ink: rgba(244, 247, 252, .94);
    --sb-muted: rgba(226, 234, 246, .62);
    --sb-label-shadow: 0 1px 3px rgba(0, 0, 0, .65);
    --sb-dot: rgba(255, 255, 255, .28);
    --sb-dot-active: rgba(255, 255, 255, .92);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1a1917;
  --panel: #211f1d;
  --card: #2a2725;
  --ink: #e8e5e0;
  --on-ink: #1a1917;
  --soft-ink: #b3ada4;
  --muted: #8f8a81;
  --line: #33302c;
  --line-strong: #3d3934;
  --danger: #e07570;
  --hover-bg: rgba(255, 255, 255, .05);
  --danger-bg: rgba(224, 117, 112, .1);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4), 0 5px 18px rgba(0, 0, 0, .25);
  --shadow-drag: 0 3px 8px rgba(0, 0, 0, .45), 0 14px 38px rgba(0, 0, 0, .5);
  --wall-top: #0b111e;
  --wall-mid: #131e33;
  --wall-bot: #0a101b;
  --wall-glow: rgba(74, 144, 226, .16);
  --sb-ink: rgba(244, 247, 252, .94);
  --sb-muted: rgba(226, 234, 246, .62);
  --sb-label-shadow: 0 1px 3px rgba(0, 0, 0, .65);
  --sb-dot: rgba(255, 255, 255, .28);
  --sb-dot-active: rgba(255, 255, 255, .92);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  background: var(--wall-bot);
  color: var(--sb-ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; }
[hidden] { display: none !important; }

/* Minimal iOS SpringBoard shell */
.springboard {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 80% 55% at 50% 20%, var(--wall-glow), transparent 72%),
    linear-gradient(180deg, var(--wall-top) 0%, var(--wall-mid) 52%, var(--wall-bot) 100%);
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  user-select: none;
  -webkit-user-select: none;
}

.status-bar {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  padding: 12px 20px 6px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--sb-muted);
}

.status-left {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.signal-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 1.5px;
  height: 10px;
}

.signal-bars i {
  display: block;
  width: 2.5px;
  border-radius: 1px;
  background: currentColor;
}
.signal-bars i:nth-child(1) { height: 4px; }
.signal-bars i:nth-child(2) { height: 6px; }
.signal-bars i:nth-child(3) { height: 8px; }
.signal-bars i:nth-child(4) { height: 10px; }

.carrier {
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.status-clock {
  color: var(--sb-ink);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 700;
}

.status-right {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.battery {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 22px;
  height: 11px;
  padding: 1.5px;
  border: 1.25px solid currentColor;
  border-radius: 3px;
}

.battery::after {
  content: "";
  position: absolute;
  right: -3.5px;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 4.5px;
  border-radius: 0 1px 1px 0;
  background: currentColor;
}

.battery-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 1.2px;
  background: currentColor;
}

.home-canvas {
  flex: 1 1 auto;
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  padding: 36px 24px 28px;
}

.app-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px 16px;
}

.app-slot {
  display: flex;
  justify-content: center;
}

.app-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  width: 78px;
  color: var(--sb-ink);
  text-decoration: none;
  outline: none;
}

.app-icon-frame {
  position: relative;
  display: block;
  width: 64px;
  height: 64px;
  border-radius: 22.5%;
  overflow: hidden;
  box-shadow:
    0 10px 24px rgba(0, 0, 0, .28),
    0 2px 6px rgba(0, 0, 0, .18),
    inset 0 0 0 1px rgba(255, 255, 255, .22);
  transition: transform 140ms cubic-bezier(.22, 1, .36, 1), filter 140ms ease, box-shadow 140ms ease;
}

/* Classic iOS glass highlight arc */
.app-icon-frame::after {
  content: "";
  position: absolute;
  inset: -12% -16% 48% -16%;
  border-radius: 0 0 50% 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, .42) 0%, rgba(255, 255, 255, .08) 100%);
  pointer-events: none;
}

.app-icon {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-label {
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-align: center;
  color: var(--sb-ink);
  text-shadow: var(--sb-label-shadow);
  word-break: break-word;
}

@media (hover: hover) {
  .app-tile:hover .app-icon-frame {
    transform: translateY(-1px) scale(1.045);
    box-shadow:
      0 14px 30px rgba(0, 0, 0, .34),
      0 3px 8px rgba(0, 0, 0, .2),
      inset 0 0 0 1px rgba(255, 255, 255, .3);
  }
}

.app-tile:active .app-icon-frame {
  transform: scale(.92);
  filter: brightness(.88);
}

.app-tile:focus-visible .app-icon-frame {
  box-shadow:
    0 0 0 3px rgba(56, 189, 248, .7),
    0 10px 24px rgba(0, 0, 0, .28);
}

.home-footer {
  padding: 12px 0 24px;
  display: flex;
  justify-content: center;
}

.page-dots {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.page-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--sb-dot);
}

.page-dot.is-active {
  background: var(--sb-dot-active);
}

@media (min-width: 600px) {
  .status-bar {
    padding-top: 18px;
  }
  .home-canvas {
    padding-top: 52px;
  }
  .app-icon-frame {
    width: 70px;
    height: 70px;
  }
  .app-tile {
    width: 84px;
  }
}
