/* 共享样式：主题变量 + 顶栏 + 登录/账户/兑换 + 通用按钮。所有页面都引入。 */
:root {
  --bg: #0f1115;
  --panel: #181b22;
  --panel-2: #1f232c;
  --border: #2a2f3a;
  --text: #e8eaed;
  --muted: #9aa3b2;
  --accent: #6c8cff;
  --accent-2: #4f6fff;
  --ok: #38c172;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
}

.hidden { display: none !important; }

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.88rem;
  padding: 0;
}
.link-btn:hover { text-decoration: underline; }

/* ---------- top bar / account ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.brand { font-weight: 700; letter-spacing: 0.02em; color: var(--text); text-decoration: none; }
.account { display: flex; align-items: center; gap: 14px; position: relative; }
.account-info { display: flex; align-items: center; gap: 14px; font-size: 0.88rem; }
.balance {
  background: #22314e;
  color: #b9c4e6;
  border-radius: 999px;
  padding: 4px 12px;
  font-weight: 600;
  font-size: 0.82rem;
  white-space: nowrap;
}
.email { color: var(--muted); }

.btn-signin {
  background: var(--accent-2);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}
.btn-signin:hover { filter: brightness(1.08); }

/* 登录浮层：从账户区下方弹出的卡片，内部竖排 */
.login-form {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(300px, calc(100vw - 28px));
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}
.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: #fff;
  color: #1f232c;
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}
.btn-google:hover { background: #f1f2f4; }
.btn-google .g {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-2);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
}
.login-or { text-align: center; color: var(--muted); font-size: 0.8rem; }
.login-form input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 0.9rem;
}
.login-form input:focus { outline: none; border-color: var(--accent); }
.login-form button:not(.btn-google) {
  width: 100%;
  padding: 9px 14px;
  border: none;
  border-radius: 8px;
  background: var(--accent-2);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}
.login-form button:disabled { opacity: 0.6; cursor: default; }
.login-msg { font-size: 0.82rem; color: var(--muted); text-align: center; }
.login-msg.ok { color: var(--ok); }
.login-msg.error { color: #ff7a7a; }

/* ---------- redeem dropdown ---------- */
.redeem-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}
.redeem-panel input {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 0.9rem;
  width: 160px;
}
.redeem-panel input:focus { outline: none; border-color: var(--accent); }
.redeem-panel button {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: var(--accent-2);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.redeem-msg { font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.redeem-msg.ok { color: var(--ok); }
.redeem-msg.error { color: #ff7a7a; }

/* ---------- 移动端：顶栏换行 ---------- */
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .brand { font-size: 0.95rem; }
  .account { width: 100%; justify-content: flex-end; flex-wrap: wrap; gap: 10px 12px; }
  .account-info { flex-wrap: wrap; justify-content: flex-end; gap: 8px 12px; }
  .email { display: none; }
  .redeem-panel { left: 0; right: 0; width: auto; flex-wrap: wrap; }
  .redeem-panel input { flex: 1 1 120px; width: auto; }
  .redeem-msg { flex-basis: 100%; white-space: normal; }
}
