html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  overscroll-behavior: none;
  touch-action: manipulation;
  font-family: "Ubuntu", system-ui, sans-serif;
}

:root {
  --ui-green: #33ff33;
  --ui-green-soft: rgba(51, 255, 51, 0.24);
  --ui-green-line: rgba(51, 255, 51, 0.46);
  --ui-green-glow: rgba(51, 255, 51, 0.22);
}

a[href],
button {
  -webkit-tap-highlight-color: transparent;
}

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at center, rgba(8, 28, 8, 0.55), rgba(0, 0, 0, 0.96) 58%),
    #000;
}

body.iam-mode #app {
  display: grid;
  place-items: center;
  width: 100vw;
  height: 100dvh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 50% 0%, rgba(51, 255, 51, 0.08), rgba(51, 255, 51, 0) 36%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0) 14%, rgba(255, 255, 255, 0) 86%, rgba(255, 255, 255, 0.03)),
    #111214;
}

#iam-page {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 24px;
  box-sizing: border-box;
  overflow: auto;
  z-index: 20;
}

body.iam-mode #iam-page {
  display: grid;
}

body.iam-mode #portal-shell,
body.iam-mode #portal-status,
body.iam-mode #portal-loader-sigil {
  display: none;
}

#iam-easter-egg {
  position: fixed;
  left: 50%;
  top: 50%;
  margin: 0;
  color: var(--ui-green);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: clamp(6px, 0.95vw, 9px);
  line-height: 1.02;
  white-space: pre;
  transform: translate3d(-50%, -50%, 0) scale(0.42);
  opacity: 0;
  pointer-events: none;
  user-select: none;
  display: none;
  z-index: 1;
}

#iam-card {
  width: min(100%, 540px);
  min-height: auto;
  max-height: calc(100dvh - 48px);
  padding: 28px 24px 32px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(8, 8, 9, 0.96), rgba(0, 0, 0, 0.99)),
    #000;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow:
    0 40px 120px rgba(0, 0, 0, 0.44),
    0 0 0 1px rgba(255, 255, 255, 0.02) inset;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#iam-avatar-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  transform: translate3d(0, 0, 0) scale(1);
  transition:
    transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1),
    filter 180ms ease;
  will-change: transform, filter;
  margin-bottom: 18px;
}

#iam-avatar {
  width: clamp(220px, 24vw, 360px);
  height: clamp(220px, 24vw, 360px);
  border-radius: 999px;
  object-fit: cover;
  background: #fff;
  box-shadow:
    0 16px 44px rgba(0, 0, 0, 0.36),
    0 0 0 2px rgba(255, 255, 255, 0.92);
}

#iam-handle {
  margin: 0 0 18px;
  color: var(--ui-green);
  font-family: "Ubuntu", system-ui, sans-serif;
  font-size: clamp(28px, 4.8vw, 34px);
  font-weight: 500;
  letter-spacing: -0.02em;
  text-align: center;
}

#iam-x-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 26px;
  color: #fff;
  text-decoration: none;
  font-family: "Ubuntu", system-ui, sans-serif;
  font-size: 18px;
  font-weight: 500;
  opacity: 0.94;
}

#iam-x-badge svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

#iam-links {
  width: 100%;
  display: grid;
  gap: 14px;
  justify-items: center;
}

.iam-link-card {
  display: grid;
  grid-template-columns: 42px auto;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: fit-content;
  min-width: 224px;
  max-width: 100%;
  min-height: 64px;
  padding: 14px 18px;
  border-radius: 14px;
  background: #1a1d21;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.03) inset,
    0 10px 24px rgba(0, 0, 0, 0.24);
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
  will-change: transform;
}

.iam-link-card:hover,
.iam-link-card:focus-visible {
  transform: translate3d(0, -2px, 0);
  background: #20242a;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 14px 28px rgba(0, 0, 0, 0.3);
}

.iam-link-icon {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

.iam-link-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.iam-link-label {
  font-family: "Ubuntu", system-ui, sans-serif;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: #ffffff;
  line-height: 1;
  text-align: center;
}

.iam-link-emoji {
  display: inline-block;
  font-size: 22px;
  line-height: 1;
  filter: grayscale(1) brightness(3.6) contrast(0.86) saturate(0);
  transform: translate3d(0, 0, 0);
}

#landing {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  gap: clamp(14px, 2.4vh, 22px);
  padding: max(24px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}

#landing-photo {
  width: min(44vw, 180px);
  height: min(44vw, 180px);
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid rgba(74, 246, 38, 0.24);
  box-shadow:
    0 22px 48px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  transform: translate3d(0, 0, 0);
}

