/* Page-level layout */
.mode-selector {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(1rem, env(safe-area-inset-top)) clamp(1rem, 4vw, 3rem)
    max(1rem, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 88% 6%, rgba(24, 52, 135, 0.07), transparent 28%),
    linear-gradient(180deg, var(--surface) 0%, var(--bg-accent) 100%);
}

.mode-panel {
  width: min(960px, 100%);
  min-width: 0;
  padding: clamp(1.25rem, 3vw, 2.25rem);
  border: 1px solid var(--line);
  border-top: 5px solid var(--primary);
  border-radius: 24px;
  background:
    radial-gradient(circle at 92% 4%, rgba(24, 52, 135, 0.06), transparent 26%),
    linear-gradient(135deg, var(--surface) 0%, var(--bg-accent) 100%);
  box-shadow: 0 24px 60px rgba(16, 41, 104, 0.14);
}

/* Text | theme toggle | logo in a single row, not a grid. The former grid had
   to be rebuilt on mobile with display:contents and explicit row placement,
   which is where the wrapping defects came from. */
.mode-panel-header,
.app-header {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: clamp(0.6rem, 2vw, 1.25rem);
}

.mode-panel-header > div,
.header-copy {
  flex: 1 1 auto;
  min-width: 0;
}

/* Far left, as far from the logo as the row allows: the logo is meant to stand
   on its own at the right. */
.mode-panel-header > .theme-toggle,
.app-header > .theme-toggle {
  flex: 0 0 auto;
  order: -1;
  align-self: center;
}

.mode-panel-header h1 {
  margin: 0.55rem 0 0;
  max-width: 20ch;
  color: var(--primary-deep);
  font-size: clamp(1.5rem, 3.2vw, 2rem);
  line-height: 1.12;
  text-wrap: balance;
}

.mode-panel-header p:not(.eyebrow) {
  max-width: 58ch;
  margin: 0.75rem 0 0;
  color: var(--muted);
  line-height: 1.5;
  text-wrap: pretty;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 1rem;
}

.mode-privacy {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.app-header {
  position: relative;
  min-height: 0;
  padding: max(0.7rem, env(safe-area-inset-top)) clamp(1rem, 3vw, 2.5rem)
    0.7rem;
  color: var(--ink);
  background:
    radial-gradient(circle at 92% 6%, rgba(24, 52, 135, 0.07), transparent 28%),
    linear-gradient(135deg, var(--surface) 0%, var(--bg-accent) 100%);
  border-top: 5px solid var(--primary);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 12px 28px rgba(16, 41, 104, 0.1);
}

.header-copy {
  max-width: 760px;
  padding: 0;
  align-self: center;
}

.app-header h1 {
  margin: 0.2rem 0 0;
  color: var(--primary-deep);
  font-size: clamp(1.25rem, 2.8vw, 1.7rem);
  line-height: 1.15;
  text-wrap: balance;
}

.eyebrow {
  margin: 0;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.74rem;
  font-weight: 800;
}

.mode-eyebrow {
  color: var(--primary);
}

.subtitle {
  max-width: 58ch;
  margin: 0.55rem 0 0;
  color: var(--muted);
  line-height: 1.45;
  text-wrap: pretty;
}

.tabbar {
  min-width: 0;
  display: flex;
  gap: 0.35rem;
  padding: 0.42rem clamp(1rem, 3vw, 2.5rem) 0;
  border-top: 1px solid rgba(127, 149, 171, 0.14);
  border-bottom: 1px solid rgba(127, 149, 171, 0.18);
  background: var(--chrome-bg);
}

.toolbar {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  /* Must stay positioned: the action menu panel is anchored to the toolbar so
     it can never leave the viewport, regardless of where the toggle sits. */
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 0.62rem clamp(1rem, 3vw, 2.5rem);
  border-bottom: 1px solid rgba(127, 149, 171, 0.2);
  background: var(--chrome-bg);
  backdrop-filter: blur(12px);
}

main {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 1rem clamp(0.7rem, 2.5vw, 2.5rem) 2rem;
}

.view {
  width: 100%;
  max-width: 1180px;
  min-width: 0;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(127, 149, 171, 0.28);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

footer {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
  color: var(--muted);
  font-size: 0.82rem;
}
footer p {
  margin: 0.25rem 0;
}

.app-version-label,
.app-version-footer {
  color: var(--primary-deep);
  font-weight: 750;
}

.app-version-label::before {
  content: "· ";
}
