:root{
  --bg-top:#1e293b;
  --bg-bottom:#020617;
  --panel:#0f172a;
  --panel-2:#111827;
  --panel-3:#1f2937;
  --panel-4:#1e293b;
  --text:#e5e7eb;
  --muted:#9ca3af;
  --muted-2:#6b7280;
  --blue:#3b82f6;
  --blue-dark:#2563eb;
  --green:#22c55e;

  --left-w:250px;
  --right-w:340px;
  --radius:16px;
  --shadow-soft:0 15px 40px rgba(0,0,0,0.45);
  --shadow-strong:0 20px 60px rgba(0,0,0,0.6);
}

*{
  box-sizing:border-box;
}

html,
body{
  margin:0;
  width:100%;
  height:100%;
}

body{
  font-family:system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background:radial-gradient(circle at top,var(--bg-top),var(--bg-bottom));
  color:white;
  overflow-y:auto;
}

/* ============================= */
/* TOP NAVIGATION */
/* ============================= */

.topNav{

  position:sticky;
  top:0;

  width:100%;
  height:64px;

  display:flex;
  align-items:center;
  justify-content:space-between;

  padding:0 24px;

  background:#020617;

  border-bottom:1px solid rgba(255,255,255,0.06);

  z-index:5000;

}


/* LEFT SIDE */

.navLeft{

  display:flex;
  align-items:center;
  gap:10px;

}

.navLogo{

  width:34px;
  height:34px;

}

.navTitle{

  font-size:18px;
  font-weight:700;

}


/* CENTER NAV */

.navCenter{

  display:flex;
  gap:26px;

}

.navItem{

  background:none;
  border:none;

  color:#cbd5e1;

  font-size:14px;
  font-weight:600;

  cursor:pointer;

  padding:8px 6px;

  transition:0.2s;

}

.navItem:hover{

  color:white;

}


/* RIGHT SIDE */

.navRight{

  display:flex;
  align-items:center;
  gap:16px;

}

.loginBtn{

  background:#2563eb;
  border:none;

  padding:8px 16px;

  border-radius:8px;

  font-weight:600;

  color:white;

  cursor:pointer;

}

.loginBtn:hover{

  background:#1d4ed8;

}

.profileCircle{

  width:36px;
  height:36px;

  border-radius:50%;

  background:#1e293b;

  display:flex;
  align-items:center;
  justify-content:center;

  font-weight:700;

}

/* ============================= */
/* MAIN APP LAYOUT */
/* ============================= */

.app{
  display:grid;
  grid-template-columns:var(--left-w) minmax(0,1fr) var(--right-w);
  width:100%;
  min-height:calc(100vh - 64px);
  isolation:isolate;
}

/* ============================= */
/* LEFT SIDEBAR */
/* ============================= */

.controls{
   min-height:100%;
  background:var(--panel);
  border-right:1px solid rgba(255,255,255,0.06);
  padding:22px 18px 22px 22px;
  display:flex;
  flex-direction:column;
  gap:22px;
  box-shadow:8px 0 30px rgba(0,0,0,0.6);
  overflow-y:auto;
  overflow-x:hidden;
  min-width:0;
}

.controls::-webkit-scrollbar{
  width:6px;
}

.controls::-webkit-scrollbar-thumb{
  background:#374151;
  border-radius:10px;
}

.controls::-webkit-scrollbar-track{
  background:transparent;
}

.sidebarHeader{
  font-size:18px;
  font-weight:700;
  color:var(--text);
}

