/* Shared frontend modals: policy, settings, and app sheets. */

.nickname-edit-modal[hidden]{display:none}
.nickname-edit-modal{position:fixed!important;inset:0!important;z-index:10020;display:grid;width:100vw;height:100vh;height:100dvh;place-items:center;padding:18px;box-sizing:border-box;opacity:0;transition:opacity .16s ease}
.nickname-edit-modal.show{opacity:1}
.nickname-edit-modal__backdrop{position:absolute;inset:0;border:0;background:rgba(25,25,25,.52);backdrop-filter:blur(8px)}
.nickname-edit-modal__panel{position:relative;width:min(100%,400px);max-height:min(86vh,560px);overflow:auto;margin:0;padding:20px;border-radius:24px;border:1px solid #ececef;background:#fff;box-shadow:0 28px 70px rgba(0,0,0,.24);transform:translateY(12px) scale(.98);transition:transform .16s ease}
.nickname-edit-modal.show .nickname-edit-modal__panel{transform:none}
.nickname-edit-modal__badge{display:grid;width:48px;height:48px;margin:0 0 14px;place-items:center;border-radius:16px;background:#fff7bf;color:#5d5100;font-size:15px;font-weight:900;box-shadow:inset 0 0 0 1px #f3df59}
.nickname-edit-modal__head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:14px}
.nickname-edit-modal__head h3{margin:0;color:#191919;font-size:19px;font-weight:800;letter-spacing:-.035em}
.nickname-edit-modal__head p{margin:5px 0 0;color:#777;font-size:11px}
.nickname-edit-modal__head p b{color:#6f6200;font-weight:900}
.nickname-edit-modal .icon-btn{border:1px solid #ececef;background:#f6f6f7;color:#555;box-shadow:none}
.nickname-edit-form{display:grid;gap:10px}
.nickname-edit-form label{color:#333;font-size:12px;font-weight:800}
.nickname-edit-form input{width:100%;min-height:48px;border:1px solid #dedee3;border-radius:14px;padding:0 14px;background:#f8f8f9;color:#191919;font-size:15px;font-weight:700;box-sizing:border-box}
.nickname-edit-form input:focus{border-color:#d4c000;outline:0;background:#fff;box-shadow:0 0 0 3px rgba(254,229,0,.2)}
.nickname-edit-form .field-help{margin:0 0 4px;color:#888;font-size:11px}
.nickname-edit-form .btn{min-height:48px;border:0;border-radius:14px;background:#fee500;color:#191919;box-shadow:0 4px 0 #d8c300,0 9px 20px rgba(89,78,0,.13);font-size:14px;font-weight:800}
.nickname-edit-form .btn:active{transform:translateY(3px);box-shadow:0 1px 0 #d8c300,0 3px 8px rgba(89,78,0,.1)}
.nickname-edit-modal--required .nickname-edit-modal__panel{border-color:#f2df58}

.policy-modal{
  position:fixed;
  inset:0;
  z-index:160;
  display:none;
}
.policy-modal.show{
  display:block;
}
.policy-modal__backdrop{
  position:absolute;
  inset:0;
  background:rgba(15,23,42,.42);
  backdrop-filter:blur(8px);
}
.policy-modal__panel{
  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  width:min(720px,calc(100vw - 28px));
  height:min(760px,calc(100vh - 36px));
  display:grid;
  grid-template-rows:auto minmax(0,1fr);
  overflow:hidden;
  border-radius:24px;
  background:#fff;
  border:1px solid #e2e8f4;
  box-shadow:0 30px 80px rgba(15,23,42,.26);
}
.policy-modal__head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:14px 16px;
  border-bottom:1px solid #e8eef7;
  background:rgba(255,255,255,.96);
}
.policy-modal__head h2{
  margin:0;
  color:#101828;
  font-size:18px;
  line-height:1.25;
  letter-spacing:0;
}
.policy-modal__body{
  width:100%;
  height:100%;
  min-height:0;
  overflow:auto;
  background:#f8fbff;
  padding:18px;
  outline:none;
  -webkit-overflow-scrolling:touch;
}
.policy-modal__body .legal-date{
  margin:0 0 8px;
  color:#98a2b3;
  font-size:11px;
  font-weight:400;
  line-height:1.45;
  letter-spacing:0;
}
.policy-modal__body h2{
  margin:0 0 16px;
  color:#101828;
  font-size:24px;
  line-height:1.18;
}
.policy-modal__body h3{
  margin:22px 0 8px;
  color:#24304a;
  font-size:16px;
  line-height:1.35;
}
.policy-modal__body p,
.policy-modal__body li{
  color:#344054;
  font-size:14px;
  line-height:1.75;
}
.policy-modal__body p{
  margin:0 0 10px;
}
.policy-modal__body ul{
  display:grid;
  gap:8px;
  margin:0;
  padding-left:18px;
}
.policy-modal__body a{
  color:#1d4ed8;
  font-weight:900;
  text-decoration:none;
}
.policy-modal__loading,
.policy-modal__error{
  min-height:220px;
  display:grid;
  place-items:center;
  gap:12px;
  text-align:center;
  color:#667085;
  font-size:14px;
  font-weight:900;
}

.settings-sheet{position:fixed;inset:0;z-index:120;display:none;place-items:center;padding:20px}
.settings-sheet.show{display:grid}
.settings-sheet__backdrop{position:absolute;inset:0;background:rgba(25,25,25,.42);opacity:0;backdrop-filter:blur(6px);transition:opacity .18s ease}
.settings-sheet.show .settings-sheet__backdrop{opacity:1}
.settings-sheet__panel{position:relative;width:min(420px,100%);max-height:min(680px,calc(100vh - 40px));overflow:auto;margin:0;background:#f7f8fa;border-radius:24px;border:1px solid rgba(0,0,0,.06);padding:18px;box-shadow:0 26px 70px rgba(0,0,0,.24);opacity:0;transform:translateY(10px) scale(.985);transition:opacity .18s ease,transform .2s cubic-bezier(.2,.8,.2,1)}
.settings-sheet.show .settings-sheet__panel{opacity:1;transform:translateY(0) scale(1)}
.settings-sheet__head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px}
.settings-sheet__title{display:flex;align-items:center;gap:11px;min-width:0}
.settings-sheet__title > span{flex:0 0 40px;width:40px;height:40px;display:grid;place-items:center;border-radius:14px;background:#fee500;color:#3c1e1e;font-size:19px;box-shadow:0 7px 16px rgba(117,98,0,.12)}
.settings-sheet__head h2{margin:0;color:#191919;font-size:19px;line-height:1.2;font-weight:750;letter-spacing:-.035em}
.settings-sheet__head p{margin:3px 0 0;color:#858585;font-size:10.5px;line-height:1.35;font-weight:550}
.settings-sheet__head > .icon-btn{flex:0 0 32px;width:32px;height:32px;border:0;border-radius:50%;background:#eceef1;color:#62666d;box-shadow:none}
.settings-form{display:grid;gap:9px}
.settings-row{display:flex;justify-content:space-between;gap:12px;padding:13px 14px;border-radius:15px;background:#fff;border:1px solid #eceef1;align-items:center;box-shadow:none}
.settings-row b{display:block;margin-bottom:3px;color:#242424;font-size:13px;line-height:1.35;font-weight:700}
.settings-row b em{display:inline-flex;margin-left:4px;padding:2px 5px;border-radius:6px;background:#fff6bf;color:#6e5b00;font-size:8.5px;line-height:1.2;font-style:normal;font-weight:750;vertical-align:1px}
.settings-row small{display:block;color:#858585;font-size:10px;line-height:1.4;font-weight:500;word-break:keep-all}
.settings-row input[type="checkbox"]{width:52px;height:30px;appearance:none;border-radius:999px;background:#2b3557;position:relative;cursor:pointer;transition:.2s}
.settings-row input[type="checkbox"]::after{content:"";position:absolute;top:3px;left:3px;width:24px;height:24px;border-radius:50%;background:#fff;transition:.2s}
.settings-row input[type="checkbox"]:checked{background:#fee500}
.settings-row input[type="checkbox"]:checked::after{left:25px}
.settings-control-row{flex-wrap:wrap}
.settings-segmented{display:grid;grid-template-columns:repeat(2,minmax(58px,1fr));gap:3px;padding:3px;border-radius:11px;background:#f0f1f3;border:1px solid #e4e6e9}
.settings-segmented label{cursor:pointer}
.settings-segmented input{position:absolute;opacity:0;pointer-events:none}
.settings-segmented label span{display:grid;min-height:32px;padding:0 13px;place-items:center;border-radius:8px;color:#777;font-size:11px;font-weight:650;transition:background .16s ease,color .16s ease,box-shadow .16s ease}
.settings-segmented input:checked + span{background:#fff;color:#191919;box-shadow:0 2px 8px rgba(0,0,0,.1)}
.settings-segmented input:focus-visible + span{outline:2px solid #fee500;outline-offset:2px}
.settings-actions{display:flex;gap:10px;margin-top:3px}
.settings-actions .btn{min-height:46px;border:1px solid #f0d900!important;border-radius:13px!important;background:#fee500!important;color:#191919!important;font-size:13px!important;font-weight:750!important;box-shadow:none!important}
@media(max-width:420px){.settings-sheet{padding:16px}.settings-sheet__panel{max-height:calc(100vh - 32px);padding:16px;border-radius:22px}.settings-control-row{align-items:flex-start}.settings-segmented{width:100%}}
@media(prefers-reduced-motion:reduce){.settings-sheet__backdrop,.settings-sheet__panel{transition:none}}

.app-modal{position:fixed;inset:0;z-index:130;display:none}
.app-modal.show{display:block}
.app-modal__backdrop{position:absolute;inset:0;background:rgba(4,8,16,.72);backdrop-filter:blur(9px)}
.app-modal__panel{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:min(560px,calc(100vw - 28px));max-height:calc(100vh - 36px);overflow:auto;border-radius:30px;background:linear-gradient(180deg,#162246,#0f1830);border:1px solid rgba(255,255,255,.1);box-shadow:0 32px 72px rgba(0,0,0,.42);padding:20px}
.app-modal__head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;margin-bottom:16px}
.app-modal__head h3{margin:6px 0 6px;font-size:28px;line-height:1.06;letter-spacing:-.05em}
.app-modal__head p{margin:0;color:#bccbee;line-height:1.6}

@media (max-width:720px){
  .policy-modal__panel{
    top:auto;
    bottom:0;
    transform:translateX(-50%);
    width:100vw;
    height:min(88vh,calc(100vh - 20px));
    border-radius:24px 24px 0 0;
    border-left:0;
    border-right:0;
    border-bottom:0;
  }
  .policy-modal__head{
    padding:13px 16px;
  }
  .app-modal__panel{top:auto;bottom:0;transform:translateX(-50%);width:min(560px,100vw);max-height:85vh;border-radius:28px 28px 0 0;padding:18px 16px calc(18px + env(safe-area-inset-bottom))}
}
