:root {
  --bg: #eef1f4;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #65717c;
  --line: #d8dee5;
  --accent: #146c5a;
  --accent-strong: #0e5648;
  --accent-soft: #e7f4f0;
  --gold: #d99a21;
  --danger: #b73535;
  --home: #1269b0;
  --away: #d4473d;
  --shadow: 0 16px 42px rgba(21, 31, 41, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

body.landing-mode .app-shell {
  grid-template-rows: 1fr;
}

body.landing-mode .topbar {
  display: none;
}

.topbar {
  min-height: 76px;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: #f8fafb;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand > div {
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: white;
  border-radius: 8px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin: 0;
}

.brand h1 {
  font-size: 1.08rem;
  line-height: 1.2;
}

.brand p {
  color: var(--muted);
  font-size: 0.86rem;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.top-actions,
.button-row,
.field-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.top-actions > *,
.field-actions > * {
  min-width: 0;
}

.top-action-divider {
  width: 2px;
  height: 36px;
  margin: 0 8px;
  border-radius: 999px;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(101, 113, 124, 0.72) 16%,
    rgba(101, 113, 124, 0.72) 84%,
    transparent
  );
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.55);
}

body.editor-mode .session-action-divider,
body.dashboard-mode .editor-action-divider {
  display: none;
}

.workspace {
  display: grid;
  grid-template-columns: 300px minmax(460px, 1fr) 340px;
  gap: 14px;
  padding: 14px;
  align-items: start;
  min-height: 0;
}

.session-view {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 14px;
  align-items: start;
}

.session-view[hidden],
.workspace[hidden] {
  display: none;
}

.session-planner {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.session-board {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(260px, 0.8fr);
  gap: 14px;
}



.session-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
  min-width: 0;
}

.session-plan-card {
  min-height: 360px;
}

.session-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.compact-grid {
  grid-template-columns: minmax(96px, 140px) 1fr;
  align-items: end;
}

.add-drill-action {
  padding-top: 12px;
}

.add-drill-action button {
  width: 100%;
}

.add-action-buttons {
  display: flex;
  gap: 8px;
  width: 100%;
}

.add-action-buttons button {
  flex: 1;
}

.session-command-row {
  margin-top: 12px;
  justify-content: flex-end;
}

.session-total {
  color: var(--accent);
  font-weight: 850;
  font-size: 0.9rem;
}

.session-blocks {
  display: grid;
  gap: 10px;
}

.session-block {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.session-block-order {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--accent);
  border-radius: 7px;
  font-weight: 850;
}

.session-block.break-block {
  border-left: 4px solid var(--gold);
  background: #fffdf9;
}

.session-block.break-block .session-block-order {
  background: var(--gold);
}

.session-block-main {
  min-width: 0;
}

.session-block-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.session-block-head strong {
  display: block;
  font-size: 0.96rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.session-block-head span,
.session-block-fields span,
.empty-state {
  color: var(--muted);
  font-size: 0.82rem;
}

.session-block-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.session-block-actions .icon-button {
  width: 32px;
  min-height: 32px;
}

.session-block-actions .secondary-button,
.session-block-actions .danger-button {
  min-height: 32px;
  padding: 0 10px;
}

.session-block-fields {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 10px;
  margin-top: 10px;
}

.session-block-fields label {
  display: grid;
  gap: 5px;
}

.session-block-fields input,
.session-block-fields textarea {
  padding: 8px;
}

.session-block-fields textarea {
  min-height: 58px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: auto;
  min-height: 0;
}

.panel-section {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-section:last-child {
  border-bottom: 0;
}

.panel-section.compact {
  padding-top: 14px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title h2 {
  font-size: 0.82rem;
  line-height: 1.2;
  color: #26313a;
  text-transform: uppercase;
  letter-spacing: 0;
}

.field-label {
  display: block;
  color: #3b4650;
  font-weight: 700;
  font-size: 0.78rem;
  margin: 12px 0 6px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd4dd;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 108, 90, 0.16);
}

.primary-button,
.secondary-button,
.danger-button,
.wide-button,
.icon-button {
  border: 1px solid transparent;
  min-height: 36px;
  border-radius: 7px;
  padding: 0 12px;
  font-weight: 750;
}

.primary-button {
  color: #fff;
  background: var(--accent);
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button,
.wide-button {
  color: #24313c;
  background: #fff;
  border-color: #cbd4dd;
}

.secondary-button:hover,
.wide-button:hover {
  background: #f2f5f7;
}

.danger-button {
  background: #fff;
  color: var(--danger);
  border-color: rgba(183, 53, 53, 0.34);
}

.danger-button:hover {
  background: #fff2f2;
}

.wide-button {
  width: 100%;
  margin-top: 10px;
}

.icon-button {
  width: 36px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  background: #fff;
  color: #22303a;
  border-color: #cbd4dd;
}

.icon-button:hover {
  background: #f2f5f7;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid #cbd4dd;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.segmented button {
  min-height: 36px;
  border: 0;
  border-right: 1px solid #cbd4dd;
  background: #fff;
  color: #394651;
  font-weight: 750;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: var(--accent);
  color: #fff;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.tool-grid button {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 4px 8px;
  border: 1px solid #cbd4dd;
  border-radius: 7px;
  background: #fff;
  color: #24313c;
  text-align: left;
}

.tool-grid button span {
  width: 30px;
  height: 28px;
  display: grid;
  place-items: center;
  background: #eef3f6;
  border-radius: 6px;
  color: #22303a;
  font-size: 0.78rem;
  font-weight: 900;
}

.tool-grid button em {
  font-style: normal;
  font-weight: 750;
  font-size: 0.82rem;
}

.tool-grid button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.selected-card .empty-state {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.selected-card {
  min-height: 260px;
}

.selection-controls {
  min-height: 178px;
}

.field-column {
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 10px;
  align-self: start;
  min-width: 0;
}

.field-toolbar {
  min-height: 52px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.field-toolbar strong {
  display: block;
  font-size: 0.94rem;
}

.field-toolbar span {
  color: var(--muted);
  font-size: 0.82rem;
}

.field-wrap {
  position: relative;
  aspect-ratio: 1200 / 780;
  min-height: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #acbac5;
  background: #0e6b45;
  box-shadow: var(--shadow);
}

#fieldSvg {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 780;
  touch-action: none;
  user-select: none;
}

.pitch-bg {
  fill: #167348;
}

.mowing rect {
  fill: rgba(255, 255, 255, 0.055);
}

.field-lines * {
  fill: none;
  stroke: rgba(255, 255, 255, 0.84);
  stroke-width: 4;
}

.build-out-lines line {
  fill: none;
  stroke: rgba(255, 255, 255, 0.6);
  stroke-width: 3;
  stroke-dasharray: 18 12;
}

.diagram-item {
  cursor: grab;
}

.diagram-item.dragging {
  cursor: grabbing;
}

.player-disc {
  stroke: rgba(255, 255, 255, 0.95);
  stroke-width: 5;
}

.player-label {
  font-size: 26px;
  font-weight: 850;
  dominant-baseline: central;
  text-anchor: middle;
  pointer-events: none;
}

.cone {
  fill: var(--gold);
  stroke: rgba(40, 28, 8, 0.48);
  stroke-width: 3;
}

.cone-detail {
  stroke: rgba(40, 28, 8, 0.34);
  stroke-width: 3;
  stroke-linecap: round;
  pointer-events: none;
}

.flat-cone {
  stroke-width: 4;
}

.flat-cone-top {
  fill: rgba(255, 237, 178, 0.58);
  stroke: rgba(40, 28, 8, 0.25);
  stroke-width: 2;
  pointer-events: none;
}

.ball {
  fill: #f7f8f8;
  stroke: #1c252d;
  stroke-width: 3;
}

.ball-detail {
  fill: none;
  stroke: #1c252d;
  stroke-width: 2;
}

.zone {
  fill: rgba(32, 161, 127, 0.18);
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 4;
  stroke-dasharray: 16 12;
}

.diagram-text {
  fill: #fff;
  font-size: 27px;
  font-weight: 800;
  paint-order: stroke;
  stroke: rgba(21, 31, 41, 0.48);
  stroke-width: 5;
  stroke-linejoin: round;
}

.diagram-line {
  fill: none;
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.line-run {
  stroke: #ffe08a;
  marker-end: url(#runArrow);
}

.line-pass {
  stroke: #ffffff;
  stroke-dasharray: 14 12;
  marker-end: url(#passArrow);
}

.line-dribble {
  stroke: #67d7ff;
  stroke-dasharray: 5 13;
}

#runArrow path {
  fill: #ffe08a;
}

#passArrow path {
  fill: #ffffff;
}

.selected .player-disc,
.selected .cone,
.selected .ball,
.selected .zone {
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.95));
}

.selected .diagram-line {
  filter: drop-shadow(0 0 7px rgba(255, 255, 255, 0.9));
}

.handle {
  fill: #fff;
  stroke: #17202a;
  stroke-width: 3;
  cursor: move;
}

.field-toast {
  position: absolute;
  top: 18px;
  left: 50%;
  z-index: 5;
  max-width: min(420px, calc(100% - 32px));
  padding: 10px 16px;
  color: #fff;
  background: rgba(14, 86, 72, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 7px;
  box-shadow: 0 12px 34px rgba(9, 24, 20, 0.28);
  font-weight: 800;
  font-size: 0.9rem;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, -10px);
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.field-toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.plan-blocks,
.saved-list,
.animation-frames {
  display: grid;
  gap: 10px;
}

.plan-block,
.saved-item,
.animation-frame {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.plan-block {
  padding: 10px;
}

.block-head {
  display: grid;
  grid-template-columns: 58px 1fr 34px;
  gap: 8px;
  align-items: center;
}

.block-time,
.block-title {
  margin: 0;
}

.block-detail {
  margin-top: 8px;
}

.saved-item {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.saved-item strong {
  font-size: 0.9rem;
}

.saved-item span {
  color: var(--muted);
  font-size: 0.78rem;
}

.saved-actions {
  display: flex;
  gap: 8px;
}

.saved-actions button {
  flex: 1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(19, 29, 38, 0.46);
}

.modal-backdrop[hidden] {
  display: none;
}

.print-area {
  display: none;
}

.modal {
  width: min(560px, 100%);
  max-height: min(720px, calc(100vh - 48px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(12, 22, 32, 0.28);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.2;
}

.modal-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
}

.modal-saved-list {
  overflow: auto;
  padding: 16px;
}

body.modal-open {
  overflow: hidden;
}

.animation-controls {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  gap: 8px;
}

.add-step-button {
  min-width: 92px;
}

.animation-meta {
  display: grid;
  grid-template-columns: 1fr auto 76px;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.82rem;
}

.animation-meta input {
  padding: 7px 8px;
}

#frameRange {
  padding-left: 0;
  padding-right: 0;
  accent-color: var(--accent);
}

.animation-frame {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  cursor: pointer;
}

.animation-frame strong {
  font-size: 0.88rem;
}

.animation-frame span {
  color: var(--muted);
  display: block;
  font-size: 0.76rem;
  margin-top: 2px;
}

.animation-frame.active {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.animation-frame-actions {
  display: flex;
  gap: 6px;
}

.animation-frame-actions .icon-button {
  width: 32px;
  min-height: 32px;
}

.animation-frame-actions [data-action="clone"] {
  width: 54px;
}

@media (max-width: 1180px) {
  .session-view {
    grid-template-columns: 1fr;
  }

  .session-sidebar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace {
    grid-template-columns: 280px minmax(420px, 1fr);
  }

  .right-panel {
    grid-column: 1 / -1;
    display: block;
  }

  .right-panel .panel-section {
    border-right: 0;
  }
}

@media (max-width: 820px) {
  .topbar,
  .field-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    padding-left: 14px;
    padding-right: 14px;
  }

  .brand {
    width: 100%;
  }

  .top-actions,
  .field-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .top-actions button,
  .field-actions button {
    width: 100%;
    padding-left: 8px;
    padding-right: 8px;
  }

  .top-actions .icon-button {
    width: 100%;
  }

  .top-action-divider {
    display: none;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .session-view {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .session-board,
  .session-sidebar,
  .session-form-grid,
  .session-block-fields {
    grid-template-columns: 1fr;
  }

  .compact-grid {
    grid-template-columns: 1fr;
  }

  .add-drill-action {
    padding-top: 0;
  }

  .session-block {
    grid-template-columns: 32px 1fr;
    padding: 10px;
  }

  .session-block-order {
    width: 30px;
    height: 30px;
  }

  .session-block-head {
    display: grid;
  }

  .session-block-actions {
    justify-content: stretch;
  }

  .session-block-actions .secondary-button,
  .session-block-actions .danger-button {
    flex: 1;
  }

  .panel,
  .right-panel {
    display: block;
    max-height: none;
  }

  .right-panel .panel-section {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .field-column {
    order: -1;
  }
}

/* Dashboard Landing styles */
.dashboard-landing {
  max-width: 900px;
  margin: 40px auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 40px;
  align-items: center;
}

.dashboard-hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.hero-logo {
  font-size: 3.5rem;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.dashboard-hero h2 {
  font-size: 2.2rem;
  margin: 0;
  color: var(--ink);
  font-weight: 700;
}

.dashboard-hero p {
  font-size: 1.1rem;
  margin: 0;
  color: var(--muted);
  max-width: 600px;
  line-height: 1.5;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  width: 100%;
}

.dashboard-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 30px 24px;
  text-align: left;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.dashboard-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 20px 48px rgba(20, 108, 90, 0.12);
}

.card-icon {
  font-size: 2.2rem;
  color: var(--accent);
  margin-bottom: 4px;
}

.dashboard-card h3 {
  font-size: 1.25rem;
  margin: 0;
  color: var(--ink);
  font-weight: 600;
}

.dashboard-card p {
  font-size: 0.95rem;
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.session-save-status {
  font-size: 0.8rem;
  padding: 4px 10px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 12px;
  font-weight: 500;
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

.session-save-status.is-warning {
  background: #f8e8e8;
  color: var(--danger);
}

@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page {
    margin: 0.45in;
  }

  body {
    background: white;
  }

  .topbar,
  .session-view,
  .workspace,
  .modal-backdrop {
    display: none !important;
  }

  .print-area {
    display: block;
    color: #17202a;
  }

  .print-drill-info {
    margin-bottom: 14px;
  }

  .print-drill-info h1 {
    font-size: 22pt;
    line-height: 1.15;
    margin: 0 0 12px;
  }

  .print-drill-info dl {
    display: grid;
    gap: 8px;
    margin: 0;
  }

  .print-drill-info div {
    break-inside: avoid;
  }

  .print-drill-info dt {
    color: #65717c;
    font-size: 9pt;
    font-weight: 800;
    margin-bottom: 2px;
    text-transform: uppercase;
  }

  .print-drill-info dd {
    font-size: 11pt;
    line-height: 1.35;
    margin: 0;
    white-space: pre-wrap;
  }

  .print-step {
    break-after: page;
    page-break-after: always;
  }

  .print-step:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  .print-step h2 {
    font-size: 12pt;
    margin: 0 0 8px;
  }

  .print-step svg {
    display: block;
    height: auto;
    max-height: 7.4in;
    width: 100%;
  }
}
