/* --- "THE DIGITAL RINK" DESIGN SYSTEM --- */
:root {
  --primary-purple: #7c3aed;
  --primary-red: #dc2626;
  --primary-color: var(--primary-red); /* Team color, set by JS */
  --primary-color-dark: #b91c1c; /* Team color dark, set by JS */
  --primary-color-glow: rgba(220, 38, 38, 0.3); /* Team color glow, set by JS */

  --dark-bg: #0a0a0c;
  --panel-bg: rgba(28, 32, 40, 0.65);
  --dark-bg-light: #2a2f38;
  --text-light: #d0d8e0;
  --text-lighter: #ffffff;
  --border-color: rgba(255, 255, 255, 0.1);
  --border-color-hover: rgba(255, 255, 255, 0.3);

  --danger-color: #e53e3e;
  --danger-hover: #c53030;
  --save-color: #38A169;
  --goal-color: #f87171;
  --archive-color: #3b82f6;
  --notes-color: #3b82f6;
  --notes-hover: #2563eb;
  --archive-glow: rgba(59, 130, 246, 0.2);
  --success-color: #48bb78;
}

html,body{
  height:100%;margin:0;font-family:'Roboto', ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial; color: var(--text-light); overflow: hidden;
  -webkit-text-size-adjust: 100%; /* Prevent zoom on rotation */
  text-size-adjust: 100%; /* Standard */
}

body{
  background-color: var(--dark-bg);
  background-image: linear-gradient(rgba(10, 10, 12, 0.8), rgba(10, 10, 12, 0.95)), url(https://images.unsplash.com/photo-1542736415-8d57b5415415?q=80&w=2070&auto=format&fit=crop);
  background-size: cover;
  background-position: center;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}

.hidden{display:none !important}

/* --- MODERN LOGIN FORM STYLES --- */
@keyframes slide-up-fade-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
#authOverlay .modal-content, #resetPasswordOverlay .modal-content {
  animation: slide-up-fade-in 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
.form-group { position: relative; }
.form-group .form-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  width: 20px;
  height: 20px;
}
.form-group input { padding-left: 40px; }
#authError, #passwordPromptError {
  background: rgba(229, 62, 62, 0.1);
  border: 1px solid var(--danger-color);
  color: var(--danger-color);
  border-radius: 6px;
  padding: 10px;
  font-size: 0.9rem;
  text-align: center;
  margin-bottom: 1rem;
  transition: all 0.3s ease;
}

#command-bar { overflow-x: auto; overflow-y: hidden; scroll-behavior: smooth; white-space: nowrap;
  position: fixed; left: 0; top: 0; height: 100%; width: 60px;
  background-color: rgba(10, 10, 12, 0.8); border-right: 1px solid var(--border-color);
  z-index: 200; display: flex; flex-direction: column; align-items: center; padding-top: 20px; gap: 15px;
}
.command-btn { background: none; border: none; padding: 10px; border-radius: 8px; cursor: pointer; transition: all 0.2s ease; }
.command-btn svg { width: 24px; height: 24px; color: var(--text-light); transition: all 0.2s ease; }
.command-btn:hover svg, .command-btn.active svg { color: var(--primary-color); }
.command-btn.active { background-color: var(--primary-color-glow); }
#app-container { margin-left: 60px; width: calc(100% - 60px); height: 100%; position: relative; }

.app-shell, .page-shell { width: 100%; height: 100%; box-sizing: border-box; position: relative; max-width: 1800px; margin: 0 auto; padding: 12px; }
#goalieEyeShell { display: flex; gap: 12px; }

.panel {
  background: var(--panel-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,0.4); border: 1px solid var(--border-color);
  display: flex; flex-direction: column; gap: 12px;
  position: absolute; overflow: hidden; touch-action: none; box-sizing: border-box; padding: 20px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.panel:hover { border-color: rgba(255, 255, 255, 0.2); }
.app-header {
  display:flex; justify-content:space-between; align-items:center;
  padding-bottom: 12px; border-bottom: 1px solid var(--border-color);
  flex-shrink: 0; margin: -20px -20px 0 -20px; padding: 16px 20px;
  transition: padding 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.drag-handle { cursor: move; flex-grow: 1; user-select: none; }

.full-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(10, 10, 12, 0.7); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); z-index: 300; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; transition: opacity 0.5s ease, visibility 0.5s; }
.full-overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none;}
.app-logo { width: 120px; height: 120px; object-fit: contain; margin-bottom: 10px; }
.team-selection { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 30px; justify-content: center; }
.team-card { position: relative; background: var(--panel-bg); border: 1px solid var(--border-color); border-radius: 12px; padding: 20px; cursor: pointer; transition: all 0.2s ease; width: 180px; }
.team-card:hover { transform: translateY(-5px); border-color: var(--primary-color); background: rgba(28,32,40,0.9); }
.team-logo { height: 100px; width: 100px; margin: 0 auto 15px auto; object-fit: contain; }
.delete-team-btn {
  position: absolute; top: 8px; right: 8px; background-color: var(--danger-color); color: white;
  border: none; border-radius: 50%; width: 24px; height: 24px; font-size: 14px;
  line-height: 24px; text-align: center; cursor: pointer; transition: all 0.2s ease;
  opacity: 0; z-index: 10; font-weight: bold;
}
.team-card:hover .delete-team-btn { opacity: 1; transform: scale(1.1); }
.team-card:hover .delete-team-btn:hover { background-color: var(--danger-hover); }

.btn {
  background: var(--dark-bg-light); padding: 10px 14px; border-radius: 8px; font-weight: 500;
  transition: all 0.2s; border: 1px solid var(--border-color); color: var(--text-lighter); cursor: pointer;
  text-align: center; font-size: 0.95rem; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn svg { width: 18px; height: 18px; }
.btn:hover:not(:disabled) { background: #3c424e; border-color: var(--border-color-hover); transform: translateY(-1px); }
.btn.primary { background-color: var(--primary-color); color: var(--text-lighter); border-color: var(--primary-color); font-weight: 700; }
.btn.primary:hover:not(:disabled) { background-color: var(--primary-color-dark); border-color: var(--primary-color-dark); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.active { background-color: var(--primary-color) !important; color: var(--text-lighter) !important; border-color: var(--primary-color) !important; font-weight: 700; }
.btn#showArchivedBtn.active { background-color: var(--archive-color) !important; border-color: var(--archive-color) !important; }
.panel .btn-group, .panel #statusBadge, .panel #sessionInfo { transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s; }

.form-group input, .form-group textarea, .form-group select {
  width: 100%; box-sizing: border-box; padding: 10px; border-radius: 6px;
  background: var(--dark-bg-light); border: 1px solid var(--border-color); color: var(--text-lighter);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 2px var(--primary-color-glow);
}

@keyframes pulse-red { 0%, 100% { box-shadow: 0 0 10px 2px rgba(229, 62, 62, 0.6); } 50% { box-shadow: 0 0 20px 5px rgba(229, 62, 62, 0.8); } }
.recording-glow { border-color: var(--danger-color) !important; animation: pulse-red 1.5s ease-in-out infinite; }

.player{background:#000;border-radius:10px;display:flex;align-items:center;justify-content:center;overflow:hidden;height:auto; flex: 1; border: 1px solid var(--border-color); position: relative; box-sizing: border-box;}

.live-overlay{ position:absolute; width:320px; min-width: 200px; background: var(--panel-bg); backdrop-filter: blur(12px); border-radius:12px; padding:12px; border:1px solid var(--border-color); z-index:110; box-shadow:0 20px 40px rgba(0,0,0,0.6); transition: max-height 0.3s ease-in-out; display: flex; flex-direction: column; touch-action: none; overflow-y: auto; max-height: 70vh; }
#livePreview { flex-grow: 1; min-height: 0; background-color: #000; border-radius: 4px;}

.live-overlay.minimized { max-height: 48px; }
.live-overlay.minimized #livePreview,
.live-overlay.minimized #liveControls,
.live-overlay.minimized #goalLocationContainer { display: none; }

.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.75); backdrop-filter: blur(5px); z-index: 350; display: flex; align-items: center; justify-content: center; padding: 16px; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-content { max-width: 95vw !important; height: auto !important; background: var(--panel-bg); padding: 24px; border-radius: 12px; width: 100%; max-width: 500px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); border: 1px solid var(--border-color); display: flex; flex-direction: column; gap: 16px; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }

/* --- PAGE SHELL & CONTENT STRUCTURE --- */
.page-shell { padding: 20px; max-width: 1800px; margin: 0 auto; display: flex; flex-direction: column; height: 100%; box-sizing: border-box; }
.page-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; margin-bottom: 20px; flex-shrink: 0; flex-wrap: wrap; gap: 1rem; }
.page-content { flex: 1; overflow-y: auto; padding-right: 5px; min-height: 0; }
.list-item { background: rgba(42, 47, 56, 0.5); padding: 10px 15px; border-radius: 8px; margin-bottom: 8px; cursor: pointer; transition: background-color 0.2s, border-color 0.2s; display: flex; justify-content: space-between; align-items: center; border: 1px solid transparent; }
.list-item:hover { background-color: rgba(60, 66, 78, 0.7); border-color: var(--border-color); }

/* --- ARCHIVE VIEW --- */
.library-panel.archive-view {
  border-color: var(--archive-color);
  box-shadow: 0 8px 30px var(--archive-glow);
}
.library-panel.archive-view #selectors-container {
  display: none;
}

/* --- GAME CARD STYLES --- */
.game-card {
    background-color: #1f2937;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}
.game-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-4px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.game-card .team-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
    flex-shrink: 0;
}
.game-card .game-info {
    flex-grow: 1;
    text-align: center;
}
.game-card .team-names {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-lighter);
    letter-spacing: 0.05em;
}
.game-card .game-date {
    font-size: 0.8rem;
    color: var(--primary-color);
    font-weight: 500;
    margin-top: 0.25rem;
    text-transform: uppercase;
}
.game-card .game-score {
    margin-top: 0.5rem;
    font-size: 1.5rem;
    font-weight: 900;
    color: white;
}