#entropy-sigil {
  position: absolute;
  left: 50%;
  top: 50%;
  margin: 0;
  color: #4af626;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: clamp(6px, 1.38vw, 10px);
  line-height: 1.02;
  letter-spacing: 0;
  white-space: pre;
  transform: translate3d(-50%, -50%, 0) perspective(1100px) rotateX(0deg) rotateY(0deg) rotateZ(0deg) scale(0.58);
  transform-origin: center;
  opacity: 0.76;
  pointer-events: none;
  user-select: none;
  filter:
    drop-shadow(0 0 12px rgba(74, 246, 38, 0.18))
    drop-shadow(0 0 26px rgba(74, 246, 38, 0.10))
    brightness(1.12);
  transition:
    opacity 120ms linear,
    filter 140ms linear;
  will-change: transform, opacity, filter;
  mix-blend-mode: screen;
}

#entropy-sigil .sigil-cell {
  display: inline-block;
  min-width: 0.58em;
  color: rgba(74, 246, 38, 0.12);
  opacity: 0.14;
  text-shadow:
    0 0 2px rgba(74, 246, 38, 0.10),
    0 0 8px rgba(74, 246, 38, 0.04);
  transition:
    opacity 120ms linear,
    color 120ms linear,
    text-shadow 160ms linear,
    transform 180ms ease;
  transform: translate3d(0, 0, 0);
}

#entropy-sigil .sigil-cell.flare {
  color: #4af626;
  opacity: 0.92;
  text-shadow:
    0 0 8px rgba(74, 246, 38, 0.52),
    0 0 18px rgba(74, 246, 38, 0.28),
    0 0 34px rgba(74, 246, 38, 0.12);
}

#entropy-sigil .sigil-cell.flare-strong {
  color: #4af626;
  opacity: 1;
  text-shadow:
    0 0 12px rgba(74, 246, 38, 0.62),
    0 0 28px rgba(74, 246, 38, 0.34),
    0 0 44px rgba(74, 246, 38, 0.18);
  transform: translate3d(0, -0.02em, 0);
}

#landing-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: min(80vw, 360px);
  min-height: 64px;
  padding: 20px 34px 18px;
  border-radius: 16px;
  color: var(--ui-green);
  text-decoration: none;
  font-family: "Ubuntu", system-ui, sans-serif;
  font-weight: 500;
  font-size: clamp(28px, 7vw, 48px);
  letter-spacing: 0.01em;
  background:
    linear-gradient(180deg, rgba(26, 34, 26, 0.84), rgba(4, 8, 4, 0.96)),
    radial-gradient(120% 160% at 50% 0%, rgba(160, 255, 180, 0.18), rgba(160, 255, 180, 0) 52%),
    linear-gradient(120deg, rgba(51, 255, 51, 0.06), rgba(51, 255, 51, 0));
  border: 1px solid var(--ui-green-line);
  box-shadow:
    0 22px 48px rgba(0, 0, 0, 0.58),
    0 10px 26px rgba(0, 0, 0, 0.44),
    0 0 0 1px rgba(51, 255, 51, 0.16) inset,
    0 0 14px rgba(51, 255, 51, 0.18),
    0 -8px 16px rgba(0, 0, 0, 0.46) inset;
  clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 12px, 100% calc(100% - 12px), calc(100% - 12px) 100%, 12px 100%, 0 calc(100% - 12px), 0 12px);
  transform: translate3d(0, 0, 0);
  transition:
    transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 220ms ease,
    border-color 220ms ease,
    filter 220ms ease;
  will-change: transform, box-shadow, filter;
  isolation: isolate;
  overflow: hidden;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
  backface-visibility: hidden;
  pointer-events: none;
}

#app.portal-collapsed #landing-button {
  pointer-events: auto;
  cursor: pointer;
}

#landing-button::before,
#landing-button::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

#landing-button::before {
  background:
    linear-gradient(180deg, rgba(190, 255, 204, 0.22), rgba(190, 255, 204, 0.02) 30%, rgba(0, 0, 0, 0.24) 100%);
  opacity: 0.64;
}

#landing-button::after {
  inset: 1px;
  background:
    linear-gradient(180deg, rgba(51, 255, 51, 0.08), rgba(51, 255, 51, 0) 55%),
    radial-gradient(85% 85% at 50% 14%, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0) 56%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0.14));
  box-shadow:
    0 1px 2px rgba(255, 255, 255, 0.10) inset,
    0 -8px 14px rgba(0, 0, 0, 0.36) inset,
    0 0 0 1px rgba(51, 255, 51, 0.16) inset;
}

.button-sheen,
.button-core,
.button-label {
  position: relative;
  z-index: 1;
}

