/* Live chat + the acceptance-letter checkout. Chat is a modern messenger; the letter stays cream paper (the old-school university touch). */

/* ---------- chat launcher ---------- */
.chat-fab { position: fixed; z-index: 6900; right: max(18px, env(safe-area-inset-right, 0px)); bottom: max(18px, env(safe-area-inset-bottom, 0px)); display: flex; align-items: flex-end; gap: 12px; transition: transform .5s var(--ease), opacity .3s; }
.chat-fab.is-open { opacity: 0; pointer-events: none; transform: scale(.6); }
.chat-fab .bubble { position: relative; width: 64px; height: 64px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .55); background: linear-gradient(180deg, #5b95ff, #2563ff 60%, #1a47d8); color: #fff; display: grid; place-items: center; box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset, 0 16px 36px rgba(0, 8, 40, .6), 0 0 44px rgba(59, 130, 255, .6); transition: transform .35s var(--spring); animation: fabPulse 3.4s ease-in-out infinite; }
@keyframes fabPulse { 0%, 100% { box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset, 0 16px 36px rgba(0, 8, 40, .6), 0 0 30px rgba(59, 130, 255, .45) } 50% { box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset, 0 16px 36px rgba(0, 8, 40, .6), 0 0 60px rgba(96, 165, 255, .85) } }
.chat-fab .bubble:hover { transform: scale(1.1) rotate(-5deg); }
.chat-fab .bubble .dot { position: absolute; right: 1px; top: 1px; width: 15px; height: 15px; border-radius: 50%; background: var(--green); border: 2.5px solid #071333; animation: live 1.8s infinite; }
.chat-fab .nudge { max-width: 240px; padding: 12px 16px; border-radius: 20px 20px 6px 20px; background: #fff; color: #0a1a47; border: 0; font: 700 .95rem/1.25 var(--ff-d); letter-spacing: -.01em; text-align: left; box-shadow: 0 18px 44px rgba(0, 6, 30, .55), 0 0 30px rgba(96, 165, 255, .4); animation: toastIn .6s var(--spring); }
.chat-fab .nudge[hidden] { display: none; }

/* ---------- chat panel ---------- */
.chat { position: fixed; z-index: 7000; right: max(16px, env(safe-area-inset-right, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); width: min(396px, calc(100vw - 28px)); height: min(640px, calc(100svh - 100px)); display: grid; grid-template-rows: auto 1fr auto; border-radius: 26px; overflow: hidden; background: #0a1534; border: 1px solid rgba(160, 205, 255, .4); box-shadow: 0 50px 110px rgba(0, 4, 22, .8), 0 0 90px rgba(37, 99, 255, .3); transform-origin: 100% 100%; transform: scale(.4) translateY(40px); opacity: 0; visibility: hidden; transition: transform .6s var(--spring), opacity .3s, visibility .3s; }
.chat.is-on { transform: none; opacity: 1; visibility: visible; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: linear-gradient(135deg, #2563ff, #1238a8 70%); border-bottom: 1px solid rgba(255, 255, 255, .18); color: #fff; }
.chat-head .av { position: relative; width: 44px; height: 44px; border-radius: 50%; background: #fff; display: grid; place-items: center; flex: none; box-shadow: 0 6px 16px rgba(0, 8, 40, .4); }
.chat-head .av img { width: 30px; }
.chat-head .av i { position: absolute; right: -1px; bottom: -1px; width: 13px; height: 13px; border-radius: 50%; background: var(--green); border: 2.5px solid #1a47d8; }
.chat-head .grow { flex: 1; min-width: 0; line-height: 1.2; }
.chat-head b { display: block; font: 800 1.08rem var(--ff-d); letter-spacing: -.02em; }
.chat-head small { display: flex; align-items: center; gap: 7px; color: #d6e5ff; font-size: .76rem; font-weight: 500; line-height: 1.25; }
.chat-head small .live-dot { background: #6ee7b7; }
.chat-head button { width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .16); font-size: 1.4rem; line-height: 1; color: #fff; transition: background .3s, transform .3s var(--spring); }
.chat-head button:hover { background: rgba(255, 255, 255, .3); transform: rotate(90deg); }
.chat-body { overflow-y: auto; padding: 16px 14px 10px; display: flex; flex-direction: column; gap: 6px; scroll-behavior: smooth; overscroll-behavior: contain; background: radial-gradient(120% 50% at 50% 0, rgba(37, 99, 255, .2), transparent), #0a1534; }
.chat-day { align-self: center; font: 600 .7rem var(--ff-n); letter-spacing: .12em; text-transform: uppercase; color: var(--dim); padding: 2px 0 8px; }
.msg { position: relative; max-width: 82%; padding: 10px 14px 8px; border-radius: 20px; font-size: .95rem; line-height: 1.42; animation: msgIn .45s var(--spring); word-wrap: break-word; }
@keyframes msgIn { from { opacity: 0; transform: translateY(14px) scale(.94) } to { opacity: 1; transform: none } }
.msg time { display: block; margin-top: 3px; font-size: .64rem; font-weight: 500; opacity: .6; letter-spacing: .02em; }
.msg.bot, .msg.human { align-self: flex-start; margin-left: 36px; background: #16295f; color: #eaf1ff; border-bottom-left-radius: 6px; }
.msg.bot::before, .msg.human::before { content: ''; position: absolute; left: -36px; bottom: 0; width: 28px; height: 28px; border-radius: 50%; background: #fff url(../assets/img/crest-sm.webp) center / 19px no-repeat; }
.msg.human { background: #0d3d33; border: 1px solid rgba(52, 211, 153, .5); color: #e4fff4; }
.msg.human::before { background: linear-gradient(180deg, #34d399, #0f9d6e); content: 'T'; display: grid; place-items: center; color: #fff; font: 800 .8rem/28px var(--ff-d); text-align: center; }
.msg.me { align-self: flex-end; background: linear-gradient(180deg, #4a8bff, #2563ff); color: #fff; font-weight: 500; border-bottom-right-radius: 6px; box-shadow: 0 8px 20px rgba(37, 99, 255, .35); }
.msg .who { display: block; font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #6ee7b7; margin-bottom: 3px; }
.msg .lnk { display: inline-block; margin: 8px 8px 0 0; padding: 7px 13px; border-radius: 99px; background: rgba(125, 184, 255, .18); border: 1px solid rgba(160, 205, 255, .45); font-weight: 700; font-size: .84rem; color: #fff; }
.msg .lnk:hover { background: rgba(125, 184, 255, .34); }
.msg .fb { display: flex; gap: 8px; margin-top: 8px; } .msg .fb button { background: none; border: 1px solid rgba(255, 255, 255, .22); border-radius: 99px; color: var(--mute); font-size: .72rem; padding: 3px 10px; }
.chat-note { align-self: center; text-align: center; font-size: .74rem; color: var(--dim); max-width: 90%; padding: 4px 0; }
.chat .chips { margin: 4px 0 6px 36px; gap: 7px; }
.chat .chips button { font: 600 .84rem var(--ff-b); padding: 8px 13px; min-height: 38px; border-radius: 99px; text-align: left; background: transparent; border: 1px solid rgba(160, 205, 255, .5); color: #dbe9ff; }
.chat .chips button:hover { background: rgba(125, 184, 255, .2); border-color: #fff; }
.msg.typ { padding: 12px 15px; }
.typing { display: inline-flex; gap: 5px; padding: 3px 2px; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: #9cc4ff; animation: tp 1.1s infinite; } .typing i:nth-child(2) { animation-delay: .16s } .typing i:nth-child(3) { animation-delay: .32s }
@keyframes tp { 0%, 60%, 100% { transform: none; opacity: .4 } 30% { transform: translateY(-6px); opacity: 1 } }
.chat-foot { padding: 10px 12px 12px; border-top: 1px solid var(--line); background: #0c1a42; display: grid; gap: 6px; }
.chat-foot form { display: flex; gap: 8px; align-items: center; }
.chat-foot input { flex: 1; min-width: 0; min-height: 46px; padding: 0 18px; border-radius: 99px; border: 1px solid rgba(160, 205, 255, .35); background: #060f2c; color: #fff; font: 500 .96rem var(--ff-b); outline: none; transition: border-color .3s, box-shadow .3s; }
.chat-foot input::placeholder { color: var(--dim); }
.chat-foot input:focus { border-color: var(--sky); box-shadow: 0 0 0 3px rgba(59, 130, 255, .3); }
.chat-foot .send { width: 46px; height: 46px; flex: none; border-radius: 50%; border: 0; background: linear-gradient(180deg, #5b95ff, #2563ff); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 20px rgba(37, 99, 255, .5); transition: transform .3s var(--spring); }
.chat-foot .send:hover { transform: scale(1.08); }
.chat-foot .send:active { transform: scale(.86); }
.human-btn { background: none; border: 0; color: var(--sky); font-weight: 700; font-size: .82rem; justify-self: center; padding: 2px 6px; text-decoration: underline; text-underline-offset: 4px; }
.lead-form { display: grid; gap: 8px; margin-top: 10px; }
.lead-form input[name=contact] { min-height: 42px; padding: 0 14px; border-radius: 12px; border: 1px solid rgba(160, 205, 255, .4); background: #060f2c; color: #fff; font: inherit; }
.lead-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.lead-form button { min-height: 42px; border-radius: 99px; border: 0; background: linear-gradient(180deg, #5b95ff, #2563ff); color: #fff; font-weight: 800; }
@media (max-width: 720px) { .chat { right: 8px; left: 8px; width: auto; bottom: 8px; height: min(660px, calc(100svh - 70px)); border-radius: 22px; } .chat-fab { bottom: max(84px, env(safe-area-inset-bottom, 0px)); } }

/* ---------- acceptance letter ---------- */
.enroll { position: fixed; inset: 0; z-index: 8100; overflow-y: auto; overflow-x: hidden; visibility: hidden; opacity: 0; transition: opacity .45s, visibility .45s; display: grid; padding: max(14px, env(safe-area-inset-top, 0px)) var(--gutr) max(30px, env(safe-area-inset-bottom, 0px)) var(--gut); -webkit-overflow-scrolling: touch; }
.enroll.is-on { opacity: 1; visibility: visible; }
.en-dim { position: fixed; inset: 0; background: radial-gradient(circle at 50% 38%, rgba(14, 40, 120, .86), rgba(2, 5, 18, .96)); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.en-x { position: fixed; z-index: 6; right: max(14px, env(safe-area-inset-right, 0px)); top: max(14px, env(safe-area-inset-top, 0px)); width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .4); background: rgba(4, 11, 31, .75); font-size: 1.7rem; line-height: 1; color: #fff; transition: transform .3s var(--spring); }
.en-x:hover { transform: rotate(90deg) scale(1.1); border-color: var(--sky); }
.en-stage { position: relative; z-index: 2; width: min(660px, 100%); margin: auto; display: grid; place-items: center; perspective: 1500px; min-height: 60vh; }
.env { position: absolute; left: 50%; top: 50%; width: min(540px, 92vw); aspect-ratio: 3 / 2; margin: calc(min(540px, 92vw) / -3) 0 0 calc(min(540px, 92vw) / -2); transform: translateY(110vh) rotate(-10deg); transform-style: preserve-3d; transition: transform 1.1s var(--spring); filter: drop-shadow(0 40px 50px rgba(0, 0, 0, .7)) drop-shadow(0 0 40px rgba(59, 130, 255, .3)); }
.enroll.s1 .env { transform: none; }
.enroll.s3 .env { transform: translateY(70vh) rotate(6deg) scale(.8); opacity: 0; transition: transform .8s var(--ease), opacity .6s; pointer-events: none; }
.env > * { position: absolute; }
.env-back { inset: 0; background: linear-gradient(160deg, #cdbb8c, #b3a070); border-radius: 8px; }
.env-paper { left: 5%; right: 5%; top: 6%; bottom: 8%; background: url(../assets/img/paper-card.jpg) center / cover; border-radius: 3px; transform: translateY(0); transition: transform 1s .5s var(--ease); box-shadow: 0 -6px 18px rgba(0, 0, 0, .25); }
.enroll.s2 .env-paper { transform: translateY(-42%); }
.env-front { inset: 0; background: linear-gradient(180deg, #ecdfb9, #dac89a); clip-path: polygon(0 0, 50% 56%, 100% 0, 100% 100%, 0 100%); border-radius: 8px; }
.env-flap { left: 0; right: 0; top: 0; height: 58%; background: linear-gradient(180deg, #f1e5c0, #dcc99b); clip-path: polygon(0 0, 100% 0, 50% 100%); transform-origin: 50% 0; transition: transform .9s var(--ease); backface-visibility: visible; z-index: 3; }
.enroll.s2 .env-flap { transform: rotateX(180deg); z-index: 0; background: #b9a676; }
.env-seal { left: 50%; top: 58%; width: 22%; margin: -11% 0 0 -11%; z-index: 4; transition: transform .6s var(--ease), opacity .5s; }
.enroll.s2 .env-seal { transform: translateY(80px) scale(.5) rotate(40deg); opacity: 0; }
.paper { position: relative; z-index: 3; width: 100%; display: none; padding: clamp(30px, 5vw, 58px) clamp(26px, 5.4vw, 64px) clamp(60px, 8vw, 90px); color: #1b2440; border-radius: 4px; background: url(../assets/img/paper-card.jpg) center / 100% 100%, #efe6cf; box-shadow: 0 60px 120px rgba(0, 0, 0, .75), 0 0 100px rgba(59, 130, 255, .3); text-align: left; }
.enroll.s3 .paper { display: grid; gap: 14px; animation: paperUp 1s var(--spring); }
@keyframes paperUp { from { opacity: 0; transform: translateY(80px) scale(.82) rotateX(24deg) } to { opacity: 1; transform: none } }
.paper-hd { display: flex; align-items: center; gap: 12px; padding-bottom: 10px; border-bottom: 1.5px solid rgba(10, 42, 110, .35); }
.paper-hd img { width: 46px; } .paper-hd b { display: block; font: 850 1.25rem var(--ff-d); letter-spacing: .04em; text-transform: uppercase; color: #0a2a6e; } .paper-hd span { font-size: .76rem; letter-spacing: .08em; color: #5a6382; font-weight: 600; text-transform: uppercase; }
.paper-dear { font-family: var(--ff-d); font-weight: 650; font-size: 1.25rem; color: #1b2440; letter-spacing: -.02em; }
.paper .paper-dear { display: flex; align-items: baseline; gap: 6px; }
.paper .paper-dear input:not([type=checkbox]) { flex: 0 1 11em; min-width: 0; min-height: 0; width: auto; background: transparent; border: 0; border-bottom: 1.5px dashed #5a73b8; border-radius: 0; box-shadow: none; font: 750 1.25rem var(--ff-d); color: #2563ff; outline: none; padding: 0 4px 2px; }
.paper .paper-dear input:focus { border-bottom-style: solid; border-color: #0a2a6e; box-shadow: none; }
.paper .paper-dear input.bad { border-bottom-color: #b3261e; box-shadow: none; }
.paper-h { font: 850 clamp(1.8rem, 4.4vw, 2.8rem)/.98 var(--ff-d); color: #0a2a6e; letter-spacing: -.028em; text-transform: uppercase; }
.paper-p { font-size: 1rem; color: #2b3556; }
.paper-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.paper label { display: grid; gap: 4px; font-weight: 700; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: #5a6382; }
.paper input:not([type=checkbox]), .paper select { min-height: 46px; padding: 0 12px; border-radius: 10px; border: 1px solid rgba(10, 42, 110, .35); background: rgba(255, 255, 255, .8); color: #0a2a6e; font: 600 1rem var(--ff-b); text-transform: none; letter-spacing: 0; outline: none; transition: border-color .2s, box-shadow .2s; min-width: 0; width: 100%; }
.paper input:focus, .paper select:focus { border-color: #2563ff; box-shadow: 0 0 0 3px rgba(37, 99, 255, .22); }
.paper input.bad { border-color: #b3261e; box-shadow: 0 0 0 3px rgba(179, 38, 30, .18); }
.paper-sum { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 10px 14px; border-radius: 12px; background: rgba(37, 99, 255, .08); border: 1px dashed rgba(10, 42, 110, .4); font-size: .9rem; font-weight: 600; color: #0a2a6e; }
.paper-chk { display: grid !important; grid-template-columns: 24px 1fr; gap: 10px !important; align-items: start; text-transform: none !important; letter-spacing: 0 !important; font-size: .9rem !important; font-weight: 500 !important; color: #2b3556 !important; }
.paper-chk input { width: 22px; height: 22px; min-height: 0; accent-color: #2563ff; margin-top: 2px; }
.paper, .paper input, .paper select { color-scheme: light; }
.paper-chk a { color: #1a47d8; font-weight: 700; text-decoration: underline; }
.paper-sign { display: grid; grid-template-columns: minmax(0, 1fr) 132px; gap: 14px; align-items: end; }
.paper-sign input { font: italic 700 1.5rem var(--ff-d) !important; min-height: 56px !important; }
.paper-stamp { position: relative; width: 132px; height: 132px; margin: -20px -6px -10px 0; opacity: 0; transform: scale(2.6) rotate(-30deg); pointer-events: none; display: grid; place-items: center; }
.paper-stamp svg { position: absolute; inset: 0; width: 100%; height: 100%; } .paper-stamp span { position: relative; font: 850 .9rem var(--ff-d); letter-spacing: .12em; color: #fff; transform: rotate(-12deg); }
.paper-stamp.is-on { animation: stampIn .6s var(--spring) forwards; }
.paper-err { padding: 10px 14px; border-radius: 10px; background: #fde7e5; color: #8a1c14; font-weight: 700; font-size: .92rem; border: 1px solid #e8a39d; }
.paper .btn { margin-top: 4px; }
.paper-fine { font-size: .8rem; color: #5a6382; text-align: center; }
@media (max-width: 560px) { .paper-grid { grid-template-columns: minmax(0, 1fr); } .paper-sign { grid-template-columns: minmax(0, 1fr); } .paper-stamp { margin: -14px auto -6px; } }