.toolSection{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.sectionTitle{
  font-size:12px;
  font-weight:700;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.1em;
}

.hintText{
  font-size:12px;
  color:var(--muted-2);
}

.playerBench{
  display:flex;
  gap:18px;
  margin-top:6px;
}

.playerToken{
  width:50px;
  height:50px;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:700;
  font-size:16px;
  cursor:grab;
  user-select:none;
  color:white;
  border:3px solid white;
  box-shadow:
    0 6px 14px rgba(0,0,0,0.5),
    inset 0 2px 4px rgba(255,255,255,0.3);
  transition:all .18s ease;
}

.playerToken:hover{
  transform:translateY(-3px) scale(1.08);
  box-shadow:
    0 12px 26px rgba(0,0,0,0.7),
    inset 0 2px 4px rgba(255,255,255,0.4);
}

.playerToken:active{
  cursor:grabbing;
  transform:scale(.95);
}

.playerToken.teamA{
  background:linear-gradient(145deg,#3b82f6,#1e40af);
}

.playerToken.teamB{
  background:linear-gradient(145deg,#ef4444,#991b1b);
}

.formationSelector{
  background:var(--panel-3);
  border:1px solid rgba(255,255,255,0.06);
  border-radius:12px;
  padding:12px 14px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  cursor:pointer;
  transition:.2s;
  position:relative;
  z-index:100;
}

.formationSelector:hover{
  background:#374151;
}

.formationArrow{
  opacity:.65;
}

#formationSelector{
  position:relative;
  z-index:50;
}

.toolRow{
  display:flex;
  gap:10px;
}

.toolBtn{
  flex:1;
  background:var(--panel-3);
  border:1px solid rgba(255,255,255,0.08);
  color:var(--text);
  padding:10px 12px;
  border-radius:12px;
  font-weight:700;
  cursor:pointer;
  transition:.18s;
  font-size:13px;
}

.toolBtn:hover{
  background:#374151;
  transform:translateY(-1px);
}

.toolBtn:active{
  transform:translateY(0);
}

.toolBtn.isActive{
  outline:2px solid rgba(59,130,246,0.55);
  background:linear-gradient(135deg,#1f2937,#111827);
}

.toolGhost{
  background:transparent;
}

.toolGhost:hover{
  background:rgba(255,255,255,0.06);
}

.toolPrimary{
  background:linear-gradient(135deg,var(--blue),var(--blue-dark));
  border:none;
  color:white;
}

.toolPrimary:hover{
  filter:brightness(1.05);
}

.colorRow{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.colorSwatch{
  width:28px;
  height:28px;
  border-radius:999px;
  border:2px solid rgba(255,255,255,0.08);
  cursor:pointer;
  transition:.18s;
}

.colorSwatch:hover{
  transform:scale(1.08);
}

.colorSwatch.isActive{
  border-color:rgba(255,255,255,0.85);
  box-shadow:0 0 0 3px rgba(59,130,246,0.35);
}

.colorPicker{
  width:42px;
  height:30px;
  border:none;
  background:transparent;
  cursor:pointer;
}

.sidebarActions{
  margin-top:auto;
  display:flex;
  flex-direction:column;
  gap:10px;
  padding-bottom:40px;
}

.exportContainer{
  position:relative;
  width:100%;
}

.exportContainer .toolBtn{
  width:100%;
}

.exportMenu{
  position:absolute;
  left:0;
  bottom:52px;
  width:100%;
  background:var(--panel);
  border:1px solid rgba(255,255,255,0.08);
  border-radius:12px;
  box-shadow:var(--shadow-strong);
  display:none;
  flex-direction:column;
  overflow:hidden;
  z-index:3000;
}

.exportMenu.open{
  display:flex;
}

.exportItem{
  background:none;
  border:none;
  color:white;
  text-align:left;
  padding:12px 14px;
  cursor:pointer;
  font-size:13px;
  transition:.15s;
}

.exportItem:hover{
  background:var(--panel-3);
}

.dangerBtn{
  border:none;
  background:#7f1d1d;
  color:white;
  padding:12px;
  border-radius:10px;
  cursor:pointer;
  font-weight:700;
  transition:.2s;
}

.dangerBtn:hover{
  background:#991b1b;
}

/* ============================= */
/* CENTER BOARD */
/* ============================= */

.board{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  min-width:0;
  min-height:900px;
}


.board::before{

  content:"";

  position:absolute;

  width:900px;
  height:900px;

  background:
    radial-gradient(
      circle,
      rgba(60,200,90,0.12),
      transparent 70%
    );

  filter:blur(120px);

  z-index:0;

}

.frameViewport{
  position:relative;
  z-index:1;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:48px;
  width:100%;
  height:100%;
  max-width:100%;
  min-width:0;
  transition:transform .45s cubic-bezier(.22,.61,.36,1);
}

.frameMain{
  position:relative;
  flex:0 0 auto;
  border:4px solid white;
  border-radius:10px;
  box-shadow:
    0 20px 60px rgba(0,0,0,0.6),
    0 0 40px rgba(0,0,0,0.3) inset;
}

#soccerField{
  position:relative;
  display:block;
  margin:auto;
  width:auto;
  height:auto;
  max-width:90%;
  max-height:85vh;
}

.frameGhost{
  position:relative;
  flex:0 0 auto;
  width:260px;
  height:455px;
  opacity:.16;
  filter:blur(1px) grayscale(.3);
  transform:scale(.82);
  transform-origin:center center;
  pointer-events:none;
}

.frameGhost svg{
  opacity:.5;
}

.frameControls{
  position:absolute;
  left:50%;
  bottom:20px;
  transform:translateX(-50%);
  display:flex;
  align-items:center;
  gap:20px;
  background:rgba(15,23,42,0.9);
  backdrop-filter:blur(10px);
  padding:12px 20px;
  border-radius:14px;
  box-shadow:0 10px 30px rgba(0,0,0,0.6);
  z-index:50;
}

.frameArrow{
  background:var(--panel-3);
  border:none;
  color:white;
  font-size:18px;
  padding:10px 14px;
  border-radius:10px;
  cursor:pointer;
}

.frameArrow:hover{
  background:#374151;
}

#frameIndicator,
.frameIndicator{
  font-weight:600;
}

.createFrameBtn{
  position:absolute;
  right:34px;
  bottom:94px;
  width:60px;
  height:60px;
  border-radius:50%;
  border:none;
  font-size:32px;
  font-weight:700;
  background:linear-gradient(135deg,var(--blue),var(--blue-dark));
  color:white;
  cursor:pointer;
  box-shadow:0 10px 30px rgba(0,0,0,0.5);
  display:none;
  align-items:center;
  justify-content:center;
  transition:.25s;
  z-index:50;
}

.createFrameBtn:hover{
  transform:scale(1.1);
}

.frameRenameInput{
  background:rgba(255,255,255,0.05);
  border:1px solid rgba(255,255,255,0.1);
  color:white;
  padding:6px 10px;
  border-radius:8px;
  font-size:14px;
  font-weight:600;
  outline:none;
  text-align:center;
  width:140px;
  transition:.2s;
}

.frameRenameInput:focus{
  border-color:var(--blue);
  box-shadow:0 0 0 3px rgba(59,130,246,0.25);
}

/* ============================= */
/* DRAWING + PLAYERS */
/* ============================= */

#drawCanvas{
  position:absolute;
  inset:0;
  z-index:5;
}

.player{
  position:absolute;
  transform: translate(-50%, -50%);
  width:36px;
  height:36px;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:bold;
  color:white;
  cursor:grab;
  user-select:none;
  z-index:10;
}

.player:hover{
  transform:scale(1.08);
}

.player:active{
  cursor:grabbing;
}

.teamA{
  background:#1e88e5;
}

.teamB{
  background:#e53935;
}

.playerNumber{
  position:absolute;
  top:50%;
  left:50%;
  transform:translate(-50%, -50%);
  font-size:14px;
  font-weight:700;
  pointer-events:none;
}

.playerName{
  position:absolute;
  top:42px;
  left:50%;
  transform:translateX(-50%);
  font-size:11px;
  font-weight:600;
  white-space:nowrap;
  color:white;
  text-shadow:0 2px 4px rgba(0,0,0,0.6);
  pointer-events:none;
}

.ghostPlayer{
  opacity:0.25;
}

/* ============================= */
/* RIGHT PANEL */
/* ============================= */

.aiPanel{
  background:#020617;
  border-left:1px solid rgba(255,255,255,0.05);
  box-shadow:-20px 0 40px rgba(0,0,0,0.45);

  display:flex;
  flex-direction:column;
  gap:18px;

  padding:18px 14px 18px 18px;

  min-width:0;
  min-height:900px;   /* keeps panel structured */

  position:relative;
}

.ai-container{
  flex:1;
  min-height:280px;
  background:var(--panel);
  border-radius:18px;
  border:1px solid rgba(255,255,255,0.06);
  box-shadow:var(--shadow-soft);
  display:flex;
  flex-direction:column;
  overflow:hidden;
}

.aiHeader,
.ai-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:14px 16px;
  font-weight:600;
  color:white;
  border-bottom:1px solid rgba(255,255,255,0.1);
  background:var(--panel-2);
}

.aiTitle{
  font-size:15px;
  font-weight:700;
  color:var(--text);
}

.aiStatus,
.ai-status{
  font-size:12px;
  color:var(--green);
  white-space:nowrap;
}

.aiChat,
.ai-chat{
  flex:1;
  min-height:0;
  overflow-y:auto;
  padding:18px;
  display:flex;
  flex-direction:column;
  gap:14px;
}

.aiChat::-webkit-scrollbar,
.ai-chat::-webkit-scrollbar,
.formationList::-webkit-scrollbar,
#notesEditor::-webkit-scrollbar{
  width:6px;
}

