/* ===========================================================
   约球日历 — 样式
   移动优先，桌面端居中成一条 480px 的"手机"
   =========================================================== */

:root {
  --bg:        #F2F5F1;
  --card:      #FFFFFF;
  --ink:       #10241B;
  --ink-2:     #3C554A;
  --muted:     #7A8F84;
  --line:      #EDF2EC;
  --green:     #0B7A4B;
  --green-2:   #0A6B42;
  --green-soft:#E3F5EB;
  --lime:      #D8F36B;
  --amber:     #E8A33D;
  --amber-soft:#FDF3E0;
  --red-soft:  #FBEAE8;
  --r:         18px;
  --shadow:    0 1px 2px rgba(16,36,27,.05), 0 10px 30px -18px rgba(16,36,27,.45);
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: #E7EDE6;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

body.locked { overflow: hidden; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

/* ---------- 外壳 ---------- */

.app {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
  box-shadow: 0 0 0 1px rgba(16,36,27,.05), 0 30px 80px -50px rgba(16,36,27,.6);
}

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 15px 14px;
  color: #fff;
  background: linear-gradient(135deg, #0C844F 0%, #0A6B42 55%, #085C38 100%);
  overflow: hidden;
}

/* 草皮纹理 */
.topbar::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    100deg,
    rgba(255,255,255,.055) 0 26px,
    rgba(255,255,255,0) 26px 52px
  );
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.logo {
  width: 38px; height: 38px;
  flex: none;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 19px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.22);
}

.brand-t { min-width: 0; }

.brand-t h1 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: .2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-t p {
  margin: 1px 0 0;
  font-size: 11.5px;
  color: rgba(255,255,255,.72);
}

.me-btn {
  position: relative;
  z-index: 1;
  flex: none;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.22);
}

/* ---------- 头像 ---------- */

.av {
  width: 24px; height: 24px;
  flex: none;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  background: hsla(var(--h), 58%, 91%, 1);
  color: hsla(var(--h), 45%, 32%, 1);
  user-select: none;
}

.av.lg { width: 32px; height: 32px; font-size: 13px; }

/* 顶栏里的"我"用亮色，避免深底上看不清 */
.me-btn .av {
  background: rgba(255,255,255,.9);
  color: hsla(var(--h), 45%, 30%, 1);
  width: 26px; height: 26px;
}

/* ---------- 卡片 ---------- */

.card {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  margin: 0 13px 11px;
  overflow: hidden;
}

.card-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px 7px;
}

.card-h b { font-size: 13px; font-weight: 700; color: var(--ink-2); letter-spacing: .2px; }
.card-h-note { font-size: 11px; color: var(--muted); }

.link-btn {
  font-size: 12px;
  font-weight: 600;
  color: var(--green);
  padding: 4px 0;
}

.link-btn.accent {
  color: #55640C;
  background: var(--lime);
  padding: 4px 9px;
  border-radius: 8px;
  margin-right: 10px;
}

.card-h-r { display: flex; align-items: center; }

/* ---------- 周导航 ---------- */

.weekbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 10px;
  margin-top: 12px;
}

.wk-nav {
  width: 34px; height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 19px;
  line-height: 1;
  color: var(--ink-2);
  background: #F1F5F0;
  padding-bottom: 3px;
}

