/* ============================================================
   LOL 组队应用样式 - 移动端优先 375px 基准
   配色：金蓝点缀的深色主题（LOL 风）
   ============================================================ */
:root {
  --bg: #0a1428;
  --bg-2: #0f2142;
  --card: #142649;
  --card-2: #1a2f5a;
  --primary: #c89b3c;
  --primary-2: #e2c079;
  --blue: #0ac8b9;
  --blue-2: #78f7ec;
  --danger: #e94c5a;
  --warn: #f2a63b;
  --ok: #46c275;
  --text: #e9ebf1;
  --text-dim: #a5b0c5;
  --border: rgba(200,155,60,0.25);
  --shadow: 0 8px 24px rgba(0,0,0,0.35);
  --radius: 14px;
  --bar-h: 36px;
  --row-h: 48px;
  --nav-h: 52px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  font-size: 15px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at -10% -20%, rgba(10,200,185,0.15), transparent 60%),
    radial-gradient(800px 500px at 110% 10%, rgba(200,155,60,0.18), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  min-height: 100%;
  overflow-x: hidden;
  line-height: 1.45;
}

/* 顶部导航 */
#nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  height: var(--nav-h); padding: 0 12px;
  background: rgba(10, 20, 40, 0.85); backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav-title { font-weight: 700; color: var(--primary-2); letter-spacing: 1px; }
.nav-back, .nav-bell {
  background: transparent; border: 0; color: var(--text);
  width: 40px; height: 40px; border-radius: 50%; font-size: 22px;
  display: inline-flex; align-items: center; justify-content: center; position: relative;
}
.nav-back:active, .nav-bell:active { background: rgba(255,255,255,0.06); }
.bell-badge {
  position: absolute; top: 6px; right: 6px;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 11px;
  display: inline-flex; align-items: center; justify-content: center;
}

/* 顶部公告条 */
.notice-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(90deg, #3a1a1f, #5a1422);
  color: #ffd3d8; border-bottom: 1px solid rgba(233,76,90,0.35);
  padding: 8px 12px; font-size: 13px;
}
.notice-bar-close {
  background: transparent; border: 0; color: #ffd3d8; font-size: 20px; line-height: 1;
  padding: 0 4px;
}

/* 主视图 */
.view { padding: 14px 14px calc(24px + var(--safe-b)); max-width: 720px; margin: 0 auto; }