/* --- GAME EVENT LIST STYLES --- */
.game-event-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
}
.game-event-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #000;
}
.game-event-icon.goal-for { background-color: var(--success-color); }
.game-event-icon.goal-against { background-color: var(--danger-color); }
.game-event-icon.save { background-color: var(--archive-color); }

/* --- CINEMA MODE & PIP --- */
#goalieEyeShell.cinema-mode #main-panel { width: 100% !important; height: 100% !important; top: 0 !important; left: 0 !important; transform: none !important; z-index: 100; }
#goalieEyeShell.cinema-mode #main-panel .app-header { padding-top: 8px; padding-bottom: 8px; }
#goalieEyeShell.cinema-mode #library-panel { width: 80px !important; height: 100% !important; top: 0 !important; left: calc(100% - 80px) !important; transform: none !important; }
#goalieEyeShell.cinema-mode #library-panel > *:not(.app-header) { display: none; }
#goalieEyeShell.cinema-mode .drag-handle { cursor: default; pointer-events: none; }
#goalieEyeShell.cinema-mode #library-panel .app-header .drag-handle { display: none; }
#goalieEyeShell.cinema-mode .btn-group,
#goalieEyeShell.cinema-mode #statusBadge,
#goalieEyeShell.cinema-mode #sessionInfo { display: none !important; }
#goalieEyeShell.cinema-mode #createClipBtn { display: flex; }

#goalieEyeShell.cinema-mode #main-timeline-container {
    display: block !important;
    z-index: 200 !important;
    bottom: 70px !important;
    left: 12px !important;
    right: 12px !important;
}
#goalieEyeShell.cinema-mode .timestamp-marker {
    z-index: 210 !important;
}

.pip-overlay { position: fixed; bottom: 20px; right: 20px; width: 200px; height: 112.5px; z-index: 2147483647; border: 2px solid var(--primary-color); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.6); overflow: hidden; cursor: move; touch-action: none; background: #000; opacity: 0; transition: opacity 0.4s ease; pointer-events: none; }
.pip-overlay.visible { opacity: 1; pointer-events: auto; }
#pipVideo { width: 100%; height: 100%; object-fit: cover; }

.timestamp-marker {
  position: absolute; top: 50%; transform: translateY(-50%); width: 8px; height: 8px;
  border-radius: 50%; border: 1px solid white; z-index: 11; box-shadow: 0 0 5px rgba(0,0,0,0.7);
}

/* --- SYNC & UPLOAD --- */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast-message { background-color: var(--panel-bg); color: var(--text-lighter); padding: 12px 20px; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.5); opacity: 0; transform: translateX(100%); transition: all 0.3s ease; border: 1px solid var(--border-color); backdrop-filter: blur(10px); }
.toast-message.show { opacity: 1; transform: translateX(0); }
.toast-message.success { border-left: 4px solid var(--success-color); }
.toast-message.error { border-left: 4px solid var(--danger-color); }

.clip-thumbnail-wrapper {
  position: relative;
  flex-shrink: 0;
  border-radius: 4px;
  overflow: hidden;
}
.thumbnail-progress-overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
  pointer-events: none;
  opacity: 0;
}
 .thumbnail-progress-overlay.visible {
  opacity: 1;
}
.progress-bar-container {
  width: 80%;
  height: 6px;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar-fill {
  width: 0%;
  height: 100%;
  background-color: var(--primary-color);
  transition: width 0.2s ease-out, background-color: 0.3s ease;
}
.progress-text {
  margin-top: 4px;
  font-size: 0.7rem;
  font-weight: bold;
  color: #fff;
}

/* --- PLAYER DETAIL MODAL --- */
.modal-content.player-detail-modal {
    max-width: 800px;
    height: 80vh;
}
 .player-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}
.player-detail-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.player-detail-tabs .tab-btn {
    padding: 8px 16px;
    border-radius: 6px 6px 0 0;
    border: 1px solid transparent;
    border-bottom: none;
    background: none;
    color: var(--text-light);
    cursor: pointer;
}
.player-detail-tabs .tab-btn.active {
    background: var(--dark-bg-light);
    border-color: var(--border-color);
    font-weight: bold;
    color: var(--text-lighter);
}
.player-detail-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 4px 0 0;
    min-height: 0;
}
.detail-tab-pane {
    display: none;
}
.detail-tab-pane.active {
    display: block;
}
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}
 .info-grid .info-item strong {
    display: block;
    color: var(--primary-color);
    font-size: 0.8rem;
    margin-bottom: 2px;
}
.stats-container {
    display: flex;
    gap: 20px;
    flex-direction: column;
}
@media (min-width: 640px) {
    .stats-container { flex-direction: row; }
}
.shot-map-container {
    flex: 1;
    min-width: 250px;
    position: relative;
}
 .shot-map-container canvas {
    width: 100%;
    border-radius: 8px;
    background-color: #111827;
    cursor: pointer;
 }
 #shot-map-tooltip {
      position: absolute;
      background: var(--panel-bg);
      border: 1px solid var(--border-color);
      padding: 8px 12px;
      border-radius: 6px;
      font-size: 0.85rem;
      pointer-events: none;
      opacity: 0;
      transition: opacity 0.2s;
      z-index: 10;
      backdrop-filter: blur(10px);
 }
.stats-summary {
    flex-shrink: 0;
}

/* --- ROSTER PAGE STYLES --- */
.roster-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.roster-tabs .tab-btn {
  padding: 8px 20px;
  font-weight: 700;
  background-color: #3c424e;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s ease;
}
.roster-tabs .tab-btn.active {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}
.roster-page-content > .tab-pane {
  display: none;
}
.roster-page-content > .tab-pane.active {
  display: block;
}
.line-group {
  margin-bottom: 24px;
}
.line-header {
  position: relative;
  background: linear-gradient(90deg, rgba(10, 10, 12, 0) 0%, rgba(28, 32, 40, 0.8) 100%);
  color: var(--text-lighter);
  padding: 4px 20px;
  font-weight: bold;
  margin-bottom: 12px;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}
.player-dropzone {
  display: flex;
  gap: 12px;
  min-height: 60px;
  padding: 8px;
  background-color: rgba(0,0,0,0.15);
  border-radius: 8px;
  border: 1px dashed var(--border-color);
  flex-wrap: wrap;
}

.roster-page-content .sortable-ghost {
  opacity: 0.4;
  background: var(--primary-color);
}

/* --- PLAYER CARD STYLES --- */
.roster-page-content .draggable-player {
    flex: 1 1 450px;
    max-width: 480px;
    min-width: 400px;
    height: 110px;
    padding: 0;
    background-color: #374151;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: stretch;
    font-family: 'Roboto', sans-serif;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: grab;
    transition: border-color 0.2s;
}
.roster-page-content .draggable-player:hover {
    border-color: var(--primary-color);
}
.roster-page-content .draggable-player:active { cursor: grabbing; }

.player-card-new {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: flex-start;
}

.pc-left {
    flex: 0 0 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 8px;
    text-align: center;
}
.pc-number {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1;
    color: var(--primary-color);
}
.pc-name {
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.pc-info {
    background-color: rgba(200, 200, 210, 0.9);
    color: #111827;
    padding: 8px 12px;
    font-size: 0.7rem;
    line-height: 1.4;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: 6px;
    margin: 8px 0;
}
.pc-info strong {
    font-weight: 900;
    font-size: 0.75rem;
    text-transform: uppercase;
    display: block;
    margin-bottom: 2px;
}

.pc-stats {
    flex-grow: 1;
    display: flex;
    position: relative;
}
.pc-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    color: #000;
    font-weight: 900;
    clip-path: polygon(25% 0, 100% 0, 75% 100%, 0% 100%);
}
.pc-stat:first-child {
    clip-path: polygon(0 0, 100% 0, 75% 100%, 0% 100%);
}
.pc-stat:last-child {
    clip-path: polygon(25% 0, 100% 0, 100% 100%, 0% 100%);
}

.pc-stat-num {
    font-size: 2.2rem;
    line-height: 1;
}
.pc-stat-label {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    text-transform: uppercase;
    font-size: 0.8rem;
    margin-top: 4px;
    font-weight: 700;
    line-height: 1;
}

.stat-goals { background: #ef4444; }
.stat-saves { background: #22c55e; }
.stat-notes { background: #3b82f6; }

.pc-delete-btn {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 22px;
    height: 22px;
    background-color: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
    z-index: 10;
}
.pc-delete-btn:hover {
    transform: scale(1.1);
    background-color: var(--danger-hover);
}

/* --- ROSTER BUILDER --- */
.roster-builder-container {
  display: flex;
  gap: 20px;
  height: 100%;
  max-height: calc(100% - 60px);
}
.builder-panel {
  background: rgba(42, 47, 56, 0.5);
  border-radius: 8px;
  padding: 15px;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.available-players-panel {
  flex: 1;
  min-width: 300px;
}
.sheet-preview-panel {
  flex: 3;
}
.builder-panel-content {
  flex-grow: 1;
  overflow-y: auto;
  padding-right: 5px;
}
.player-source-list {
  min-height: 50px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px;
}
.draggable-player {
  background-color: var(--dark-bg-light);
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 6px;
  cursor: grab;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border-color);
  font-size: 0.9rem;
}
.draggable-player:active { cursor: grabbing; }
.draggable-player .player-number {
  font-weight: bold;
  color: var(--primary-color);
  margin-right: 10px;
}
.line-chart-grid {
  display: grid;
  grid-template-columns: 50px 1fr 1fr 1fr;
  gap: 4px;
  align-items: center;
}
.line-chart-grid.defense {
  grid-template-columns: 50px 1fr 1fr;
}
.line-header-builder {
  font-weight: bold;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-lighter);
  position: relative; /* Added for star */
}
.position-label {
  font-size: 0.7rem;
  color: var(--text-light);
  text-align: center;
  padding-bottom: 4px;
}
.player-slot {
  background-color: rgba(0,0,0,0.2);
  border: 1px dashed var(--border-color);
  border-radius: 6px;
  min-height: 48px;
  padding: 4px;
}
.player-slot .draggable-player {
  margin-bottom: 0;
}
.sortable-ghost {
  opacity: 0.4;
  background: var(--primary-color);
}
#opponentLogoPreview {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background-color: var(--dark-bg-light);
}

/* --- WELCOME SCREEN --- */
#welcomeOverlay .app-logo {
  background: var(--dark-bg);
  border-radius: 50%;
}
#welcomeOverlay .welcome-content {
    position: relative;
}
#welcomeSignOutBtn {
    position: absolute;
    top: -20px;
    right: -20px;
    color: white;
}