.wk-nav:active { background: #E4EBE2; }

.wk-mid { flex: 1; text-align: center; min-width: 0; }
.wk-mid b { display: block; font-size: 14px; font-weight: 700; }
.wk-mid span { font-size: 11px; color: var(--muted); }

.wk-today {
  flex: none;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
  background: var(--green-soft);
}

/* ---------- 提示条 ---------- */

.hint {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 13px 11px;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 12px;
  line-height: 1.5;
  color: #4A5F32;
  background: linear-gradient(180deg, #F6FAD9, #EEF6C6);
  border: 1px solid #E2EDB4;
}

.hint span { flex: 1; }

.hint button {
  flex: none;
  font-size: 11.5px;
  font-weight: 700;
  color: #5D7A22;
  padding: 3px 8px;
  border-radius: 8px;
  background: rgba(255,255,255,.65);
}

/* ---------- 最佳时间 ---------- */

.best-row {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 13px;
  text-align: left;
}

.best-row + .best-row { border-top: 1px dashed var(--line); }
.best-row:active { background: #FAFCF9; }

.rank {
  width: 21px; height: 21px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-2);
  background: #F1F5F0;
}

.rank.top { background: var(--lime); color: #2A4415; }

.best-day {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.best-day i {
  font-style: normal;
  font-weight: 500;
  font-size: 11.5px;
  color: var(--muted);
  margin-left: 5px;
}

.best-avs { display: flex; flex: none; }
.best-avs .av { margin-left: -5px; box-shadow: 0 0 0 2px #fff; width: 22px; height: 22px; font-size: 10px; }
.best-avs .av:first-child { margin-left: 0; }

.best-n {
  flex: none;
  min-width: 34px;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
  font-variant-numeric: tabular-nums;
}

.best-empty {
  padding: 6px 14px 15px;
  font-size: 12.5px;
  color: var(--muted);
}

/* ---------- 每日卡片 ---------- */

.day {
  position: relative;
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  margin: 0 13px 10px;
  overflow: hidden;
}

.day.is-today { box-shadow: var(--shadow), 0 0 0 2px rgba(11,122,75,.42); }
.day.is-past { opacity: .66; }

.day-h {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 13px 4px;
}

.day-h b { font-size: 13.5px; font-weight: 700; }
.day-h .dnum { font-size: 11.5px; color: var(--muted); }

.pill-today {
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  background: var(--green);
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: .3px;
}

.pill-game {
  margin-left: auto;
  flex: none;
  font-size: 10.5px;
  font-weight: 800;
  color: #35490B;
  background: var(--lime);
  padding: 3px 8px;
  border-radius: 999px;
}

/* ---------- 时段行 ---------- */

.slot {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px 8px 13px;
  text-align: left;
  transition: background .15s;
}

.slot:active { background: #F7FAF6; }
.slot + .slot { border-top: 1px solid #F0F4EF; }

.slot-l { width: 37px; flex: none; line-height: 1.18; }
.slot-l b { display: block; font-size: 12.5px; font-weight: 700; }
.slot-l i { font-style: normal; font-size: 9.5px; color: var(--muted); letter-spacing: -.2px; }

.dots {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 3px;
  overflow: hidden;
}

.dot {
  width: 20px; height: 20px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1;
  user-select: none;
  background: hsla(var(--h), 58%, 91%, 1);
  color: hsla(var(--h), 45%, 32%, 1);
}

.dot.maybe {
  background: transparent;
  border: 1.5px dashed hsla(var(--h), 42%, 62%, 1);
  color: hsla(var(--h), 42%, 42%, 1);
}

.dot.more {
  background: #F1F5F0;
  color: var(--muted);
  font-size: 8.5px;
}

.dots-empty {
  font-size: 11px;
  color: #B9C6BD;
}

.cnt {
  flex: none;
  min-width: 27px;
  text-align: right;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.cnt b { font-size: 13px; color: var(--ink); }
.cnt.all b { color: var(--green); }

.me-tag {
  flex: none;
  width: 21px; height: 21px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.me-tag.free  { background: var(--green-soft); color: var(--green); }
.me-tag.maybe { background: var(--amber-soft); color: #A9761F; }
.me-tag.no    { background: #F0F2F0; color: #8A9A91; }
.me-tag.none  { background: #F7F9F6; color: #CBD7CE; font-weight: 600; }

/* ---------- 球局 ---------- */

.game {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 13px;
  text-align: left;
  width: 100%;
}

.game + .game { border-top: 1px solid #F0F4EF; }

.g-when {
  flex: none;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--green);
  background: var(--green-soft);
  padding: 4px 8px;
  border-radius: 8px;
  text-align: center;
  line-height: 1.3;
}

.g-when.past { color: var(--muted); background: #F1F4F0; }

.g-body { flex: 1; min-width: 0; display: block; }
.g-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.g-sub { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }

.g-del {
  flex: none;
  width: 26px; height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-size: 13px;
  color: #B4C2B9;
  background: #F6F9F5;
}

.g-empty {
  padding: 4px 14px 14px;
  font-size: 12.5px;
  color: var(--muted);
}

/* ---------- 我的时间：格子 ---------- */

.grid {
  display: grid;
  grid-template-columns: 32px repeat(7, 1fr);
  gap: 6px;
  padding: 4px 12px 14px;
  align-items: center;
}

.gh {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  padding-bottom: 2px;
}

.gh.today { color: var(--green); font-weight: 800; }

.cell {
  aspect-ratio: 1 / 1;
  min-height: 40px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 800;
  color: #C2CEC5;
  background: #F4F7F3;
  border: 1.5px dashed #DEE6DC;
  transition: transform .12s, background .15s;
}

.cell:active { transform: scale(.93); }
.cell.free  { color: #fff; background: var(--green); border: 1.5px solid var(--green); box-shadow: 0 5px 12px -6px rgba(11,122,75,.85); }
.cell.maybe { color: #A9761F; background: var(--amber-soft); border: 1.5px solid #F0C780; }
.cell.no    { color: #8A9A91; background: #EDF0EE; border: 1.5px solid #D7DED8; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 0 14px 14px;
  font-size: 11.5px;
  color: var(--muted);
}

.legend i {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 3px;
  margin-right: 4px;
  vertical-align: -1px;
}

/* ---------- 底部标签栏 ---------- */

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  z-index: 35;
  display: flex;
  gap: 8px;
  padding: 9px 13px calc(9px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.94);
  border-top: 1px solid rgba(16,36,27,.07);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.tabbar button {
  flex: 1;
  padding: 11px 0;
  border-radius: 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  transition: .18s;
}

.tabbar button.active {
  color: #fff;
  background: var(--green);
  box-shadow: 0 8px 20px -10px rgba(11,122,75,.95);
}

/* ---------- 遮罩 + 底部抽屉 ---------- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(8,24,16,.44);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s;
}

.scrim.on { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 50;
  width: 100%;
  max-width: 480px;
  max-height: 84vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 17px calc(18px + env(safe-area-inset-bottom));
  background: #fff;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -18px 50px -24px rgba(16,36,27,.55);
  transform: translate(-50%, 110%);
  transition: transform .3s cubic-bezier(.22,.85,.28,1);
}

.sheet.on { transform: translate(-50%, 0); }

.grab {
  width: 36px; height: 4px;
  margin: 8px auto 10px;
  border-radius: 999px;
  background: #E2E8E1;
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 2px;
}

.sheet-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .2px;
}

.sheet-head p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.close {
  flex: none;
  width: 30px; height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 13px;
  color: var(--muted);
  background: #F3F6F2;
}

/* 三态选择 */

.seg {
  display: flex;
  gap: 8px;
  padding: 14px 0 4px;
}

.seg button {
  flex: 1;
  padding: 12px 0;
  border-radius: 14px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-2);
  background: #F3F6F2;
  border: 1.5px solid transparent;
  transition: .15s;
}

.seg button.on-free  { color: #fff; background: var(--green); border-color: var(--green); }
.seg button.on-maybe { color: #8A5D12; background: var(--amber-soft); border-color: #F0C780; }
.seg button.on-no    { color: #7D8A82; background: #EDF0EE; border-color: #D7DED8; }

.seg-clear {
  display: block;
  margin: 8px auto 0;
  font-size: 12px;
  color: var(--muted);
  padding: 4px 10px;
}

/* 谁有空 */

.who-h {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 16px 0 7px;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: .4px;
}

.who-h .n { color: var(--ink-2); font-weight: 700; }

.who-list { display: flex; flex-wrap: wrap; gap: 7px; }

.who-i {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px 4px 4px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  background: #F6F9F5;
}

.who-i.is-me { background: var(--green-soft); color: #0A5F3A; }

.who-none { font-size: 12.5px; color: #A9B7AD; padding: 2px 0 6px; }

.sheet-foot { padding-top: 18px; }

.btn-primary {
  width: 100%;
  padding: 14px 0;
  border-radius: 15px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .5px;
  color: #fff;
  background: linear-gradient(135deg, #0C844F, #086037);
  box-shadow: 0 12px 26px -14px rgba(11,122,75,.95);
}

.btn-primary.ghost {
  color: var(--ink-2);
  background: #F1F5F0;
  box-shadow: none;
}

/* 成员选择 / 邀请 */

.mem-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 13px;
  text-align: left;
}

.mem-row + .mem-row { margin-top: 2px; }
.mem-row:active { background: #F5F8F4; }
.mem-row.is-me { background: var(--green-soft); }

.mem-name { flex: 1; font-size: 14px; font-weight: 600; }

.mem-tag {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--green);
  background: #fff;
  padding: 3px 8px;
  border-radius: 999px;
}

.code-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 6px;
  padding: 14px;
  border-radius: 15px;
  background: #F5F8F4;
  border: 1px dashed #D6E0D4;
}

.code-box .code {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--ink-2);
  word-break: break-all;
  line-height: 1.5;
}

.copy {
  flex: none;
  padding: 8px 13px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 700;
  color: #fff;
  background: var(--green);
}

.note {
  font-size: 12px;
  line-height: 1.65;
  color: var(--muted);
  margin: 10px 0 0;
}

.note b { color: var(--ink-2); }

.foot {
  margin: 4px 0 18px;
  text-align: center;
  font-size: 11px;
  color: #A6B4AA;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  z-index: 60;
  transform: translate(-50%, 12px);
  max-width: 78vw;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: rgba(12,32,22,.92);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  text-align: center;
}

.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 桌面端 ---------- */

@media (min-width: 560px) {
  body { padding: 20px 0; background: #E3E9E2; }
  .app { min-height: calc(100vh - 40px); border-radius: 26px; }
  .topbar { border-radius: 26px 26px 0 0; }
  .tabbar { bottom: 20px; border-radius: 0 0 26px 26px; }
  .sheet { bottom: 0; }
}

/* ---------- 加入队伍 / 我的身份 ---------- */

.name-input {
  width: 100%;
  margin: 4px 0 2px;
  padding: 13px 14px;
  font-size: 16px;              /* 16px 以下 iOS 会自动放大页面 */
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  outline: none;
}
.name-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(11, 122, 75, .1); }

.me-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 10px;
  padding: 14px;
  background: var(--bg);
  border-radius: 14px;
}
.me-card .mem-name { font-size: 15px; font-weight: 700; }