.aiChat::-webkit-scrollbar-thumb,
.ai-chat::-webkit-scrollbar-thumb,
.formationList::-webkit-scrollbar-thumb,
#notesEditor::-webkit-scrollbar-thumb{
  background:#374151;
  border-radius:10px;
}

.ai-message{
  max-width:85%;
  padding:10px 14px;
  border-radius:12px;
  font-size:14px;
}

.ai-system{
  background:var(--panel-4);
  color:#cbd5f5;
}

.ai-user{
  background:var(--blue-dark);
  color:white;
  align-self:flex-end;
}

.aiInputContainer,
.ai-input-container{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px;
  background:var(--panel);
  border-top:1px solid rgba(255,255,255,0.08);
}

.ai-input-area{
  display:flex;
  padding:10px;
  border-top:1px solid rgba(255,255,255,0.1);
}

#aiInput,
#ai-input{
  flex:1;
  min-height:38px;
  max-height:120px;
  resize:none;
  border:none;
  outline:none;
  background:var(--panel-4);
  color:white;
  padding:10px 12px;
  border-radius:12px;
  font-size:14px;
  overflow:hidden;
}

#aiInput::placeholder,
#ai-input::placeholder{
  color:var(--muted);
}

#aiSend,
#ai-send{
  width:38px;
  height:38px;
  border:none;
  border-radius:12px;
  background:var(--blue-dark);
  color:white;
  font-size:16px;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  transition:.2s;
  flex:0 0 auto;
}