/* ==============================================
=== MOBILE & RESPONSIVE OPTIMIZATION START ===
==============================================
*/
@media (max-width: 900px) {
 #command-bar {
  top: auto;
  bottom: 0;
  width: 100%;
  height: calc(60px + env(safe-area-inset-bottom));
  flex-direction: row;
  justify-content: flex-start; /* Keeps icons aligned to the left */
  align-items: center;
  overflow-x: auto; /* Allows horizontal scrolling if icons overflow */
  overflow-y: hidden;
  white-space: nowrap; /* Prevents icons from wrapping to a new line */
  flex-wrap: nowrap; /* Explicitly prevent wrapping */
  padding: 0 15px;
  padding-bottom: env(safe-area-inset-bottom);
  border-right: none;
  border-top: 1px solid var(--border-color);
  background-color: rgba(10, 10, 12, 0.85);
  backdrop-filter: blur(10px);
  gap: 15px;
}
/* This is a new rule for the app container to accommodate the new side bar */
#app-container {
    margin-left: calc(60px + env(safe-area-inset-left)); /* Match the command bar width */
    padding-right: env(safe-area-inset-right); /* Add padding on the other side */
    width: calc(100% - (60px + env(safe-area-inset-left)));
    height: 100%;
    padding-bottom: 0; /* Remove bottom padding from portrait mode */
}
  #command-bar > div:last-child {
    margin-top: 0;
    margin-bottom: 0;
    margin-left: auto;
    height: 100%;
    flex-direction: row;
    align-items: center;
  }

  #command-bar > div {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    width: auto !important;
    flex-direction: row !important;
  }

  #app-container {
      margin-left: 0; width: 100%;
      height: calc(100% - (60px + env(safe-area-inset-bottom)));
      padding-bottom: calc(60px + env(safe-area-inset-bottom));
  }
  .app-shell, .page-shell { padding: 12px; }

  #goalieEyeShell.cinema-mode #main-timeline-container {
      display: block !important;
  }
  #clipPlayerContainer.player {
      padding-bottom: 40px;
  }
  #main-timeline-container {
      bottom: 82px !important;
      left: 12px !important;
      right: 12px !important;
      z-index: 200 !important;
  }
  .timestamp-marker {
      z-index: 210 !important;
  }

  .full-overlay {
      padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }
  .modal-content, .source-clips-content {
      max-width: 95vw;
      height: auto !important;
      padding: 16px;
  }

  html { font-size: 16px; }

  .panel { padding: 15px; }
  .panel .app-header { margin: -15px -15px 0 -15px; padding: 12px 15px; }

  .btn, .form-group input, .form-group select, .form-group textarea {
      font-size: 1rem;
      padding-top: 12px;
      padding-bottom: 12px;
  }
  .btn.primary { padding-top: 14px; padding-bottom: 14px; }
  .btn svg { width: 20px; height: 20px; }
  .btn.danger, .btn.archive-btn, #addGoalieBtn, #delGoalieBtn, #addDrillBtn, #delDrillBtn {
      padding: 8px !important;
  }

  .text-2xl { font-size: 1.3rem; }
  .text-xl { font-size: 1.15rem; }

  #editorShell .editor-main {
      flex-direction: column;
  }
  #editorShell #playlist-panel,
  #editorShell #source-clips-panel {
      width: 100%;
      height: 200px;
      flex-shrink: 0;
      flex-basis: auto;
  }
  #editorShell #trimmer-panel {
      min-height: 0;
  }


/* Start of Portrait Orientation Styles */
@media (orientation: portrait) {
    html, body { overflow: auto; }
    #app-container { height: auto; min-height: calc(100dvh - 60px); }
    #goalieEyeShell { flex-direction: column; gap: 15px; }
    .panel { position: relative !important; width: 100% !important; height: auto !important; left: auto !important; top: auto !important; transform: none !important; resize: none; }
    .drag-handle, #cinemaModeBtn { display: none; }

   /* Live overlay adjustments for portrait */
    .live-overlay {
      position: absolute; /* Keep absolute for portrait */
      width: 320px;
      min-width: 200px;
      background: var(--panel-bg);
      backdrop-filter: blur(12px);
      border-radius: 12px;
      padding: 12px;
      border: 1px solid var(--border-color);
      z-index: 110;
      box-shadow: 0 20px 40px rgba(0,0,0,0.6);
      transition: max-height 0.3s ease-in-out;
      display: flex;
      flex-direction: column;
      touch-action: none;
      overflow-y: auto; /* Ensures scrollability */
      max-height: 70vh; /* Limits height */
    }

    /* Goal location container layout */
    #goalLocationContainer {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid var(--border-color);
        flex-shrink: 0; /* <-- FIX: Prevents growing too large */
        min-height: 0; 
    }

    #goalLocationContainer #goal-net-container-live {
        flex-grow: 1; /* Let canvas container take available space */
        min-height: 0; /* Allows canvas container to shrink */
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* NEW rule to ensure canvas respects its container height */
    #goalLocationContainer #goal-net-container-live canvas {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }


    #goalLocationContainer .flex.justify-end {
        flex-shrink: 0; /* Prevent button group shrinking */
    }

    /* Other portrait adjustments */
    #liveControls .btn { padding: 10px; font-size: 0.9rem; }

    #selectors-container {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .selectors-group {
        flex: 1;
    }

    #clipsGallery .list-item {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 8px;
    }
    #clipsGallery .list-item .clip-thumbnail-wrapper {
        flex-shrink: 0;
    }
    #clipsGallery .list-item .flex-grow {
        min-width: 150px;
    }
     #clipsGallery .list-item .flex-col {
        margin-left: auto;
    }

    .pip-overlay { bottom: 70px; }
} /* End of Portrait Orientation Styles */

  @media (orientation: landscape) {
    html, body { overflow: hidden; }

    #goalieEyeShell { flex-direction: row; gap: 12px; }
    .panel { position: relative !important; height: 100% !important; width: auto !important; top: 0 !important; left: 0 !important; transform: none !important; min-width: 0; min-height: 0; }
    .drag-handle, #cinemaModeBtn { display: none; }
    #main-panel { flex: 5; }
    #library-panel { flex: 1; min-width: 250px; }
    #clipsGallery { flex-grow: 1; overflow-y: auto; }
    .live-overlay { position: fixed !important; width: 280px !important; top: 15px !important; right: 15px !important; bottom: auto; left: auto; } /* Base rule with overflow-y: auto still applies */

    #editorShell .editor-main {
       flex-direction: row;
    }
    #editorShell #source-clips-panel {
        width: 220px;
        height: auto;
    }
  }
}

/* --- THEME OVERRIDE FOR LOGIN & WELCOME SCREENS --- */
#authOverlay,
#welcomeOverlay {
    background: #111214 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
#authOverlay .modal-content,
#welcomeOverlay .welcome-content {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: none !important;
    box-shadow: none !important;
    gap: 0 !important;
}
#authOverlay .modal-content { max-width: 360px !important; }
#authOverlay .app-logo { width: 50px !important; height: 50px !important; margin: 0 auto 1rem auto !important; }
#authOverlay #authTitle { font-size: 1.25rem !important; font-weight: 500 !important; color: var(--text-lighter) !important; margin-bottom: 2rem !important; }
#authOverlay .form-group { margin-bottom: 0.75rem !important; }
#authOverlay form { gap: 0 !important; }
#authOverlay .form-group input { background-color: #2a2f38 !important; border: 1px solid #3c424e !important; border-radius: 6px !important; padding-top: 0.8rem !important; padding-bottom: 0.8rem !important; font-size: 1rem !important; color: var(--text-lighter) !important; }
#authOverlay .form-group input::placeholder { color: #9ca3af; }
#authOverlay .form-group input:focus { border-color: var(--primary-red) !important; box-shadow: none !important; }
#authOverlay .btn.primary { background-color: var(--primary-red) !important; border: none !important; border-radius: 6px !important; font-weight: 500 !important; text-transform: none !important; margin-top: 1rem !important; padding-top: 0.8rem !important; padding-bottom: 0.8rem !important; }
#authOverlay .btn.primary:hover:not(:disabled) { background-color: var(--primary-color-dark) !important; }
#authOverlay #forgotPasswordLink, #authOverlay #authToggle { margin-top: 1rem !important; color: #9ca3af !important; font-size: 0.8rem !important; font-weight: 400 !important; }
#authOverlay #authToggle { margin-top: 0.5rem !important; }
#welcomeOverlay .welcome-content > .app-logo { width: 60px; height: 60px; margin: 0 auto 1rem auto; }
#welcomeOverlay .welcome-header-group { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-bottom: 0.5rem; }
#welcomeOverlay h1 { font-size: 2rem !important; margin: 0 !important; }
#welcomeOverlay #welcomeSignOutBtn { position: static !important; padding: 6px !important; border: 1px solid var(--border-color) !important; background: transparent !important; border-radius: 8px; color: var(--text-light) !important; }
#welcomeOverlay #welcomeSignOutBtn:hover { background: var(--dark-bg-light) !important; }
#welcomeOverlay #welcomeSignOutBtn svg { width: 22px; height: 22px; }
#welcomeOverlay .welcome-content > p { color: #9ca3af !important; margin-top: 0 !important; }
#welcomeOverlay .team-selection { margin-top: 2.5rem; gap: 1.5rem; padding-left: 1rem; padding-right: 1rem; }
#welcomeOverlay .team-card { background-color: #1c2028 !important; border: 1px solid #3c424e !important; width: 160px; height: 160px; display: flex !important; flex-direction: column; justify-content: center; align-items: center; gap: 1rem; border-radius: 12px; padding: 1rem; }
#welcomeOverlay .team-card .team-logo { height: 70px; width: 70px; margin: 0 !important; }
#welcomeOverlay .team-card h2 { font-size: 1rem; font-weight: 500; color: var(--text-lighter); }
#welcomeOverlay #add-team-btn { color: #9ca3af; gap: 0.5rem !important; }
#welcomeOverlay #add-team-btn span:first-child { font-size: 2rem; font-weight: 300; line-height: 1; margin-bottom: 0 !important; }
#welcomeOverlay #add-team-btn span:last-child { font-size: 1rem; font-weight: 500; }

