:root {
  --green-dark: #2D6A2D;
  --green-mid: #3E8C3E;
  --green: #4CAF50;
  --green-bright: #66BB6A;
  --green-light: #C8E6C9;
  --green-pale: #E8F5E9;
  --yellow: #FFD600;
  --yellow-light: #FFF9C4;
  --white: #FFFFFF;
  --off-white: #F1F8F1;
  --text-dark: #1B3A1B;
  --text-mid: #3D5E3D;
  --text-muted: #6A8C6A;
  --border: #B2DFBB;
  --shadow: rgba(45, 106, 45, 0.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Nunito', sans-serif; background: var(--off-white); min-height: 100vh; color: var(--text-dark); }

.header { background: linear-gradient(160deg, var(--green-dark) 0%, var(--green-mid) 70%, var(--green) 100%); padding: 14px 16px 0; position: sticky; top: 0; z-index: 200; box-shadow: 0 3px 18px var(--shadow); }
.header-inner { max-width: 960px; margin: 0 auto; }
.header-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon-wrap { width: 42px; height: 42px; background: var(--white); border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0,0,0,0.25); flex-shrink: 0; overflow: hidden; }
.brand-icon { width: 34px; height: 34px; object-fit: contain; }
.brand-text { font-family: 'Fredoka One', cursive; font-size: 22px; color: var(--yellow); text-shadow: 2px 2px 0 rgba(0,0,0,0.25); letter-spacing: 0.5px; }
.brand-text span { color: var(--white); }
.user-pill { background: rgba(255,255,255,0.18); border: 1.5px solid rgba(255,255,255,0.35); border-radius: 20px; padding: 5px 12px; color: var(--white); font-size: 12px; font-weight: 800; display: flex; align-items: center; gap: 6px; }
.user-dot { width: 8px; height: 8px; background: var(--yellow); border-radius: 50%; }
.tabs { display: flex; }
.tab { flex: 1; padding: 10px 4px 8px; text-align: center; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.07em; color: rgba(255,255,255,0.55); cursor: pointer; border-bottom: 3px solid transparent; transition: all 0.18s; }
.tab.active { color: var(--yellow); border-bottom-color: var(--yellow); }

.content { padding: 16px 14px 40px; max-width: 720px; margin: 0 auto; }
@media (min-width: 900px) { .content { max-width: 800px; padding: 20px 24px 40px; } }
@media (min-width: 1200px) { .content { max-width: 960px; padding: 24px 32px 40px; } }

.hero-banner { background: linear-gradient(135deg, var(--green-dark) 0%, var(--green-mid) 100%); border-radius: 20px; padding: 18px 16px 16px; margin-bottom: 16px; border: 3px solid var(--green-bright); box-shadow: 0 6px 24px var(--shadow); }
.hero-label { font-size: 10px; font-weight: 800; color: var(--green-light); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 8px; }
.hero-stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.hero-stat { text-align: center; background: rgba(255,255,255,0.1); border-radius: 14px; padding: 10px 6px; border: 1px solid rgba(255,255,255,0.15); }
.hero-stat-val { font-family: 'Fredoka One', cursive; font-size: 30px; color: var(--yellow); line-height: 1; }
.hero-stat-lbl { font-size: 10px; color: rgba(255,255,255,0.7); margin-top: 3px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }

.section-hd { display: flex; align-items: center; justify-content: space-between; margin: 20px 0 10px; }
.section-title { font-family: 'Fredoka One', cursive; font-size: 18px; color: var(--green-dark); display: flex; align-items: center; gap: 6px; }
.section-pill { font-size: 11px; font-weight: 800; color: var(--green-dark); background: var(--green-light); border-radius: 10px; padding: 3px 10px; border: 1.5px solid var(--green-bright); }

.lb-card { background: var(--white); border-radius: 18px; overflow: hidden; border: 2.5px solid var(--green-light); box-shadow: 0 4px 18px var(--shadow); margin-bottom: 16px; }
.lb-header { background: linear-gradient(90deg, var(--green-dark), var(--green-mid)); padding: 10px 16px; display: flex; align-items: center; gap: 8px; }
.lb-header-icon { font-size: 16px; }
.lb-header-text { font-family: 'Fredoka One', cursive; font-size: 15px; color: var(--white); }
.lb-row { display: flex; align-items: center; gap: 11px; padding: 12px 16px; border-bottom: 1.5px solid var(--green-pale); }
.lb-row:last-child { border-bottom: none; }
.lb-row.me { background: linear-gradient(90deg, var(--green-pale) 0%, #FFFDE7 100%); }
.rank-cell { width: 28px; text-align: center; flex-shrink: 0; }
.rank-medal { font-size: 20px; }
.rank-num { font-family: 'Fredoka One', cursive; font-size: 16px; color: var(--text-muted); }
.pickle-av { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 900; flex-shrink: 0; border: 2.5px solid var(--white); box-shadow: 0 2px 8px var(--shadow); }
.av-1 { background: linear-gradient(135deg, #43A047, #1B5E20); color: var(--white); }
.av-2 { background: linear-gradient(135deg, #FDD835, #F57F17); color: #3E2700; }
.av-3 { background: linear-gradient(135deg, #26C6DA, #00838F); color: var(--white); }
.av-4 { background: linear-gradient(135deg, #EF5350, #B71C1C); color: var(--white); }
.av-5 { background: linear-gradient(135deg, #AB47BC, #6A1B9A); color: var(--white); }
.av-6 { background: linear-gradient(135deg, #FF7043, #BF360C); color: var(--white); }
.av-7 { background: linear-gradient(135deg, #78909C, #263238); color: var(--white); }
.pl-info { flex: 1; min-width: 0; }
.pl-name-row { display: flex; align-items: center; gap: 6px; }
.pl-name { font-size: 14px; font-weight: 900; color: var(--text-dark); }
.you-tag { font-size: 9px; font-weight: 900; background: var(--green); color: var(--white); border-radius: 5px; padding: 1px 6px; text-transform: uppercase; }
.new-tag { font-size: 9px; font-weight: 900; background: var(--yellow); color: #5a3e00; border-radius: 5px; padding: 1px 6px; text-transform: uppercase; }
.pl-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; font-weight: 700; display: flex; align-items: center; gap: 5px; }
.streak-chip { font-size: 9px; font-weight: 900; padding: 2px 7px; border-radius: 8px; }
.chip-fire { background: #FFF3E0; color: #E65100; border: 1px solid #FFCC80; }
.chip-hot { background: #FFEBEE; color: #C62828; border: 1px solid #FFCDD2; }
.win-cell { text-align: right; min-width: 58px; }
.win-pct { font-family: 'Fredoka One', cursive; font-size: 17px; color: var(--green-dark); }
.win-bar { height: 6px; background: var(--green-pale); border-radius: 3px; overflow: hidden; margin-top: 4px; border: 1px solid var(--border); }
.wfill-hi { height: 100%; background: linear-gradient(90deg, var(--green-dark), var(--green-bright)); border-radius: 3px; }
.wfill-mid { height: 100%; background: linear-gradient(90deg, #FFA000, #FFD54F); border-radius: 3px; }
.wfill-lo { height: 100%; background: linear-gradient(90deg, #E53935, #EF9A9A); border-radius: 3px; }

.add-player-toggle { width: 100%; background: linear-gradient(135deg, var(--green-dark), var(--green)); color: var(--white); border: none; border-radius: 14px; padding: 13px 16px; font-family: 'Fredoka One', cursive; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 4px 14px var(--shadow); margin-bottom: 14px; transition: opacity 0.15s; }
.add-player-toggle:hover { opacity: 0.9; }
.add-player-form { background: var(--white); border-radius: 18px; border: 2.5px solid var(--green-light); box-shadow: 0 4px 18px var(--shadow); padding: 18px 16px; margin-bottom: 16px; }
.add-player-intro { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 2px dashed var(--green-light); }
.add-player-intro-icon { width: 40px; height: 40px; object-fit: contain; }
.add-player-intro-text { font-family: 'Fredoka One', cursive; font-size: 16px; color: var(--green-dark); }
.add-player-intro-sub { font-size: 11px; color: var(--text-muted); font-weight: 700; margin-top: 2px; }

.sched-card { background: var(--white); border-radius: 18px; overflow: hidden; border: 2.5px solid var(--green-light); box-shadow: 0 4px 18px var(--shadow); margin-bottom: 16px; }
.match-row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1.5px solid var(--green-pale); }
.match-row:last-child { border-bottom: none; }
.date-blob { background: linear-gradient(135deg, var(--green), var(--green-dark)); border-radius: 14px; padding: 8px 10px; text-align: center; min-width: 46px; flex-shrink: 0; box-shadow: 0 2px 8px var(--shadow); }
.date-num { font-family: 'Fredoka One', cursive; font-size: 22px; color: var(--yellow); line-height: 1; }
.date-mon { font-size: 9px; font-weight: 800; color: rgba(255,255,255,0.8); text-transform: uppercase; letter-spacing: 0.08em; }
.match-info { flex: 1; min-width: 0; }
.match-players { font-size: 13px; font-weight: 900; color: var(--text-dark); }
.match-meta { font-size: 11px; color: var(--text-muted); margin-top: 3px; font-weight: 700; display: flex; align-items: center; gap: 5px; }
.dot { width: 3px; height: 3px; background: var(--text-muted); border-radius: 50%; opacity: 0.4; }
.type-tag { font-size: 10px; font-weight: 900; padding: 4px 10px; border-radius: 10px; flex-shrink: 0; }
.tag-s { background: var(--green-pale); color: var(--green-dark); border: 1.5px solid var(--green-light); }
.tag-d { background: var(--yellow-light); color: #7B5800; border: 1.5px solid var(--yellow); }
.delete-btn { background: none; border: none; font-size: 16px; cursor: pointer; opacity: 0.35; padding: 4px; line-height: 1; transition: opacity 0.15s; flex-shrink: 0; }
.delete-btn:hover { opacity: 0.7; }
.add-match-toggle { width: 100%; background: linear-gradient(135deg, var(--green-dark), var(--green)); color: var(--white); border: none; border-radius: 14px; padding: 13px 16px; font-family: 'Fredoka One', cursive; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 4px 14px var(--shadow); margin-bottom: 14px; transition: opacity 0.15s; }
.add-match-toggle:hover { opacity: 0.9; }
.add-match-form { background: var(--white); border-radius: 18px; border: 2.5px solid var(--green-light); box-shadow: 0 4px 18px var(--shadow); padding: 18px 16px; margin-bottom: 16px; }

.form-label { font-size: 11px; font-weight: 900; color: var(--green-dark); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; display: block; }
.form-group { margin-bottom: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-toggle { display: flex; gap: 8px; }
.type-btn { flex: 1; padding: 10px 8px; border-radius: 12px; border: 2.5px solid var(--green-light); font-size: 13px; font-weight: 900; cursor: pointer; text-align: center; background: var(--off-white); color: var(--text-muted); transition: all 0.18s; display: flex; align-items: center; justify-content: center; gap: 5px; }
.type-btn.active { background: var(--green-dark); color: var(--white); border-color: var(--green-dark); }

select,
input[type="text"],
input[type="number"],
input[type="date"],
input[type="time"] {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--green-light);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dark);
  background: var(--off-white);
  outline: none;
  transition: border-color 0.15s;
  font-family: 'Nunito', sans-serif;
  appearance: none;
  -webkit-appearance: none;
}
select:focus, input:focus { border-color: var(--green); background: var(--white); }
.save-btn { width: 100%; background: linear-gradient(135deg, var(--green-dark), var(--green)); color: var(--white); border: none; border-radius: 12px; padding: 13px; font-family: 'Fredoka One', cursive; font-size: 16px; cursor: pointer; box-shadow: 0 4px 14px var(--shadow); transition: opacity 0.15s; margin-top: 4px; }
.save-btn:hover { opacity: 0.9; }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
@media (min-width: 700px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-tile { background: var(--white); border-radius: 16px; padding: 16px 14px; border: 2px solid var(--green-light); box-shadow: 0 3px 12px var(--shadow); }
.stat-tile.big-green { background: linear-gradient(135deg, var(--green-dark), var(--green)); border: none; }
.stat-tile-icon { font-size: 22px; margin-bottom: 6px; }
.stat-tile-val { font-family: 'Fredoka One', cursive; font-size: 32px; color: var(--green-dark); line-height: 1; }
.stat-tile.big-green .stat-tile-val { color: var(--yellow); }
.stat-tile-lbl { font-size: 10px; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 4px; }
.stat-tile.big-green .stat-tile-lbl { color: rgba(255,255,255,0.7); }
.stat-tile-sub { font-size: 12px; font-weight: 700; color: var(--text-muted); margin-top: 2px; }
.stat-tile.big-green .stat-tile-sub { color: rgba(255,255,255,0.6); }

.h2h-block { background: var(--white); border-radius: 16px; padding: 16px; border: 2px solid var(--green-light); box-shadow: 0 3px 12px var(--shadow); margin-bottom: 16px; }
.h2h-title { font-family: 'Fredoka One', cursive; font-size: 16px; color: var(--green-dark); margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.h2h-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.h2h-row:last-child { margin-bottom: 0; }
.h2h-av { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 900; flex-shrink: 0; }
.h2h-name { font-size: 13px; font-weight: 800; color: var(--text-dark); flex: 1; }
.h2h-score { font-family: 'Fredoka One', cursive; font-size: 14px; color: var(--text-mid); min-width: 36px; text-align: right; }
.h2h-bar { height: 6px; background: var(--green-pale); border-radius: 3px; overflow: hidden; width: 72px; border: 1px solid var(--border); }
.h2h-fill-w { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--green-dark), var(--green-bright)); }
.h2h-fill-l { height: 100%; border-radius: 3px; background: linear-gradient(90deg, #E53935, #EF9A9A); }
.h2h-empty-text { color: var(--text-muted); font-size: 13px; padding: 8px 0; }

.recent-block { margin-top: 16px; }
.recent-match-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--green-pale); }
.recent-match-row:last-child { border-bottom: none; }
.recent-icon { font-size: 16px; }
.recent-detail { flex: 1; font-size: 13px; font-weight: 700; color: var(--text-dark); }
.recent-date { font-size: 11px; color: var(--text-muted); font-weight: 700; }

.log-card { background: var(--white); border-radius: 20px; padding: 20px 16px; border: 2.5px solid var(--green-light); box-shadow: 0 4px 18px var(--shadow); }
.log-intro { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding-bottom: 16px; border-bottom: 2px dashed var(--green-light); }
.log-intro-icon { width: 52px; height: 52px; object-fit: contain; flex-shrink: 0; }
.log-intro-text { font-family: 'Fredoka One', cursive; font-size: 17px; color: var(--green-dark); }
.log-intro-sub { font-size: 12px; color: var(--text-muted); font-weight: 700; margin-top: 2px; }
.score-row { display: grid; grid-template-columns: 1fr 40px 1fr; gap: 8px; align-items: center; }
.vs-badge { text-align: center; font-family: 'Fredoka One', cursive; font-size: 16px; color: var(--green-dark); background: var(--green-pale); border-radius: 8px; padding: 8px 4px; border: 2px solid var(--green-light); }
.submit-btn { width: 100%; background: linear-gradient(135deg, var(--green-dark) 0%, var(--green) 100%); color: var(--white); border: none; border-radius: 14px; padding: 15px; font-family: 'Fredoka One', cursive; font-size: 18px; cursor: pointer; box-shadow: 0 5px 18px var(--shadow); transition: opacity 0.15s, transform 0.12s; display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 4px; }
.submit-btn:hover { opacity: 0.92; }
.submit-btn:active { transform: scale(0.97); }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 10px); background: var(--green-dark); color: var(--white); padding: 13px 22px; border-radius: 16px; font-size: 14px; font-weight: 800; z-index: 999; opacity: 0; transition: opacity 0.3s, transform 0.3s; pointer-events: none; border: 2px solid var(--green-bright); box-shadow: 0 8px 30px var(--shadow); display: flex; align-items: center; gap: 8px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.empty-state { text-align: center; padding: 48px 24px; }
.empty-icon { font-size: 52px; margin-bottom: 14px; }
.empty-text { font-size: 15px; color: var(--text-muted); font-weight: 700; }