:root {
    --bg-deep: #030715;
    --panel: rgba(8, 19, 49, 0.88);
    --panel-border: rgba(95, 124, 182, 0.36);
    --text: #ecf3ff;
    --muted: #a6b4d4;
    --cyan: #25f4ee;
    --pink: #fe2c55;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Outfit', 'Noto Sans JP', sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 25% 5%, rgba(37,244,238,0.16), transparent 35%),
        radial-gradient(circle at 85% 8%, rgba(254,44,85,0.14), transparent 33%),
        var(--bg-deep);
    overflow: hidden;
}
.starfield, .starfield-layer {
    position: fixed;
    inset: -20%;
    pointer-events: none;
}
.starfield {
    background-image:
        radial-gradient(2px 2px at 15% 25%, rgba(255,255,255,0.95), transparent),
        radial-gradient(1.5px 1.5px at 75% 40%, rgba(255,255,255,0.75), transparent),
        radial-gradient(2px 2px at 40% 70%, rgba(170, 220, 255, 0.8), transparent),
        radial-gradient(1px 1px at 55% 15%, rgba(255,255,255,0.9), transparent),
        radial-gradient(1px 1px at 85% 80%, rgba(150, 210, 255, 0.8), transparent);
    animation: slowRotate 90s linear infinite;
    opacity: 0.62;
}
.starfield-layer {
    background-image:
        radial-gradient(2px 2px at 20% 60%, rgba(37,244,238,0.45), transparent),
        radial-gradient(2px 2px at 62% 30%, rgba(255,255,255,0.7), transparent),
        radial-gradient(1.5px 1.5px at 48% 80%, rgba(255,255,255,0.6), transparent),
        radial-gradient(2px 2px at 78% 68%, rgba(255,255,255,0.7), transparent);
    animation: twinkle 4s ease-in-out infinite alternate, slowRotate 120s linear infinite reverse;
    opacity: 0.52;
}
.gate-topbar {
    position: fixed;
    left: 50%;
    top: 14px;
    transform: translateX(-50%);
    width: min(1080px, calc(100vw - 28px));
    z-index: 4;
    border: 1px solid rgba(109, 138, 196, 0.34);
    border-radius: 14px;
    background: rgba(3, 12, 32, 0.72);
    backdrop-filter: blur(8px);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.gate-brand { font-weight: 800; letter-spacing: 0.02em; }
.gate-nav { display: inline-flex; gap: 8px; color: #9db2df; font-size: 13px; font-weight: 700; }
.gate-nav span {
    border: 1px solid rgba(106,131,183,0.35);
    border-radius: 999px;
    padding: 6px 12px;
    background: rgba(9,21,48,0.5);
}
.gate-nav .active {
    color: #001a25;
    background: linear-gradient(135deg, var(--cyan), #70f9ff);
    border-color: rgba(37,244,238,0.95);
    box-shadow: 0 0 20px rgba(37,244,238,0.32);
}
.gate-shell {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 92px 28px 28px;
    transition: transform 0.6s ease, opacity 0.6s ease;
}
.gate-shell.unlocking {
    transform: scale(0.94);
    opacity: 0;
}
.gate-card {
    width: min(900px, 100%);
    border-radius: 30px;
    border: 1px solid var(--panel-border);
    background: linear-gradient(160deg, rgba(10, 28, 63, 0.92), var(--panel));
    backdrop-filter: blur(12px);
    box-shadow: 0 26px 92px rgba(1, 9, 28, 0.8), inset 0 0 42px rgba(37, 244, 238, 0.07);
    padding: 42px 44px 30px;
    text-align: center;
}
.cloud-logo {
    width: 58px;
    height: 58px;
    margin: 0 auto 14px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 28px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(150,173,220,0.36);
}
h1 {
    margin: 0;
    font-size: clamp(34px, 4vw, 54px);
    font-weight: 800;
    letter-spacing: 0.02em;
}
.lead {
    margin: 14px auto 24px;
    max-width: 660px;
    color: var(--muted);
    font-size: 21px;
    line-height: 1.5;
}
form { margin: 0 auto; max-width: 690px; }
.fade-in-stage { animation: stageFadeIn 0.45s ease-out; }
.field { text-align: left; margin-bottom: 16px; }
.field input {
    width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(162, 184, 224, 0.3);
    background: rgba(2, 14, 38, 0.58);
    color: var(--text);
    font-size: 17px;
    padding: 14px 16px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.field input:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(37, 244, 238, 0.2);
}
.invite-code-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
}
.invite-char {
    width: 100%;
    text-align: center;
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    font-weight: 700;
    letter-spacing: 0.03em;
    font-size: 28px;
    border-radius: 16px;
    border: 1px solid rgba(179, 196, 227, 0.3);
    background: rgba(8, 19, 44, 0.24);
    color: #f7fbff;
    padding: 16px 0;
    transition: all 0.16s ease;
}
.invite-char:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 2px rgba(37, 244, 238, 0.55), 0 0 26px rgba(37, 244, 238, 0.62), inset 0 0 18px rgba(37, 244, 238, 0.22);
    transform: translateY(-2px);
}
.invite-char::placeholder { color: transparent; }
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus,
.invite-char:-webkit-autofill,
.invite-char:-webkit-autofill:hover,
.invite-char:-webkit-autofill:focus {
    -webkit-text-fill-color: #f7fbff !important;
    -webkit-box-shadow: 0 0 0 1000px #0a0e17 inset !important;
    box-shadow: 0 0 0 1000px #0a0e17 inset !important;
    transition: background-color 5000s ease-in-out 0s;
    filter: none !important;
}
.primary-btn {
    margin-top: 4px;
    width: min(420px, 100%);
    border: 0;
    border-radius: 999px;
    padding: 16px 22px;
    font-size: 22px;
    font-weight: 800;
    color: #031126;
    background: linear-gradient(135deg, #ffffff, #d6e5ff);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.25s ease;
}
.primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(219, 232, 255, 0.35);
}
.ghost-link {
    margin-top: 18px;
    border: none;
    background: transparent;
    color: #b8c6e8;
    font-size: 14px;
    cursor: pointer;
    opacity: 0.88;
    transition: color 0.2s ease, opacity 0.2s ease;
}
.ghost-link:hover { color: #d5e4ff; opacity: 1; }
.alt-login-wrap {
    margin-top: 14px;
    display: grid;
    gap: 10px;
    justify-items: center;
}
.alt-caption {
    color: #9db2df;
    font-size: 12px;
}
.google-btn {
    width: min(420px, 100%);
    border: 1px solid rgba(120, 146, 200, 0.45);
    border-radius: 12px;
    padding: 12px 14px;
    background: #fff;
    color: #1f2937;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: transform 0.14s ease, box-shadow 0.2s ease;
}
.google-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(17, 24, 39, 0.28);
}
.google-g {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    background: linear-gradient(45deg, #ea4335 0 25%, #fbbc05 25% 50%, #34a853 50% 75%, #4285f4 75% 100%);
}
.error-msg {
    display: none;
    margin: 0 auto 16px;
    max-width: 620px;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.16);
    border: 1px solid rgba(248, 113, 113, 0.5);
    color: #fecaca;
    padding: 10px 12px;
    font-size: 14px;
    text-align: left;
}
.unlock-flash {
    position: fixed;
    z-index: 3;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(circle at center, rgba(255,255,255,0.95) 0%, rgba(96, 244, 255, 0.75) 24%, rgba(5, 14, 34, 0) 65%);
    transform: scale(0.2);
}
.unlock-flash.active { animation: unlockBurst 0.85s ease-out forwards; }
@keyframes slowRotate {
    from { transform: rotate(0deg) scale(1.05); }
    to { transform: rotate(360deg) scale(1.05); }
}
@keyframes twinkle {
    from { opacity: 0.35; filter: brightness(0.9); }
    to { opacity: 0.9; filter: brightness(1.18); }
}
@keyframes unlockBurst {
    0% { opacity: 0; transform: scale(0.2); }
    30% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.22); }
}
@keyframes stageFadeIn {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (max-width: 768px) {
    .gate-topbar { top: 8px; padding: 8px 10px; }
    .gate-nav { gap: 6px; font-size: 11px; }
    .gate-nav span { padding: 5px 8px; }
    .gate-shell { padding-top: 78px; }
    .gate-card { padding: 26px 18px 22px; }
    .lead { font-size: 15px; margin-bottom: 18px; }
    .invite-code-grid { gap: 8px; }
    .invite-char { font-size: 22px; padding: 12px 0; }
    .primary-btn { font-size: 18px; padding: 13px 16px; }
}
