.portal { min-height: 100dvh; padding: 0 clamp(18px, 5vw, 78px) 34px; color: var(--navy); }
.portal-top, .portal-main { max-width: 1420px; margin-inline: auto; }
.portal-top { min-height: 86px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.portal-brand { display: inline-flex; flex: none; align-items: center; gap: 9px; border-radius: 12px; color: var(--navy); font-size: 1.25rem; font-weight: 750; text-decoration: none; }
.portal-controls { display: flex; align-items: center; gap: 8px; min-width: 0; }
.portal-controls .theme-button { border: 1px solid var(--line); background: var(--surface); }
.portal-languages { max-width: min(165px, 39vw); }
.portal-languages select { height: 42px; border: 1px solid var(--line); border-radius: 24px; padding-inline-start: 15px; background: var(--surface); color: var(--link); font: inherit; font-size: .86rem; font-weight: 650; }
.portal-footer { max-width: 1420px; margin: 19px auto 0; font-size: .75rem; }
.portal-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(23px, 4.8vw, 78px); align-items: stretch; }
.portal-content { display: grid; align-items: center; min-width: 0; padding: 28px 0; }
.portal-content h1 { margin: 0; font-size: clamp(2.5rem, 5.9vw, 5.6rem); line-height: .99; font-weight: 780; letter-spacing: -.075em; text-wrap: balance; }
.portal-accent { color: var(--link); }
.portal-content p { margin: 24px 0 0; max-width: 390px; color: var(--muted); font-size: clamp(1rem, 1.5vw, 1.2rem); line-height: 1.53; }
.portal-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.portal-registration-note { align-self: center; color: var(--muted); font-size: .9rem; }
.portal-primary, .portal-secondary { display: inline-flex; min-height: 50px; justify-content: center; align-items: center; padding: 0 20px; border: 1px solid transparent; border-radius: 11px; font: inherit; font-weight: 680; }
.portal-primary { color: white; background: var(--blue); }
.portal-primary:hover { background: var(--blue-hover); }
.portal-primary:disabled { background: var(--panel); color: var(--muted); }
.portal-secondary { background: var(--field); border-color: var(--line); color: var(--link); }
.portal-secondary:hover { background: var(--hover); }
.portal-visual { isolation: isolate; overflow: hidden; position: relative; min-height: clamp(400px, 71vh, 730px); border: 1px solid var(--line); border-radius: 24px; background: #141e30; box-shadow: var(--shadow); }
.portal-photo { position: absolute; inset: 0; opacity: 0; transition: opacity .65s ease; }
.portal-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.portal-photo.is-current { opacity: 1; }
.portal-shade { position: absolute; inset: 0; background: linear-gradient(180deg, #0b122624, transparent 30%, #0c14264a 65%, #080d1bd4); }
.portal-greeting { position: absolute; bottom: 66px; inset-inline: 20px; color: white; text-align: center; pointer-events: none; }
.portal-greeting span { display: inline-block; max-width: 100%; font-size: clamp(3rem, 7vw, 6.3rem); font-weight: 710; line-height: 1.2; letter-spacing: -.045em; text-shadow: 0 4px 26px #10192bc2; }
@keyframes greeting-in { from { opacity: .25; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.portal-greeting .greeting-in { animation: greeting-in .4s ease-out both; }
.portal-gallery { position: absolute; bottom: 16px; inset-inline: 16px; display: flex; justify-content: center; align-items: center; gap: 4px; }
.portal-gallery button { position: relative; display: grid; place-items: center; width: 34px; height: 44px; background: transparent; border: 0; color: white; }
.portal-gallery button[data-slide]::after { content: ''; width: 8px; height: 8px; border-radius: 9px; background: #ffffff9f; }
.portal-gallery button[data-slide][aria-pressed="true"]::after { width: 21px; background: #fff; }
.portal-gallery .gallery-pause { position: absolute; right: 0; font-size: 1rem; border-radius: 8px; background: #11182c8c; }
.portal:not(.account-open) :is(.portal-top, .portal-main, .portal-footer) { max-width: 1240px; }
.portal:not(.account-open) .portal-main {
  grid-template-columns: minmax(0, .94fr) minmax(0, 1.06fr);
  align-items: center;
  gap: clamp(24px, 4.2vw, 58px);
  padding: clamp(22px, 4vw, 52px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(124deg, var(--surface) 30%, var(--accent-surface));
  box-shadow: var(--shadow);
}
#portal-intro h1 { font-size: clamp(2.05rem, 4.2vw, 3.8rem); line-height: 1.04; letter-spacing: -.048em; }
#portal-intro p { max-width: 32ch; margin-top: 18px; line-height: 1.55; }
#portal-intro .portal-actions { align-items: center; gap: 10px 16px; }
#portal-login { min-width: 124px; }
.portal:not(.account-open) .portal-visual { min-height: clamp(390px, 61vh, 520px); border-radius: 20px; }
.portal:not(.account-open) .portal-photo img { object-position: center 38%; }
.portal:not(.account-open) .portal-shade { background: linear-gradient(180deg, #10182a5c, transparent 47%, #10182a85); }
.portal:not(.account-open) .portal-gallery { top: 8px; bottom: auto; left: auto; right: 10px; padding-inline-end: 34px; }
.portal:not(.account-open) .portal-gallery button[data-slide] { width: 26px; }
.portal:not(.account-open) .portal-greeting { inset: 18px auto auto 16px; max-width: calc(100% - 146px); text-align: start; }
.portal:not(.account-open) .portal-greeting span {
  padding: 5px 10px;
  border: 1px solid #ffffff42;
  border-radius: 20px;
  background: #10182a94;
  font-size: .9rem;
  letter-spacing: 0;
}
.portal-demo {
  position: absolute;
  inset: auto 16px 16px;
  display: grid;
  gap: 8px;
  max-width: 410px;
  margin-inline: auto;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.account-open .portal-demo { display: none; }
.portal-demo h2 { margin: 1px 3px 3px; color: var(--muted); font-size: .79rem; font-weight: 700; }
.portal-demo-line { display: grid; gap: 3px; padding: 8px 10px; border-radius: 10px; background: var(--field); }
.portal-demo-line span { color: var(--muted); font-size: .72rem; font-weight: 650; }
.portal-demo-line p { margin: 0; color: var(--navy); font-size: .88rem; line-height: 1.35; }
.portal-demo-translation { background: var(--accent-surface); }
.portal-account {
  width: min(100%, 480px);
  padding: clamp(20px, 3.2vw, 32px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.portal-account h1 { font-size: clamp(2rem, 3.1vw, 3.15rem); line-height: 1.06; letter-spacing: -.055em; }
.portal-account h1:focus { outline: none; }
.portal-account p { margin: 8px 0 16px; font-size: .9rem; }
.portal.invite-open {
  display: flex;
  flex-direction: column;
  padding-bottom: max(15px, env(safe-area-inset-bottom));
  background: radial-gradient(ellipse at 69% 44%, var(--accent-surface), transparent 68%);
}
.portal.invite-open :is(.portal-top, .portal-main, .portal-footer) { width: min(100%, 1160px); margin-inline: auto; }
.portal.invite-open .portal-main { flex: 1; grid-template-columns: minmax(0, 1fr); }
.portal.invite-open .portal-content { padding: 0; }
.portal.invite-open .portal-visual { display: none; }
.portal.invite-open .portal-footer { margin-top: 10px; }
.invite-letter {
  display: grid;
  grid-template: "copy art" / minmax(0, .9fr) minmax(0, 1.1fr);
  align-items: center;
  gap: clamp(24px, 7vw, 100px);
  padding: 24px clamp(0px, 3vw, 48px);
}
.invite-letter-copy { grid-area: copy; display: grid; justify-items: start; gap: 26px; }
.invite-letter h1 {
  max-width: 14ch;
  font-size: clamp(2.15rem, 4.55vw, 3.65rem);
  line-height: 1.03;
  letter-spacing: -.055em;
}
.invite-letter h1:focus { outline: none; }
.invite-art {
  grid-area: art;
  display: grid;
  place-items: center;
  padding-block: clamp(72px, 10vw, 142px) clamp(28px, 5vw, 68px);
  background: radial-gradient(ellipse, color-mix(in srgb, var(--blue) 13%, transparent), transparent 69%);
}
.invite-letter-person { display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 0; max-width: 100%; color: var(--navy); font-size: clamp(.94rem, 2.4vw, 1.3rem); }
.invite-letter-person .avatar { width: clamp(29px, 5vw, 46px); height: clamp(29px, 5vw, 46px); border-radius: 10px; }
.invite-letter-person strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#invite-join { width: min(100%, 254px); min-height: 54px; }
.invite-envelope {
  position: relative;
  isolation: isolate;
  width: min(100%, 440px);
  aspect-ratio: 200 / 104;
  border-radius: clamp(13px, 2vw, 25px);
  background: color-mix(in srgb, var(--blue) 38%, var(--surface));
  color: var(--link);
  box-shadow: 0 20px 35px color-mix(in srgb, var(--blue) 19%, transparent);
}
.invite-envelope-flap {
  position: absolute;
  inset: 0 0 auto;
  height: 57%;
  border-radius: 12px 12px 0 0;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform: rotateX(180deg);
  transform-origin: center top;
  background: color-mix(in srgb, var(--blue) 31%, var(--surface));
}
.invite-envelope-paper {
  position: absolute;
  z-index: 1;
  inset: 0 6% auto;
  height: 78%;
  display: grid;
  justify-items: center;
  align-content: start;
  padding: clamp(8px, 2.5vw, 22px) 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  transform: translateY(-50%);
  background: var(--surface);
}
.invite-envelope-front {
  position: absolute;
  z-index: 2;
  inset: 0;
  border-radius: inherit;
  clip-path: polygon(0 0, 50% 59%, 100% 0, 100% 100%, 0 100%);
  background: linear-gradient(135deg, var(--accent-surface), color-mix(in srgb, var(--blue) 28%, var(--surface)));
}
@media (prefers-reduced-motion: no-preference) {
  .invite-envelope-flap { animation: invite-flap-open 420ms ease-in-out 130ms backwards; }
  .invite-envelope-paper { animation: invite-paper-rise 460ms cubic-bezier(.2, .65, .3, 1) 450ms backwards; }
}
@keyframes invite-flap-open { from { z-index: 3; transform: rotateX(0); } 55% { z-index: 3; } to { z-index: 0; transform: rotateX(180deg); } }
@keyframes invite-paper-rise {
  from { transform: translateY(64%); clip-path: inset(0 0 36%); }
  to { transform: translateY(-50%); clip-path: inset(0); }
}
@media (max-width: 820px) {
  .portal.invite-open { background: radial-gradient(ellipse at 50% 40%, var(--accent-surface), transparent 70%); }
  .portal.invite-open .portal-footer { text-align: center; }
  .invite-letter {
    grid-template: "art" "copy" / minmax(0, 1fr);
    justify-items: center;
    gap: clamp(14px, 4vh, 36px);
    padding: 16px 0 26px;
    text-align: center;
  }
  .invite-art { padding-block: clamp(61px, 14vw, 104px) 18px; }
  .invite-envelope { width: min(76vw, 330px); }
  .invite-letter-copy { justify-items: center; gap: 19px; width: min(100%, 390px); }
  .invite-letter h1 { max-width: 18ch; font-size: clamp(1.85rem, 6.5vw, 3.15rem); }
  #invite-join { width: min(100%, 300px); }
}
.auth-heading { display: flex; gap: 11px; align-items: center; }
.auth-heading h1 { min-width: 0; overflow-wrap: anywhere; }
.invite-signup { width: min(100%, 420px); }
.invite-signup .auth-progress { margin: 0 0 14px; color: var(--muted); }
.invite-signup .auth-progress-track { display: none; }
.portal-account.invite-signup h1 { font-size: clamp(1.4rem, 5vw, 1.85rem); letter-spacing: -.03em; text-wrap: wrap; }
.invite-signup .auth-heading .avatar { width: 42px; height: 42px; }
#invite-existing { display: block; width: 100%; min-height: 44px; margin: 3px 0 0; padding: 7px 4px; font-size: .84rem; }
#invite-existing:hover { text-decoration: underline; }
.auth-submit-row > button { width: 100%; }
.portal-back { padding: 10px 0; margin-bottom: 12px; color: var(--link); border: 0; background: none; font-weight: 650; }
#portal-back { display: inline-flex; align-items: center; gap: 9px; min-height: 38px; margin: -4px 0 6px; padding: 6px 2px; font-size: .85rem; }
#portal-back::before { width: 7px; height: 7px; border-bottom: 1.6px solid currentColor; border-left: 1.6px solid currentColor; transform: rotate(45deg); content: ''; }
.auth-progress { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0 9px; color: var(--link); font-size: .76rem; font-weight: 700; }
.auth-progress-track { display: flex; gap: 4px; width: 56px; }
.auth-progress-track i { flex: 1; height: 4px; border-radius: 8px; background: var(--line); }
.auth-progress-track i:first-child, .auth-progress[data-step="2"] i { background: var(--blue); }
.portal-account form { display: grid; gap: 13px; }
.auth-credentials { display: grid; gap: 13px; }
.auth-field { display: grid; gap: 6px; min-width: 0; }
.portal-account .auth-field input { background: var(--field); font-size: 1rem; }
.portal-account .auth-field input[aria-invalid="true"] { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 7%, var(--surface)); }
.auth-field input[aria-invalid="true"]:focus-visible { outline: 2px solid color-mix(in srgb, var(--danger) 32%, transparent); outline-offset: 1px; }
.portal-account form .auth-field-error { color: var(--danger); font-weight: 650; }
#signup-avatar { gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--field); }
#signup-avatar .avatar { width: 46px; height: 46px; border-radius: 11px; }
.signup-avatar-title { font-size: .84rem; font-weight: 650; overflow-wrap: anywhere; }
.signup-avatar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 8px; }
.signup-avatar-actions .avatar-picker > span { min-height: 34px; padding: 4px 8px; background: var(--surface); }
.signup-avatar-actions .avatar-picker:hover > span { background: var(--hover); }
#signup-avatar [data-avatar-status]:empty { display: none; }
.device-options { min-width: 0; padding: 2px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--field); }
.portal-account form .device-options .setting { display: flex; min-height: 44px; }
.device-options .setting + .setting { border-top: 1px solid var(--line); }
.portal-account .signup-alert-note { margin: 0 0 9px; font-size: .82rem; line-height: 1.4; }
.signup-alert-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 8px; }
.signup-alert-actions button { padding-inline: 12px; }
.setup-region { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; }
.setup-region small { grid-column: 1 / -1; }
#auth-method { margin: 9px 0 0; }
.portal-account form label { display: grid; gap: 6px; font-size: .92rem; font-weight: 650; }
.portal-account input:not([type="checkbox"]), .portal-account select { min-width: 0; width: 100%; height: 48px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--navy); font: inherit; font-weight: 500; }
.portal-account .select-wrap select { padding-inline-end: 42px; }
.portal-account form small { color: var(--muted); font-size: .82rem; font-weight: 450; line-height: 1.42; }
.pin-heading { display: flex; align-items: center; min-height: 28px; }
.pin-line { position: relative; border-radius: 12px; }
.pin-line:focus-within { outline: 2px solid #567ec5; outline-offset: 3px; }
.pin-line #pin-entry { position: absolute; z-index: 1; inset: 0; height: 100%; opacity: 0; cursor: text; }
#pin-slots { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; pointer-events: none; }
#pin-slots span { display: grid; min-height: 49px; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--field); color: var(--link); font-size: 1.25rem; font-weight: 750; }
#pin-slots .filled { border-color: #567ec5; background: var(--accent-surface); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; width: 100%; margin-top: 11px; }
.pin-pad button { min-height: 43px; border: 1px solid var(--line); border-radius: 9px; color: var(--navy); background: var(--field); font: inherit; font-weight: 650; }
.pin-pad button:hover { background: var(--hover); }
.pin-pad button:active { background: var(--hover); }
.pin-pad .key-zero { grid-column: 2; }
.pin-pad .key-delete { color: var(--muted); }
.pin-line.sealing #pin-slots span { animation: pin-seal .3s cubic-bezier(.2, .65, .23, 1) both; }
.pin-line.sealing #pin-slots span:nth-child(2) { animation-delay: .02s; }
.pin-line.sealing #pin-slots span:nth-child(3) { animation-delay: .04s; }
.pin-line.sealing #pin-slots span:nth-child(4) { animation-delay: .06s; }
.pin-line.sealing #pin-slots span:nth-child(5) { animation-delay: .08s; }
.pin-line.sealing #pin-slots span:nth-child(6) { animation-delay: .1s; }
@keyframes pin-seal { from { transform: perspective(90px) rotateX(-72deg); opacity: .35; } to { transform: none; opacity: 1; } }
.recovery-reminder { border: 1px solid var(--line); padding: 14px; border-radius: 14px; background: var(--accent-surface); }
.recovery-row { display: flex; align-items: center; gap: 8px; }
.recovery-row input { flex: 1; }
.recovery-row .portal-secondary { min-height: 48px; padding-inline: 12px; }
.saved-confirm { display: flex; gap: 7px; align-items: center; margin: 15px 0; font-size: .92rem; }
.saved-confirm input { accent-color: var(--blue); width: 18px; height: 18px; }
.portal-account .auth-result { color: var(--danger); margin: 11px 0 0; }
.portal-account .auth-result.ok { color: var(--online); }
.saved-seats { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 15px; }
.saved-seats a { min-height: 42px; color: var(--link); text-decoration: none; }
@media (max-width: 760px) {
  .portal-top { min-height: 72px; }
  .portal-main { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .portal-content { padding: 18px 0 0; }
  .portal-content h1 { font-size: clamp(2.5rem, 9.6vw, 4.5rem); }
  .portal-content p { margin-top: 15px; }
  .portal-actions { margin-top: 21px; }
  .portal:not(.account-open) .portal-main { grid-template-columns: minmax(0, 1fr); gap: 22px; padding: clamp(14px, 4vw, 24px); border-radius: 20px; }
  .portal:not(.account-open) .portal-content { padding: 6px 0 0; }
  #portal-intro h1 { font-size: clamp(1.9rem, 7.2vw, 3rem); }
  #portal-intro p { margin-top: 12px; }
  #portal-intro .portal-actions { margin-top: 17px; }
  .portal:not(.account-open) .portal-visual { min-height: clamp(335px, 57vh, 420px); border-radius: 14px; }
  .portal-demo { inset-inline: 9px; bottom: 9px; padding: 9px; }
  .portal-visual { min-height: clamp(270px, 42vh, 400px); border-radius: 20px; }
  .portal-greeting { bottom: 51px; }
  .portal-greeting span { font-size: clamp(2.75rem, 13vw, 5.5rem); }
  .portal-gallery { bottom: 7px; }
  .portal.account-open { padding-inline: clamp(12px, 4vw, 18px); padding-bottom: 24px; }
  .portal.account-open .portal-visual { display: none; }
  .portal.account-open .portal-content { padding-top: 4px; }
  .portal.account-open .portal-account { margin-inline: auto; padding: clamp(14px, 4.4vw, 20px); border-radius: 17px; }
  .portal.account-open .portal-footer { width: min(100%, 480px); margin-top: 12px; }
  .portal:has(.invite-signup) .portal-footer { width: min(100%, 420px); }
  .portal-account h1 { font-size: clamp(1.8rem, 7.2vw, 2.6rem); }
  .portal-account p { margin: 8px 0 14px; }
  .portal-account select { font-size: 1rem; }
  .auth-submit-row { position: sticky; z-index: 1; bottom: 0; padding-block: 7px max(7px, env(safe-area-inset-bottom)); background: var(--surface); }
  .portal-account .select-wrap select { padding-inline-end: 32px; }
  .portal-account .select-wrap::after { inset-inline-end: 13px; }
  #pin-slots span { min-height: 43px; }
  .pin-pad { margin-top: 8px; }
  .pin-pad button { min-height: 39px; }
}
@media (prefers-reduced-motion: reduce) {
  .portal-photo { transition: none; }
  .portal-greeting .greeting-in { animation: none; }
  .portal-gallery .gallery-pause { display: none; }
  .pin-line.sealing #pin-slots span { animation: none; }
}