/* --- COACHES LOCKDOWN MODE --- */
body.lockdown-active #command-bar .command-btn:not(#lockdownBtn) {
    opacity: 0.3;
    pointer-events: none;
    cursor: not-allowed;
}
body.lockdown-active #lockdownBtn svg {
    color: var(--primary-red);
}

/* --- SETTINGS PAGE --- */
.settings-section {
  background: rgba(42, 47, 56, 0.5);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
  border: 1px solid var(--border-color);
}
.settings-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-lighter);
}
.settings-section .danger-zone-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.settings-section .danger-zone-content + .danger-zone-content {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

/* === INLINE BEAUTY THEME === */
:root{
  --shadow-color: 0 10px 30px rgba(2,6,23,.45);
  --ring-focus: 0 0 0 2px rgba(255,255,255,.08), 0 0 0 6px var(--primary-color-glow);
}
* { -webkit-tap-highlight-color: transparent; }
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.25) transparent; }
*::-webkit-scrollbar{ height:10px;width:10px }
*::-webkit-scrollbar-track{ background: transparent }
*::-webkit-scrollbar-thumb{
  background: linear-gradient(180deg, rgba(255,255,255,.15), rgba(255,255,255,.05));
  border-radius: 999px; border:1px solid rgba(255,255,255,.12);
}
.panel{
  background: linear-gradient(180deg, rgba(28,32,40,.65), rgba(22,26,35,.65));
  box-shadow: var(--shadow-color);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.panel:hover{ transform: translateY(-2px); border-color: var(--border-color-hover); }
.app-header{
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,0));
}
#command-bar{ backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
#command-bar .command-btn{ position:relative; isolation:isolate; }
#command-bar .command-btn.active{ background: linear-gradient(180deg, rgba(220,38,38,.18), rgba(220,38,38,.10)); box-shadow: 0 6px 16px rgba(220,38,38,.18); }
.btn{ position:relative; overflow:hidden; box-shadow: 0 1px 0 rgba(255,255,255,.05) inset; transition: transform .15s ease, border-color .2s ease, background .2s ease; }
.btn:hover:not(:disabled){ transform: translateY(-1px); }
.btn:active{ transform: translateY(0); }
.btn.primary{ background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-color-dark) 100%); border-color: rgba(0,0,0,.2); }
.btn.primary:hover{ filter: brightness(1.02); }
.btn:focus-visible{ outline: none; box-shadow: var(--ring-focus); }
.team-card, .list-item, .game-card{
  background: linear-gradient(180deg, rgba(37,42,53,.7), rgba(28,32,40,.7));
  transition: transform .18s ease, border-color .2s ease, box-shadow .2s ease;
}
.team-card:hover, .list-item:hover, .game-card:hover{
  transform: translateY(-3px);
  border-color: var(--border-color-hover);
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.player{ box-shadow: var(--shadow-color); border-radius: 14px; }
.live-overlay{ box-shadow: 0 20px 50px rgba(2,6,23,.6); }
.pip-overlay{ border-color: var(--primary-color); box-shadow: 0 14px 40px rgba(220,38,38,.25); }
.modal-overlay.active{ backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.modal-content{ background: linear-gradient(180deg, rgba(28,32,40,.9), rgba(18,22,31,.92)); box-shadow: 0 40px 80px rgba(0,0,0,.6); }
.form-group input, .form-group textarea, .form-group select{ background: rgba(36,42,53,.95); transition: border-color .2s ease, box-shadow .2s ease, background .2s ease; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus{
  border-color: var(--primary-color); box-shadow: 0 0 0 2px var(--primary-color-glow); background: rgba(36,42,53,1);
}
.game-event-icon{ box-shadow: 0 6px 16px rgba(0,0,0,.35); color:#0a0a0c; }
#toast-container .toast-message{ box-shadow: var(--shadow-color); }
.player-slot{ background: repeating-linear-gradient(45deg, rgba(255,255,255,.04) 0 6px, rgba(255,255,255,0) 6px 12px); }
#shot-map-tooltip{ transform: translateY(-6px); }
.library-panel.archive-view{ box-shadow: 0 14px 40px rgba(59,130,246,.25); border-color: rgba(59,130,246,.5); }
.pc-number{ text-shadow: 0 2px 0 rgba(0,0,0,.25), 0 8px 24px rgba(0,0,0,.25); }
:focus-visible{ outline: none; box-shadow: var(--ring-focus); border-radius: 8px; }

/* === MODIFICATIONS & ADDITIONS --- */
.nav-username, .nav-user, .navbar .username, #nav-username, #username, [data-role="nav-username"]{ display:none !important; }
.player-detail-modal .shot-map-container canvas, .game-note-panel .heatmap canvas, .goal-detail-panel .heatmap canvas, #eventDetailModal #detail-net-container canvas,
#addNoteModal #game-note-net-canvas { /* <-- Added addNoteModal canvas */
    max-height: 240px !important;
}
.player-detail-modal .shot-map-container, .game-note-panel .heatmap, .goal-detail-panel .heatmap, #eventDetailModal #detail-net-container { display:block; max-width: 420px; margin: 0 auto; }
.compact-roster .draggable-player { flex-direction: row; min-width: 200px !important; max-width: 240px !important; height: auto !important; padding: 8px 12px !important; align-items: center; }
.compact-roster .pc-left { flex: 0 0 auto; width: auto; padding: 0; flex-direction: row; align-items: center; gap: 10px; }
.compact-roster .pc-number { font-size: 1.5rem; line-height: 1; }
.compact-roster .pc-name { font-size: 1rem; font-weight: 500; text-transform: none; letter-spacing: 0; }
.compact-roster .pc-info, .compact-roster .pc-stats { display: none !important; }
.compact-roster .pc-delete-btn { display: flex !important; position: static; margin-left: auto; }
#whiteboardSheet { width: 100%; height: 100%; display: flex; flex-direction: column; overflow: hidden; }
#whiteboardCanvas { flex: 1; background: #fff; cursor: crosshair; touch-action: none; border-radius: 8px; }
#editorShell .page-content { padding: 0; display: flex; flex-direction: column; }
#editorShell .editor-main { flex-grow: 1; display: flex; gap: 12px; min-height: 0; }
#editorShell #source-clips-panel, #editorShell #trimmer-panel { background: rgba(42, 47, 56, 0.5); border-radius: 8px; padding: 15px; display: flex; flex-direction: column; border: 1px solid var(--border-color); }
#editorShell #source-clips-panel { flex: 0 0 280px; }
#editorShell #source-clips-list { flex-grow: 1; overflow-y: auto; }
#editorShell .source-clip-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 6px; cursor: pointer; transition: background-color 0.2s; border: 1px solid transparent; }
#editorShell .source-clip-item:hover { background-color: rgba(255, 255, 255, 0.1); border-color: var(--border-color); }
#editorShell #trimmer-panel { flex: 1; min-width: 0; }
#editorShell #playlist-container { flex-grow: 1; display: flex; flex-direction: column; min-height: 0; margin-top: 1rem; }
#editorShell #playlist-clips { flex-grow: 1; overflow-y: auto; list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--border-color); padding-top: 1rem; }
#editorShell #editor-player { width: 100%; flex: 0 0 55%; background: #000; border-radius: 8px; min-height: 0; object-fit: contain; }
#editorShell .editor-controls { flex-shrink: 0; margin-top: 1rem; }
#clipEditorFallback{ display:none; position: fixed; inset: 0; z-index: 9500; background: rgba(0,0,0,.6); align-items:center; justify-content:center; }
#clipEditorCard{ width: min(1100px, 96vw); height: min(760px, 90vh); background: var(--panel-bg, rgba(28,32,40,.92)); border:1px solid var(--border-color, rgba(255,255,255,.1)); border-radius: 12px; display:flex; flex-direction:column; overflow:hidden }
#clipEditorHeader{ padding:10px; display:flex; align-items:center; justify-content:space-between; border-bottom:1px solid var(--border-color, rgba(255,255,255,.1)) }
#editorShell #playlist-clips { display: flex; flex-wrap: wrap; gap: 16px; }
#editorShell #playlist-clips .list-item { flex-basis: calc(20% - 16px); min-width: 160px; max-width: 200px; flex-grow: 1; flex-direction: column; justify-content: flex-start; align-items: stretch; text-align: center; padding: 8px; margin-bottom: 0; gap: 4px; position: relative;  }
#editorShell #playlist-clips .list-item img { width: 100%; height: auto; aspect-ratio: 16 / 9; margin: 0; }
#editorShell #playlist-clips .list-item .flex-1 { padding: 0; }
#editorShell #playlist-clips .list-item .text-sm, #editorShell #playlist-clips .list-item small { font-size: 0.75rem; line-height: 1.2; white-space: normal; }
#editorShell #playlist-clips .list-item .drag-handle { position: absolute; top: 12px; left: 12px; color: white; background-color: rgba(0, 0, 0, 0.5); padding: 2px 4px; border-radius: 4px; z-index: 1; }
#editorShell #playlist-clips .list-item .btn.danger { position: absolute; top: 12px; right: 12px; z-index: 1; }
#eventDetailModal .modal-content { max-width: 480px; max-height: 90vh; overflow-y: auto; }

/* --- NEW & CORRECTED: MOBILE UTILITY DRAWER STYLES --- */
/* Default state for Desktop */
#utility-toggle-btn {
  display: none; /* Hide the arrow button on desktop */
}
#utility-popup-content {
  display: flex; /* Show the utility buttons on desktop */
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
/* --- Mobile Styles (Screen 900px or narrower) --- */
@media (max-width: 900px) {
  #utility-toggle-btn {
    display: flex; /* Show the arrow button on mobile */
  }
  #utility-popup-content {
    display: none; /* Hide the utility buttons on mobile by default */
  }
  #utility-container {
    position: relative; /* Needed for positioning the popup */
    margin-left: auto !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }
  /* When the drawer is open, show the popup content */
  #utility-container.is-open #utility-popup-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    opacity: 1;
    transform: translateY(0);
  }
  /* These are the styles for the popup itself */
  #utility-container #utility-popup-content {
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    width: 200px;
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 -8px 30px rgba(0,0,0,0.4);
    padding: 8px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
  }
  /* Style the buttons inside the popup */
  #utility-popup-content .command-btn {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 12px;
    font-size: 1rem;
    font-weight: 500;
  }
  #utility-popup-content #currentUserDisplay {
     padding-bottom: 8px;
     margin-bottom: 4px;
     border-bottom: 1px solid var(--border-color);
  }
  #utility-toggle-btn svg {
    transition: transform 0.2s ease;
  }
  /* Rotate the arrow when the drawer is open */
  #utility-container.is-open #utility-toggle-btn svg {
    transform: rotate(180deg);
  }
}

