:root {
  color-scheme: dark;
  --bg: #0b0b0c;
  --surface: #171719;
  --raised: #222225;
  --text: #f4f4f5;
  --muted: #aaaab3;
  --accent: #8ab4f8;
  --outline: #ffffff26;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: var(--bg);
  color: var(--text);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input {
  font: inherit;
}
a {
  color: inherit;
  text-decoration: none;
}
button,
a,
input,
summary {
  -webkit-tap-highlight-color: transparent;
}
button,
a,
summary {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
[hidden] {
  display: none !important;
}
button:disabled {
  opacity: 0.6;
  cursor: wait;
}
.brand {
  font-size: 30px;
  font-weight: 750;
  letter-spacing: -1.7px;
  white-space: nowrap;
}
.brand span {
  color: var(--accent);
}
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  border: 0;
  border-radius: 14px;
  min-height: 48px;
  padding: 12px 20px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  background: var(--raised);
}
.button.primary {
  background: var(--accent);
  color: #091629;
}
.button.quiet {
  background: transparent;
  color: var(--muted);
  padding-inline: 12px;
}
.button:hover {
  filter: brightness(1.08);
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 0.19em;
  font-weight: 650;
  color: var(--accent);
}
.gate {
  min-height: 100dvh;
  padding: calc(32px + env(safe-area-inset-top))
    max(24px, env(safe-area-inset-right))
    calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  max-width: 1100px;
  margin: auto;
}
.gate > .brand {
  align-self: flex-start;
}
.gate-card {
  width: min(420px, 100%);
  margin: auto;
  padding-block: 36px;
}
.gate h1 {
  font-size: clamp(38px, 7vw, 54px);
  font-weight: 620;
  line-height: 1.08;
  letter-spacing: -2.2px;
  margin: 20px 0;
}
.gate-intro {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
  margin: 0 0 32px;
  max-width: 320px;
}
.gate-footer {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0;
}
.pin-form {
  display: flex;
  flex-direction: column;
}
.pin-label {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
}
.pin-form > input {
  width: 100%;
  height: 64px;
  border: 1px solid var(--outline);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  font-size: 28px;
  letter-spacing: 0.45em;
  padding: 12px 20px;
}
.field-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}
.check-label {
  min-height: 44px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  line-height: 1.4;
}
.check-label input {
  accent-color: var(--accent);
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  margin: 1px 0 0;
}
.check-label small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.pin-form .check-label {
  margin: 24px 0 28px;
}
.notice {
  padding: 14px 18px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.6;
}
.notice.error {
  background: #392324;
  color: #f3aaa5;
  margin-bottom: 20px;
}
.connection {
  background: #332b1f;
  color: #e9c584;
  border-radius: 0;
  text-align: center;
}
.portal-shell {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.portal-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 24px;
  align-items: center;
  padding: calc(18px + env(safe-area-inset-top))
    max(28px, env(safe-area-inset-right)) 18px
    max(28px, env(safe-area-inset-left));
  flex-shrink: 0;
}
.portal-header .brand {
  justify-self: start;
}
.app-switch {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border-radius: 15px;
}
.app-switch a {
  min-height: 40px;
  min-width: 88px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.app-switch a[aria-current] {
  background: var(--raised);
  color: var(--text);
}
.lock-form {
  justify-self: end;
  margin: 0;
}
.launcher {
  flex: 1;
  min-height: 0;
  overflow: auto;
  width: 100%;
  padding: clamp(26px, 7vh, 74px) max(24px, env(safe-area-inset-right))
    calc(32px + env(safe-area-inset-bottom));
  max-width: 840px;
  margin: 0 auto;
}
.launcher-heading h1 {
  font-size: clamp(32px, 5vw, 48px);
  letter-spacing: -1.7px;
  font-weight: 600;
  line-height: 1.13;
  margin: 18px 0;
}
.launcher-heading > p {
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 32px;
}
.app-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.app-card {
  position: relative;
  border-radius: 24px;
  padding: 28px;
  background: var(--surface);
  min-width: 0;
}
.app-card:hover {
  background: #202023;
}
.app-icon {
  display: grid;
  place-items: center;
  font-size: 40px;
  line-height: 1;
  width: 48px;
  height: 48px;
  color: var(--accent);
  margin-bottom: 28px;
}
.forms-icon {
  font-size: 44px;
}
.card-arrow {
  position: absolute;
  right: 28px;
  top: 30px;
  color: var(--muted);
  font-size: 24px;
}
.app-card h2 {
  font-size: 24px;
  font-weight: 580;
  letter-spacing: -0.7px;
  margin: 0 0 12px;
}
.app-card p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 30px;
}
.card-action {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}
.remember-section {
  margin: 28px 0;
}
.install-help {
  color: var(--muted);
  font-size: 12px;
  max-width: 560px;
  line-height: 1.7;
}
.install-help summary {
  min-height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.install-help p {
  margin-top: 4px;
}
.muted {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.app-view {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}
.frame-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 34px;
  padding: 0 max(20px, env(safe-area-inset-right)) 8px
    max(20px, env(safe-area-inset-left));
  font-size: 11px;
  color: var(--muted);
}
.frame-toolbar p {
  margin: 0;
}
.frame-toolbar a {
  color: var(--accent);
  padding: 6px 0;
}
#frame-container {
  flex: 1;
  min-height: 0;
}
#frame-container iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--bg);
}
.legacy-draft {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: center;
  background: #202a3a;
  padding: 12px 24px;
  flex-shrink: 0;
}
.legacy-draft p {
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
  color: #bcd3f8;
}
.legacy-draft .button {
  font-size: 12px;
  min-height: 40px;
  white-space: nowrap;
}
@media (max-width: 560px) {
  .portal-header {
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  }
  .portal-header .brand {
    font-size: 27px;
  }
  .app-switch {
    grid-row: 2;
    grid-column: 1/-1;
    justify-self: center;
  }
  .lock-form {
    grid-row: 1;
    grid-column: 2;
  }
  .lock-form .button {
    font-size: 12px;
    min-height: 42px;
  }
  .launcher {
    padding-top: 28px;
  }
  .launcher-heading h1 {
    font-size: 34px;
  }
  .app-cards {
    gap: 12px;
  }
  .app-card {
    padding: 22px 18px;
    border-radius: 21px;
  }
  .app-card h2 {
    font-size: 21px;
  }
  .app-card p {
    font-size: 12px;
  }
  .card-arrow {
    right: 20px;
    top: 26px;
  }
  .app-icon {
    margin-bottom: 22px;
  }
  .legacy-draft {
    padding: 12px 16px;
    gap: 10px;
    align-items: flex-start;
    flex-direction: column;
  }
  .legacy-draft .button {
    align-self: flex-start;
  }
}
@media (max-width: 340px) {
  .app-cards {
    grid-template-columns: 1fr;
  }
  .app-card p br {
    display: none;
  }
  .app-card p {
    margin-bottom: 20px;
  }
}

.reauth-dialog {
  border: 0;
  padding: max(24px, env(safe-area-inset-top)) 24px
    max(24px, env(safe-area-inset-bottom));
  width: 100%;
  max-width: none;
  min-height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  overflow: auto;
}
.reauth-dialog::backdrop {
  background: var(--bg);
}
.reauth-content {
  max-width: 380px;
  margin: max(36px, 10dvh) auto 36px;
}
.reauth-content h2 {
  font-size: clamp(28px, 6vw, 36px);
  font-weight: 620;
  letter-spacing: -1px;
  margin: 36px 0 18px;
}
