/* MediFoodz Apps — iPhone-home launcher (SIGNATURE.md) */

/* Beta / sandbox — Creative badge (SANDBOX_BANNER=1 or PORTAL_ORIGIN has beta.) */
.sandbox-banner {
  position: sticky;
  top: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(90deg, #1a1208 0%, #3d2a0a 40%, #1a1208 100%);
  color: #fff7ed;
  text-align: center;
  font-family: var(--font, "Inter Tight", Inter, system-ui, sans-serif);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.3;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(245, 183, 0, 0.35);
}
.sandbox-banner .beta-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f5b700;
  color: #15211b;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.4;
  flex: 0 0 auto;
}
.sandbox-banner .beta-copy {
  opacity: 0.92;
}
body:has(.sandbox-banner) .frame-wrap {
  height: calc(100dvh - 36px);
}
body:has(.sandbox-banner) .wall {
  min-height: calc(100dvh - 36px);
}
.shell .top .beta-pill,
.frame-bar .beta-pill {
  display: inline-flex;
  align-items: center;
  margin-left: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f5b700;
  color: #15211b;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.4;
  vertical-align: middle;
}

:root {
  --forest: #124734;
  --forest-ink: #0a2a1f;
  --avocado: #b8be14;
  --cream: #f6f3ec;
  --gold: #f5b700;
  --paper: #fffdf8;
  --ink: #15211b;
  --page: #ffffff;
  --hairline: #e8e4dc;
  --font: "Inter Tight", Inter, "Helvetica Neue", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
/* Wall / denied: quiet dark — no green gradient wash */
body {
  font-family: var(--font);
  background: var(--forest-ink);
  color: var(--paper);
  -webkit-font-smoothing: antialiased;
}
/* Signed-in pages: page base follows shell (no forest wash behind .shell) */
body:has(.shell) {
  background: var(--page);
  color: var(--ink);
}
html[data-theme="dark"] body:has(.shell) {
  background: #0b0d0c;
  color: var(--paper);
}

.wall {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.wall-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
}
.mark { width: 72px; height: 72px; display: block; }
.top .mark { width: 36px; height: 36px; }
.ms-btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  background: #fff;
  color: #1b1b1b;
  font: 600 15px/1 var(--font);
  padding: 12px 18px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
.ms-btn svg { width: 20px; height: 20px; }
.denied { min-height: 100dvh; display: grid; place-items: center; padding: 24px; text-align: center; }
.denied p { margin: 0; color: rgba(255,253,248,0.62); font-size: 15px; letter-spacing: 0.01em; }

/* Signed-in shell — light default (gallery + Settings) */
.shell {
  min-height: 100dvh;
  background: var(--page);
  color: var(--ink);
}
.shell .top {
  background: var(--cream);
  border-bottom: 1px solid var(--hairline);
  padding: 14px 24px;
}
.shell .who {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  font-size: 13px;
  color: rgba(21, 33, 27, 0.62);
}
.shell .who .email { color: inherit; }
.shell .who a, .shell .top a { color: inherit; }
.shell .out {
  color: var(--avocado);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

/* Theme toggle — obvious Light / Dark */
.theme-toggle {
  appearance: none;
  cursor: pointer;
  border: 1px solid rgba(21, 33, 27, 0.14);
  background: #ffffff;
  color: var(--ink);
  font: 600 12px/1 var(--font);
  padding: 7px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.01em;
}
.theme-toggle:hover { border-color: rgba(184, 190, 20, 0.55); }
.theme-toggle .theme-ico {
  width: 14px;
  height: 14px;
  display: block;
}
.theme-toggle[aria-pressed="true"] {
  background: #1a1f1c;
  color: var(--paper);
  border-color: rgba(255, 253, 248, 0.16);
}

html[data-theme="dark"] .shell {
  background: #0b0d0c;
  color: var(--paper);
}
html[data-theme="dark"] .shell .top {
  background: #121514;
  border-bottom: 1px solid rgba(255, 253, 248, 0.08);
}
html[data-theme="dark"] .shell .who {
  color: rgba(255, 253, 248, 0.62);
}
html[data-theme="dark"] .shell .out {
  color: var(--avocado);
}
html[data-theme="dark"] .theme-toggle {
  background: #0b0d0c;
  color: var(--paper);
  border-color: rgba(255, 253, 248, 0.14);
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
}

/* Gallery — phone-density launcher */
.gallery {
  position: relative;
  padding: 28px 24px 64px;
  max-width: 600px;
  margin: 0 auto;
  isolation: isolate;
}
.gallery .wallpaper {
  position: absolute;
  inset: 8px 8px 24px;
  z-index: 0;
  border-radius: 28px;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 45% at 18% 22%, rgba(18, 71, 52, 0.14), transparent 60%),
    radial-gradient(ellipse 50% 40% at 82% 28%, rgba(184, 190, 20, 0.16), transparent 58%),
    radial-gradient(ellipse 45% 35% at 55% 88%, rgba(245, 183, 0, 0.12), transparent 55%),
    linear-gradient(180deg, #f7f4ee 0%, #f2efe8 48%, #f8f6f1 100%);
  filter: blur(0.2px);
}
html[data-theme="dark"] .gallery .wallpaper {
  background:
    radial-gradient(ellipse 55% 45% at 18% 22%, rgba(18, 71, 52, 0.28), transparent 60%),
    radial-gradient(ellipse 50% 40% at 82% 28%, rgba(184, 190, 20, 0.12), transparent 58%),
    radial-gradient(ellipse 45% 35% at 55% 88%, rgba(245, 183, 0, 0.08), transparent 55%),
    #0b0d0c;
}
.gallery h1 {
  position: relative;
  z-index: 1;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
  color: rgba(21, 33, 27, 0.72);
}
html[data-theme="dark"] .gallery h1 {
  color: rgba(255, 253, 248, 0.72);
}

.apps {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 20px 12px;
  justify-items: center;
}

.app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 88px;
  max-width: 88px;
  text-decoration: none;
  color: inherit;
  border: 0;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
}
.app.live { cursor: pointer; }
.app .icon {
  width: 72px;
  height: 72px;
  display: block;
  flex: 0 0 72px;
  object-fit: cover;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.app.live:hover .icon {
  transform: scale(1.04);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
}
html[data-theme="dark"] .app .icon {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}
html[data-theme="dark"] .app.live:hover .icon {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.55);
}
.app .name {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: normal;
  line-height: 1.2;
  text-align: center;
  color: rgba(21, 33, 27, 0.85);
  max-width: 88px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
html[data-theme="dark"] .app .name {
  color: rgba(255, 253, 248, 0.9);
}

.frame-wrap { height: 100dvh; display: grid; grid-template-rows: 48px 1fr; }
.frame-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; background: var(--forest-ink);
  border-bottom: 1px solid rgba(184,190,20,0.2);
  font-size: 13px;
  color: var(--paper);
}
.frame-bar a { color: var(--avocado); text-decoration: none; font-weight: 600; }
iframe { width: 100%; height: 100%; border: 0; background: var(--cream); }

.admin { max-width: 640px; margin: 0 auto; padding: 40px 28px; }
.admin table { width: 100%; border-collapse: collapse; }
.admin th, .admin td { text-align: left; padding: 10px 8px; border-bottom: 1px solid rgba(21,33,27,0.1); font-size: 14px; }
.admin .note { color: rgba(21,33,27,0.6); font-size: 13px; }

/* mobile pass */
html, body { overflow-x: hidden; }
.shell { overflow-x: hidden; max-width: 100vw; }
.gallery { overflow-x: hidden; max-width: min(600px, 100%); box-sizing: border-box; }
.gallery .wallpaper { max-width: 100%; }
.apps { width: 100%; box-sizing: border-box; }
.shell .top {
  flex-wrap: wrap;
  row-gap: 8px;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
}
.shell .who { max-width: 100%; justify-content: flex-start; }
@media (max-width: 480px) {
  .gallery { padding: 16px 12px 48px; }
  .gallery .wallpaper { inset: 4px 4px 16px; border-radius: 20px; }
  .apps { gap: 16px 8px; }
  .app, .app .name { max-width: 80px; width: 80px; }
  .gallery h1 { margin-bottom: 12px; font-size: 1rem; }
}
