/* 授权码遮罩（gate）—— 只做一件事：未解锁时把整站挡住，只留一个输码框。
   配色沿用 styles.css 的奶油底 + 琥珀，移动端 320 / 390 宽都验过。 */

#gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  background:
    radial-gradient(120% 60% at 50% -10%, #fffdf7 0%, rgba(255,253,247,0) 60%),
    radial-gradient(90% 50% at 100% 100%, #fdf1dd 0%, rgba(253,241,221,0) 55%),
    #fffaf0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#gate[hidden] { display: none; }

#gate .gate-card {
  width: 100%;
  max-width: 400px;
  background: #ffffff;
  border: 1px solid #efe4d2;
  border-radius: 20px;
  padding: 24px 20px 20px;
  box-shadow: 0 10px 30px rgba(80, 60, 30, .07), 0 2px 6px rgba(80, 60, 30, .05);
}

#gate .gate-badge {
  display: inline-block;
  margin: 0 0 10px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #fae4ba;
  color: #8a5a12;
  font-size: 12px;
  letter-spacing: .04em;
}

#gate h1 {
  margin: 0 0 6px;
  font-size: 20px;
  line-height: 1.4;
  color: #2d261a;
  font-weight: 700;
}

#gate p.gate-sub {
  margin: 0 0 18px;
  font-size: 13.5px;
  line-height: 1.6;
  color: #6e6961;
}

#gate label.gate-label {
  display: block;
  margin: 0 0 6px;
  font-size: 13px;
  color: #4a4235;
  font-weight: 600;
}

#gate input#gateCode {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid #efe4d2;
  border-radius: 14px;
  background: #fdf5e8;
  color: #2d261a;
  /* 16px 以下 iOS 会自动放大页面，这里必须 ≥16 */
  font-size: 17px;
  letter-spacing: .16em;
  text-align: center;
  text-transform: uppercase;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  outline: none;
  transition: border-color .16s, background .16s;
}

#gate input#gateCode::placeholder {
  letter-spacing: .1em;
  color: #b3aaa0;
  text-transform: none;
  font-family: inherit;
}

#gate input#gateCode:focus {
  border-color: #d68a2a;
  background: #fff;
}

#gate button#gateBtn {
  width: 100%;
  margin-top: 14px;
  padding: 14px 16px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #f0b45e, #d68a2a);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .02em;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(214, 138, 42, .24);
}

#gate button#gateBtn[disabled] {
  opacity: .6;
  cursor: default;
  box-shadow: none;
}

#gate button#gateBtn:active { transform: translateY(1px); }

#gate .gate-msg {
  margin: 12px 0 0;
  min-height: 20px;
  font-size: 13px;
  line-height: 1.6;
  color: #a2402c;
}

#gate .gate-msg.ok { color: #3f7a5a; }

#gate .gate-foot {
  margin: 16px 0 0;
  padding-top: 12px;
  border-top: 1px solid #efe4d2;
  font-size: 12px;
  line-height: 1.7;
  color: #8c848a;
}

#gate .gate-foot a { color: #d68a2a; text-decoration: none; }

/* 320 宽的小屏：收紧留白，字号不缩到 14 以下 */
@media (max-width: 340px) {
  #gate { padding: 12px 10px calc(12px + env(safe-area-inset-bottom)); }
  #gate .gate-card { padding: 20px 14px 16px; border-radius: 16px; }
  #gate h1 { font-size: 18px; }
  #gate input#gateCode { font-size: 16px; letter-spacing: .12em; }
}

/* 解锁后遮罩整体移除，避免残留层挡住点击 */
#gate.gone { display: none !important; }