#aiSend:hover{
  transform:scale(1.05);
}

#ai-send:hover{
  background:var(--blue);
}

.notesPanel{
  flex:1;
  min-height:260px;
  background:var(--panel);
  border-radius:18px;
  border:1px solid rgba(255,255,255,0.06);
  box-shadow:var(--shadow-soft);
  display:flex;
  flex-direction:column;
  overflow:hidden;
}

.notesHeader{
  padding:14px 16px;
  font-size:14px;
  font-weight:700;
  color:var(--text);
  border-bottom:1px solid rgba(255,255,255,0.06);
  display:flex;
  justify-content:space-between;
  align-items:center;
  background:var(--panel-2);
}

.notesToolbar{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  padding:10px 14px;
  border-bottom:1px solid rgba(255,255,255,0.06);
  background:#020617;
}

.notesBtn{
  border:none;
  background:var(--panel-4);
  color:var(--text);
  padding:6px 12px;
  border-radius:8px;
  font-size:13px;
  font-weight:600;
  cursor:pointer;
  transition:all .15s ease;
}

.notesBtn:hover{
  background:#334155;
}

.notesBtn:active{
  transform:scale(.96);
}

#notesEditor{
  flex:1;
  min-height:0;
  padding:16px;
  overflow-y:auto;
  outline:none;
  color:white;
  font-size:14px;
  line-height:1.7;
  font-family:system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

#notesEditor:empty:before{
  content:"Write tactical notes here...";
  color:var(--muted-2);
  pointer-events:none;
}

#notesEditor ul{
  padding-left:22px;
}

#notesEditor li{
  margin-bottom:6px;
}

/* ============================= */
/* PLAYER EDITOR */
/* ============================= */

.playerEditor{
  position:fixed;
  z-index:4000;
  width:260px;
  padding:18px;
  border-radius:16px;
  background:var(--panel);
  border:1px solid rgba(255,255,255,0.08);
  box-shadow:0 20px 60px rgba(0,0,0,0.55);
  display:flex;
  flex-direction:column;
  gap:10px;
}

.playerEditor.hidden{
  display:none;
}

.playerEditorHeader{
  font-size:15px;
  font-weight:700;
  color:var(--text);
  margin-bottom:4px;
}

.editorLabel{
  font-size:12px;
  font-weight:700;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.08em;
}

.editorInput{
  border:none;
  outline:none;
  background:var(--panel-3);
  color:white;
  border-radius:12px;
  padding:11px 12px;
  font-size:14px;
  border:1px solid rgba(255,255,255,0.06);
}

.editorInput:focus{
  border-color:rgba(59,130,246,0.55);
  box-shadow:0 0 0 3px rgba(59,130,246,0.15);
}

.editorActions{
  display:flex;
  gap:10px;
  margin-top:6px;
}

.editorBtn{
  flex:1;
  border:none;
  border-radius:12px;
  padding:10px 12px;
  font-weight:700;
  cursor:pointer;
  transition:.18s;
}

.editorBtnGhost{
  background:var(--panel-3);
  color:var(--text);
  border:1px solid rgba(255,255,255,0.06);
}

.editorBtnGhost:hover{
  background:#374151;
}

.editorBtnPrimary{
  background:linear-gradient(135deg,var(--blue),var(--blue-dark));
  color:white;
}

.editorBtnPrimary:hover{
  filter:brightness(1.05);
}

/* ============================= */
/* FORMATION MODAL */
/* ============================= */

.formationModal{
  position:fixed;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  background:rgba(0,0,0,0.55);
  backdrop-filter:blur(6px);
  z-index:2000;
}