/* --- DRILL CREATOR STYLES --- */
#dc-editor-view {
  display: flex;
  flex-direction: column;
  height: 100%;
}

#dc-editor-top-bar {
  background: var(--dark-bg-light);
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-color);
}

#dc-editor-main {
  flex-grow: 1;
  display: flex;
  padding: 12px 0;
  gap: 12px;
  overflow: hidden;
}

#dc-editor-left-sidebar,
#dc-editor-right-sidebar {
  background: rgba(42, 47, 56, 0.5);
  border-radius: 8px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
  overflow-y: auto;
}

#dc-editor-left-sidebar { width: 260px; }
#dc-editor-right-sidebar { width: 320px; }

#dc-canvas-wrapper {
  flex-grow: 1;
  background: rgba(42, 47, 56, 0.5);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

#dc-canvas-container {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}

#dc-canvas { cursor: crosshair; }

.dc-tool-btn {
  transition: all 0.2s ease-in-out;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--dark-bg-light);
  border: 2px solid transparent;
  border-radius: 6px;
  color: var(--text-light);
  cursor: pointer;
}

.dc-tool-btn.active {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.dc-tool-btn:hover:not(.active) { background-color: #3c424e; }
.dc-tool-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.dc-color-btn {
    aspect-ratio: 1/1;
    border-radius: 50%;
    border: 2px solid transparent;
}
.dc-color-btn.active { border-color: white; }

#dc-steps-list .step-btn {
    padding: 8px 12px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--dark-bg-light);
    border: 1px solid var(--border-color);
    cursor: pointer;
}
#dc-steps-list .step-btn:hover { background: #3c424e; }
#dc-steps-list .step-btn.active {
    background: var(--primary-color);
    font-weight: bold;
    color: white;
}
#dc-steps-list .delete-step-btn { background: none; border: none; color: var(--danger-color); font-weight: bold; cursor: pointer; }

/* Drill List View */
.drill-card {
    background-color: #1f2937;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    border-left: 5px solid var(--primary-color);
    cursor: pointer;
    transition: all 0.2s ease;
}
.drill-card:hover { border-color: var(--primary-color); transform: translateY(-3px); }
.drill-card-img { grid-row: 1 / 3; background-color: white; border-radius: 6px; padding: 4px; display: flex; align-items: center; justify-content: center;}
.drill-card-img img { width: 100%; object-fit: contain; }

.playback-disabled { pointer-events: none; opacity: 0.6; }
/* ADD THIS TO THE END OF style.css */

/* --- IMPORTED DRILL CREATOR STYLES --- */
#drillCreatorShell .tool-btn {
    transition: all 0.2s ease-in-out; /* */
}
#drillCreatorShell .tool-btn.active {
    background-color: var(--primary-color); /* */
    color: white; /* */
    border-color: var(--primary-color); /* */
}
#drillCreatorShell .tool-btn:hover:not(.active) {
    background-color: #4B5563; /* */
}
#drill-canvas {
    cursor: crosshair; /* */
}
#canvas-container {
    position: relative; /* */
}
#drillCreatorShell .bg-gradient-custom {
    background-image: radial-gradient(circle at top left, #4c0519, #1e293b 70%); /* */
}
#drill-modal #modal-content {
    max-height: 90vh; /* */
}
.drill-card-new {
    background-color: white; /* */
    color: #1f2937; /* */
    border-radius: 0.5rem; /* */
    padding: 1rem; /* */
    display: grid; /* */
    grid-template-columns: 1.2fr 1fr; /* */
    grid-template-rows: auto 1fr; /* */
    gap: 1rem; /* */
    border-left-width: 5px; /* */
}
.drill-card-header {
    grid-column: 1 / 2; /* */
    grid-row: 1 / 2; /* */
}
.drill-card-notes-section {
    grid-column: 1 / 2; /* */
    grid-row: 2 / 3; /* */
    overflow-y: auto; /* */
    max-height: 220px; /* */
}
.drill-card-image-container {
    grid-column: 2 / 3; /* */
    grid-row: 1 / 3; /* */
}
.playback-disabled {
    pointer-events: none; /* */
    opacity: 0.6; /* */
}
.practice-log-display {
    background-color: #f3f4f6; /* */
    border: 1px solid #d1d5db; /* */
    border-radius: 0.25rem; /* */
    padding: 0.5rem; /* */
    height: 100px; /* */
    overflow-y: auto; /* */
    font-size: 0.75rem; /* */
    line-height: 1rem; /* */
    color: #4b5563; /* */
}
#drillCreatorShell .color-btn {
    border-width: 0px;
    border-color: transparent;
}
#drillCreatorShell .color-btn.active {
    border-color: white;
    border-width: 2px;
}
@media (max-width: 900px) and (orientation: portrait) {
  #rosterShell .page-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--dark-bg);
    padding-top: 1rem;
    padding-bottom: 1rem;
    margin-bottom: 0; /* Remove bottom margin to connect with content */
  }

  #rosterShell .page-content {
    padding-top: 1rem; /* Add padding to prevent content from hiding under the sticky header */
  }
}
/* ADD this to the end of style.css */
/* --- MIRROR MODE FULLSCREEN --- */
#goalieEyeShell.mirror-cinema-mode #main-panel {
    width: 100% !important;
    height: 100% !important;
    top: 0 !important;
    left: 0 !important;
    transform: none !important;
    z-index: 100;
}

#goalieEyeShell.mirror-cinema-mode #library-panel {
    display: none !important; /* Hide the library completely */
}

#goalieEyeShell.mirror-cinema-mode .drag-handle {
    cursor: default;
    pointer-events: none;
}

#goalieEyeShell.mirror-cinema-mode .btn-group,
#goalieEyeShell.mirror-cinema-mode #statusBadge,
#goalieEyeShell.mirror-cinema-mode #sessionInfo {
    display: none !important;
}

#goalieEyeShell.mirror-cinema-mode #createClipBtn {
    display: flex; /* Ensure Create Clip button is visible */
}

/* Add this to your style.css file */
.prose a {
    color: var(--primary-color);
    text-decoration: none;
}

.prose a:hover {
    text-decoration: underline;
}

.prose h2 {
    color: var(--text-lighter);
}
/* --- COACHES CORNER PAGE --- */
.coaches-corner-page {
    color: var(--text-light);
    max-width: 800px; /* Constrain width for readability */
    margin: 0 auto;
}

.coaches-corner-page h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-lighter);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.coaches-corner-page p {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.coaches-corner-page ul {
    list-style-type: disc;
    padding-left: 25px;
    margin-bottom: 1.5rem;
    space-y-2;
}

.coaches-corner-page li {
    font-size: 1rem;
}

.coaches-corner-page a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
}

.coaches-corner-page a:hover {
    text-decoration: underline;
}

.dedication-placeholder {
    background: rgba(42, 47, 56, 0.5);
    border-left: 4px solid var(--primary-color);
    padding: 16px 20px;
    border-radius: 8px;
    margin-top: 1rem;
    font-style: italic;
}

.dedication-placeholder p {
    margin-bottom: 0.5rem;
    color: var(--text-lighter);
}

/* --- ADD THIS TO THE END of style.css --- */

