/* ============ xrcy租号站 v1.0 前台样式（Apple 风格） ============ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --blue: #0071e3; --blue-hover: #0077ed;
  --bg: #f5f5f7; --card: #ffffff;
  --text: #1d1d1f; --sub: #6e6e73; --line: #e8e8ed;
  --gold: #f5a623; --green: #07c160; --red: #fa5151;
  --radius: 20px;
}
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6;
  padding-top: 64px;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; font-size: 16px; }

/* ---------- 公告 ---------- */
.announce {
  background: linear-gradient(90deg, #1d1d1f, #3a3a3c);
  color: #f5f5f7; text-align: center; font-size: 13px; padding: 8px 16px;
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
}
.announce:empty { display: none; }

/* ---------- 头部 ---------- */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: rgba(255,255,255,.82); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0,0,0,.06);
  height: 60px;
}
.announce:not(:empty) ~ .header { top: 33px; }
.header-inner { max-width: 1080px; margin: 0 auto; height: 100%; display: flex; align-items: center; gap: 20px; padding: 0 20px; }
.logo { font-size: 20px; font-weight: 800; color: var(--text); text-decoration: none; letter-spacing: -.5px; }
.logo span { color: var(--blue); font-weight: 500; font-size: 16px; }
.nav { display: flex; gap: 6px; margin-left: 12px; }
.nav a { color: var(--sub); text-decoration: none; padding: 8px 16px; border-radius: 999px; font-size: 14px; transition: all .2s; }
.nav a:hover { color: var(--text); background: rgba(0,0,0,.05); }
.nav a.active { color: #fff; background: var(--blue); }
.hamburger { display: none; background: none; border: none; font-size: 24px; }

/* ---------- 侧拉栏 ---------- */
.mask { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 70; opacity: 0; pointer-events: none; transition: opacity .25s; }
.mask.show { opacity: 1; pointer-events: auto; }
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 280px; background: #fff; z-index: 80;
  transform: translateX(-100%); transition: transform .3s ease; display: flex; flex-direction: column;
}
.sidebar.show { transform: translateX(0); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 20px; border-bottom: 1px solid var(--line); }
.sidebar-head .close { background: none; border: none; font-size: 28px; color: var(--sub); }
.sidebar-nav { display: flex; flex-direction: column; padding: 12px; gap: 4px; }
.sidebar-nav a { padding: 14px 16px; border-radius: 12px; color: var(--text); text-decoration: none; font-size: 16px; }
.sidebar-nav a.active { background: rgba(0,113,227,.1); color: var(--blue); font-weight: 600; }
.sidebar-nav a.disabled { color: #c7c7cc; }
.sidebar-nav .dev { padding: 10px 16px; color: #c7c7cc; font-size: 12px; }

/* ---------- 主区 ---------- */
.main { max-width: 1080px; margin: 0 auto; padding: 30px 20px 80px; }
.sec-title { margin: 10px 0 22px; }
.sec-title h2 { font-size: 30px; letter-spacing: -.5px; }
.sec-title p { color: var(--sub); font-size: 14px; margin-top: 4px; }

/* ---------- 兑换区（最大） ---------- */
.sec-exchange .exchange-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.ex-card {
  background: var(--card); border-radius: var(--radius); padding: 34px 30px;
  box-shadow: 0 2px 14px rgba(0,0,0,.05); position: relative; overflow: hidden;
}
.ex-card.ex-normal { border-top: 4px solid var(--blue); }
.ex-card.ex-universal { border-top: 4px solid var(--gold); }
.ex-badge {
  display: inline-block; font-size: 12px; padding: 4px 12px; border-radius: 999px; margin-bottom: 14px;
  background: rgba(0,113,227,.1); color: var(--blue); font-weight: 600;
}
.ex-badge.gold { background: rgba(245,166,35,.15); color: #b26a00; }
.ex-card h3 { font-size: 24px; margin-bottom: 8px; }
.ex-sub { color: var(--sub); font-size: 13px; min-height: 40px; }
.ex-input { display: flex; gap: 10px; margin-top: 20px; }
.ex-input input {
  flex: 1; padding: 14px 18px; border: 1px solid var(--line); border-radius: 14px;
  outline: none; font-size: 20px; letter-spacing: 4px; text-align: center; transition: border .2s;
}
.ex-input input:focus { border-color: var(--blue); }

/* ---------- 按钮 ---------- */
.btn-primary {
  background: var(--blue); color: #fff; border: none; padding: 14px 26px; border-radius: 999px;
  font-size: 15px; font-weight: 600; transition: all .2s; white-space: nowrap;
}
.btn-primary:hover { background: var(--blue-hover); }
.btn-primary:active { transform: scale(.97); }
.btn-secondary { background: #fff; color: var(--blue); border: 1px solid var(--blue); padding: 12px 24px; border-radius: 999px; font-size: 14px; font-weight: 600; transition: all .2s; }
.btn-secondary:hover { background: rgba(0,113,227,.06); }
.btn-ghost { background: #f2f2f7; color: var(--text); border: none; padding: 12px 24px; border-radius: 999px; font-size: 14px; }
.btn-disabled { background: #f2f2f7; color: #c7c7cc; border: none; padding: 12px 24px; border-radius: 999px; font-size: 14px; cursor: not-allowed; }

/* ---------- 商城 ---------- */
.mall-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.mall-item {
  background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: 0 2px 14px rgba(0,0,0,.05);
  transition: transform .2s;
}
.mall-item:hover { transform: translateY(-4px); }
.mall-img { height: 150px; background: #e8e8ed; display: flex; align-items: center; justify-content: center; font-size: 48px; color: #a1a1a6; }
.mall-img img { width: 100%; height: 100%; object-fit: cover; }
.mall-body { padding: 16px 18px 20px; }
.mall-body h3 { font-size: 16px; margin-bottom: 4px; }
.mall-body .mall-meta { color: var(--sub); font-size: 12px; margin-bottom: 10px; }
.mall-body .mall-price { color: var(--red); font-size: 22px; font-weight: 700; }
.mall-body .mall-price small { font-size: 12px; color: var(--sub); font-weight: 400; }
.mall-buy { width: 100%; margin-top: 12px; padding: 11px; background: var(--blue); color: #fff; border: none; border-radius: 12px; font-size: 15px; font-weight: 600; }

/* ---------- 正在租用 ---------- */
.rent-list { display: flex; flex-direction: column; gap: 16px; }
.rent-item {
  background: var(--card); border-radius: var(--radius); padding: 22px 24px; box-shadow: 0 2px 14px rgba(0,0,0,.05);
  border-left: 4px solid var(--green);
}
.rent-item .rent-top { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 10px; }
.rent-item .game-name { font-size: 18px; font-weight: 700; }
.rent-item .countdown { color: var(--green); font-weight: 700; font-size: 15px; }
.rent-item .countdown.warn { color: var(--red); }
.rent-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0; }
.rent-field { background: #f5f5f7; border-radius: 12px; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rent-field .label { color: var(--sub); font-size: 12px; }
.rent-field .val { font-weight: 600; font-family: "SF Mono", Menlo, Consolas, monospace; word-break: break-all; }
.copy-btn { background: none; border: none; color: var(--blue); font-size: 12px; white-space: nowrap; }
.rent-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.rent-actions button { font-size: 13px; padding: 9px 18px; border-radius: 999px; }
.code-btn { background: #fff; color: var(--blue); border: 1px solid var(--blue); }
.code-btn:disabled { color: #c7c7cc; border-color: #e8e8ed; cursor: not-allowed; }
.renew-btn { background: #fff; color: var(--gold); border: 1px solid var(--gold); }
.code-show { margin-top: 10px; background: rgba(7,193,96,.08); border: 1px dashed var(--green); border-radius: 12px; padding: 10px 14px; color: var(--green); font-weight: 700; letter-spacing: 3px; }

/* ---------- 超时续费 ---------- */
.expired-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.expired-item { background: var(--card); border-radius: var(--radius); padding: 28px 22px; text-align: center; box-shadow: 0 2px 14px rgba(0,0,0,.05); }
.expired-icon { font-size: 40px; margin-bottom: 10px; }
.expired-item h3 { font-size: 16px; margin-bottom: 6px; }
.expired-item p { color: var(--sub); font-size: 12px; margin-bottom: 16px; min-height: 34px; }

/* ---------- 模态框 ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 90; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal.show { display: flex; }
.modal-box {
  background: #fff; border-radius: 24px; padding: 30px 28px; width: 100%; max-width: 460px;
  max-height: 86vh; overflow-y: auto; animation: pop .25s ease;
}
@keyframes pop { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-box h3 { font-size: 22px; margin-bottom: 6px; }
.modal-sub { color: var(--sub); font-size: 13px; margin-bottom: 18px; }
.modal-box > input { width: 100%; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; outline: none; font-size: 18px; letter-spacing: 2px; text-align: center; margin-bottom: 6px; }
.modal-box > input:focus { border-color: var(--blue); }
.modal-btns { display: flex; gap: 10px; margin-top: 20px; }
.modal-btns .btn-primary, .modal-btns .btn-ghost { flex: 1; }
.choose-opt { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; cursor: pointer; transition: all .15s; }
.choose-opt:hover, .choose-opt.sel { border-color: var(--blue); background: rgba(0,113,227,.05); }
.choose-icon { width: 40px; height: 40px; border-radius: 12px; background: rgba(0,113,227,.1); color: var(--blue); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.choose-opt b { display: block; font-size: 15px; }
.choose-opt small { color: var(--sub); font-size: 12px; }
.choose-accounts { margin: 12px 0; }
.choose-accounts label { display: block; font-size: 13px; color: var(--sub); margin-bottom: 6px; }
.choose-accounts select { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 12px; outline: none; background: #fff; }

.cat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cat-item { padding: 14px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; text-align: center; transition: all .15s; }
.cat-item:hover, .cat-item.sel { border-color: var(--blue); background: rgba(0,113,227,.06); }
.cat-item b { display: block; font-size: 14px; }
.cat-item small { color: var(--sub); font-size: 12px; }

.duration-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.dur-item { padding: 14px 8px; border: 1px solid var(--line); border-radius: 14px; text-align: center; cursor: pointer; transition: all .15s; }
.dur-item:hover, .dur-item.sel { border-color: var(--blue); background: rgba(0,113,227,.06); }
.dur-item b { display: block; font-size: 15px; }
.dur-item small { color: var(--sub); font-size: 12px; }
.custom-hours label { display: block; font-size: 13px; color: var(--sub); margin-bottom: 6px; }
.custom-hours input { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 12px; outline: none; }

.old-result { background: #f5f5f7; border-radius: 14px; padding: 16px; margin: 12px 0; }
.old-result .row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.old-result .row b { color: var(--blue); }
.old-result .tip { color: var(--sub); font-size: 12px; margin-top: 8px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 60px; transform: translateX(-50%) translateY(20px);
  background: rgba(29,29,31,.92); color: #fff; padding: 12px 24px; border-radius: 999px; font-size: 14px;
  z-index: 100; opacity: 0; pointer-events: none; transition: all .3s; max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
/* 修复：成功动画提示 */
.toast.success { background: #07c160; }
.toast.pop { animation: toastPop .45s ease; }
@keyframes toastPop { 0% { transform: translateX(-50%) scale(.5); } 55% { transform: translateX(-50%) scale(1.08); } 100% { transform: translateX(-50%) scale(1); } }
.rent-item.flash { animation: rentFlash 1.1s ease; }
@keyframes rentFlash { 0% { box-shadow: 0 0 0 3px rgba(7,193,96,.4); } 100% { box-shadow: 0 2px 14px rgba(0,0,0,.05); } }

/* ---------- 空状态 ---------- */
.empty { text-align: center; color: var(--sub); padding: 60px 20px; background: var(--card); border-radius: var(--radius); }
.empty .big { font-size: 44px; margin-bottom: 10px; }

/* ---------- 响应式 ---------- */
@media (max-width: 820px) {
  .nav { display: none; }
  .hamburger { display: block; }
  .exchange-grid, .expired-grid { grid-template-columns: 1fr; }
  .rent-fields { grid-template-columns: 1fr; }
  .cat-grid { grid-template-columns: 1fr; }
  body { padding-top: 60px; }
}
/* 修复：超小屏适配，防止按钮溢出与输入框挤压 */
@media (max-width: 480px) {
  .ex-input { flex-direction: column; }
  .ex-input .btn-primary { width: 100%; }
  .ex-input input { width: 100%; }
  .modal-btns { flex-direction: column; }
  .rent-actions button { flex: 1 1 auto; }
  .duration-grid { grid-template-columns: repeat(2, 1fr); }
  .header-inner { gap: 10px; padding: 0 14px; }
  .main { padding: 20px 14px 70px; }
}