.formationPanel{
  background:var(--panel);
  width:min(460px, calc(100vw - 32px));
  max-height:min(560px, calc(100vh - 32px));
  border-radius:14px;
  padding:22px;
  display:flex;
  flex-direction:column;
  box-shadow:0 20px 80px rgba(0,0,0,0.75);
  border:1px solid rgba(255,255,255,0.08);
}

.formationPanelHeader{
  font-size:18px;
  font-weight:800;
  margin-bottom:14px;
  color:var(--text);
}

.formationList{
  display:flex;
  flex-direction:column;
  gap:10px;
  overflow-y:auto;
  padding-right:6px;
}

.formationItem{
  background:var(--panel-3);
  border:1px solid rgba(255,255,255,0.06);
  padding:14px;
  border-radius:12px;
  cursor:pointer;
  transition:.2s;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
}

.formationItem:hover{
  background:#374151;
  transform:translateY(-1px);
}

.formationTag{
  font-size:12px;
  color:var(--muted);
  white-space:nowrap;
}

/* ============================= */
/* BREAKPOINT: LARGE LAPTOP */
/* ============================= */

@media (max-width: 1500px){
  :root{
    --left-w:230px;
    --right-w:320px;
  }

  .controls{
    padding:18px 14px 18px 18px;
    gap:18px;
  }

  .aiPanel{
    padding:16px 12px 16px 16px;
  }

  .frameGhost{
    display:none;
  }

  .frameViewport{
    gap:0;
  }

  .createFrameBtn{
    right:24px;
  }
}

/* ============================= */
/* BREAKPOINT: STANDARD LAPTOP */
/* ============================= */

@media (max-width: 1280px){
  :root{
    --left-w:210px;
    --right-w:300px;
  }

  .logoTitle,
  .sidebarHeader{
    font-size:17px;
  }

  .toolBtn{
    font-size:12px;
    padding:9px 10px;
  }

  .playerToken{
    width:46px;
    height:46px;
    font-size:15px;
  }

  .controls{
    padding:16px 12px 16px 16px;
    gap:16px;
  }

  .aiPanel{
    padding:14px 10px 14px 14px;
    gap:14px;
  }

  .notesBtn{
    padding:6px 10px;
    font-size:12px;
  }
}

/* ============================= */
/* BREAKPOINT: TABLET */
/* ============================= */

@media (max-width: 1024px){
  body{
  overflow-y:auto;
}

  .app{
    grid-template-columns:1fr;
    grid-template-rows:auto auto auto;
    height:auto;
    min-height:100vh;
  }

  .controls,
  .board,
  .aiPanel{
    height:auto;
    width:100%;
  }

  .controls{
    border-right:none;
    border-bottom:1px solid rgba(255,255,255,0.06);
    box-shadow:none;
    overflow:visible;
  }

  .board{
    min-height:70vh;
    padding:20px 14px 72px;
  }

  .aiPanel{
    border-left:none;
    border-top:1px solid rgba(255,255,255,0.05);
    box-shadow:none;
    padding:16px;
  }

  .frameGhost{
    display:none;
  }

  .frameViewport{
    gap:0;
  }

  #soccerField{
    max-height:72vh;
  }

  .createFrameBtn{
    right:20px;
    bottom:90px;
  }
}

/* ============================= */
/* BREAKPOINT: PHONE */
/* ============================= */

@media (max-width: 768px){
  .controls{
    padding:14px;
    gap:14px;
  }

  .logoContainer{
    margin-bottom:8px;
    padding-bottom:12px;
  }

  .siteLogo{
    width:48px;
    height:48px;
  }

  .board{
    min-height:58vh;
    padding:14px 10px 72px;
  }

  #soccerField{
    max-height:58vh;
  }

  .frameControls{
    bottom:14px;
    gap:14px;
    padding:10px 14px;
  }

  .frameArrow{
    padding:9px 12px;
    font-size:16px;
  }

  .createFrameBtn{
    width:52px;
    height:52px;
    font-size:28px;
    right:16px;
    bottom:82px;
  }

  .toolRow{
    flex-wrap:wrap;
  }

  .toolRow .toolBtn{
    min-width:calc(50% - 5px);
  }

  .aiPanel{
    padding:12px;
    gap:12px;
  }

  .aiChat,
  .ai-chat,
  #notesEditor{
    padding:14px;
  }

  .aiInputContainer,
  .ai-input-container{
    padding:8px;
  }
}

/* ============================= */
/* BREAKPOINT: VERY SMALL PHONE */
/* ============================= */