/* --- PRINT STYLES --- */
@media print {
    /* Basic page setup */
    :root {
        --print-team-color: #B91C1C; /* Fallback, overridden by JS */
    }
    body, html {
        width: 8.5in;
        height: 11in;
        margin: 0;
        padding: 0;
        background: #FFFFFF !important;
        font-family: 'Inter', sans-serif, sans-serif; /* Added sans-serif fallback */
        -webkit-print-color-adjust: exact !important;
        color-adjust: exact !important;
        color: #000 !important; /* Ensure text is black */
    }

    @page {
        size: letter portrait;
        margin: 0.25in;
    }

    /* --- HIDE NON-PRINT ELEMENTS (Common rule for both print types) --- */
    body.printing-roster > *:not(#printableRoster),
    body.printing-plan > *:not(#printablePracticePlan),
    body.printing-sticker > *:not(#printableSticker) /* Added sticker */
     {
        display: none !important;
        visibility: hidden !important;
        position: absolute !important;
        left: -9999px !important;
        top: -9999px !important;
    }

    /* Specifically hide overlays when printing either type */
    body.printing-roster #loadingOverlay, body.printing-plan #loadingOverlay, body.printing-sticker #loadingOverlay,
    body.printing-roster #authOverlay, body.printing-plan #authOverlay, body.printing-sticker #authOverlay,
    body.printing-roster #resetPasswordOverlay, body.printing-plan #resetPasswordOverlay, body.printing-sticker #resetPasswordOverlay,
    body.printing-roster #welcomeOverlay, body.printing-plan #welcomeOverlay, body.printing-sticker #welcomeOverlay,
    body.printing-roster .modal-overlay, body.printing-plan .modal-overlay, body.printing-sticker .modal-overlay, /* Covers most modals */
    body.printing-roster #drill-modal, body.printing-plan #drill-modal, body.printing-sticker #drill-modal, /* Specific modals if needed */
    body.printing-roster #liveOverlay, body.printing-plan #liveOverlay, body.printing-sticker #liveOverlay,
    body.printing-roster #pipOverlay, body.printing-plan #pipOverlay, body.printing-sticker #pipOverlay,
    body.printing-roster #toast-container, body.printing-plan #toast-container, body.printing-sticker #toast-container,
    body.printing-roster #passwordPromptOverlay, body.printing-plan #passwordPromptOverlay, body.printing-sticker #passwordPromptOverlay,
    body.printing-roster nav#command-bar, body.printing-plan nav#command-bar, body.printing-sticker nav#command-bar
     {
        display: none !important;
        visibility: hidden !important;
    }

    /* --- ENSURE PRINT CONTAINER IS VISIBLE (Common rule) --- */
    #printableRoster,
    #printablePracticePlan,
    #printableSticker /* Added sticker */
     {
        display: block !important; /* Default display */
        visibility: visible !important;
        position: static !important;
        width: 100% !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important; /* Reset padding here */
        overflow: visible !important;
        background: #FFFFFF !important;
        color: #000 !important;
    }

   /* --- ROSTER-SPECIFIC PRINT STYLES --- */
    #printableRoster {
      display: block !important; /* Make it a simple block container */
      width: 100%;
      height: auto; /* Let content determine height */
      padding: 0; /* Padding is handled by the .print-page class */
      box-sizing: border-box;
    }
    /* All the detailed .print-header-new, .roster-sheet-main, .player-box-print etc. rules go here */
    .print-header-new { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-shrink: 0; }
    .team-logo-print { max-height: 60px; max-width: 60px; object-fit: contain; }
    .header-text-new h1 { font-size: 2rem; font-weight: 900; margin: 0; color: #000; }
    .header-text-new p { font-size: 0.8rem; font-weight: 700; margin: 0; color: #333; }
    .roster-sheet-main { flex-grow: 1; display: flex; flex-direction: column; background: #FFF; border: 4px solid var(--print-team-color); padding: 16px; }
    .position-group-print, .d-g-container { margin-bottom: 6px; }
    .group-title-print { background-color: var(--print-team-color); color: white; font-weight: 900; font-size: 0.7rem; padding: 4px 8px; text-align: center; display: flex; justify-content: space-around; }
    .group-title-print.forwards-title span, .group-title-print.defense-title span { flex: 1; text-align: center; }
    .forwards-grid-print, .defense-grid-print { display: grid; gap: 6px; margin-top: 6px; }
    .forwards-grid-print { grid-template-columns: repeat(3, 1fr); }
    .defense-grid-print { grid-template-columns: repeat(2, 1fr); }
    .goalies-list-print, .extra-skaters-list-print { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
    .player-box-print { border: 2px solid var(--print-team-color); padding: 4px; display: flex; align-items: center; gap: 6px; min-height: 50px; box-sizing: border-box; }
    .player-box-print.empty { border: 2px dashed #DDD; background-color: #FAFAFA; }
    .p-box-num-print { font-size: 1.8rem; font-weight: 900; color: #333; flex-shrink: 0; width: 35px; text-align: center; }
    .p-box-details-print { flex-grow: 1; }
    .p-box-name { font-weight: 700; font-size: 0.7rem; line-height: 1.1; word-break: break-word; }
    .p-box-info { font-size: 0.5rem; font-weight: 500; color: #444; line-height: 1.2; }
    .p-box-vitals-print { display: flex; flex-direction: column; justify-content: space-around; font-size: 0.6rem; font-weight: 700; background-color: #EEE; padding: 0 4px; border-radius: 2px; align-self: stretch; }
    .d-g-container { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; align-items: start; }
    .d-g-col.right-col { display: flex; flex-direction: column; gap: 12px; }
.not-dressing-list-print { padding: 2px 8px; display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 4px; }
    .not-dressing-title { background-color: #6B7280; }
   .scratch-item { font-size: 0.65rem; font-weight: 700; white-space: nowrap; }
    .scratch-num { display: inline-block; width: 25px; color: #555; }
    .coaching-staff-group { margin-bottom: 0; }
    .coaches-list-print { padding: 4px 8px; font-size: 0.7rem; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 16px; margin-top: 4px; }
    .socials-print-section { margin-top: auto; display: flex; justify-content: center; align-items: center; gap: 20px; padding-top: 6px; border-top: 2px solid #EEE; flex-shrink: 0; }
    .socials-print-section > div { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.9rem; }
    .socials-print-section svg { width: 20px; height: 20px; }
    .print-footer-new { margin-top: auto; display: grid; grid-template-columns: 1fr 1.5fr; gap: 24px; padding-top: 10px; border-top: 2px solid #EEE; align-items: start; }
    .socials-print-section { border-top: none; padding-top: 0; flex-direction: column; justify-content: flex-start; align-items: flex-start; gap: 8px; } /* Adjusted duplicate */
    .pronunciation-guide-print .group-title-print { justify-content: center; margin-bottom: 4px; }
   .guide-list-print { font-size: 0.6rem; display: block; -webkit-column-count: 2; column-count: 2; -webkit-column-gap: 16px; column-gap: 16px; padding: 2px 8px; }
   .guide-list-print div { break-inside: avoid-column; padding-bottom: 2px; }
    .is-starting-line { font-weight: 900 !important; color: var(--print-team-color) !important; }

    /* --- PRACTICE PLAN-SPECIFIC PRINT STYLES --- */
    #printablePracticePlan {
        padding: 0.25in; /* Restore plan padding */
        box-sizing: border-box;
    }
    .practice-plan-page {
        page-break-after: always;
        height: 10.5in;
        display: flex;
        flex-direction: column;
        gap: 0.25in;
    }
    .practice-plan-drill {
        height: 5.1in;
        border: 2px solid var(--print-team-color, #000);
        padding: 0.15in;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        box-sizing: border-box;
    }
    .practice-plan-drill.empty {
        border: 2px dashed #DDD;
        background-color: #FAFAFA;
        height: 5.1in;
    }
    .drill-print-header {
        display: flex; align-items: center; gap: 0.15in; padding-bottom: 0.1in; margin-bottom: 0.1in; border-bottom: 1px solid #CCC; flex-shrink: 0;
    }
    .drill-print-logo { max-height: 40px; max-width: 40px; object-fit: contain; flex-shrink: 0; }
    .drill-header-text { flex-grow: 1; min-width: 0; }
    .drill-print-title { font-size: 14pt; font-weight: 900; color: var(--print-team-color, #000); margin: 0 0 4px 0; padding: 0; border: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .drill-print-meta { display: flex; justify-content: space-between; font-size: 8pt; color: #333; gap: 1em; }
    .drill-print-meta span { white-space: nowrap; }
    .drill-print-content { flex-grow: 1; display: flex; gap: 0.15in; overflow: hidden; }
    .drill-print-notes-col { flex: 1; display: flex; flex-direction: column; overflow: hidden; font-size: 10pt; min-width: 0; }
    .drill-print-diagram-col { flex: 1; display: flex; align-items: center; justify-content: center; background: #FFFFFF; border: 1px solid #EEE; box-sizing: border-box; overflow: hidden; border-radius: 4px; min-width: 0; }
    .drill-print-diagram-col img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
    .drill-print-subtitle { font-size: 11pt; font-weight: 700; margin: 0 0 4px 0; padding-bottom: 2px; border-bottom: 1px solid #EEE; flex-shrink: 0; }
    .drill-print-notes { font-size: 9pt; line-height: 1.3; flex-grow: 1; overflow-y: auto; padding-right: 5px; margin: 0; word-break: break-word; }

    /* --- STICKER-SPECIFIC PRINT STYLES (REVISED) --- */
        #printableSticker {
            padding: 0;
            box-sizing: border-box;
            width: 100%;
            height: auto;
            background: #fff !important; /* Force white background */
        }
.roster-sticker {
            width: 3in;     /* ADJUST WIDTH TO YOUR LABEL SIZE */
            /* height: auto; */ /* Let content determine height */
            border: 1px dashed #ccc;
            padding: 2mm 3mm; /* Reduced vertical padding */
            box-sizing: border-box;
            font-family: Arial, sans-serif;
            font-size: 9.5pt; /* Slightly smaller base font */
            line-height: 1.25; /* Slightly tighter line height */
            overflow: hidden; /* Clip horizontally if needed */
            page-break-inside: avoid;
            display: flex;
            flex-direction: column;
            background: #fff !important;
            color: #000 !important;
            min-height: 1in;
        }
        /* ... keep .sticker-header-print, .sticker-logo-print, .sticker-title-print, .sticker-line ... */
      .sticker-header-print {
            display: flex;
            align-items: center;
            gap: 2mm; /* Reduced space between logo and title */
            margin-bottom: 1.5mm; /* Reduced bottom margin */
            flex-shrink: 0;
            height: 0.3in; /* Significantly smaller fixed height for header area */
        }
        .sticker-logo-print {
            max-height: 100%; /* Use full height of the smaller header area */
            max-width: 0.3in; /* Limit width */
            object-fit: contain;
            flex-shrink: 0;
        }
        .sticker-title-print {
            font-size: 10pt; /* Smaller font for title */
            font-weight: bold;
            text-align: left;
            margin: 0;
            padding: 0;
            color: #000 !important;
            flex-grow: 1;
            white-space: nowrap; /* Keep title on one line */
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .sticker-player-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1mm; /* Reduced space between rows */
            min-height: 11pt; /* Maintain minimum height */
        }
        .sticker-player-row:last-child {
             margin-bottom: 0;
        }
        .sticker-player-row.empty {
             opacity: 0.5;
        }
        .sticker-player-info {
            display: flex;
            align-items: baseline;
            flex-grow: 1;
            overflow: hidden;
            white-space: nowrap;
        }
        .sticker-player-num {
            font-weight: bold;
            font-size: 10.5pt; /* Adjusted */
            min-width: 35px;
            text-align: left;
            margin-right: 1.5mm; /* Reduced */
            flex-shrink: 0;
        }
        .sticker-player-name {
            font-weight: bold;
            font-size: 9.5pt; /* Adjusted */
            overflow: hidden;
            text-overflow: ellipsis;
            flex-grow: 1;
            margin-right: 1mm;
        }
        .sticker-player-pos {
            font-size: 8.5pt; /* Adjusted */
            font-weight: bold;
            color: #000;
            flex-shrink: 0;
            margin-left: 1mm;
        }
        .sticker-checkbox {
            width: 11pt; /* Adjusted */
            height: 11pt; /* Adjusted */
            border: 1px solid #000;
            margin-left: 2.5mm; /* Adjusted */
            flex-shrink: 0;
            background-color: #fff;
        }

    } /* End of @media print */

/* --- STARTING LINE STYLES --- */
:root {
    /* ... other variables ... */
    --starting-line-color: #f59e0b; /* Yellow/Orange for starting line */
}

.line-header-builder {
    position: relative; /* Needed for absolute positioning of the star */
    /* ... existing styles ... */
}

.toggle-starting-btn {
    position: absolute;
    left: -30px; /* Position to the left of the line number */
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1.5rem; /* Make star bigger */
    opacity: 0.3; /* Dim by default */
    transition: color 0.2s, opacity 0.2s;
    padding: 0;
    line-height: 1;
}

.toggle-starting-btn:hover {
    opacity: 0.7;
}

.toggle-starting-btn.is-starting {
    color: var(--starting-line-color);
    opacity: 1; /* Bright when active */
}

@media (max-width: 900px) {
    .toggle-starting-btn {
         left: -25px;
         font-size: 1.2rem;
    }
}
/* ... existing styles ... */

/* --- NEW STYLES FOR EDIT BUTTON --- */
.edit-team-btn {
  position: absolute;
  top: 8px;
  left: 8px; /* Position on the left */
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 14px;
  line-height: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  opacity: 0;
  z-index: 10;
  font-weight: bold;
}

.team-card:hover .edit-team-btn {
  opacity: 1;
  transform: scale(1.1);
}

.edit-team-btn:hover {
  background-color: var(--primary-color-dark);
}
/* ... existing styles ... */

/* --- PLAYER NOTES GRID --- */
.player-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
.player-card-bubble {
    background-color: #1f2937;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative; /* 👈 ADD THIS LINE */
}
.player-card-bubble:hover {
    border-color: var(--primary-color);
    transform: translateY(-4px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.player-card-bubble .pc-number {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    color: var(--primary-color);
}
.player-card-bubble .pc-name {
    font-size: 1.1rem;
    font-weight: 500;
    text-align: center;
}
.player-card-bubble .pc-position {
    font-size: 0.85rem;
    color: var(--text-light);
    opacity: 0.7;
}

/* --- PLAYER NOTES DETAIL VIEW --- */
.player-notes-detail-header {
    display: flex;
    gap: 16px;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}
.player-notes-detail-header .pc-number {
    font-size: 3.5rem;
    font-weight: 900;
    line-height: 1;
    color: var(--primary-color);
}
.player-notes-detail-header .pc-name {
    font-size: 1.75rem;
    font-weight: 700;
}
.player-notes-detail-header .pc-position {
    font-size: 1rem;
    color: var(--text-light);
    opacity: 0.8;
}

.player-notes-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    /* Use flex-grow on page-content, not this grid */
}
.player-notes-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
}
.player-notes-section {
    background: rgba(42, 47, 56, 0.5);
    border-radius: 8px;
    padding: 16px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}
.player-notes-section.clips-section {
    flex-grow: 1;
    min-height: 0;
}
.player-notes-section h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 12px;
}
.player-notes-list, .player-clips-list {
    flex-grow: 1;
    overflow-y: auto;
    max-height: 400px; /* You can adjust this */
}
.player-clips-list .list-item {
    padding: 8px;
}
.player-clips-list .list-item img {
    width: 100px;
    height: 56.25px; /* 16:9 */
    object-fit: cover;
    border-radius: 4px;
}

@media (max-width: 900px) {
    .player-notes-content {
        grid-template-columns: 1fr;
    }
}
/* ... existing styles ... */

/* --- TEAM TYPE BUBBLE --- */
.team-type-bubble {
    display: inline-block;
    padding: 3px 10px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 99px;
    letter-spacing: 0.5px;
    margin-top: 0.5rem; /* Space it from the name */
}

/* Color coding */
.team-type-bubble[data-type="team"] {
    background-color: var(--primary-color);
    color: #fff;
}
.team-type-bubble[data-type="camp"] {
    background-color: #16a34a; /* Green from add modal */
    color: #fff;
}
.team-type-bubble[data-type="private"] {
    background-color: #7c3aed; /* Purple from add modal */
    color: #fff;
}

/* Adjust card layout slightly */
#welcomeOverlay .team-card {
    gap: 0.25rem; /* Reduce gap to pull bubble closer to name */
}
#welcomeOverlay .team-card h2 {
     margin-bottom: 0; /* Remove default margin */
}
/* ADD THIS TO THE END of style.css */

/* --- ATHLETE PORTAL SECTION --- */
.athlete-portal-section {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}
.athlete-portal-section h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 12px;
}
.athlete-portal-section .info-item {
    grid-column: span 2 / span 2;
}

/* --- SHARED BADGE --- */
.shared-badge {
    background-color: var(--success-color);
    color: #000;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto;
    flex-shrink: 0;
}
/* ADD THIS TO THE END of style.css */

/* --- ATHLETE LOGIN LINK STYLES --- */
#athleteLoginLink, #coachLoginLink {
    color: #9ca3af;
    font-size: 0.8rem;
    font-weight: 400;
}
#athleteLoginOverlay #athleteAuthError {
    background: rgba(229, 62, 62, 0.1);
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
    border-radius: 6px;
    padding: 10px;
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}
/* ADD THIS TO THE END of style.css */

/* --- ATHLETE PORTAL SHELL --- */
#athletePortalShell {
    max-width: 800px;
    margin: 0 auto;
}

.athlete-portal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.athlete-portal-header .team-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.athlete-portal-header .team-logo {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 8px;
    background-color: #fff;
    padding: 4px;
}

.athlete-portal-header .athlete-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-lighter);
}

.athlete-portal-notes-list .list-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    background: #1f2937;
    border: 1px solid var(--border-color);
}

.athlete-portal-notes-list .note-text {
    font-size: 1rem;
    color: var(--text-light);
    white-space: pre-wrap; /* Preserves line breaks from the note */
}

.athlete-portal-notes-list .note-date {
    font-size: 0.75rem;
    color: var(--primary-color);
    font-weight: 500;
}
/* --- CALENDAR STYLES --- */
#calendarShell {
    /* Make the shell a flex column to control children */
    display: flex;
    flex-direction: column;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-shrink: 0; /* Header shouldn't shrink */
}

.calendar-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.calendar-day-headers {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    flex-shrink: 0; /* Day headers shouldn't shrink */
}

.calendar-day-header {
    font-size: 0.8rem;
    font-weight: 700;
    text-align: center;
    padding: 8px 4px;
    background: rgba(42, 47, 56, 0.5);
    border-bottom: 1px solid var(--border-color);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    /* Make the grid grow to fill remaining space */
    flex-grow: 1; 
    border-top: 1px solid var(--border-color);
    border-left: 1px solid var(--border-color);
    /* Set an explicit height for calendar rows */
    grid-auto-rows: minmax(100px, 1fr); 
}

.calendar-day {
    position: relative;
    /* Remove fixed min-height, let the grid control it */
    padding: 4px;
    padding-top: 22px;
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    background: rgba(28, 32, 40, 0.3);
    cursor: pointer;
    transition: background-color 0.2s;
    overflow-y: auto; /* Allow scrolling within a day */
}
.calendar-day:hover {
    background: rgba(42, 47, 56, 0.5);
}

.calendar-day .day-number {
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 0.8rem;
    font-weight: 700;
}
.calendar-day.other-month {
    opacity: 0.4;
    background: rgba(28, 32, 40, 0.1);
}
.calendar-day.today {
    background: var(--primary-color-glow);
}
.calendar-day.today .day-number {
    color: var(--primary-color);
    font-size: 0.9rem;
}

.calendar-event {
    font-size: 0.75rem;
    padding: 3px 6px;
    border-radius: 4px;
    background-color: var(--primary-color);
    color: #fff;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    border: 1px solid var(--primary-color-dark);
}
.calendar-event:hover {
    filter: brightness(1.2);
}

/* Event type colors */
.calendar-event[data-type="practice"] { background-color: #3b82f6; border-color: #2563eb; }
.calendar-event[data-type="game"] {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px; /* A little more padding */
    background-color: #1f2937; /* Darker, more "official" background */
    border-color: var(--border-color);
    color: #fff; /* White text for dark background */
}

.cal-event-logo {
    width: 20px;
    height: 20px;
    object-fit: contain;
    border-radius: 4px;
    background-color: #fff; /* White bg for transparent logos */
    flex-shrink: 0;
}

.cal-event-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1; /* Allow title to take remaining space */
}
.calendar-event[data-type="camp"] { background-color: #16a34a; border-color: #15803d; }
.calendar-event[data-type="lesson"] { background-color: #7c3aed; border-color: #6d28d9; }
.calendar-event[data-type="other"] { background-color: #6b7280; border-color: #4b5563; }
/* --- CALENDAR ATTENDANCE MODAL --- */
.attendance-section {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 16px;
    border: 1px solid var(--border-color);
}
.attendance-lists {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.attendance-column strong {
    font-weight: 700;
    color: var(--text-lighter);
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    display: block;
}
.attendance-list {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.attendance-list p {
    font-size: 0.9rem;
    color: var(--text-light);
}

/* --- ATHLETE PORTAL SCHEDULE --- */
.athlete-event-item {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}
.athlete-event-info {
    display: flex;
    flex-direction: column;
}
.athlete-event-info .event-date {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary-color);
}
.athlete-event-info .event-title {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-lighter);
}
.athlete-event-actions {
    display: flex;
    gap: 10px;
}
.athlete-event-actions .btn {
    flex: 1;
}
.athlete-event-actions .btn.danger {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
}
/* --- ATTENDANCE EXPLANATION STYLE --- */
.attendance-list p span {
    color: var(--text-light);
    opacity: 0.8;
    font-style: italic;
}

/* === EVENT ATTENDANCE MODAL STYLES === */
.event-attendance-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.event-attendance-modal .modal-content {
  background: #1a1a1a;
  color: white;
  border-radius: 12px;
  padding: 20px;
  width: 400px;
  max-height: 80vh;
  overflow-y: auto;
}
.event-attendance-modal h3 {
  margin-top: 10px;
  font-weight: 600;
}
.event-attendance-modal .reason {
  color: #bbb;
  font-size: 0.9em;
}
/* --- ROSTER ATTACHMENT STYLES --- */
.roster-attach-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    background: rgba(0,0,0,0.1);
    padding: 12px;
    border-radius: 6px;
}

.custom-file-input {
    font-size: 0.9rem;
    color: var(--text-light);
}
/* Style the file input button */
.custom-file-input::file-selector-button {
    background: var(--dark-bg-light);
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid var(--border-color);
    color: var(--text-lighter);
    cursor: pointer;
    margin-right: 12px;
}
.custom-file-input::file-selector-button:hover {
    background: #3c424e;
    border-color: var(--border-color-hover);
}

@media (max-width: 600px) {
    .roster-attach-options {
        grid-template-columns: 1fr;
    }
}
/* --- NEW: Timestamp Note Styles --- */
.timestamp-tag-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.timestamp-note {
  font-size: 0.75rem;
  font-style: italic;
  color: var(--text-light);
  opacity: 0.8;
  padding-left: 4px;
}
/* Fix for new note input in live overlay */
#goalTimestampNote {
  width: 100%;
  box-sizing: border-box;
  padding: 8px;
  border-radius: 6px;
  background: var(--dark-bg-light);
  border: 1px solid var(--border-color);
  color: var(--text-lighter);
}
/* --- Style for new Editor Goalie Filter --- */
#editorGoalieFilter {
  width: 100%; 
  box-sizing: border-box; 
  padding: 10px; 
  border-radius: 6px;
  background: var(--dark-bg-light); 
  border: 1px solid var(--border-color); 
  color: var(--text-lighter);
}
/* --- NEW: ROSTER BUILDER TABS --- */
.builder-panel .roster-tabs {
  padding: 0 15px; /* Match panel padding */
  margin-bottom: 1rem;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-color);
}
.builder-panel .roster-tabs .tab-btn {
  padding: 8px 16px;
  border-radius: 6px 6px 0 0;
  border-bottom: none;
  background: none;
  color: var(--text-light);
  opacity: 0.6;
}
.builder-panel .roster-tabs .tab-btn.active {
  background: var(--dark-bg-light);
  border-color: var(--border-color);
  font-weight: bold;
  color: var(--text-lighter);
  opacity: 1;
}

/* --- NEW: SPECIAL TEAMS GRID (BUILDER) --- */
.special-teams-grid {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 8px 12px;
  align-items: center;
  background: rgba(0,0,0,0.1);
  padding: 12px;
  border-radius: 8px;
}
.special-teams-grid.pk {
  grid-template-columns: 100px 1fr 100px 1fr;
}
.special-teams-grid .pp-pos-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-light);
  text-align: right;
}
.special-teams-grid .player-slot {
  min-height: 48px;
}

/* --- NEW: MULTI-PAGE PRINT STYLES --- */
@media print {
  /* This class wraps each page */
  .print-page {
    page-break-after: always; /* This is the key! */
    width: 8in;
    height: 10.5in; /* A little less than 11 to account for margins */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0.25in 0; /* Give it the same top/bottom margin as the page */
  }
  
  /* Make sure the last page doesn't try to break */
  .print-page:last-child {
    page-break-after: avoid;
  }
  
  /* Apply the existing main roster styles ONLY to the first page */
  .print-page:first-child .roster-sheet-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: #FFF;
    border: 4px solid var(--print-team-color);
    padding: 16px;
  }

  /* --- NEW: PP/PK PAGE STYLES --- */
  .pp-pk-print-page .pp-pk-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background: #FFF;
    border: 4px solid var(--print-team-color);
    padding: 16px;
  }
  
  .pp-pk-unit {
    border: 2px solid #888;
    border-radius: 8px;
    overflow: hidden;
  }
  
  .pp-pk-unit-title {
    font-size: 1.2rem;
    font-weight: 900;
    text-align: center;
    padding: 8px;
    background: var(--print-team-color);
    color: #FFF;
  }
  .pp-pk-unit-title.pk-title {
    background: #6B7280; /* Gray for PK */
  }
  
  .pp-pk-player-row {
    display: grid;
    grid-template-columns: 100px 80px 1fr;
    align-items: center;
    gap: 1rem;
    padding: 8px 12px;
    font-size: 1.1rem;
    border-bottom: 1px solid #EEE;
  }
  .pp-pk-player-row:last-child {
    border-bottom: none;
  }
  
  .pp-pk-pos {
    font-weight: 500;
    color: #444;
  }
  .pp-pk-num {
    font-weight: 700;
    font-size: 1.2rem;
  }
  .pp-pk-name {
    font-weight: 700;
    font-size: 1.2rem;
  }
}
/* =========================================
   NEW SUBSCRIPTION & PRICING STYLES
   ========================================= */

.subscription-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.sub-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.2s, border-color 0.2s;
}