/* 通用 */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.card-title h2 { font-size: 16px; margin: 0; color: var(--primary-2); }
.muted { color: var(--text-dim); font-size: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 0;
  font-weight: 600; font-size: 15px;
  background: linear-gradient(180deg, var(--primary) 0%, #a8802a 100%);
  color: #1a1100; cursor: pointer; transition: transform 0.1s ease;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-ghost {
  background: transparent; color: var(--text); border: 1px solid var(--border);
}
.btn-danger { background: linear-gradient(180deg, #ef6570, #c9313d); color: #fff; }
.btn-blue { background: linear-gradient(180deg, #0ac8b9, #079084); color: #001915; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; filter: grayscale(0.2); }
.btn-block { display: flex; width: 100%; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* 表单 */
label.field { display: block; margin-bottom: 12px; }
label.field > span.lbl {
  display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px;
}
input[type=text], input[type=number], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: 0 12px; border-radius: 10px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1);
  color: var(--text); font-size: 15px; font-family: inherit;
}
input::placeholder, textarea::placeholder { color: rgba(255,255,255,0.3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(200,155,60,0.2); }
.err-hint { color: var(--danger); font-size: 12px; margin-top: 4px; min-height: 16px; }
input.invalid { border-color: var(--danger); background: rgba(233,76,90,0.08); }

/* 首页 - 概览按钮 + 列表 */
.hero {
  border-radius: 18px; padding: 18px; margin-bottom: 18px;
  background: linear-gradient(135deg, rgba(10,200,185,0.18), rgba(200,155,60,0.22));
  border: 1px solid var(--border);
}
.hero h1 { margin: 0 0 6px; font-size: 22px; color: var(--primary-2); }
.hero p { margin: 0 0 14px; color: var(--text-dim); font-size: 13px; }

.invite-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.invite-item {
  display: block; text-decoration: none; color: inherit;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 14px;
  transition: background 0.15s ease, transform 0.15s ease;
}
.invite-item:active { transform: scale(0.99); background: var(--card-2); }
.invite-item .top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; }
.invite-item .nick { color: var(--primary-2); font-weight: 600; }
.invite-item .tcount {
  font-weight: 700; color: #142649; background: linear-gradient(180deg, var(--primary-2), var(--primary));
  padding: 2px 10px; border-radius: 999px; font-size: 13px;
}
.invite-item .meta { display: flex; gap: 8px; flex-wrap: wrap; color: var(--text-dim); font-size: 12.5px; }
.status-tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; }
.status-active { background: rgba(70,194,117,0.15); color: var(--ok); }
.status-deadline { background: rgba(242,166,59,0.15); color: var(--warn); }
.status-ended { background: rgba(165,176,197,0.15); color: var(--text-dim); }

/* 详情 - 看板 */
.board {
  border-radius: var(--radius); padding: 16px; background:
    linear-gradient(135deg, rgba(10,200,185,0.22), rgba(200,155,60,0.26));
  border: 1px solid var(--border); margin-bottom: 14px;
}
.board .total {
  text-align: center; margin-bottom: 8px;
}
.board .total .num {
  font-size: 42px; font-weight: 800; color: var(--primary-2); line-height: 1;
  text-shadow: 0 2px 16px rgba(226,192,121,0.25);
}
.board .total .lbl { color: var(--text-dim); font-size: 12.5px; margin-top: 4px; }
.board .countdown {
  display: flex; justify-content: space-between; align-items: center; margin-top: 10px;
  font-size: 13.5px; color: var(--text);
}
.countdown .val { color: var(--primary-2); font-weight: 600; }
.board .host { margin-top: 8px; color: var(--text-dim); font-size: 12.5px; text-align: center; }

.board.deadline { opacity: 0.85; filter: saturate(0.6); }
.board.ended { background: rgba(255,255,255,0.04); color: var(--text-dim); }
.board.ended .total .num { color: var(--text-dim); text-shadow: none; }

.ended-screen {
  min-height: 60vh; display: flex; align-items: center; justify-content: center; flex-direction: column;
  text-align: center; gap: 16px;
}
.ended-screen h1 { color: var(--primary-2); margin: 0; }

/* 操作栏 */
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }

/* 条形图 */
.chart-card { padding: 12px; }
.chart-scroll { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
.chart-wrap { min-width: 100%; }
.chart-svg { display: block; width: 100%; height: auto; }
.axis-line, .axis-tick { stroke: rgba(255,255,255,0.12); }
.axis-label, .row-label { fill: var(--text-dim); font-size: 11px; }
.now-line { stroke: var(--danger); stroke-width: 1.5; stroke-dasharray: 4 3; }
.now-label { fill: var(--danger); font-size: 10.5px; font-weight: 600; }
.bar { fill: url(#barGrad); stroke: rgba(200,155,60,0.5); stroke-width: 0.5; rx: 8; ry: 8; transition: fill 0.2s ease; }
.bar.host { fill: url(#barGradHost); stroke: rgba(10,200,185,0.6); }
.bar.expired { fill: rgba(255,255,255,0.05); stroke: rgba(255,255,255,0.15); }
.bar-text { fill: #1a1100; font-size: 12.5px; font-weight: 700; text-anchor: middle; dominant-baseline: middle; pointer-events: none; }
.bar-text.dark { fill: #e9ebf1; }
.row-line { stroke: rgba(255,255,255,0.05); }
.legend { display: flex; gap: 12px; font-size: 12px; color: var(--text-dim); margin-top: 8px; padding: 0 4px; }
.legend > i { display: inline-block; width: 14px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: middle; }
.legend .c-host { background: linear-gradient(180deg, #2de0d0, #0b9184); }
.legend .c-other { background: linear-gradient(180deg, var(--primary-2), var(--primary)); }
.legend .c-expired { background: rgba(255,255,255,0.12); }

.chart-section-title {
  font-size: 13.5px; color: var(--text-dim); margin: 12px 4px 6px; font-weight: 600;
}

/* 参与者列表（已结束） */
.expired-list {
  list-style: none; padding: 0; margin: 0;
  border-radius: 12px; background: rgba(255,255,255,0.03);
  border: 1px dashed rgba(255,255,255,0.1);
  overflow: hidden;
}
.expired-list li {
  display: flex; align-items: center; justify-content: space-between; padding: 8px 12px;
  font-size: 13px; color: var(--text-dim);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.expired-list li:last-child { border-bottom: 0; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(44px + var(--safe-b));
  transform: translateX(-50%) translateY(20px);
  background: rgba(0,0,0,0.82); color: #fff; padding: 10px 16px;
  border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease; z-index: 200; max-width: 85vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 模态框 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: fadeIn 0.15s ease both;
}
.modal {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 18px; width: 100%; max-width: 420px; padding: 18px;
  box-shadow: var(--shadow);
  animation: popIn 0.18s ease both;
}
.modal h3 { margin: 0 0 12px; color: var(--primary-2); }
.modal .foot { display: flex; gap: 10px; margin-top: 14px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(12px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* 通知抽屉 */
.notify-drawer { position: fixed; inset: 0; z-index: 150; pointer-events: none; }
.notify-drawer.open { pointer-events: auto; }
.drawer-mask {
  position: absolute; inset: 0; background: rgba(0,0,0,0.45);
  opacity: 0; transition: opacity 0.2s ease;
}
.notify-drawer.open .drawer-mask { opacity: 1; }
.drawer-panel {
  position: absolute; right: 0; top: 0; bottom: 0;
  width: min(88vw, 420px); background: var(--bg-2);
  border-left: 1px solid var(--border); padding: 14px 0;
  transform: translateX(100%); transition: transform 0.22s ease;
  display: flex; flex-direction: column;
}
.notify-drawer.open .drawer-panel { transform: translateX(0); }
.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 16px 12px; border-bottom: 1px solid var(--border);
}
.drawer-header h3 { margin: 0; color: var(--primary-2); }
.drawer-header button { background: transparent; border: 0; color: var(--text); font-size: 26px; line-height: 1; width: 40px; height: 40px; }
.drawer-list { overflow-y: auto; padding: 8px 0 32px; flex: 1; }
.drawer-list .empty-tip { padding: 24px 16px; text-align: center; color: var(--text-dim); }
.notify-item {
  padding: 10px 16px; border-left: 3px solid transparent;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  display: grid; gap: 3px;
}
.notify-item.unread { border-left-color: var(--primary); background: rgba(200,155,60,0.06); }
.notify-item .type { font-weight: 600; font-size: 13.5px; color: var(--text); }
.notify-item.type-GO_ONLINE .type { color: var(--blue-2); }
.notify-item.type-JOIN .type { color: var(--ok); }
.notify-item.type-LEAVE .type { color: var(--danger); }
.notify-item.type-UPDATE .type { color: var(--primary-2); }
.notify-item.type-DEADLINE_PASSED, .notify-item.type-DEADLINE_WARNING, .notify-item.type-ENDED { color: var(--warn); }
.notify-item .msg { color: var(--text-dim); font-size: 13px; }
.notify-item .time { color: rgba(255,255,255,0.35); font-size: 11.5px; }

/* 小屏不出现横条 */
@media (max-width: 480px) {
  .actions { grid-template-columns: 1fr 1fr; }
  .board .total .num { font-size: 38px; }
}
@media (max-width: 320px) {
  body { font-size: 14px; }
  .hero h1 { font-size: 19px; }
}