@media (max-width: 480px){
  .controls{
    padding:12px;
  }

  .sectionTitle{
    font-size:11px;
  }

  .playerToken{
    width:42px;
    height:42px;
    font-size:14px;
  }

  .toolBtn{
    font-size:12px;
    padding:8px 10px;
  }

  .frameControls{
    gap:10px;
    padding:8px 12px;
  }

  .frameArrow{
    padding:8px 10px;
    font-size:15px;
  }

  .aiHeader,
  .ai-header,
  .notesHeader{
    padding:12px 14px;
  }

  .notesToolbar{
    padding:8px 10px;
    gap:6px;
  }

  .notesBtn{
    padding:6px 9px;
    font-size:12px;
  }
}

/* ============================= */
/* PROFESSIONAL SOCCER FIELD */
/* ============================= */

#soccerField{

  display:block;
  margin:auto;
  max-width:100%;
  max-height:82vh;

  /* GRASS STRIPES */
  background:
  repeating-linear-gradient(
    to bottom,
    #2f7d32 0px,
    #2f7d32 60px,
    #256b2a 60px,
    #256b2a 120px
  );

  border-radius:6px;

}


/* GRASS TEXTURE */

#soccerField::after{

  content:"";
  position:absolute;
  inset:0;

  background:
  repeating-linear-gradient(
    90deg,
    rgba(255,255,255,0.03) 0px,
    rgba(255,255,255,0.03) 2px,
    transparent 2px,
    transparent 6px
  );

  opacity:0.35;

  pointer-events:none;

}


/* FIELD LINES */

#soccerField line,
#soccerField path,
#soccerField circle{

  stroke:white;
  stroke-width:2;
  fill:none;

}

.loginModal{
position:fixed;
top:0;
left:0;
width:100%;
height:100%;
background:rgba(0,0,0,0.55);
display:flex;
align-items:center;
justify-content:center;
z-index:1000;
}

.hidden{
display:none;
}

.loginCard{
background:#0f172a;
padding:30px;
border-radius:14px;
width:320px;
box-shadow:0 20px 50px rgba(0,0,0,0.5);
display:flex;
flex-direction:column;
gap:14px;
}

.loginTitle{
color:white;
font-size:18px;
font-weight:600;
margin-bottom:4px;
}

.loginInput{
background:#1e293b;
border:none;
padding:10px;
border-radius:8px;
color:white;
outline:none;
}

.loginButtons{
display:flex;
gap:10px;
margin-top:10px;
}

.loginPrimary{
flex:1;
background:#3b82f6;
border:none;
color:white;
padding:10px;
border-radius:8px;
cursor:pointer;
}

.loginGhost{
flex:1;
background:#1e293b;
border:none;
color:#cbd5f5;
padding:10px;
border-radius:8px;
cursor:pointer;
}

.profileCircle{
width:36px;
height:36px;
border-radius:50%;
background:#1e293b;
display:flex;
align-items:center;
justify-content:center;
color:white;
font-weight:700;
cursor:pointer;
transition:0.2s;
}

.profileCircle:hover{
background:#334155;
}

.loginError{
  margin-top:8px;
  color:#ef4444;
  font-size:13px;
}

.hidden{
  display:none;
}

.profileContainer{
  position:relative;
  display:none;  /* ← Use display:none instead */
}

.profileContainer.active{
  display:block;  /* ← Show when logged in */
}

.authButtons{
  display:flex;
  gap:10px;
  align-items:center;
}

.authButtons.hidden{
  display:none;  /* ← Hide when logged in */
}

.profileMenu{
  position:absolute;
  right:0;
  top:45px;
  width:180px;
  background:#111827;
  border-radius:10px;
  box-shadow:0 10px 30px rgba(0,0,0,0.4);
  padding:8px 0;
  z-index:1000;
}

.profileMenuItem{
  padding:10px 16px;
  font-size:14px;
  color:#e5e7eb;
  cursor:pointer;
}

.profileMenuItem:hover{
  background:#1f2937;
}

.profileDivider{
  height:1px;
  background:#374151;
  margin:6px 0;
}

.profileMenuItem.danger{
  color:#ef4444;
}

.hidden{
  display:none;
}

.avatarContainer{
  position:relative;
  width:120px;
  height:120px;
}



.avatarLayer{
  position:absolute;
  width:100%;
  height:100%;
  left:0;
  top:0;

  image-rendering: pixelated;
}

.siteFooter{
width:100%;
text-align:center;
padding:25px;
margin-top:40px;
border-top:1px solid #1f2937;
background:#020617;
}

.siteFooter a{
color:#9ca3af;
text-decoration:none;
font-size:14px;
}

.siteFooter a:hover{
color:white;
}

.signupSwitch span{
  color:#3b82f6;
  cursor:pointer;
  font-weight:500;
}

.signupSwitch span:hover{
  text-decoration:underline;
}