.sub-card:hover {
  border-color: var(--primary-color);
  background: rgba(255, 255, 255, 0.08);
}

.sub-card.featured {
  border-color: var(--primary-color);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.05) 0%, rgba(124, 58, 237, 0.1) 100%);
}

.sub-tag {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--primary-color);
  color: white;
  font-size: 0.7rem;
  font-weight: bold;
  padding: 4px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.sub-price {
  font-size: 2rem;
  font-weight: 800;
  color: white;
  margin: 10px 0;
}

.sub-period {
  font-size: 1rem;
  font-weight: normal;
  color: #9ca3af;
}

.sub-features {
  list-style: none;
  padding: 0;
  margin: 20px 0;
  flex-grow: 1;
}

.sub-features li {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  color: #d1d5db;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sub-features li::before {
  content: "✓";
  color: var(--success-color);
  font-weight: bold;
}

/* Ad Progress Bar inside Card */
.ad-progress-container {
  background: rgba(0,0,0,0.3);
  height: 8px;
  border-radius: 4px;
  margin-bottom: 10px;
  overflow: hidden;
}
.ad-progress-bar {
  height: 100%;
  background: var(--primary-color);
  width: 0%;
  transition: width 0.3s ease;
}
/* --- NEW: SUBSCRIPTION DASHBOARD --- */
.sub-status-dashboard {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-left: 5px solid var(--text-light); /* Default Color */
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

.sub-status-dashboard.premium-monthly {
  border-left-color: #9333ea; /* Purple */
  background: linear-gradient(90deg, rgba(147, 51, 234, 0.1) 0%, rgba(28, 32, 40, 0.65) 100%);
}

.sub-status-dashboard.premium-ads {
  border-left-color: #16a34a; /* Green */
  background: linear-gradient(90deg, rgba(22, 163, 74, 0.1) 0%, rgba(28, 32, 40, 0.65) 100%);
}

.status-info h2 {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0;
  color: white;
}

.status-info p {
  color: #9ca3af;
  margin: 5px 0 0 0;
  font-size: 0.9rem;
}

.timer-display {
  font-family: monospace;
  font-size: 1.5rem;
  font-weight: bold;
  color: white;
  background: rgba(0,0,0,0.3);
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.btn-danger-outline {
  background: transparent;
  border: 1px solid var(--danger-color);
  color: var(--danger-color);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-danger-outline:hover {
  background: var(--danger-color);
  color: white;
}
/* --- HEADER TIMER --- */
.header-timer {
  font-family: 'Courier New', monospace; /* Monospace for steady numbers */
  background: rgba(22, 163, 74, 0.2);    /* Green tint */
  color: #4ade80;                        /* Bright green text */
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid rgba(22, 163, 74, 0.5);
  font-size: 0.9rem;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 10px;
}

.header-timer::before {
  content: "⏱"; /* Small watch icon */
}
/* --- ACCOUNT STATUS BUBBLE (WELCOME SCREEN) --- */
.account-status-bubble {
  position: absolute;
  top: 20px;
  right: 60px; /* Left of the Sign Out button */
  background: rgba(30, 30, 35, 0.95);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  z-index: 1000;
  transition: all 0.3s ease;
}

.account-status-bubble.free {
  border-color: var(--text-light);
}

.account-status-bubble.premium {
  border-color: var(--success-color);
  background: linear-gradient(90deg, rgba(22, 163, 74, 0.2) 0%, rgba(30, 30, 35, 0.95) 100%);
}

.account-status-text {
  font-weight: 700;
  color: var(--text-lighter);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.account-timer {
  font-family: 'Courier New', monospace;
  font-size: 1rem;
  font-weight: bold;
  color: var(--primary-color);
  background: rgba(0,0,0,0.3);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Mobile Adjustment for the bubble */
@media (max-width: 600px) {
  .account-status-bubble {
    top: auto;
    bottom: 20px;
    right: 50%;
    transform: translateX(50%);
    width: max-content;
  }
}
/* --- LOCKED FEATURE BADGE (Little X) --- */
.command-btn {
  position: relative; /* Ensures the badge sits relative to the button */
}

.command-btn.locked-feature::after {
  content: "×"; /* The "X" symbol */
  position: absolute;
  top: -2px;
  right: -2px;
  background-color: var(--danger-color);
  color: white;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  font-size: 14px;
  line-height: 15px;
  text-align: center;
  font-weight: bold;
  pointer-events: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
  border: 1px solid var(--dark-bg);
  z-index: 10;
}

/* Optional: Dim the icon slightly to imply it's inactive */
.command-btn.locked-feature svg {
  opacity: 0.5;
}