:root {
  --green: #2e7d32;
  --green-light: #4caf50;
  --green-bg: #e8f5e9;
  --bg: #f4f6f4;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #757575;
  --border: #e0e0e0;
  --red: #c62828;
  --red-bg: #ffebee;
  --orange: #e65100;
  --orange-bg: #fff3e0;
  --blue: #1565c0;
  --blue-bg: #e3f2fd;
  --yellow: #f9a825;
  --yellow-bg: #fffde7;
  --header-h: 52px;
  --nav-h: 60px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  font-size: 16px;
}

.header {
  background: var(--green);
  color: #fff;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.header h1 { font-size: 1.05rem; font-weight: 700; flex: 1; text-align: center; }
.hbtn {
  background: none; border: none; color: #fff;
  font-size: 1.5rem; line-height: 1; padding: 6px 8px; cursor: pointer;
  min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center;
}

.page { display: none; padding: 14px 14px 80px; }
.page.active { display: block; }

.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  background: #fff; border-top: 1px solid var(--border);
  display: flex; z-index: 50;
  padding-bottom: env(safe-area-inset-bottom);
}
.nbtn {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 8px 4px 6px; background: none; border: none; cursor: pointer;
  font-size: 0.62rem; font-weight: 600; color: var(--muted); gap: 2px; letter-spacing: .03em;
}
.nbtn-icon { font-size: 1.35rem; }
.nbtn.on { color: var(--green); }

.card {
  background: var(--card); border-radius: 14px;
  padding: 14px 16px; margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
}
.ctitle {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); margin-bottom: 10px;
}

.btn {
  display: block; width: 100%; padding: 14px; border: none;
  border-radius: 12px; font-size: 1rem; font-weight: 600;
  cursor: pointer; text-align: center; margin-bottom: 10px;
  min-height: 48px;
}
.btn:active { opacity: .85; }
.btn-primary { background: var(--green); color: #fff; }
.btn-secondary { background: var(--bg); color: var(--text); border: 1.5px solid var(--border); }
.btn-danger { background: var(--red); color: #fff; }
.btn-orange { background: var(--orange); color: #fff; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-sm { display: inline-flex; align-items: center; width: auto; padding: 8px 16px; font-size: .85rem; margin-bottom: 0; border-radius: 8px; }

.fgroup { margin-bottom: 14px; }
.flabel { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.finput {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--border);
  border-radius: 10px; font-size: 1rem; background: #fff; color: var(--text);
  -webkit-appearance: none; appearance: none;
}
.finput:focus { outline: none; border-color: var(--green); }
select.finput { cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23757575' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

.trow {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 0; border-bottom: 1px solid var(--border);
}
.trow:last-child { border-bottom: none; }
.tlabel { font-size: .95rem; font-weight: 500; }
.tsub { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.toggle { position: relative; width: 48px; height: 27px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.tslider {
  position: absolute; inset: 0; background: #ccc;
  border-radius: 27px; cursor: pointer; transition: .2s;
}
.tslider:before {
  content: ''; position: absolute;
  height: 21px; width: 21px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: .2s;
}
.toggle input:checked + .tslider { background: var(--green); }
.toggle input:checked + .tslider:before { transform: translateX(21px); }

.prow {
  display: flex; align-items: center; padding: 10px 0;
  border-bottom: 1px solid var(--border); gap: 11px;
}
.prow:last-child { border-bottom: none; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--green-light); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; flex-shrink: 0;
}
.pname { flex: 1; font-weight: 500; }
.pmins {
  font-size: .8rem; font-weight: 600; color: var(--muted);
  background: var(--bg); padding: 3px 9px; border-radius: 10px;
}

.big-timer {
  font-size: 3.2rem; font-weight: 800; text-align: center;
  font-variant-numeric: tabular-nums; line-height: 1; color: var(--green);
}
.rot-timer {
  font-size: 1.6rem; font-weight: 700; text-align: center;
  font-variant-numeric: tabular-nums;
}
.pbar { background: var(--border); border-radius: 4px; height: 7px; overflow: hidden; margin: 5px 0; }
.pfill { height: 100%; background: var(--green); border-radius: 4px; transition: width 1s linear; }
.pfill.amber { background: var(--orange); }
.pfill.red { background: var(--red); }

.section-hd {
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); display: flex;
  align-items: center; gap: 6px; padding: 8px 0 5px;
}
.sbadge {
  background: var(--green); color: #fff; border-radius: 10px;
  padding: 1px 8px; font-size: .68rem;
}

.field-card {
  display: flex; align-items: center; background: #fff;
  border-radius: 11px; padding: 10px 12px; margin-bottom: 6px;
  border: 2px solid var(--green-light); gap: 10px;
}
.field-card.gk { border-color: var(--yellow); }
.bench-card {
  display: flex; align-items: center; background: #fff;
  border-radius: 11px; padding: 10px 12px; margin-bottom: 6px;
  border: 1.5px solid var(--border); gap: 10px;
}
.bench-card.next-up { border-color: var(--blue); background: var(--blue-bg); }

.tchip {
  font-size: .78rem; font-weight: 600; padding: 3px 9px;
  border-radius: 9px; background: var(--bg); color: var(--muted); margin-left: auto;
  white-space: nowrap;
}
.tchip.hi { background: var(--red-bg); color: var(--red); }
.tchip.lo { background: var(--green-bg); color: var(--green); }

.alert-banner {
  background: var(--orange); color: #fff; padding: 11px 16px;
  border-radius: 11px; font-weight: 700; text-align: center;
  margin-bottom: 10px; display: none; animation: pulse 1s ease infinite;
}
.alert-banner.on { display: block; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.75} }

.chkrow {
  display: flex; align-items: center; padding: 11px 0;
  border-bottom: 1px solid var(--border); gap: 11px; cursor: pointer;
}
.chkrow:last-child { border-bottom: none; }
.chkrow input[type=checkbox] { width: 22px; height: 22px; cursor: pointer; accent-color: var(--green); flex-shrink: 0; }
.chkrow input[type=radio] { width: 22px; height: 22px; cursor: pointer; accent-color: var(--green); flex-shrink: 0; }

.overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.55); z-index: 100;
  padding: 16px; align-items: flex-end; justify-content: center;
}
.overlay.on { display: flex; }
.modal {
  background: #fff; border-radius: 18px 18px 14px 14px;
  padding: 20px; width: 100%; max-width: 480px;
  max-height: 82vh; overflow-y: auto;
}
.modal-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 14px; }