.signupPrimary{
  background:#3b82f6;
  color:white;
  border:none;
  padding:8px 16px;
  border-radius:8px;
  font-weight:600;
  cursor:pointer;
  transition:all .15s ease;
}

.signupPrimary:hover{
  background:#2563eb;
}

.authButtons{
  display:flex;
  gap:10px;
  align-items:center;
}

/* ===========================
   RIGHT PANEL: COMPACT ANALYSIS (APPLE STYLE)
   =========================== */

.resultsContent {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.resultsContent.hidden {
  display: none;
}

#quickMetrics {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #cbd5e1;
  padding-left: 8px;
}

.metricLine {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.metricLine:last-child {
  border-bottom: none;
}

.viewDetailsBtn {
  width: 100%;
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: white;
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
  margin-top: 8px;
}

.viewDetailsBtn:hover {
  background: linear-gradient(135deg, var(--blue-dark), #1d4ed8);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.viewDetailsBtn:active {
  transform: translateY(0);
}

/* ===========================
   EXPANDED MODAL
   =========================== */

.expandedModal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.expandedModal.hidden {
  display: none;
}

.modalOverlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.modalContent {
  position: relative;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  background: var(--panel);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.modalHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--panel-2);
}

.modalHeader h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.closeModalBtn {
  background: var(--panel-3);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.closeModalBtn:hover {
  background: #374151;
  transform: scale(1.05);
}

.closeModalBtn svg {
  stroke: #ffffff;
}

.modalBody {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

.modalBody::-webkit-scrollbar {
  width: 6px;
}

.modalBody::-webkit-scrollbar-thumb {
  background: #374151;
  border-radius: 3px;
}

.modalSection {
  margin-bottom: 32px;
}

.modalSection:last-child {
  margin-bottom: 0;
}

.modalSectionTitle {
  font-size: 13px;
  font-weight: 700;
  color: #86868b;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
}

.overviewGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.overviewCard {
  background: var(--panel-2);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.overviewLabel {
  font-size: 12px;
  color: #86868b;
  font-weight: 500;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.overviewValue {
  font-size: 32px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -1px;
}

.metricsTable {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.metricRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  background: var(--panel-2);
  border-radius: 10px;
  border-left: 4px solid var(--blue);
}

.metricRowLabel {
  font-size: 14px;
  color: #cbd5e1;
  font-weight: 500;
}

.metricRowValue {
  font-size: 15px;
  color: #ffffff;
  font-weight: 700;
}

.modalList {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modalList li {
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.6;
  color: #e5e7eb;
  background: var(--panel-2);
}

.modalList.positive li {
  border-left: 4px solid #10b981;
}

.modalList.negative li {
  border-left: 4px solid #ef4444;
}

.analyzeButton {
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border: none;
  border-radius: 8px;
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s ease;
  margin-top: 20px;
}

.analyzeButton:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.analyzeButton:active {
  transform: translateY(0);
}

.analyzeIcon {
  font-size: 18px;
  filter: brightness(1.2);
}

.ai-chat {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.navRight .authButtons button {
  pointer-events: auto;
}

/* ============================= */
/* MY TACTICS PAGE */
/* ============================= */

.myTacticsPage {
  padding: 40px 60px;
}

.pageTitle {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 30px;
}

/* GRID LAYOUT */
.tacticsGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}

/* CARD */
.tacticCard {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid rgba(255,255,255,0.05);
}

.tacticCard:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.4);
}

/* PREVIEW AREA (top box) */
.tacticPreview {
  height: 160px;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.3);
  font-size: 14px;
}

/* INFO */
.tacticInfo {
  padding: 14px;
}

.tacticTitle {
  font-weight: 600;
  font-size: 15px;
}

.tacticMeta {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  margin-top: 4px;
}

.miniPitch {
  position: relative;
  width: 100%;
  height: 140px;
  border-radius: 16px;
  overflow: hidden;

  /* grass look */
  background:
    linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01)),
    repeating-linear-gradient(
      90deg,
      rgba(255,255,255,0.02) 0px,
      rgba(255,255,255,0.02) 24px,
      rgba(255,255,255,0.01) 24px,
      rgba(255,255,255,0.01) 48px
    );

  border: 1px solid rgba(255,255,255,0.15);
}

.miniPitch::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  background: rgba(255,255,255,0.15);
  transform: translateY(-50%);
}

