:root {
    --ink: #0c1926;
    --muted: rgba(255, 255, 255, 0.72);
    --surface: rgba(255, 255, 255, 0.96);
    --accent: #0d7377;
    --accent-2: #1a9ea8;
    --line: rgba(15, 28, 42, 0.1);
    --font-display: "Syne", sans-serif;
    --font-body: "Manrope", sans-serif;
    --radius: 16px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

body.portal {
    margin: 0;
    font-family: var(--font-body);
    color: var(--ink);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.portal-stage {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem 1.15rem;
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(165deg, rgba(8, 24, 40, 0.55) 0%, rgba(13, 115, 119, 0.35) 100%),
        radial-gradient(ellipse 80% 60% at 20% 10%, #1a4a5c 0%, transparent 55%),
        linear-gradient(160deg, #0a1624 0%, #123447 42%, #0d7377 100%);
}

.portal-stage::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

.portal-shell {
    width: min(420px, 100%);
    position: relative;
    z-index: 1;
}

.portal-brand {
    text-align: center;
    color: #fff;
    margin-bottom: 1.35rem;
    animation: rise 0.55s var(--ease) both;
}

.portal-brand img {
    max-height: 64px;
    margin-bottom: 0.85rem;
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.25));
}

.portal-brand h1 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(1.55rem, 5vw, 1.95rem);
    letter-spacing: -0.03em;
    line-height: 1.15;
}

.portal-brand p {
    margin: 0.45rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.portal-card {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: var(--radius);
    padding: 1.25rem 1.2rem 1.15rem;
    margin-bottom: 0.85rem;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
    animation: rise 0.55s var(--ease) both;
}

.portal-card:nth-of-type(1) { animation-delay: 0.06s; }
.portal-card:nth-of-type(2) { animation-delay: 0.12s; }
.portal-card:nth-of-type(3) { animation-delay: 0.18s; }
.portal-card:nth-of-type(4) { animation-delay: 0.24s; }

.portal-card h2 {
    margin: 0 0 0.95rem;
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.portal-split {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 1rem;
    align-items: stretch;
    margin-bottom: 1rem;
}

.portal-split.is-image-left .portal-split-copy { order: 2; }
.portal-split.is-image-left .portal-split-media { order: 1; }

.portal-split-copy {
    margin-bottom: 0;
}

.portal-split-copy h1 {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4vw, 3rem);
    line-height: 1.05;
    margin: 0 0 0.75rem;
    letter-spacing: -0.04em;
}

.portal-split-subtitle {
    color: #5a6b7c;
    font-size: 1rem;
    margin-bottom: 0.85rem;
}

.portal-split-body {
    color: #5a6b7c;
    font-size: 0.96rem;
    line-height: 1.65;
    margin-bottom: 1rem;
}

.portal-split-media {
    min-height: 420px;
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(8, 24, 40, 0.12), rgba(13, 115, 119, 0.18)),
        linear-gradient(160deg, #10283a, #1a4a5c);
    background-size: cover;
    background-position: center;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
}

.portal-card .form-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #5a6b7c;
}

.portal-card .form-control,
.portal-card .form-select {
    border-radius: 10px;
    border-color: var(--line);
    min-height: 46px;
    background: #f7fafc;
}

.portal-card .form-control:focus,
.portal-card .form-select:focus {
    border-color: rgba(13, 115, 119, 0.55);
    box-shadow: 0 0 0 3px rgba(13, 115, 119, 0.14);
    background: #fff;
}

.portal-btn {
    width: 100%;
    border: 0;
    border-radius: 10px;
    min-height: 46px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.98rem;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(120deg, var(--accent), var(--accent-2));
    box-shadow: 0 8px 20px rgba(13, 115, 119, 0.3);
    transition: transform 0.16s var(--ease), filter 0.16s ease;
}

.portal-btn:hover { transform: translateY(-1px); filter: brightness(1.04); }
.portal-btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

.portal-btn-ghost {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    min-height: 46px;
    font-weight: 700;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s var(--ease);
}

.portal-btn-ghost:hover {
    background: #f4f7fa;
    transform: translateY(-1px);
}

.portal-alert {
    border-radius: 12px;
    padding: 0.8rem 0.95rem;
    margin-bottom: 0.85rem;
    font-size: 0.9rem;
    animation: rise 0.4s var(--ease) both;
}

.portal-alert-danger {
    background: #fef3f2;
    border: 1px solid #fecdca;
    color: #b42318;
}

.portal-alert-info {
    background: #eff8ff;
    border: 1px solid #b2ddff;
    color: #175cd3;
}

.portal-guest {
    display: none !important;
}

.portal-modal-trigger {
    width: 100%;
    margin-bottom: 0.55rem;
}

.portal-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 1.25rem;
}

.portal-modal[hidden] { display: none !important; }

.portal-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 18, 28, 0.55);
    backdrop-filter: blur(4px);
}

.portal-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(400px, 100%);
    max-height: min(88vh, 640px);
    overflow: auto;
    margin: 0;
    animation: rise 0.35s var(--ease) both;
}

.portal-modal-x {
    position: absolute;
    top: 0.55rem;
    right: 0.65rem;
    border: 0;
    background: transparent;
    font-size: 1.45rem;
    line-height: 1;
    color: #5a6b7c;
    cursor: pointer;
    width: 36px;
    height: 36px;
}

.portal-modal-x:hover { color: #0c1926; }

@media (max-width: 768px) {
    .portal-split {
        grid-template-columns: 1fr;
    }

    .portal-split-copy,
    .portal-split-media,
    .portal-split.is-image-left .portal-split-copy,
    .portal-split.is-image-left .portal-split-media {
        order: initial;
    }

    .portal-split-media {
        min-height: 240px;
    }
}

@keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
}