.subpbtn {
  display: flex; align-items: center; width: 100%;
  background: #fff; border: 2px solid var(--border);
  border-radius: 11px; padding: 11px 12px; margin-bottom: 7px;
  cursor: pointer; gap: 10px; text-align: left;
}
.subpbtn:active { opacity: .8; }
.subpbtn.sel-on { border-color: var(--blue); background: var(--blue-bg); }
.subpbtn.sel-off { border-color: var(--red); background: var(--red-bg); }
.subpbtn.suggest { border-color: var(--blue); }

.srow {
  display: flex; align-items: center; padding: 8px 0;
  border-bottom: 1px solid var(--border); gap: 10px;
}
.srow:last-child { border-bottom: none; }
.srank { font-weight: 700; color: var(--muted); width: 22px; text-align: center; font-size: .85rem; }

.badge {
  display: inline-block; font-size: .72rem; font-weight: 700;
  padding: 2px 8px; border-radius: 8px; margin: 2px 2px 2px 0;
}
.b-gk { background: var(--yellow-bg); color: #6d4c00; }
.b-cap { background: var(--orange-bg); color: var(--orange); }
.b-inj { background: var(--red-bg); color: var(--red); }
.b-potd { background: var(--green-bg); color: var(--green); }

.hitem {
  padding: 12px 0; border-bottom: 1px solid var(--border); cursor: pointer;
}
.hitem:last-child { border-bottom: none; }
.hdate { font-weight: 600; margin-bottom: 3px; }
.hsub { font-size: .82rem; color: var(--muted); margin-top: 2px; }

.row2 { display: flex; gap: 9px; margin-bottom: 10px; }
.row2 > * { flex: 1; }
hr.div { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-icon { font-size: 2.8rem; margin-bottom: 10px; }
.tag { display: inline-block; font-size: .72rem; background: var(--bg); color: var(--muted); padding: 2px 8px; border-radius: 8px; }
.input-row { display: flex; gap: 9px; }
.input-row .finput { flex: 1; }
.warn { color: var(--red); font-size: .83rem; margin-bottom: 8px; display: none; padding: 8px 12px; background: var(--red-bg); border-radius: 9px; }
