:root {
  --bg: #e9eef1;
  --surface: rgba(255,255,255,.92);
  --card: #ffffff;
  --text: #17222b;
  --muted: #6b7480;
  --line: #d5dde4;
  --teal: #13b6c8;
  --teal-dark: #0d6f7b;
  --deep: #165a66;
  --danger: #d92d20;
  --shadow: 0 18px 36px rgba(19, 28, 35, 0.08);
  --radius: 24px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Inter, Arial, sans-serif;
  background: linear-gradient(180deg, #eef3f5 0%, #e7edef 100%);
  color: var(--text);
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
code {
  display: inline-block;
  background: #f4f7fa;
  border-radius: 10px;
  padding: 6px 8px;
  margin-top: 8px;
}
.app-shell { min-height: 100vh; }
.drawer {
  position: fixed;
  inset: 0 auto 0 0;
  width: 320px;
  background: #f8fbfc;
  border-right: 1px solid var(--line);
  box-shadow: 10px 0 30px rgba(0,0,0,.08);
  transform: translateX(-105%);
  transition: transform .25s ease;
  z-index: 50;
  display: flex;
  flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.mobile-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 30, .35);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
  z-index: 40;
}
.mobile-drawer-backdrop.show { opacity: 1; pointer-events: auto; }
.drawer-header {
  background: linear-gradient(180deg, var(--teal), #12a8bb);
  color: #fff;
  padding: 22px 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.drawer-title { font-size: 2rem; font-weight: 800; }
.drawer-subtitle { opacity: .9; margin-top: 4px; }
.ghost-icon {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 1.25rem;
}
.drawer-nav {
  padding: 14px 0;
  display: grid;
}
.nav-item {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}
.nav-item.active { background: #eef8fa; color: var(--teal-dark); font-weight: 700; }
.nav-icon { width: 28px; text-align: center; font-size: 1.35rem; color: #7e8793; }
.drawer-footer { margin-top: auto; }
.muted-row { color: var(--muted); }
.screen {
  min-height: 100vh;
  padding-bottom: 82px;
}
.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, var(--teal), #12a8bb);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 8px 22px rgba(0,0,0,.12);
}
.appbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.appbar-title {
  font-size: clamp(1.2rem, 2vw, 2rem);
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 38vw;
}
.appbar-subtitle { font-size: .88rem; opacity: .9; }
.appbar-btn, .appbar-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 0;
  background: rgba(255,255,255,.16);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}
.appbar-actions { display: flex; gap: 8px; }
.content-wrap {
  width: min(1180px, calc(100% - 24px));
  margin: 18px auto;
  display: grid;
  gap: 16px;
}
.panel {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,.5);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  backdrop-filter: blur(12px);
}
.glass {
  background: linear-gradient(135deg, rgba(255,255,255,.92), rgba(255,255,255,.78));
}
.hero {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 24px;
  align-items: center;
}
.hero h1 { margin: 8px 0 12px; font-size: clamp(1.8rem, 4vw, 3rem); line-height: 1.06; }
.hero p { color: var(--muted); font-size: 1.03rem; line-height: 1.6; }
.eyebrow {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(19,182,200,.12);
  color: var(--teal-dark);
  font-weight: 800;
  letter-spacing: .02em;
}
.hero-actions, .saved-actions, .floating-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.button {
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.button.primary { background: var(--teal); color: #fff; }
.button.secondary { background: #edf4f7; color: #153640; }
.button.deep { background: var(--deep); color: #fff; }
.button.full { width: 100%; }
.phone-mockup { display: flex; justify-content: center; }
.phone-card {
  width: min(360px, 100%);
  background: #edf3f5;
  border-radius: 30px;
  padding: 16px;
  border: 10px solid #163844;
  box-shadow: 0 20px 44px rgba(16, 24, 40, 0.18);
}
.phone-chip, .list-chip {
  display: inline-flex;
  border: 2px solid var(--teal);
  color: var(--teal-dark);
  border-radius: 12px;
  padding: 8px 12px;
  font-weight: 800;
  background: #f4fdff;
}
.phone-toolbar, .chip-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.phone-player {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
}
.stars { color: #f5b700; letter-spacing: 2px; }
.phone-buttons { display: grid; gap: 12px; margin-top: 16px; }
.pill-btn {
  display: flex;
  justify-content: center;
  border-radius: 999px;
  padding: 14px 18px;
  background: #0f8ea2;
  color: #fff;
  font-weight: 800;
}
.pill-btn.dark { background: var(--deep); }
.stats-grid, .split, .editor-grid, .form-grid, .teams-grid.mobile-friendly {
  display: grid;
  gap: 16px;
}
.stats-grid { grid-template-columns: repeat(3, 1fr); }
.stat-card { text-align: center; }
.stat-value { font-size: 2.4rem; font-weight: 900; }
.stat-label { color: var(--muted); margin-top: 6px; }
.accent-a { border-top: 5px solid #11b6c9; }
.accent-b { border-top: 5px solid #0d7c89; }
.accent-c { border-top: 5px solid #ffd449; }
.split { grid-template-columns: 1.15fr .85fr; }
.steps { margin: 14px 0 0; padding-left: 20px; line-height: 1.9; }
.tip-card {
  border-radius: 22px;
  background: linear-gradient(135deg, #163d47, #0f6b78);
  color: #fff;
  padding: 18px;
}
.tip-card p { opacity: .92; line-height: 1.6; }
.section-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}
.section-top.compact { margin-bottom: 14px; }
.section-top h2, .panel h2, .panel h3, .panel h4 { margin: 6px 0; }
.list-stack { display: grid; gap: 14px; }
.saved-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.saved-title { font-size: 1.2rem; font-weight: 800; }
.saved-meta { color: var(--muted); }
.icon-action {
  border: 1px solid var(--line);
  background: #f8fbfd;
  color: #15414b;
  padding: 12px 14px;
  border-radius: 999px;
  font-weight: 700;
}
.icon-action.danger { color: var(--danger); }
.icon-action.open { color: var(--teal-dark); }
.editor-grid { grid-template-columns: 1fr 1fr; align-items: start; }
.mobile-first-card {
  background: linear-gradient(180deg, rgba(255,255,255,.94), rgba(243,248,250,.98));
}
.icon-mini {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #e8f6f8;
  color: var(--teal-dark);
}
.field { display: grid; gap: 8px; margin-bottom: 14px; }
.field span { font-weight: 800; }
input[type="text"], select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 16px;
  padding: 13px 14px;
  color: var(--text);
}
.players-mobile { display: grid; gap: 12px; }
.mobile-player-row {
  display: grid;
  grid-template-columns: 22px 1fr 120px 48px;
  gap: 10px;
  align-items: center;
}
.mobile-player-index {
  color: var(--muted);
  text-align: center;
  font-size: 1.2rem;
}
.delete-player {
  border: 0;
  border-radius: 14px;
  background: #fff1f1;
  color: var(--danger);
  height: 44px;
}
.form-grid { grid-template-columns: 1fr 1fr; }
.teams-head { margin-top: 18px; }
.teams-grid.mobile-friendly { grid-template-columns: repeat(3, 1fr); margin-top: 14px; }
.team-card-app {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfdfe, #f4f8fb);
  border-radius: 22px;
  padding: 14px;
}
.team-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.team-card-app ul { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }
.team-card-app li {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.team-summary { margin-top: 12px; color: var(--muted); font-weight: 700; }
.level-dot {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: .83rem;
  font-weight: 800;
}
.level-1 { background: #fff4d8; color: #9f6800; }
.level-2 { background: #e8f7ff; color: #1560a8; }
.level-3 { background: #ebfff5; color: #117a46; }
.empty-state { text-align: center; }
.empty-state.inline { margin-top: 16px; }
.flash {
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.flash.success { background: #ecfdf3; color: #027a48; }
.flash.error { background: #fff1f3; color: #c01048; }
.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 10px;
  width: min(560px, calc(100% - 18px));
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(255,255,255,.7);
  box-shadow: 0 14px 34px rgba(0,0,0,.12);
  border-radius: 22px;
  display: none;
  z-index: 30;
}
.bottom-item {
  flex: 1;
  padding: 12px 10px;
  display: grid;
  justify-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: .84rem;
}
.bottom-item span:first-child { font-size: 1.25rem; }
.bottom-item.active { color: var(--teal-dark); font-weight: 800; }
@media (min-width: 1120px) {
  .screen { padding-left: 0; }
}
@media (max-width: 1024px) {
  .hero, .editor-grid, .split, .stats-grid, .teams-grid.mobile-friendly { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .appbar-subtitle { display: none; }
  .appbar-title { max-width: 46vw; }
  .saved-row, .section-top { flex-direction: column; align-items: stretch; }
  .saved-actions > * { flex: 1 1 100%; }
  .saved-actions form { flex: 1 1 100%; }
  .saved-actions form button { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .bottom-nav { display: flex; }
  .content-wrap { width: min(100%, calc(100% - 14px)); margin: 10px auto 90px; }
  .panel { border-radius: 20px; padding: 14px; }
}
@media (max-width: 600px) {
  .appbar { padding: 12px; }
  .appbar-actions { gap: 6px; }
  .appbar-icon:nth-child(2) { display: inline-flex; }
  .mobile-player-row { grid-template-columns: 18px 1fr; }
  .mobile-player-row select, .mobile-player-row .delete-player { grid-column: 2 / -1; }
  .floating-actions { position: sticky; bottom: 76px; z-index: 5; }
  .button { padding: 15px 16px; }
}
