*,*::before,*::after{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
:root{
  --coral:#FA5D56;
  --grad:linear-gradient(100deg,#FA5A55 0%,#FB766B 55%,#FF9A8B 100%);
  --btn-grad:linear-gradient(90deg,#FA5F5D 0%,#FF9A8E 100%);
  --bg:#F5F6FD;
  --text:#1D212F;
  --sub:#7C8293;
  --ph:#C3C7D6;
  --font:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
}
html,body{background:#E6E9F0;font-family:var(--font);color:var(--text);-webkit-text-size-adjust:100%}
body{display:flex;justify-content:center;min-height:100vh;overflow-x:hidden}
.screen{position:relative;width:100%;max-width:430px;min-height:100vh;background:var(--bg);box-shadow:0 0 30px rgba(0,0,0,.08);overflow-x:hidden}
.view{display:none;min-height:100vh}
.view.active{display:block}
button{font-family:inherit;border:none;background:none;outline:none;cursor:pointer}
input{font-family:inherit;outline:none;border:none;background:none}
a{text-decoration:none;color:inherit}
.chev{width:16px;height:16px;flex-shrink:0;color:#8E94A8}

/* ---------- top bars ---------- */
.hero{position:relative;height:217px;background:var(--grad);border-radius:0 0 32px 32px;padding-top:env(safe-area-inset-top,0px)}
.hero h1{height:52px;display:flex;align-items:center;justify-content:center;color:#fff;font-size:20px;font-weight:500}
.topbar{position:sticky;top:0;z-index:5;height:calc(52px + env(safe-area-inset-top,0px));padding-top:env(safe-area-inset-top,0px);background:#fff;display:flex;align-items:center;justify-content:center}
.topbar h1{font-size:19px;font-weight:500;color:var(--text)}
.back-btn{position:absolute;left:6px;bottom:0;width:44px;height:52px;display:flex;align-items:center;justify-content:center}
.back-btn svg{width:22px;height:22px;stroke:var(--text)}
.back-btn.light{top:env(safe-area-inset-top,0px);bottom:auto}
.back-btn.light svg{stroke:#fff}

/* ---------- profile card ---------- */
.profile-card{position:relative;margin:-159px 14px 0;background:#fff;border-radius:16px;padding:0 17px 12px;z-index:2}
.row{display:flex;align-items:center}
.avatar-row{height:93px;padding-top:13px;cursor:pointer}
.avatar-circle{width:80px;height:80px;border-radius:50%;overflow:hidden;background:#fff;flex-shrink:0;margin-top:0}
.avatar-circle img{width:100%;height:100%;object-fit:cover;display:block}
.row-hint{margin-left:auto;margin-right:8px;font-size:15px;color:var(--sub)}
.nick-row,.uid-row{height:73px;cursor:pointer}
.nick-row{border-bottom:1px solid #F1F2F7;cursor:pointer}
.uid-row{cursor:default}
.row-label{font-size:15px;color:var(--sub)}
.row-value{margin-left:auto;font-size:16px;color:var(--text)}
.nick-row .row-value{margin-right:8px}
.copy-btn{width:22px;height:22px;margin-left:10px;padding:0;display:flex;align-items:center;justify-content:center}
.copy-btn svg{width:20px;height:20px}

/* ---------- security ---------- */
.section-title{display:flex;align-items:center;margin:46px 14px 10px 14px;font-size:17.5px;font-weight:700;color:var(--text);height:24px;line-height:24px}
.section-title i{display:block;width:3px;height:21px;background:var(--coral);margin-right:11px}
.menu-card{display:flex;align-items:center;height:80px;margin:0 14px 17px;padding:0 15px 0 14px;background:#fff;border-radius:16px;cursor:pointer}
.menu-icon{width:40px;height:40px;border-radius:10px;background:#FDE3E3;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.menu-icon svg{width:22px;height:22px}
.menu-label{margin-left:14px;font-size:16px;color:var(--text)}
.menu-hint{margin-left:auto;margin-right:8px;font-size:15px;color:var(--sub)}
#cardMail:not([data-go]){cursor:default}

/* ---------- forms (password + mail) ---------- */
.pwd-body{padding:0 24px}
.mail-body{padding:0 15px}
.field{margin-top:0}
.pwd-body .field{margin-top:17px}
.pwd-body .field:first-child{margin-top:63px}
.f-label{display:flex;align-items:center;height:27px;font-size:17.5px;color:var(--text);margin-bottom:0}
.f-ico{width:24px;height:24px;margin-left:2px;margin-right:12px;display:flex;align-items:center;justify-content:center}
.f-ico svg{width:20px;height:24px}
.input-wrap{position:relative;display:flex;align-items:center;height:50px;margin-top:0;background:#fff;border-radius:14px;padding:0 14px 0 15px}
.input-wrap input{flex:1;min-width:0;width:100%;height:100%;font-size:16px;color:var(--text)}
.input-wrap input::placeholder{color:var(--ph)}
.eye{width:30px;height:30px;display:flex;align-items:center;justify-content:center;color:#A0A6B8;flex-shrink:0}
.eye.on{color:var(--coral)}
.forgot-link{display:flex;align-items:center;justify-content:flex-end;margin-top:19px;height:24px;font-size:15px;color:#6B7285}
.forgot-link .chev{width:14px;height:14px;margin-left:2px;color:#6B7285}
.btn-main{display:block;height:46px;border-radius:23px;background:var(--btn-grad);color:#fff;font-weight:700}
.btn-main:active{opacity:.9}
.btn-main[disabled]{opacity:.6}
.pwd-save{width:calc(100% - 39px);margin:60px auto 0;font-size:18px;letter-spacing:2.6px}

.mail-body .field:first-child{margin-top:56px}
.mail-body .field+.field{margin-top:23px}
.f-label.m{height:26px;margin-bottom:1px}
.m-ico{width:26px;height:18px;margin-right:11px;flex-shrink:0}
.m-ico.shield{width:22px;height:25px;margin-right:12px;margin-left:2px}
.input-wrap.sq{border-radius:12px;padding:0 15px}
.input-wrap.code-wrap{padding-right:6px}
.btn-send{flex-shrink:0;height:40px;min-width:108px;padding:0 14px;margin-left:6px;border-radius:20px;background:var(--btn-grad);color:#fff;font-size:15px;font-weight:400}
.btn-send.counting{background:#C6CBDB;cursor:not-allowed}
.btn-send[disabled]{opacity:.85}
.code-wrap input{padding-right:4px}
.helper-row{display:flex;align-items:flex-start;margin-top:17px;padding:0 3px;font-size:14px;line-height:18px;color:var(--coral)}
.helper-row[hidden]{display:none}
.helper-row svg{flex-shrink:0;margin-top:1px;margin-right:6px}
.helper-row .h-text{width:calc(50% - 18px);margin-right:auto}
.helper-row .h-link{width:calc(50% - 8px);color:var(--coral)}
.mail-bind{position:fixed;bottom:calc(111px + env(safe-area-inset-bottom,0px));left:50%;transform:translateX(-50%);width:calc(min(100vw,430px) - 28px);height:45px;border-radius:23px;font-size:17.5px}
.mail-bind:active{opacity:.9}

/* ---------- avatar ---------- */
#viewAvatar{background:#F6F7FA}
.avatar-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:13px;padding:14px 28px 40px}
.avatar-tile{position:relative;aspect-ratio:200/180;border-radius:15px;border:3px solid transparent;cursor:pointer}
.avatar-tile img{width:100%;height:100%;object-fit:cover;display:block;border-radius:12px}
.avatar-tile.selected{border-color:var(--coral)}
.avatar-check{position:absolute;right:-3px;bottom:-3px;width:22px;height:22px;border-radius:50%;background:var(--coral);display:none;align-items:center;justify-content:center}
.avatar-tile.selected .avatar-check{display:flex}
.avatar-check svg{width:13px;height:13px}

/* ---------- nickname modal ---------- */
.nick-overlay{position:fixed;inset:0;z-index:200;background:rgba(0,0,0,.6);display:flex;flex-direction:column;align-items:center;justify-content:center}
.nick-overlay[hidden]{display:none}
.nick-modal{width:calc(min(100vw,430px) - 35px);height:430px;border-radius:16px;background:linear-gradient(180deg,#FF6B6B 0%,#FF4747 100%);padding:0 8px 10px;display:flex;flex-direction:column}
.nick-title{height:64px;display:flex;align-items:center;justify-content:center;gap:0;margin:0 -8px}
.nick-title h3{color:#fff;font-size:21px;font-weight:700;margin:0 14px}
.nick-title .line{display:block;height:1px;width:55px}
.nick-title .line.l{background:linear-gradient(90deg,rgba(255,255,255,0),rgba(255,255,255,.9))}
.nick-title .line.r{background:linear-gradient(90deg,rgba(255,255,255,.9),rgba(255,255,255,0))}
.nick-inner{flex:1;background:#fff;border-radius:16px;padding:0 14px 10px;display:flex;flex-direction:column;min-height:0}
.nick-label{display:flex;align-items:center;height:40px;margin-top:30px;font-size:17.5px;color:var(--text)}
.nick-label svg{width:22px;height:24px;margin-right:10px}
.nick-inner input{height:50px;border-radius:25px;background:#F5F6FD;padding:0 26px;font-size:17.5px;color:var(--text);width:100%;margin-top:1px}
.nick-spacer{flex:1}
.nick-divider{height:1px;background:#F3F4F8;margin:0 -2px 0}
.nick-confirm{width:100%;height:40px;border-radius:20px;font-size:16px;margin-top:0}
.nick-close{width:32px;height:32px;margin-top:27px;padding:0}
.nick-close svg{width:32px;height:32px;display:block}

/* ---------- toast ---------- */
.toast{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:99999;min-width:130px;max-width:72%;min-height:131px;background:rgba(74,74,76,.96);border-radius:16px;padding:14px 12px 16px;display:none;flex-direction:column;align-items:center;justify-content:center;text-align:center;pointer-events:none}
.toast.show{display:flex}
.toast-ico{height:44px;display:flex;align-items:center;justify-content:center;margin-bottom:6px}
.toast-ico:empty{display:none}
.toast-text{color:#fff;font-size:16px;line-height:1.4;white-space:pre-line}
