*{box-sizing:border-box}html,body{margin:0;background:#05070a;color:#f5f7fa;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif}button,input,select{font:inherit}button{cursor:pointer}.hidden{display:none!important}.screen{min-height:100vh;display:grid;place-items:center;background:radial-gradient(circle at top,#14243a,#05070a 55%)}.auth-card{width:min(420px,92vw);background:#101722;border:1px solid #334155;border-radius:16px;padding:28px;box-shadow:0 25px 80px #0008}.logo{font-size:22px;margin-bottom:20px}.logo span,.brand span{color:#168cff}.auth-card h1{margin:0 0 8px}.auth-card input{width:100%;margin:7px 0;background:#0a111b;color:#fff;border:1px solid #334155;border-radius:8px;padding:12px}.primary{background:#0b7ee8;border:0;color:white;border-radius:7px;padding:11px 14px;font-weight:700}.full{width:100%;margin:7px 0}.secondary,.iconBtn,.toggle,.chip{background:#121a25;color:#fff;border:1px solid #344052;border-radius:7px;padding:9px 12px}.link{display:block;background:none;border:0;color:#58aefc;margin:12px auto}.muted,.msg{color:#9ca8b7}.top{height:62px;background:#090d13;border-bottom:1px solid #1e2734;display:flex;align-items:center;gap:9px;padding:8px 14px;position:sticky;top:0;z-index:5}.brand{font-weight:800;white-space:nowrap}.top select{background:#171d27;color:#fff;border:1px solid #e43b3b;border-radius:7px;padding:9px}.spacer{flex:1}.toggle.active{background:#1679df;border-color:#1679df}.layout{display:flex;min-height:calc(100vh - 62px)}.sidebar{width:285px;background:#0d121a;border-right:1px solid #202a38;padding:12px;overflow:auto}.teamHead{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}.teamHead small{display:block;color:#8e9bad}.search{width:100%;background:#101722;color:#fff;border:1px solid #303b4c;padding:9px;border-radius:7px;margin:7px 0}.player{display:grid;grid-template-columns:35px 1fr 28px;gap:7px;padding:8px 2px;border-bottom:1px solid #1c2532;font-size:13px}.num{color:#27a8ff}.main{flex:1;min-width:0;display:flex;flex-direction:column}.toolbar{height:48px;display:flex;gap:18px;align-items:center;padding:0 16px;background:#090d13}.fieldArea{flex:1;display:flex;align-items:center;justify-content:center;padding:10px;background:#07100a}.field{position:relative;width:min(1100px,96vw);aspect-ratio:1.78;background:repeating-linear-gradient(0deg,#236f2e 0 44px,#2c8138 44px 88px);border:3px solid #e7eee2;overflow:hidden}.field:before{content:"";position:absolute;inset:0;background:repeating-linear-gradient(90deg,transparent 0 9.6%,#ffffffaa 9.6% 9.9%);opacity:.5}.mid{position:absolute;left:0;right:0;top:50%;height:4px;background:#dce8d8;opacity:.7}.tag{position:absolute;left:50%;transform:translateX(-50%);z-index:2;padding:5px 18px;border-radius:5px;font-weight:800}.offense{top:7px;background:#b82c28}.defense{top:51%;background:#1768c8}.slot{position:absolute;transform:translate(-50%,-50%);min-width:70px;padding:5px 4px;text-align:center;background:#090d12ed;border:2px solid #e43b32;border-radius:5px;z-index:3;font-size:11px;font-weight:800}.slot.def{border-color:#1493ff}.slot small{display:block;color:#cbd5e1;font-size:10px}.actions{width:118px;background:#0d121a;border-left:1px solid #202a38;padding:12px;display:flex;flex-direction:column;gap:10px}.actions button{padding:13px 7px;background:#121a25;color:white;border:1px solid #344052;border-radius:7px}.actions .next{background:#159448;border-color:#159448}.bottom{display:flex;align-items:center;gap:6px;padding:9px 12px;background:#090d13;border-top:1px solid #222d3b;overflow:auto}.lineChip{display:inline-block}.statsSummary{margin-left:auto;color:#9ca8b7;font-size:12px;white-space:nowrap}.modalWrap{position:fixed;inset:0;background:#000a;display:grid;place-items:center;z-index:30}.modal{width:min(800px,94vw);max-height:90vh;overflow:auto;background:#101722;border:1px solid #344052;border-radius:12px;padding:18px;box-shadow:0 25px 80px #000}.modal h2{margin-top:0}.formgrid{display:grid;grid-template-columns:repeat(2,1fr);gap:10px}.formgrid label{font-size:12px;color:#aeb8c5}.formgrid input,.formgrid select{width:100%;margin-top:4px;background:#0a111b;color:white;border:1px solid #344052;border-radius:7px;padding:10px}.modalFoot{display:flex;justify-content:flex-end;gap:8px;margin-top:15px}.danger{color:#ff6b6b}@media(max-width:900px){.sidebar{display:none}.actions{width:88px}.toolbar{gap:8px;font-size:12px}.brand{font-size:14px}.statsSummary{display:none}.fieldArea{padding:3px}.bottom{padding:6px}.top{padding:6px}.top .brand{display:none}}
.notice{background:#101a27;border:1px solid #2b3b50;border-radius:8px;padding:12px;margin:10px 0;color:#dbe7f5}
.picker{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;max-height:55vh;overflow:auto}
.playerPick{background:#121a25;color:#fff;border:1px solid #334155;border-radius:7px;padding:11px;text-align:left}
.playerPick.selected{border-color:#22c55e;background:#14311f}
.statRow{display:grid;grid-template-columns:52px 1fr 80px 58px;gap:8px;padding:9px 4px;border-bottom:1px solid #263241;align-items:center}
@media(max-width:650px){.picker{grid-template-columns:1fr}.statRow{grid-template-columns:42px 1fr 65px 48px}}

/* Final sideline UI */
.dashScreen{min-height:100dvh;background:radial-gradient(circle at 50% -10%,#173458 0,#08111d 34%,#05070a 70%);color:#fff}
.dashTop{height:68px;display:flex;align-items:center;padding:0 max(18px,env(safe-area-inset-left));border-bottom:1px solid #243247;background:#080d14dd;backdrop-filter:blur(12px)}
.dashBrand{font-size:20px}.dashBrand span{color:#168cff}.dashTop .secondary{margin-left:auto}
.dashWrap{width:min(900px,94vw);margin:auto;padding:34px 0 60px}
.teamHero{display:flex;align-items:center;justify-content:space-between;background:linear-gradient(135deg,#101b2a,#0c1420);border:1px solid #293a51;border-radius:20px;padding:24px;margin-bottom:18px;box-shadow:0 20px 60px #0005}
.teamHero h1{font-size:clamp(30px,6vw,52px);margin:3px 0}.eyebrow{font-size:12px;letter-spacing:2px;color:#5ab0ff;font-weight:800}.teamBadge{font-size:58px}
.dashGrid{display:grid;grid-template-columns:1fr 1fr;gap:14px}.dashCard{width:100%;display:grid;grid-template-columns:54px 1fr 20px;align-items:center;gap:12px;text-align:left;color:#fff;background:#101722;border:1px solid #2a3a50;border-radius:16px;padding:20px;box-shadow:0 12px 35px #0003}.dashCard:hover{border-color:#168cff}.dashCard b{font-size:18px}.dashCard small{display:block;color:#9eacbd;margin-top:4px;line-height:1.35}.dashCard>span{font-size:28px;color:#65768a}.dashIcon{font-size:30px}.gameDay{margin-bottom:14px;background:linear-gradient(135deg,#0878df,#0759ac);border-color:#2999ff;padding:25px}.gameDay b{font-size:25px}.gameDay small{color:#d7ecff}.dashHint{text-align:center;color:#6f7e91;font-size:12px;margin-top:24px}
.homeBtn{white-space:nowrap}.activeLine{color:#fff!important}.inviteCode{display:inline-block;font-size:28px;letter-spacing:3px;font-weight:900;color:#58aefc;margin-top:8px}.rosterManage{display:grid;grid-template-columns:1fr 1fr;gap:8px;max-height:55vh;overflow:auto}.rosterManage small{float:right;color:#94a3b8}
#nextSide{font-size:15px;font-weight:900;min-height:64px}
@media(max-width:700px){
 .dashWrap{padding:18px 0 40px}.dashTop{height:58px}.dashBrand{font-size:16px}.teamHero{padding:18px}.teamBadge{font-size:42px}
 .dashGrid{grid-template-columns:1fr}.dashCard{padding:16px}.gameDay{padding:20px}.rosterManage{grid-template-columns:1fr}
 .top{height:56px}.homeBtn{font-size:11px;padding:8px}.top select{max-width:125px;font-size:12px}.toggle{padding:8px;font-size:11px}
 .actions{width:82px;padding:6px;gap:6px}.actions button{font-size:11px;padding:10px 4px}
 .toolbar{height:38px}.field{width:100%;min-width:610px}.fieldArea{overflow:auto;justify-content:flex-start}
 .bottom{min-height:50px}.lineChip{font-size:11px;padding:8px}.desktopOnly{display:none}
}
@media(orientation:landscape) and (max-height:600px){
 .top{height:48px}.layout{min-height:calc(100dvh - 48px);height:calc(100dvh - 48px)}
 .toolbar{height:32px}.fieldArea{padding:2px;overflow:hidden}.field{min-width:0;width:100%;height:100%;aspect-ratio:auto}
 .bottom{padding:4px;min-height:42px}.actions{width:92px;padding:5px}.actions button{padding:8px 4px}
 .slot{min-width:58px;padding:3px;font-size:9px}.slot small{font-size:8px}.tag{padding:3px 12px;font-size:10px}
}

/* Saved game lineup / template feature */
.gameLineupChoices{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:12px 0 16px}
.gameLineupChoices button{min-height:58px;font-weight:800}
.lineTemplateActions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:16px}
.savedList{display:grid;gap:8px;margin-top:12px;max-height:50vh;overflow:auto}
.savedRow{display:grid;grid-template-columns:1fr auto;gap:8px;align-items:stretch}
.savedRow .playerPick{display:flex;justify-content:space-between;align-items:center}
.savedRow .playerPick small{color:#8fa0b4;margin-left:12px}
.dangerBtn{background:#2b1115;color:#ff8a95;border:1px solid #6f2630;border-radius:7px;padding:8px 12px;font-weight:800}
@media(max-width:700px){
  .gameLineupChoices{grid-template-columns:1fr}
  .lineTemplateActions{grid-template-columns:1fr}
}

/* Team Admin */
.adminMemberList{display:grid;gap:8px;margin:10px 0 16px}
.adminMemberRow{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:12px;align-items:center;background:#0b121c;border:1px solid #26364a;border-radius:10px;padding:12px}
.adminMemberRow small{display:block;color:#8fa0b4;margin-top:3px}
.adminMemberActions{display:flex;align-items:center;gap:8px}
.roleSelect{background:#121a25;color:#fff;border:1px solid #344052;border-radius:7px;padding:8px}
.roleBadge{display:inline-block;background:#182333;border:1px solid #344052;border-radius:999px;padding:6px 10px;font-size:11px;font-weight:900;letter-spacing:.5px}
.roleBadge.owner{background:#17331f;border-color:#2c7650;color:#74e2a2}
.dangerZone{margin-top:22px;padding:16px;background:#210e12;border:1px solid #6d2932;border-radius:12px}
.dangerZone h3{margin:0 0 6px;color:#ff8994}.dangerZone p{color:#cda7ab;font-size:13px;line-height:1.45}
@media(max-width:700px){
  .adminMemberRow{grid-template-columns:1fr}
  .adminMemberActions{justify-content:space-between;flex-wrap:wrap}
}

/* Final combined package: view tabs, movable formations, Special Teams, responsive layout */
.gameToolbar{height:auto;min-height:52px;flex-wrap:wrap;padding:6px 10px}
.viewTabs{display:flex;gap:4px}.viewTab,.editFieldBtn{background:#121a25;color:#fff;border:1px solid #344052;border-radius:7px;padding:8px 11px;font-weight:800;font-size:12px}
.viewTab.active{background:#1679df;border-color:#2999ff}.editFieldBtn.activeEdit{background:#8d5d00;border-color:#f6b925}
.specialUnitSelect{background:#151e2b;color:#fff;border:1px solid #4b5f78;border-radius:7px;padding:8px;font-weight:700}
.field.editing{outline:3px solid #f6b925;outline-offset:-3px}.slot.draggable{cursor:move;box-shadow:0 0 0 2px #f6b925,0 7px 18px #0008}.specialSlot{border-color:#f5c542!important}
.deviceModeLabel{display:block;color:#aeb8c5;font-size:12px;margin:12px 0}.deviceModeLabel select{display:block;width:100%;margin-top:5px;background:#0a111b;color:#fff;border:1px solid #344052;border-radius:7px;padding:10px}

/* Mobile is intentionally one-task-at-a-time. */
.mode-mobile .sidebar{display:none!important}.mode-mobile .actions{width:82px}.mode-mobile .brand{display:none}
.mode-mobile .fieldArea{overflow:auto;justify-content:flex-start}.mode-mobile .field{min-width:590px}
/* Tablet forces the richer sideline layout when space allows. */
.mode-tablet .sidebar{display:block!important;width:270px}.mode-tablet .actions{display:flex!important;width:110px}.mode-tablet .field{min-width:650px}

@media(max-width:760px){
  .gameToolbar{gap:5px}.gameToolbar>b{width:54px}.viewTabs{order:3;width:100%;display:grid;grid-template-columns:1fr 1fr 1.35fr}
  .viewTab{padding:8px 4px;font-size:10px}.editFieldBtn{font-size:10px}.specialUnitSelect{max-width:145px;font-size:11px}
  body:not(.mode-tablet) .sidebar{display:none}
  body:not(.mode-tablet) .field{min-width:590px}
}
@media(orientation:landscape) and (max-height:620px){
  .gameToolbar{min-height:42px}.viewTabs{order:initial;width:auto;display:flex}.viewTab{font-size:9px;padding:6px}
  body:not(.mode-mobile) .field{min-width:0}
}

/* Desktop mode + active-field layout correction */
.mode-desktop .sidebar{display:block!important;width:310px}
.mode-desktop .actions{display:flex!important;width:145px;padding:12px}
.mode-desktop .actions button{font-size:14px;min-height:58px}
.mode-desktop .main{min-width:620px}
.mode-desktop .fieldArea{padding:14px;overflow:hidden;justify-content:center}
.mode-desktop .field{width:100%;max-width:1280px;min-width:0;aspect-ratio:1.75}
.mode-desktop .toolbar{padding:8px 16px}
.mode-desktop .bottom{padding:10px 14px}
.mode-desktop .slot{min-width:72px;font-size:11px}
.mode-desktop .slot small{font-size:10px}

/* Only the selected unit uses the entire visible field. */
.field.view-offense .mid,.field.view-defense .mid,.field.view-special .mid{display:none}
.field.view-special:after{
  content:"SPECIAL TEAMS";
  position:absolute;left:50%;top:10px;transform:translateX(-50%);
  z-index:2;padding:5px 18px;border-radius:5px;background:#7b5a08;color:#fff;font-weight:800;
}

/* Phone portrait: fit the whole formation instead of horizontally clipping it. */
@media(max-width:760px) and (orientation:portrait){
  body:not(.mode-tablet):not(.mode-desktop) .fieldArea{
    overflow:hidden;
    justify-content:center;
    padding:2px;
  }
  body:not(.mode-tablet):not(.mode-desktop) .field{
    width:100%;
    min-width:0!important;
    max-width:none;
    aspect-ratio:1.18;
  }
  body:not(.mode-tablet):not(.mode-desktop) .slot{
    min-width:46px;
    max-width:62px;
    padding:4px 2px;
    font-size:8px;
    line-height:1.05;
  }
  body:not(.mode-tablet):not(.mode-desktop) .slot small{font-size:7px}
  body:not(.mode-tablet):not(.mode-desktop) .tag{font-size:10px;padding:4px 10px}
}

/* Phone landscape: maximize the playable field and keep all 11 spots visible. */
@media(max-width:950px) and (orientation:landscape){
  body:not(.mode-tablet):not(.mode-desktop) .fieldArea{overflow:hidden;justify-content:center;padding:2px}
  body:not(.mode-tablet):not(.mode-desktop) .field{width:100%;height:100%;min-width:0!important;max-width:none;aspect-ratio:auto}
  body:not(.mode-tablet):not(.mode-desktop) .slot{min-width:48px;max-width:68px;padding:3px 2px;font-size:8px}
  body:not(.mode-tablet):not(.mode-desktop) .slot small{font-size:7px}
}

/* Tablet keeps a roomy center field without forced horizontal scrolling. */
.mode-tablet .fieldArea{overflow:hidden;justify-content:center}
.mode-tablet .field{width:100%;min-width:0!important;max-width:1050px}

/* Desktop field expansion — maximize usable field area */
.mode-desktop .layout{
  height:calc(100dvh - 62px);
  min-height:0;
}
.mode-desktop .main{
  min-width:0;
  height:100%;
}
.mode-desktop .toolbar{
  min-height:54px;
  justify-content:center;
  gap:10px;
}
.mode-desktop .toolbar>b{
  margin-right:auto;
}
.mode-desktop .toolbar .spacer{
  display:none;
}
.mode-desktop .toolbar #warning{
  margin-left:auto;
}
.mode-desktop .viewTabs{
  position:absolute;
  left:50%;
  transform:translateX(-50%);
}
.mode-desktop .fieldArea{
  flex:1;
  min-height:0;
  padding:6px 10px;
  overflow:hidden;
  align-items:stretch;
  justify-content:center;
}
.mode-desktop .field{
  width:100%;
  height:100%;
  max-width:none;
  min-width:0!important;
  aspect-ratio:auto;
  border-width:2px;
}
.mode-desktop .bottom{
  min-height:54px;
  padding:6px 10px;
}
.mode-desktop .slot{
  min-width:86px;
  max-width:108px;
  padding:7px 6px;
  font-size:13px;
  border-width:2px;
  border-radius:7px;
}
.mode-desktop .slot small{
  font-size:11px;
  margin-top:2px;
}
.mode-desktop .tag{
  font-size:13px;
  padding:6px 22px;
}
.mode-desktop .sidebar{
  width:300px;
}
.mode-desktop .actions{
  width:132px;
}
.mode-desktop .actions button{
  min-height:52px;
}
.mode-desktop .lineChip{
  font-size:12px;
  padding:8px 11px;
}

/* Large desktop screens get an even roomier formation */
@media(min-width:1400px){
  .mode-desktop .sidebar{width:320px}
  .mode-desktop .actions{width:145px}
  .mode-desktop .slot{
    min-width:96px;
    max-width:118px;
    padding:8px 7px;
    font-size:14px;
  }
  .mode-desktop .slot small{font-size:12px}
  .mode-desktop .tag{font-size:14px}
}

/* Auto mode on true desktop screens should also make better use of space */
@media(min-width:1100px) and (min-height:700px){
  body:not(.mode-mobile):not(.mode-tablet):not(.mode-desktop) .layout{
    height:calc(100dvh - 62px);
    min-height:0;
  }
  body:not(.mode-mobile):not(.mode-tablet):not(.mode-desktop) .fieldArea{
    flex:1;
    min-height:0;
    padding:8px;
    overflow:hidden;
    align-items:stretch;
  }
  body:not(.mode-mobile):not(.mode-tablet):not(.mode-desktop) .field{
    width:100%;
    height:100%;
    max-width:none;
    min-width:0!important;
    aspect-ratio:auto;
  }
}

/* Combined Desktop Max Field + Field Full Screen */
.fullscreenControls{display:none}

.field-fullscreen{
  overflow:hidden;
  background:#020503;
}
.field-fullscreen .top,
.field-fullscreen .sidebar,
.field-fullscreen .actions,
.field-fullscreen .bottom{
  display:none!important;
}
.field-fullscreen .layout,
.field-fullscreen .main{
  width:100vw!important;
  height:100dvh!important;
  min-height:100dvh!important;
}
.field-fullscreen .gameToolbar{
  position:fixed;
  z-index:60;
  top:max(8px,env(safe-area-inset-top));
  left:50%;
  transform:translateX(-50%);
  width:auto;
  max-width:96vw;
  min-height:0;
  background:#071018e8;
  border:1px solid #31445c;
  border-radius:12px;
  box-shadow:0 10px 30px #0008;
  padding:6px 8px;
}
.field-fullscreen .gameToolbar>b,
.field-fullscreen .gameToolbar #warning,
.field-fullscreen .gameToolbar .spacer{
  display:none!important;
}
.field-fullscreen .editFieldBtn{
  display:none!important;
}
.field-fullscreen .fieldArea{
  position:fixed!important;
  inset:0!important;
  width:100vw!important;
  height:100dvh!important;
  padding:0!important;
  margin:0!important;
  overflow:hidden!important;
  display:flex!important;
  align-items:stretch!important;
  justify-content:stretch!important;
  background:#020503;
}
.field-fullscreen .field{
  width:100vw!important;
  height:100dvh!important;
  max-width:none!important;
  min-width:0!important;
  aspect-ratio:auto!important;
  border:0!important;
}
.field-fullscreen .slot{
  min-width:72px;
  max-width:102px;
  padding:6px 5px;
  font-size:12px;
}
.field-fullscreen .slot small{font-size:10px}
.field-fullscreen .tag{top:58px!important}
.field-fullscreen .fullscreenControls{
  position:fixed;
  z-index:70;
  right:max(8px,env(safe-area-inset-right));
  bottom:max(8px,env(safe-area-inset-bottom));
  display:flex!important;
  gap:6px;
  align-items:center;
}
.field-fullscreen .fullscreenControls button{
  padding:9px 12px;
  font-weight:800;
  border-radius:9px;
}
@media(max-width:760px){
  .field-fullscreen .gameToolbar{
    top:max(4px,env(safe-area-inset-top));
    max-width:98vw;
    padding:4px;
  }
  .field-fullscreen .viewTab{font-size:10px;padding:7px 8px}
  .field-fullscreen .specialUnitSelect{font-size:10px;padding:7px}
  .field-fullscreen .slot{
    min-width:50px;
    max-width:68px;
    padding:4px 2px;
    font-size:8px;
  }
  .field-fullscreen .slot small{font-size:7px}
  .field-fullscreen .tag{top:48px!important;font-size:10px}
  .field-fullscreen .fullscreenControls{
    right:max(4px,env(safe-area-inset-right));
    bottom:max(4px,env(safe-area-inset-bottom));
  }
  .field-fullscreen .fullscreenControls button{
    padding:7px 9px;
    font-size:10px;
  }
}

/* Fullscreen readability update */
.field-fullscreen .slot{
  min-width:112px!important;
  max-width:150px!important;
  padding:11px 10px!important;
  font-size:18px!important;
  line-height:1.05!important;
  border-width:3px!important;
  border-radius:10px!important;
  box-shadow:0 8px 24px #0009!important;
}
.field-fullscreen .slot small{
  font-size:15px!important;
  margin-top:4px!important;
  line-height:1.05!important;
}
.field-fullscreen .fullscreenControls{
  left:max(10px,env(safe-area-inset-left));
  right:max(10px,env(safe-area-inset-right));
  bottom:max(10px,env(safe-area-inset-bottom));
  justify-content:flex-end;
}
.field-fullscreen .fullscreenLineBadge{
  margin-right:auto;
  color:#fff;
  border:2px solid #ef4444;
  background:#ef4444;
  border-radius:10px;
  padding:11px 18px;
  font-size:18px;
  font-weight:900;
  letter-spacing:.5px;
  box-shadow:0 8px 24px #0009;
  white-space:nowrap;
}
@media(max-width:900px){
  .field-fullscreen .slot{
    min-width:76px!important;
    max-width:96px!important;
    padding:7px 5px!important;
    font-size:12px!important;
  }
  .field-fullscreen .slot small{
    font-size:10px!important;
    margin-top:2px!important;
  }
  .field-fullscreen .fullscreenLineBadge{
    font-size:13px;
    padding:8px 11px;
  }
}
@media(max-width:700px) and (orientation:landscape){
  .field-fullscreen .slot{
    min-width:64px!important;
    max-width:82px!important;
    padding:5px 4px!important;
    font-size:10px!important;
  }
  .field-fullscreen .slot small{
    font-size:8px!important;
  }
  .field-fullscreen .fullscreenLineBadge{
    font-size:11px;
    padding:7px 9px;
  }
}

/* Stadium-style field visual upgrade */
.field{
  isolation:isolate;
  background:
    radial-gradient(circle at 50% 50%,rgba(255,255,255,.035),transparent 42%),
    repeating-linear-gradient(0deg,rgba(255,255,255,.035) 0 1px,transparent 1px 4px),
    repeating-linear-gradient(90deg,#1f7434 0 9.8%,#277f3b 9.8% 19.6%);
  box-shadow:
    inset 0 0 70px rgba(0,0,0,.30),
    0 0 0 1px rgba(255,255,255,.12),
    0 18px 45px rgba(0,0,0,.38);
}
.field:before{
  z-index:1;
  background:
    repeating-linear-gradient(90deg,
      transparent 0 9.72%,
      rgba(255,255,255,.82) 9.72% 10.02%,
      transparent 10.02% 19.72%);
  opacity:.72;
}
.fieldDecor{position:absolute;inset:0;z-index:1;pointer-events:none;overflow:hidden}
.fieldDecor:before,.fieldDecor:after{
  content:"";position:absolute;top:0;bottom:0;width:4.5%;background:linear-gradient(90deg,rgba(6,39,18,.55),rgba(19,92,42,.75));
  border-color:rgba(255,255,255,.55);border-style:solid;box-shadow:inset 0 0 25px #0006
}
.fieldDecor:before{left:0;border-width:0 2px 0 0}
.fieldDecor:after{right:0;border-width:0 0 0 2px}
.fieldLogoMark{
  position:absolute;left:50%;top:50%;transform:translate(-50%,-50%) rotate(-8deg);
  font-size:clamp(24px,4.4vw,72px);font-weight:950;letter-spacing:3px;color:rgba(255,255,255,.10);
  text-shadow:0 2px 10px rgba(0,0,0,.18);white-space:nowrap
}
.fieldLogoMark span{color:rgba(62,159,255,.16)}
.yardNumber{
  position:absolute;transform:translateX(-50%);font-weight:900;font-size:clamp(10px,1.4vw,22px);
  color:rgba(255,255,255,.44);text-shadow:0 1px 3px #0008
}
.topNum{top:7%}.bottomNum{bottom:7%;transform:translateX(-50%) rotate(180deg)}
.hashRow{
  position:absolute;left:10%;right:10%;height:8px;opacity:.65;
  background:repeating-linear-gradient(90deg,rgba(255,255,255,.82) 0 1.2%,transparent 1.2% 4.9%)
}
.hashTop{top:34%}.hashBottom{bottom:34%}
.field .slot{z-index:4;backdrop-filter:blur(3px);background:linear-gradient(180deg,rgba(11,18,26,.96),rgba(4,8,13,.96))}
.field .slot:hover{filter:brightness(1.12);transform:translate(-50%,-50%) scale(1.04)}
.field .tag{z-index:5;box-shadow:0 6px 18px #0006;border:1px solid rgba(255,255,255,.22)}
.savingPlay{opacity:.58!important;pointer-events:none!important}
.playFlash{display:inline-block;animation:playPulse .45s ease}
@keyframes playPulse{0%{transform:scale(1)}45%{transform:scale(1.45);color:#55e98d}100%{transform:scale(1)}}

/* Keep decorative details subtle on smaller phones. */
@media(max-width:700px){
  .yardNumber{font-size:8px}.fieldLogoMark{font-size:24px}.hashRow{height:5px}
}

/* Next Play line rotation cue */
.lineChip.activeLine{
  box-shadow:0 0 0 2px rgba(255,255,255,.78),0 4px 14px rgba(0,0,0,.45);
  font-weight:900;
}



/* Larger player cards in Full Screen */
.field-fullscreen .slot{
  min-width:138px!important;
  max-width:178px!important;
  padding:14px 12px!important;
  font-size:22px!important;
  line-height:1.05!important;
  border-width:3px!important;
  border-radius:11px!important;
}
.field-fullscreen .slot small{
  font-size:18px!important;
  margin-top:5px!important;
  line-height:1.05!important;
}

/* Medium screens */
@media(max-width:1100px){
  .field-fullscreen .slot{
    min-width:104px!important;
    max-width:132px!important;
    padding:10px 8px!important;
    font-size:16px!important;
  }
  .field-fullscreen .slot small{
    font-size:13px!important;
  }
}

/* Phones in landscape */
@media(max-width:760px) and (orientation:landscape){
  .field-fullscreen .slot{
    min-width:78px!important;
    max-width:98px!important;
    padding:7px 5px!important;
    font-size:12px!important;
  }
  .field-fullscreen .slot small{
    font-size:10px!important;
  }
}

/* Substitution picker: clearly mark players already on the field */
.playerPick.onFieldPlayer{
  border-color:#d94343!important;
  background:linear-gradient(180deg,#321217,#211014)!important;
  color:#ffd7d7!important;
}
.playerPick.onFieldPlayer:hover{
  border-color:#ff6a6a!important;
  background:linear-gradient(180deg,#46171d,#2a1015)!important;
}
.playerPick.onFieldPlayer.selected{
  box-shadow:0 0 0 2px #ffb84d inset;
}
.usedTag{
  float:right;
  margin-left:8px;
  color:#ff8d8d;
  font-size:10px;
  font-weight:900;
  letter-spacing:.5px;
}

/* Mobile tablet-style layout
   Goal: make phone portrait feel like a compact tablet instead of a squeezed desktop. */
@media(max-width:760px) and (orientation:portrait){

  body:not(.mode-desktop) .top{
    height:auto;
    min-height:58px;
    display:grid;
    grid-template-columns:auto minmax(110px,1fr) auto auto auto;
    gap:6px;
    padding:8px 8px;
  }
  body:not(.mode-desktop) .top .homeBtn{grid-column:1}
  body:not(.mode-desktop) .top #lineSelect{
    grid-column:2;
    max-width:none;
    width:100%;
    min-width:0;
    font-size:12px;
    font-weight:800;
  }
  body:not(.mode-desktop) .top #namesBtn,
  body:not(.mode-desktop) .top #numbersBtn,
  body:not(.mode-desktop) .top #teamBtn{
    min-width:0;
    padding:9px 8px;
    font-size:11px;
  }
  body:not(.mode-desktop) .top .brand,
  body:not(.mode-desktop) .top .spacer{
    display:none;
  }

  body:not(.mode-desktop) .layout{
    display:flex;
    flex-direction:column;
    min-height:calc(100dvh - 58px);
  }

  body:not(.mode-desktop) .sidebar{
    display:none!important;
  }

  body:not(.mode-desktop) .main{
    width:100%;
    order:1;
  }

  body:not(.mode-desktop) .gameToolbar{
    display:grid;
    grid-template-columns:auto 1fr auto;
    gap:6px;
    min-height:0;
    padding:6px 8px;
    background:#090d13;
  }

  body:not(.mode-desktop) .gameToolbar>b{
    grid-column:1;
    align-self:center;
    width:auto;
    font-size:12px;
  }

  body:not(.mode-desktop) .gameToolbar .viewTabs{
    grid-column:1 / -1;
    grid-row:2;
    order:initial;
    width:100%;
    display:grid;
    grid-template-columns:1fr 1fr 1.35fr;
    gap:5px;
  }

  body:not(.mode-desktop) .gameToolbar .viewTab{
    min-height:42px;
    font-size:11px;
    padding:8px 4px;
  }

  body:not(.mode-desktop) .gameToolbar #editFieldBtn{
    grid-column:2;
    grid-row:1;
    justify-self:start;
    min-height:38px;
    padding:8px 10px;
    font-size:10px;
  }

  body:not(.mode-desktop) .gameToolbar #warning{
    grid-column:3;
    grid-row:1;
    align-self:center;
    justify-self:end;
    font-size:10px;
    white-space:nowrap;
  }

  body:not(.mode-desktop) .gameToolbar .specialUnitSelect{
    grid-column:1 / -1;
    grid-row:3;
    width:100%;
    max-width:none;
  }

  /* Use a tablet-like full-width field with enough height to read the formation. */
  body:not(.mode-desktop) .fieldArea{
    width:100%;
    min-height:52vh;
    padding:4px;
    overflow:hidden;
    justify-content:center;
    align-items:stretch;
    background:#041007;
  }

  body:not(.mode-desktop) .field{
    width:100%;
    height:auto;
    min-width:0!important;
    max-width:none!important;
    aspect-ratio:1.05;
  }

  body:not(.mode-desktop) .slot{
    min-width:58px!important;
    max-width:78px!important;
    padding:6px 4px!important;
    font-size:10px!important;
    line-height:1.05!important;
  }

  body:not(.mode-desktop) .slot small{
    font-size:8px!important;
    margin-top:2px;
  }

  body:not(.mode-desktop) .tag{
    font-size:10px;
    padding:4px 10px;
  }

  /* Tablet-style action dock below the field instead of a narrow right rail. */
  body:not(.mode-desktop) .actions{
    order:2;
    width:100%!important;
    display:grid!important;
    grid-template-columns:1.35fr 1fr 1fr 1fr;
    gap:6px;
    padding:7px 8px;
    border-left:0;
    border-top:1px solid #202a38;
    background:#0d121a;
  }

  body:not(.mode-desktop) .actions button{
    min-height:48px;
    padding:7px 4px;
    font-size:10px;
    line-height:1.05;
  }

  body:not(.mode-desktop) .actions .next{
    min-height:48px;
    font-size:13px;
  }

  body:not(.mode-desktop) .actions #resetFieldBtn,
  body:not(.mode-desktop) .actions #fullscreenBtn,
  body:not(.mode-desktop) .actions #rotateFieldBtn{
    grid-column:auto;
  }

  /* Put line rotation directly below the field, horizontally like tablet controls. */
  body:not(.mode-desktop) .bottom{
    display:grid;
    grid-template-columns:auto 1fr auto;
    gap:6px;
    min-height:58px;
    padding:6px 8px;
    overflow:visible;
  }

  body:not(.mode-desktop) .bottom #lineChips{
    display:flex;
    gap:5px;
    overflow-x:auto;
    min-width:0;
    padding-bottom:2px;
    scrollbar-width:none;
  }

  body:not(.mode-desktop) .bottom #lineChips::-webkit-scrollbar{display:none}

  body:not(.mode-desktop) .lineChip{
    flex:0 0 auto;
    min-height:42px;
    font-size:10px;
    padding:8px 9px;
  }

  body:not(.mode-desktop) .bottom #prevBtn,
  body:not(.mode-desktop) .bottom #nextBtn{
    min-height:44px;
    padding:8px 10px;
    font-size:10px;
  }

  body:not(.mode-desktop) .statsSummary{
    display:none;
  }
}

/* Keep mobile landscape close to tablet presentation too. */
@media(max-width:950px) and (orientation:landscape){
  body:not(.mode-desktop) .actions{
    width:92px;
  }
  body:not(.mode-desktop) .fieldArea{
    min-height:0;
  }
}



/* Field orientation cleanup
   The painted football field now runs top-to-bottom, matching the player formation. */
.field{
  background:
    radial-gradient(circle at 50% 50%,rgba(255,255,255,.035),transparent 42%),
    repeating-linear-gradient(90deg,rgba(255,255,255,.028) 0 1px,transparent 1px 4px),
    repeating-linear-gradient(0deg,#1f7434 0 9.8%,#277f3b 9.8% 19.6%)!important;
  transform:none!important;
}

.field:before{
  z-index:1;
  background:
    repeating-linear-gradient(0deg,
      transparent 0 9.72%,
      rgba(255,255,255,.82) 9.72% 10.02%,
      transparent 10.02% 19.72%)!important;
  opacity:.72;
}

/* End zones are now at the top and bottom of the field. */
.fieldDecor:before,
.fieldDecor:after{
  content:"";
  position:absolute;
  left:0;
  right:0;
  width:auto;
  height:5%;
  background:linear-gradient(180deg,rgba(6,39,18,.62),rgba(19,92,42,.80));
  box-shadow:inset 0 0 25px #0006;
  border-style:solid;
  border-color:rgba(255,255,255,.58);
}
.fieldDecor:before{
  top:0;
  bottom:auto;
  border-width:0 0 2px 0;
}
.fieldDecor:after{
  bottom:0;
  top:auto;
  border-width:2px 0 0 0;
}

.yardNumber{
  transform:translateY(-50%)!important;
  font-weight:900;
  font-size:clamp(10px,1.4vw,22px);
  color:rgba(255,255,255,.45);
}
.leftNum{
  left:7%!important;
  right:auto!important;
}
.rightNum{
  right:7%!important;
  left:auto!important;
  transform:translateY(-50%) rotate(180deg)!important;
}

.hashCol{
  position:absolute;
  top:10%;
  bottom:10%;
  width:8px;
  opacity:.68;
  background:repeating-linear-gradient(
    0deg,
    rgba(255,255,255,.82) 0 1.2%,
    transparent 1.2% 4.9%
  );
}
.hashLeft{left:34%}
.hashRight{right:34%}

/* Old horizontal-hash elements are no longer used. */
.hashRow,.topNum,.bottomNum{display:none!important}

/* Keep player cards, tags and text upright everywhere. */
.field .slot,
.field .tag,
.field .fieldLogoMark{
  rotate:0deg!important;
}

/* Mobile: preserve the same top-to-bottom field direction. */
@media(max-width:760px){
  .yardNumber{font-size:8px}
  .hashCol{width:5px}
  .leftNum{left:6%!important}
  .rightNum{right:6%!important}
}

/* Final polish */
html{background:#08111d;overscroll-behavior:none;-webkit-text-size-adjust:100%}
body{min-height:100dvh;overscroll-behavior:none;-webkit-tap-highlight-color:transparent}
button,.chip,.viewTab,.dashCard,.playerPick{touch-action:manipulation}
button:active,.chip:active,.viewTab:active,.dashCard:active,.playerPick:active{transform:scale(.985)}
button:focus-visible,input:focus-visible,select:focus-visible{
  outline:3px solid rgba(55,156,255,.75);outline-offset:2px
}
.syncStatus{
  display:inline-flex;align-items:center;margin-left:10px;padding:4px 8px;border-radius:999px;
  border:1px solid rgba(84,222,135,.42);background:rgba(34,197,94,.10);color:#55df87;
  font-size:10px;font-weight:900;letter-spacing:.6px;vertical-align:middle
}
.syncStatus.offline{
  color:#ffb454;border-color:rgba(255,180,84,.45);background:rgba(255,180,84,.09)
}
@media(max-width:760px){
  .syncStatus{margin-left:6px;padding:3px 6px;font-size:8px}
}
@media(display-mode:standalone){
  body{padding-top:env(safe-area-inset-top);padding-bottom:env(safe-area-inset-bottom)}
}

/* Tappable playing-time alert */
#warning{
  cursor:pointer;
  user-select:none;
  border-radius:8px;
  padding:6px 8px;
  transition:background .15s ease, transform .12s ease;
}
#warning:hover,
#warning:focus-visible{
  background:rgba(255,255,255,.06);
}
#warning:active{
  transform:scale(.985);
}
#warning.hasAlert{
  color:#ffd45e;
  background:rgba(245,158,11,.09);
  border:1px solid rgba(245,158,11,.22);
}
.alertPlayerList{
  display:grid;
  gap:8px;
  margin:12px 0;
}
.alertPlayerRow{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 14px;
  border:1px solid #37465c;
  border-radius:12px;
  background:#0d1622;
}
.alertPlayerIdentity{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}
.alertPlayerIdentity small{
  display:block;
  margin-top:2px;
  color:#8fa0b5;
  font-size:11px;
}
.alertJersey{
  min-width:44px;
  height:44px;
  display:grid;
  place-items:center;
  border-radius:10px;
  background:#182437;
  font-weight:900;
}
.alertPlayerStats{
  display:grid;
  justify-items:end;
  gap:2px;
  white-space:nowrap;
}
.alertPlayerStats span{
  color:#9aa9ba;
  font-size:12px;
}
.alertPlayerStats b{
  color:#ff6b6b;
  font-size:20px;
}
@media(max-width:760px){
  .alertPlayerRow{padding:10px}
  .alertJersey{min-width:38px;height:38px}
  .alertPlayerStats b{font-size:17px}
}
