:root {
  color-scheme: light;
  --olive: #3e5641;
  --olive-deep: #304533;
  --sage: #84a98c;
  --cream: #faf7f2;
  --paper: #ffffff;
  --charcoal: #1f2937;
  --muted: #667085;
  --line: rgba(62, 86, 65, 0.16);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--cream);
  color: var(--charcoal);
}

button,
a { font: inherit; }

.app-shell {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: 46px minmax(0, 1fr);
  background: var(--cream);
}

.shell-bar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left));
  color: #fff;
  background: linear-gradient(100deg, var(--olive-deep), var(--olive));
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 12px rgba(31, 41, 55, 0.12);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: inherit;
  text-decoration: none;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand img {
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.shell-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.secure-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.82);
}

.secure-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #cde8d2;
  box-shadow: 0 0 0 4px rgba(205, 232, 210, 0.1);
}

.install-button {
  border: 1px solid rgba(255, 255, 255, 0.44);
  border-radius: 999px;
  padding: 6px 12px;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
}

.install-button:hover,
.install-button:focus-visible { background: rgba(255, 255, 255, 0.18); }

.portal-launch {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 90% 8%, rgba(132, 169, 140, 0.24), transparent 33%),
    radial-gradient(circle at 15% 85%, rgba(132, 169, 140, 0.2), transparent 28%),
    var(--cream);
}

.launch-panel {
  width: min(560px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(28px, 6vw, 48px);
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 24px 70px rgba(48, 69, 51, 0.14);
}

.fallback-panel[hidden] { display: none; }

.loading-mark { border-radius: 15px; box-shadow: 0 14px 34px rgba(48, 69, 51, 0.18); }

.loading-title {
  margin: 18px 0 5px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.25rem, 3vw, 1.65rem);
  font-weight: 700;
}

.loading-copy,
.fallback-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.fallback-panel p { max-width: 520px; line-height: 1.55; }

.portal-button,
.fallback-panel a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  padding: 12px 20px;
  text-decoration: none;
  cursor: pointer;
}

.portal-button {
  min-width: 180px;
  margin-top: 24px;
  border: 1px solid var(--olive);
  color: #fff;
  background: var(--olive);
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(48, 69, 51, 0.2);
}

.portal-button:hover,
.portal-button:focus-visible { background: var(--olive-deep); }

.launch-status {
  min-height: 1.25rem;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.fallback-panel {
  width: 100%;
  margin-top: 8px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.fallback-panel a {
  margin-top: 12px;
  border: 1px solid var(--line);
  color: var(--olive-deep);
  background: var(--paper);
  font-weight: 650;
}

.support-link {
  margin-top: 18px;
  color: var(--olive);
  font-size: 0.84rem;
}

.noscript { margin: 24px; }

@media (max-width: 560px) {
  .app-shell { grid-template-rows: 42px minmax(0, 1fr); }
  .secure-state { display: none; }
  .brand { font-size: 0.98rem; }
  .brand img { width: 27px; height: 27px; }
  .portal-launch { padding: 18px; }
  .launch-panel { border-radius: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