.miniPitch::after {
  content: "";
  position: absolute;
  width: 40px;
  height: 40px;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.miniPlayer {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #4da6ff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow:
    0 0 6px rgba(77,166,255,0.8),
    0 0 12px rgba(77,166,255,0.4);
}

.backButtonContainer {
  margin-bottom: 16px;
}

/* Back button: modern icon-only primary */
.backButtonContainer { margin: 18px 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  font-family: inherit;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.btn--primary {
  background: linear-gradient(180deg,#2f8bff 0%,#1e6ffb 100%);
  color: #fff;
  padding: 8px 12px;
  border-radius: 10px;
  box-shadow: 0 6px 22px rgba(30,111,251,0.16);
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
  min-height: 40px;
  min-width: 40px;
}

/* icon-only variant keeps it compact */
.btn--icon {
  padding: 8px;
  width: 44px;
  height: 44px;
}

/* SVG uses currentColor */
.btn--icon svg { color: #ffffff; display: block; }

/* Hover / active / focus */
.btn--primary:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(30,111,251,0.20); }
.btn--primary:active { transform: translateY(-1px); opacity: .95; }
.btn--primary:focus { outline: 3px solid rgba(47,139,255,0.16); outline-offset: 3px; }

/* Reduced motion respect */
@media (prefers-reduced-motion: reduce) {
  .btn--primary, .btn--primary:hover { transition: none; transform: none; }
}

.site-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(12px);
  background: rgba(20,20,30,0.9);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.35);
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
  z-index: 9999;
}
.site-toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

.save-status {
  font-size:13px;
  padding:6px 10px;
  border-radius:8px;
  background: rgba(255,255,255,0.02);
  color: #bcdcff;
  border:1px solid rgba(255,255,255,0.03);
  display:inline-flex;
  align-items:center;
  min-width:86px;
  justify-content:center;
  margin-right:8px;
}
.save-status.unsaved { background: linear-gradient(180deg,#3b3b3b,#2b2b2b); color:#ffd; box-shadow: 0 6px 18px rgba(0,0,0,0.24); }

.saveWrapper {
  display: inline-flex;
  position: relative;
  border-radius: 10px;
  overflow: hidden;
}

.saveWrapper .btn {
  border-radius: 0;
}

#saveMainBtn {
  width: 100%;
  margin-top: 10px;
}

.saveToggle {
  width: 40px;
  padding: 0;
  border-left: 1px solid rgba(255,255,255,0.1);
}

.saveDropdown {
  position: absolute;
  top: 110%;
  right: 0;
  background: #1e293b;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 6px;
  min-width: 220px;
  z-index: 1000;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.saveOption {
  padding: 10px 14px;
  cursor: pointer;
  border-radius: 6px;
  transition: 0.2s;
}

.saveOption:hover {
  background: rgba(255,255,255,0.08);
}

.hidden {
  display: none;
}

/* FIX SAVE MENU POSITION */
.saveWrapper {
  position: relative;
  display: inline-block;
}

/* Make dropdown behave like export */
#saveMenu {
  position: absolute;
  bottom: 110%;   /* opens upward like export */
  left: 0;
  min-width: 180px;
  z-index: 999;
}

/* Prevent full width bug */
#saveMenu div {
  white-space: nowrap;
}

/* Save wrapper and menu - FIXED */
.exportWrapper.saveWrapper {
  position: relative;
  width: 100%;
  margin-top: 10px;
}

.exportWrapper.saveWrapper .toolBtn {
  width: 100%;
}

#saveMenu {
  position: fixed;  /* Changed from absolute to fixed */
  bottom: auto;
  top: auto;
  left: auto;
  width: 200px;
  background: #0f172a;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  box-shadow: 0 -10px 30px rgba(0,0,0,0.6);
  display: none;
  flex-direction: column;
  overflow: visible;
  z-index: 99999;
}

#saveMenu.open {
  display: flex;
}

#saveMenu div {
  background: none;
  border: none;
  color: white;
  text-align: left;
  padding: 12px 14px;
  cursor: pointer;
  font-size: 13px;
  transition: .15s;
  width: 100%;
  box-sizing: border-box;
}

#saveMenu div:hover {
  background: #1e293b;
}

#saveMenu div:first-child {
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* Password Input Wrapper */
.passwordInputWrapper {
  position: relative;
  width: 100%;
}

.passwordInputWrapper .loginInput {
  padding-right: 45px;
  width: 100%;
  background-image: none !important;
}

.passwordToggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  transition: color 0.2s ease;
  z-index: 10;
}

.passwordToggle:hover {
  color: #cbd5e1;
}

.passwordToggle:focus {
  outline: 2px solid rgba(59, 130, 246, 0.5);
  outline-offset: 2px;
  border-radius: 4px;
}

.eyeIcon {
  pointer-events: none;
}

.eyeClosed {
  display: block;
}

.eyeOpen {
  display: none;
}

.passwordToggle.visible .eyeOpen {
  display: block;
}

.passwordToggle.visible .eyeClosed {
  display: none;
}