.button-sheen {
  position: absolute;
  inset: -30% -12%;
  background:
    conic-gradient(from 210deg at 50% 50%, rgba(255, 255, 255, 0) 0deg, rgba(255, 255, 255, 0.15) 42deg, rgba(255, 255, 255, 0) 85deg),
    radial-gradient(circle at 50% 50%, rgba(96, 255, 124, 0.08), rgba(96, 255, 124, 0) 60%);
  filter: blur(18px);
  opacity: 0.8;
  transform: translate3d(0, 0, 0);
}

.button-core {
  position: absolute;
  inset: 8px;
  border-radius: inherit;
  background:
    radial-gradient(circle at 50% 30%, rgba(120, 255, 140, 0.14), rgba(120, 255, 140, 0) 58%),
    linear-gradient(180deg, rgba(10, 14, 10, 0), rgba(10, 14, 10, 0.3));
}

.button-label {
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06),
    0 2px 8px rgba(0, 0, 0, 0.62),
    0 0 18px rgba(74, 246, 38, 0.26);
}

#landing-button:hover:not(.interaction-armed):not(.interaction-release),
#landing-button:focus-visible:not(.interaction-armed):not(.interaction-release) {
  transform: translate3d(0, -2px, 0) scale(1.03);
  border-color: rgba(51, 255, 51, 0.62);
  box-shadow:
    0 30px 72px rgba(0, 0, 0, 0.62),
    0 14px 36px rgba(0, 0, 0, 0.46),
    0 0 0 1px rgba(51, 255, 51, 0.22) inset,
    0 0 22px rgba(51, 255, 51, 0.24),
    0 -10px 18px rgba(0, 0, 0, 0.42) inset;
  filter: saturate(1.10);
}

#landing-button.interaction-armed {
  transform: translate3d(0, 1px, 0) scale(1.016);
}

#landing-button.interaction-release {
  transform: translate3d(0, -1px, 0) scale(1.038);
}

#landing-button:active {
  transform: translate3d(0, 1px, 0) scale(0.992);
}

#portal-shell {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  mix-blend-mode: normal;
  background: #000;
  transform: translate3d(0, 0, 0) scale(1);
  opacity: 1;
  transition:
    transform 700ms cubic-bezier(0.16, 1, 0.3, 1),
    opacity 650ms ease,
    filter 650ms ease;
  will-change: transform, opacity, filter;
  backface-visibility: hidden;
  contain: layout paint style;
}

#portal-shell.collapsed {
  opacity: 0;
  filter: blur(10px);
  transform: translate3d(0, -2vh, 0) scale(0.94);
}

#portal-canvas {
  position: absolute;
  left: 50%;
  top: 50%;
  display: block;
  background: #000;
  transform: translate3d(-50%, -50%, 0);
  will-change: transform, opacity;
  backface-visibility: hidden;
  contain: layout paint style;
}

html.gpu-compositor #app,
html.gpu-compositor #portal-shell,
html.gpu-compositor #portal-canvas,
html.gpu-compositor #portal-loader-sigil,
html.gpu-compositor #entropy-sigil,
html.gpu-compositor #portal-status,
html.gpu-compositor #landing-button {
  backface-visibility: hidden;
  transform-style: preserve-3d;
}

html.gpu-compositor #portal-shell,
html.gpu-compositor #portal-canvas {
  will-change: transform, opacity;
}

#portal-status {
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  color: var(--ui-green);
  font-family: "Ubuntu", "Ubuntu Medium", "Segoe UI", system-ui, sans-serif;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-align: center;
  cursor: pointer;
  pointer-events: auto;
  padding: 7px 10px;
  max-width: calc(100vw - 32px);
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid rgba(51, 255, 51, 0.28);
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
  outline: none;
  z-index: 10;
}

#portal-status:hover:not(.interaction-armed):not(.interaction-release),
#portal-status:focus-visible:not(.interaction-armed):not(.interaction-release) {
  transform: translateX(-50%) translate3d(0, -1px, 0) scale(1.028);
  border-color: rgba(51, 255, 51, 0.56);
  box-shadow:
    0 0 14px rgba(51, 255, 51, 0.20),
    0 10px 22px rgba(0, 0, 0, 0.22);
}

#portal-status {
  transition:
    transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1),
    border-color 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease;
  will-change: transform, border-color, box-shadow;
}

#portal-status.interaction-armed {
  transform: translateX(-50%) translate3d(0, 1px, 0) scale(1.014);
}

#portal-status.interaction-release {
  transform: translateX(-50%) translate3d(0, -1px, 0) scale(1.04);
}

