:root {
  --bg: #f7f8fa;
  --card: #ffffff;
  --text: #1c1d20;
  --muted: #737780;
  --line: #e8eaef;
  --red: #d80012;
  --red-soft: #ffe9ec;
  --gold: #ca9b3a;
  --green: #0a9d5a;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
}

.grain {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(80% 50% at 50% 0%, #ffeef0 0%, transparent 100%),
    linear-gradient(180deg, #fff 0%, #f7f8fa 60%);
  pointer-events: none;
  z-index: -1;
}

.hidden { display: none !important; }

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: 20px;
  padding: 28px;
  border: 1px solid var(--line);
  box-shadow: 0 14px 40px rgba(170, 20, 20, 0.08);
}
.auth-card h1 { margin: 0; color: var(--red); font-weight: 800; }
.subtitle { color: var(--muted); margin: 8px 0 18px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.auth-tabs button {
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px 0;
  border-radius: 10px;
}
.auth-tabs .active { background: var(--red-soft); border-color: #ffd0d8; color: var(--red); }

label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 10px; }
input, select {
  margin-top: 6px;
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
}
.hint { color: #8a8e95; font-size: 12px; }

.btn-primary, .btn-secondary {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-weight: 700;
  cursor: pointer;
}
.btn-primary { background: linear-gradient(135deg, #ff233c, #d80012); color: #fff; }
.btn-secondary { background: #fff4f6; color: var(--red); border: 1px solid #ffd0d8; }

.phone-shell {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  background: #f2f3f5;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  position: relative;
  padding-bottom: 72px;
}
.topbar {
  height: 76px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #d80012, #f40a2d);
  color: #fff;
}
.brand { font-weight: 800; letter-spacing: 1px; }
.mini-link { color: #fff; font-size: 12px; text-decoration: none; border: 1px solid #ffffff66; padding: 6px 10px; border-radius: 20px; }

.page { display: none; padding: 14px; animation: rise .25s ease; }
.page.active { display: block; }
@keyframes rise {
  from { opacity: .2; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-card {
  background: linear-gradient(135deg, #d80012, #ff4b5f);
  color: #fff;
  border-radius: 16px;
  padding: 16px;
  min-height: 120px;
  display: flex;
  align-items: end;
  position: relative;
  overflow: hidden;
}
.hero-card::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -40px;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, #ffffff66 0%, transparent 70%);
}

.stats-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.stat {
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 12px;
  text-align: center;
}
.stat strong { display: block; color: var(--red); font-size: 20px; }
.stat span { color: var(--muted); font-size: 12px; }

.panel {
  margin-top: 12px;
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 14px;
}
.panel-title { font-weight: 800; margin-bottom: 12px; }
.yield-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.yield-row #avg-yield { color: var(--red); font-size: 24px; font-weight: 800; }
.tag { border: 1px solid var(--line); border-radius: 999px; font-size: 12px; padding: 4px 10px; }
.tag-select {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  width: auto;
}

.weekday-board { margin-top: 12px; }
.weekday-board td { min-width: 72px; }
.day-cell {
  border-radius: 8px;
  padding: 6px;
  text-align: center;
  font-size: 12px;
  border: 1px solid var(--line);
}
.day-cell .d { font-weight: 700; display: block; }
.day-cell.r { background: #fff0f2; color: #b3081a; }
.day-cell.g { background: #ebfff4; color: #047743; }
.day-cell.n { background: #fafbfc; color: #9da3ac; }
.wk-avg { font-weight: 700; }

.kv-list {
  display: grid;
  gap: 8px;
}
.kv {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 6px;
  font-size: 14px;
}

.list .item {
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  font-size: 13px;
}
.pill {
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  border: 1px solid var(--line);
}
.pill.pending { background: #fff6e8; color: #996000; border-color: #ffdc9f; }
.pill.approved { background: #e9fff3; color: #047743; border-color: #b2eed0; }
.pill.rejected { background: #fff0f2; color: #b3081a; border-color: #ffc7cf; }

.rank-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
}
.rank-switch button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}
.rank-switch button[data-rank="follow"] { order: 1; }
.rank-divider {
  order: 2;
  align-self: stretch;
  width: 1px;
  min-height: 42px;
  background: #e4aeb8;
  border-radius: 999px;
}
.rank-switch button[data-rank="all"] { order: 3; }
.rank-switch button[data-rank="青铜组"] { order: 4; }
.rank-switch button[data-rank="十万组"] { order: 5; }
.rank-switch button[data-rank="百万组"] { order: 6; }
.rank-switch button[data-rank="千万组"] { order: 7; }
.rank-switch .active { background: var(--red-soft); color: var(--red); border-color: #ffd0d8; }
.rank-filters {
  display: grid;
  gap: 10px;
}
.rank-filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}
.rank-search-btn {
  width: 100%;
  border: 1px solid #ffd0d8;
  background: linear-gradient(135deg, #ff233c, #d80012);
  color: #fff;
  border-radius: 10px;
  padding: 10px 0;
  font-weight: 700;
}
.section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, #f1c5cc, transparent);
  margin: 14px 0;
}
.chip {
  display: inline-block;
  background: #fff7e7;
  color: #7f5a15;
  border: 1px solid #f0d6a1;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
  font-size: 12px;
}
.rank-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.rank-table th, .rank-table td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 8px 4px;
}
.player-link {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.player-link img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

.profile-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
}
.profile-card img {
  width: 100px; height: 100px; border-radius: 50%; object-fit: cover; border: 4px solid #f3f5f9;
}
.profile-main h3 { margin: 0 0 8px; font-size: 34px; font-family: "STZhongsong", "Noto Serif SC", serif; }
.icon-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  padding: 2px 8px;
  background: #fff;
}

.menu-list {
  margin: 12px 0;
  padding: 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.menu-list li {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  cursor: pointer;
}
.menu-list li:last-child { border-bottom: none; }

.logout {
  width: 100%;
  padding: 16px;
  border: 1px solid #ffd0d8;
  color: var(--red);
  border-radius: 14px;
  background: #fff;
  font-weight: 800;
}

.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(560px, 100%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #fff;
  border-top: 1px solid var(--line);
}
.tabbar button {
  border: none;
  background: #fff;
  padding: 14px 0 18px;
}
.tabbar .active { color: var(--red); font-weight: 700; }
.quick-score-btn {
  position: fixed;
  right: max(18px, calc((100vw - 420px) / 2 + 18px));
  bottom: 74px;
  z-index: 35;
  border: 1px solid #ffd0d8;
  background: linear-gradient(135deg, #ff233c, #d80012);
  color: #fff;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  white-space: pre-line;
  text-align: center;
  line-height: 1.05;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 14px 28px rgba(216, 0, 18, .24);
}
.quick-score-btn:hover { transform: translateY(-1px); }
.page-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0 12px;
}
.page-head h2 {
  margin: 0;
  font-size: 22px;
}
.page-title {
  text-align: center;
  color: var(--red);
  font-size: 28px;
  margin: 4px 0 18px;
}
.content-text {
  color: #49515d;
  line-height: 1.9;
  font-size: 16px;
}
.about-text p { margin: 0 0 18px; }
.page-footer {
  text-align: center;
  color: #9ca3af;
  margin: 24px 0 8px;
}
.feedback-tip {
  border-left: 3px solid #ff7b82;
  padding: 14px 16px;
  background: #fafafa;
  border-radius: 10px;
  text-align: center;
  color: #6b7280;
  margin-bottom: 16px;
  line-height: 1.7;
}
.feedback-upload {
  display: flex;
  align-items: center;
  gap: 10px;
}
.upload-box {
  width: 120px;
  height: 120px;
  border: 1px dashed #e3e5ea;
  background: #fff;
  color: #b9bfc8;
  border-radius: 10px;
}
.count-tip {
  display: flex;
  justify-content: space-between;
  color: #a2a8b2;
  font-size: 12px;
  margin-top: 6px;
}
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  margin-bottom: 10px;
}
.card-list-item strong { display: block; }
.card-list-item p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.card-list-item.clickable { cursor: pointer; }
.page-list {
  display: grid;
  gap: 10px;
}
.follow-item {
  align-items: center;
  gap: 12px;
}
.follow-item strong {
  display: block;
}
.follow-item p {
  margin-top: 4px;
}
.follow-item img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
}
.empty-state {
  padding: 24px 14px;
  color: #8a8f98;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #fafbfc;
}
.join-btn {
  border: 1px solid #ffd0d8;
  background: linear-gradient(135deg, #ff233c, #d80012);
  color: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
}
.mine-switch {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 10px;
}
.shot-placeholder {
  min-height: 180px;
  display: grid;
  place-items: center;
  color: #a4a9b1;
  background: #fafbfc;
}
.ghost-btn {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}
.player-head .player-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.player-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.player-name-row h3 {
  margin: 0;
}
.follow-btn {
  border: 1px solid #ffd0d8;
  background: #fff;
  color: var(--red);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  transition: all .15s ease;
}
.follow-btn:hover {
  background: var(--red-soft);
}
.follow-btn.active {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.follow-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}
.player-head img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
}
.player-metrics {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.player-metrics div {
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
}
.player-metrics span {
  color: var(--muted);
  font-size: 12px;
  display: block;
}
.player-metrics strong {
  font-size: 16px;
}
.player-calendar-head,
.holding-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
}
.month-nav {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
}
.player-calendar-table td {
  vertical-align: top;
  padding: 0;
}
.calendar-cell {
  min-height: 58px;
  border-radius: 8px;
  border: 1px solid transparent;
  text-align: center;
  padding: 6px 4px;
  cursor: pointer;
}
.calendar-cell .date {
  display: block;
  font-weight: 700;
  margin-bottom: 2px;
}
.calendar-cell .value {
  font-size: 12px;
}
.calendar-cell.pos { background: #fff0f2; color: #b3081a; }
.calendar-cell.neg { background: #ebfff4; color: #047743; }
.calendar-cell.empty { color: #c5cad3; background: #fafbfc; cursor: default; }
.calendar-cell.selected {
  border-color: #ff9a9a;
  box-shadow: inset 0 0 0 1px #ff9a9a;
}
.holding-date {
  font-weight: 700;
  color: var(--muted);
}
.holding-list {
  display: grid;
  gap: 10px;
}
.holding-day {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.holding-day-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: #fafbfc;
  border-bottom: 1px solid var(--line);
}
.holding-day-head strong {
  color: var(--red);
}
.holding-day-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}
.holding-rows {
  display: grid;
}
.holding-row {
  display: grid;
  grid-template-columns: 1.2fr .7fr .8fr .5fr .7fr;
  gap: 8px;
  padding: 10px 14px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.holding-row:last-child {
  border-bottom: none;
}
.holding-stock {
  color: #2f6bd8;
  font-weight: 600;
}
.holding-action.buy {
  color: #c5161d;
}
.holding-action.sell {
  color: #0a9d5a;
}
.holding-day-detail-btn {
  border: 1px solid #cfe0ff;
  background: #eef5ff;
  color: #2f6bd8;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
}
.holding-shot-wrap {
  padding: 12px 14px 14px;
  background: #fff;
}
.holding-shot-wrap img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
}
.holding-shot-wrap p {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
}
canvas {
  width: 100%;
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 10px;
}
.report-detail {
  padding: 14px;
}
.report-detail button {
  margin-top: 10px;
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 10px;
}
.report-detail .shot-card img {
  height: 180px;
}

dialog {
  border: none;
  border-radius: 14px;
  width: min(420px, 92vw);
  padding: 0;
}
dialog form { padding: 16px; }
.form-block {
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.form-block label { margin-bottom: 0; color: var(--text); font-weight: 700; }
.form-block input,
.form-block textarea {
  margin-top: 8px;
  width: 100%;
  border: 1px solid #edf0f4;
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
}
.form-block textarea { min-height: 96px; resize: vertical; }
.switch-row .switch-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.switch-row input[type="checkbox"] {
  width: 44px;
  height: 24px;
  margin: 0;
}
.range-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dialog-actions button { padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }

.admin-body { padding: 20px; }
.admin-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.admin-grid { max-width: 980px; margin: 0 auto; }

@media (max-width: 620px) {
  .profile-main h3 { font-size: 24px; }
  .rank-switch { gap: 6px; }
  .rank-divider { display: none; }
  .rank-filter-row { grid-template-columns: 1fr; }
  .quick-score-btn {
    right: 14px;
    bottom: 70px;
    width: 64px;
    height: 64px;
    font-size: 12px;
  }
  .holding-row {
    grid-template-columns: 1.2fr .7fr .8fr .6fr .7fr;
  }
}