#iam-avatar-link:hover:not(.interaction-armed):not(.interaction-release),
#iam-avatar-link:focus-visible:not(.interaction-armed):not(.interaction-release) {
  transform: translate3d(0, -2px, 0) scale(1.03);
  filter: brightness(1.04);
}

#iam-avatar-link.interaction-armed {
  transform: translate3d(0, 1px, 0) scale(1.014);
}

#iam-avatar-link.interaction-release {
  transform: translate3d(0, -1px, 0) scale(1.038);
}

.iam-link-card:hover:not(.interaction-armed):not(.interaction-release),
.iam-link-card:focus-visible:not(.interaction-armed):not(.interaction-release) {
  transform: translate3d(0, -2px, 0) scale(1.022);
}

.iam-link-card.interaction-armed {
  transform: translate3d(0, 1px, 0) scale(1.012);
}

.iam-link-card.interaction-release {
  transform: translate3d(0, -1px, 0) scale(1.03);
}

#portal-loader-sigil {
  position: fixed;
  left: 0;
  top: 0;
  margin: 0;
  display: block;
  color: #4af626;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: clamp(9px, 1.08vw, 13px);
  line-height: 1.05;
  letter-spacing: 0;
  white-space: pre;
  pointer-events: none;
  user-select: none;
  text-shadow:
    0 0 8px rgba(74, 246, 38, 0.54),
    0 0 20px rgba(74, 246, 38, 0.28),
    0 0 40px rgba(74, 246, 38, 0.14);
  transform: translate3d(-9999px, -9999px, 0);
  opacity: 0;
  transition: opacity 120ms linear;
  z-index: 9;
  will-change: transform, opacity, filter;
  backface-visibility: hidden;
  filter:
    drop-shadow(0 0 12px rgba(74, 246, 38, 0.16))
    brightness(1.18);
  mix-blend-mode: screen;
}

.loader-sigil-part {
  position: absolute;
  margin: 0;
  left: 0;
  top: 0;
  color: inherit;
  font: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  white-space: pre;
  transform: translate3d(0, 0, 0);
  transform-origin: center;
  will-change: transform;
}

#portal-loader-sigil.active {
  opacity: 0.98;
}

#portal-status.hidden {
  display: none;
}

@media (hover: none) {
  #landing-button {
    transform: translate3d(0, 0, 0) scale(1);
  }

  #landing-button:hover,
  #landing-button:focus-visible,
  #portal-status:hover,
  #portal-status:focus-visible,
  #iam-avatar-link:hover,
  #iam-avatar-link:focus-visible,
  .iam-link-card:hover,
  .iam-link-card:focus-visible {
    transform: none;
  }
}

@media (max-width: 640px) {
  #iam-page {
    padding: 14px;
  }

  #iam-card {
    width: min(100%, 420px);
    min-height: auto;
    max-height: calc(100dvh - 28px);
    padding: 18px 14px 24px;
    border-radius: 18px;
  }

  .iam-link-card {
    min-height: 56px;
    min-width: 200px;
    padding: 12px 14px;
    grid-template-columns: 38px auto;
    gap: 12px;
  }

  .iam-link-icon {
    width: 38px;
    height: 38px;
  }

  #iam-avatar {
    width: clamp(118px, 32vw, 168px);
    height: clamp(118px, 32vw, 168px);
  }

  .iam-link-label {
    font-size: 15px;
  }

  #landing-photo {
    width: min(38vw, 146px);
    height: min(38vw, 146px);
  }

  #entropy-sigil {
    font-size: clamp(7px, 1.92vw, 10px);
    transform: translate3d(-50%, -50%, 0) perspective(900px) rotateX(0deg) rotateY(0deg) rotateZ(0deg) scale(0.64);
  }

  #landing-button {
    min-width: min(86vw, 360px);
    min-height: 60px;
    padding: 18px 28px 16px;
    font-size: clamp(24px, 9vw, 40px);
  }

  #portal-loader-sigil {
    font-size: clamp(8px, 1.9vw, 10px);
  }

}

@media (max-width: 960px) and (orientation: landscape) {
  #iam-page {
    padding: 12px;
  }

  #iam-card {
    width: min(100%, 760px);
    min-height: auto;
    padding: 18px 18px 22px;
  }

  #iam-avatar {
    width: clamp(120px, 24vh, 180px);
    height: clamp(120px, 24vh, 180px);
  }

  #iam-handle {
    margin-bottom: 14px;
    font-size: clamp(24px, 4vh, 30px);
  }

  #iam-links {
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, max-content));
    justify-content: center;
  }

  .iam-link-card {
    min-width: 180px;
    min-height: 52px;
    padding: 10px 14px;
  }
}
