:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #f2f6f7;
  color: #1f2933;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  -webkit-text-size-adjust: 100%;
}

[hidden] {
  display: none !important;
}

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

button {
  min-height: 36px;
  border: 1px solid #c9d2dc;
  border-radius: 6px;
  padding: 0 14px;
  background: #ffffff;
  color: #17202a;
  cursor: pointer;
}

button:hover {
  border-color: #7c8fa3;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #c9d2dc;
  border-radius: 6px;
  padding: 10px 12px;
  background: #ffffff;
  color: #17202a;
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 650;
  color: #4a5a6a;
}

.shell {
  min-height: 100vh;
}

.topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 28px;
  align-items: center;
  min-height: 72px;
  padding: 10px 28px;
  border-bottom: 1px solid #dce2e8;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
  color: #66788a;
}

.brand-home {
  display: inline-grid;
  gap: 1px;
  min-width: 132px;
  color: inherit;
  text-decoration: none;
}

.brand-home:hover h1 {
  color: #2563eb;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 20px;
  line-height: 1.1;
}

h2 {
  font-size: 17px;
}

h3 {
  font-size: 15px;
}

.connection {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(160px, 220px) auto;
  gap: 12px;
  align-items: end;
}

.workspace-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.workspace-nav a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 0 10px;
  color: #526273;
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
}

.workspace-nav a:hover,
.workspace-nav a.active {
  background: #eef4fb;
  color: #17202a;
}

.layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  min-height: calc(100vh - 105px);
}

.creator-dashboard {
  display: grid;
  gap: 18px;
  max-width: 1120px;
  padding: 34px 32px 56px;
}

.dashboard-head,
.creator-editor-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.dashboard-head {
  border: 1px solid #dce2e8;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(63, 149, 0, 0.07), rgba(37, 99, 235, 0.04)),
    #ffffff;
  padding: 20px;
  box-shadow: 0 12px 32px rgba(23, 32, 42, 0.05);
}

.creator-editor-head {
  border-bottom: 1px solid #dce2e8;
  padding-bottom: 12px;
}

#editingLabel {
  color: #526273;
  font-size: 13px;
  font-weight: 750;
}

.creator-play-list {
  display: grid;
  gap: 12px;
}

.creator-play-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  border: 1px solid #dce2e8;
  border-radius: 8px;
  background: #ffffff;
  padding: 18px;
  box-shadow: 0 10px 26px rgba(23, 32, 42, 0.05);
}

.creator-play-main {
  min-width: 0;
}

.creator-play-row .play-title {
  font-size: 17px;
}

.creator-play-row .play-meta {
  justify-content: flex-start;
  margin-top: 8px;
}

.creator-play-row .play-meta span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border: 1px solid #dce2e8;
  border-radius: 999px;
  padding: 0 10px;
  background: #f8fafc;
  color: #526273;
  font-size: 12px;
  font-weight: 800;
}

.creator-play-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.creator-play-actions button {
  min-height: 38px;
  padding: 0 14px;
}

.empty-state {
  display: grid;
  gap: 10px;
  border: 1px solid #dce2e8;
  border-radius: 8px;
  background: #ffffff;
  padding: 24px;
  box-shadow: 0 10px 26px rgba(23, 32, 42, 0.05);
}

.empty-state p {
  margin: 0;
  color: #526273;
  line-height: 1.55;
}

.link-button {
  display: inline-flex;
  width: fit-content;
  min-height: 36px;
  align-items: center;
  border: 1px solid #2563eb;
  border-radius: 6px;
  padding: 0 14px;
  background: #2563eb;
  color: #ffffff;
  font-weight: 750;
  text-decoration: none;
}

.sidebar {
  border-right: 1px solid #dce2e8;
  background: #ffffff;
  padding: 26px 22px;
}

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

.play-list {
  display: grid;
  gap: 8px;
}

.play-item {
  width: 100%;
  min-height: 74px;
  text-align: left;
  padding: 14px;
  border-radius: 6px;
  background: #ffffff;
}

.play-item.active {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px #2563eb inset;
}

.play-title {
  display: block;
  font-weight: 750;
  margin-bottom: 6px;
}

.play-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: #66788a;
}

.editor {
  padding: 28px 32px 56px;
}

form {
  display: grid;
  gap: 18px;
  max-width: 1120px;
}

.form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 14px;
}

.cover-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px) auto;
  gap: 14px;
  align-items: end;
}

.steps {
  display: grid;
  gap: 14px;
}

.step-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.step-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.step-tab {
  min-width: 38px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 6px;
  font-weight: 750;
}

.step-tab.active {
  border-color: #2563eb;
  background: #2563eb;
  color: #ffffff;
}

.step {
  display: grid;
  gap: 14px;
  border: 1px solid #dce2e8;
  border-radius: 8px;
  padding: 16px;
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(23, 32, 42, 0.04);
}

.step:not(.active-step) {
  display: none;
}

.step-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.field-workspace {
  --canvas-toolbar-offset: 50px;
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(220px, 1fr);
  gap: 30px;
  align-items: start;
}

.field-canvas-column {
  display: grid;
  gap: 10px;
}

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

.quick-add-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px dashed #c9d2dc;
  border-radius: 10px;
  background: #ffffff;
  color: #334155;
  font-size: 13px;
  font-weight: 750;
}

.quick-add-button::before {
  content: '';
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

.quick-add-button.team-blue::before {
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: #2563eb;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.35);
}

.quick-add-button.team-red::before {
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: #ef4444;
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.35);
}

.quick-add-button.kind-cone::before {
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 15px solid #f59e0b;
  filter: drop-shadow(0 0 0 rgba(146, 64, 14, 0.35));
}

.quick-add-button.kind-disc::before {
  border: 2px solid #cbd5e1;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: inset 0 -1px 0 rgba(148, 163, 184, 0.18);
}

.quick-add-button:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.field-side {
  display: grid;
  gap: 16px;
  padding-top: var(--canvas-toolbar-offset);
}

.field-tools {
  display: grid;
  gap: 12px;
  align-items: stretch;
}

.step-notes-panel,
.inspector-panel,
.shortcut-panel {
  border: 1px solid #dce2e8;
  border-radius: 8px;
  background: #ffffff;
  padding: 16px;
}

.panel-title {
  margin-bottom: 10px;
  color: #334155;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
}

.field-section-title {
  color: #334155;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
}

.step-notes-panel {
  display: grid;
  gap: 10px;
}

.step-notes-panel textarea {
  min-height: 132px;
  resize: vertical;
  border-radius: 10px;
  background: #fbfcfd;
  padding: 16px 18px;
}

.inspector-panel {
  display: grid;
  gap: 12px;
}

.selected-id {
  min-height: 34px;
  border-color: transparent;
  background: #f6f8fb;
  font-weight: 800;
}

.selected-id::placeholder {
  color: #94a3b8;
}

.inspector-selection-chip {
  display: inline-flex;
  width: fit-content;
  min-height: 32px;
  align-items: center;
  border: 1px solid #dce2e8;
  border-radius: 999px;
  padding: 0 14px;
  background: #f8fafc;
  color: #526273;
  font-size: 13px;
  font-weight: 800;
}

.inspector-empty {
  margin: 0;
  color: #66788a;
  font-size: 12px;
  line-height: 1.45;
}

.inspector-fields {
  display: grid;
  gap: 12px;
}

.inspector-fields label {
  display: grid;
  gap: 6px;
}

.selected-entity-kind[readonly] {
  background: #f6f8fb;
  color: #526273;
  font-weight: 700;
}

.selected-team-row.is-hidden {
  display: none;
}

.is-hidden {
  display: none !important;
}

.utility-panel {
  display: grid;
  gap: 0;
  border: 0;
  background: transparent;
}

.shortcut-panel {
  background: #fbfcfd;
}

.shortcut-panel .panel-title {
  margin-bottom: 10px;
}

.shortcut-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.shortcut-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  color: #526273;
  font-size: 12px;
  font-weight: 700;
}

.shortcut-list span {
  line-height: 1.35;
}

kbd {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  justify-content: center;
  border: 1px solid #c9d2dc;
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 0 8px;
  background: #ffffff;
  color: #17202a;
  font-size: 11px;
  font-weight: 800;
}

.preview-field.armed-cut {
  cursor: crosshair;
}

.field-tools button {
  white-space: nowrap;
}

.preview-field {
  position: relative;
  width: min(100%, 360px);
  aspect-ratio: 0.55;
  overflow: hidden;
  border: 3px solid #ffffff;
  outline: 10px solid #3b8f00;
  margin: 10px 0 4px 10px;
  border-radius: 0;
  background: #3f9500;
  touch-action: none;
}

.end-zone {
  position: absolute;
  left: 0;
  right: 0;
  display: grid;
  place-items: center;
  color: rgba(27, 81, 0, 0.5);
  font-size: 19px;
  font-weight: 850;
  text-transform: uppercase;
}

.top-zone {
  top: 0;
  height: 20%;
}

.bottom-zone {
  bottom: 0;
  height: 20%;
}

.playing-zone {
  position: absolute;
  inset: 20% 0;
  display: grid;
  place-items: center;
  color: rgba(27, 81, 0, 0.5);
  font-size: 19px;
  font-weight: 850;
  text-transform: uppercase;
}

.goal-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 3px dashed rgba(255, 255, 255, 0.92);
}

.top-line {
  top: 20%;
}

.bottom-line {
  bottom: 20%;
}

.preview-actions,
.preview-players,
.selection-popover {
  position: absolute;
  inset: 0;
}

.preview-actions {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: auto;
}

.preview-players {
  pointer-events: none;
}

.selection-popover {
  inset: auto;
  z-index: 4;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.84);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(10px);
  transform: translate(-50%, calc(-100% - 18px));
  pointer-events: none;
}

.selection-popover.anchor-left {
  transform: translate(0, calc(-100% - 18px));
}

.selection-popover.anchor-right {
  transform: translate(-100%, calc(-100% - 18px));
}

.selection-popover::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 10px;
  height: 10px;
  border-right: 1px solid rgba(255, 255, 255, 0.72);
  border-bottom: 1px solid rgba(255, 255, 255, 0.72);
  background: rgba(15, 23, 42, 0.84);
  transform: translateX(-50%) rotate(45deg);
}

.selection-popover.anchor-left::after {
  left: 20px;
  transform: rotate(45deg);
}

.selection-popover.anchor-right::after {
  left: auto;
  right: 20px;
  transform: rotate(45deg);
}

.selection-popover button {
  min-height: 30px;
  border-color: rgba(255, 255, 255, 0.14);
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  font-size: 12px;
  font-weight: 800;
  pointer-events: auto;
}

.selection-popover button:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.14);
}

.selection-popover button.is-active {
  border-color: rgba(96, 165, 250, 0.64);
  background: rgba(37, 99, 235, 0.34);
  color: #dbeafe;
}

.selection-popover button.is-danger {
  background: rgba(239, 68, 68, 0.16);
  color: #fecaca;
}

.selection-popover button.is-danger:hover {
  border-color: rgba(248, 113, 113, 0.42);
  background: rgba(239, 68, 68, 0.24);
}

.preview-player {
  position: absolute;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%);
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: #2563eb;
  color: #ffffff;
  font-weight: 850;
  box-shadow: 0 7px 14px rgba(23, 32, 42, 0.25);
  cursor: grab;
  pointer-events: auto;
  user-select: none;
}

.preview-player.team-red {
  background: #ef4444;
}

.preview-player.team-blue {
  background: #2563eb;
}

.preview-player.kind-cone {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  background: #f59e0b;
  color: #17202a;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  font-size: 10px;
}

.preview-player.disc {
  background: #f8fafc;
  color: #17202a;
}

.preview-player.selected {
  outline: 3px solid #facc15;
  outline-offset: 2px;
}

.action-line {
  stroke: #17202a;
  stroke-width: 1.05;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 3 2;
  fill: none;
}

.selectable-action {
  pointer-events: stroke;
  cursor: pointer;
}

.action-hit {
  fill: none;
  pointer-events: stroke;
  stroke: rgba(255, 255, 255, 0);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 7;
  cursor: pointer;
}

.route-handle {
  fill: #ffffff;
  pointer-events: all;
  stroke: #6366f1;
  stroke-width: 0.45;
  cursor: grab;
  vector-effect: non-scaling-stroke;
}

.route-handle-start {
  fill: #eef2ff;
}

.route-handle-add {
  fill: rgba(255, 255, 255, 0.98);
  stroke: #60a5fa;
  stroke-dasharray: 0.55 0.4;
}

.selected-action {
  stroke: #facc15;
  stroke-width: 1.65;
}

.temp-line {
  stroke: #ef4444;
  stroke-width: 2.2;
}

.throw-line {
  stroke: #ef4444;
  stroke-width: 1.35;
  stroke-linecap: round;
  fill: none;
}

.throw-line.selected-action {
  stroke: #facc15;
  stroke-width: 1.85;
}

.preview-error {
  border-color: #b42318;
  box-shadow: 0 0 0 1px #b42318 inset;
}

.json-details {
  display: grid;
  gap: 10px;
}

.json-details summary {
  color: #4a5a6a;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
}

.actions {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  background: #f2f6f7;
}

#saveBtn {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

#publishBtn {
  background: #0f766e;
  border-color: #0f766e;
  color: #ffffff;
}

#statusText {
  color: #526273;
  font-size: 13px;
}

@media (max-width: 900px) {
  .layout {
    display: block;
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: start;
  }

  .topbar,
  .creator-dashboard,
  .editor,
  .sidebar {
    padding-left: 16px;
    padding-right: 16px;
  }

  .connection,
  .form-row,
  .cover-row,
  .creator-play-row,
  .field-workspace,
  .field-tools,
  .utility-panel {
    grid-template-columns: 1fr;
  }

  .workspace-nav {
    flex-wrap: wrap;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid #dce2e8;
  }

  .creator-play-actions {
    justify-content: stretch;
  }

  .creator-play-actions button,
  .actions button,
  .step-head-actions button {
    min-width: 0;
  }

  .creator-play-actions button {
    flex: 1 1 90px;
  }

  .preview-field {
    width: min(82vw, 340px);
    margin-left: 8px;
  }

  .field-side {
    padding-top: 0;
  }

  .actions {
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  button,
  input,
  select,
  textarea,
  .link-button {
    min-height: 44px;
  }

  .topbar {
    padding-top: 20px;
  }

  .connection {
    margin-top: 0;
  }

  .creator-dashboard {
    padding-top: 22px;
  }

  .dashboard-head,
  .creator-editor-head,
  .step-head,
  .section-head {
    align-items: stretch;
  }

  .dashboard-head button,
  .creator-editor-head button,
  .section-head button,
  .step-head-actions button {
    width: 100%;
  }

  .creator-play-row {
    padding: 13px;
  }

  .editor {
    padding-top: 18px;
  }

  form {
    gap: 14px;
  }

  .step {
    padding: 13px;
  }

  .field-workspace {
    gap: 16px;
  }

  .preview-field {
    width: min(80vw, 300px);
    outline-width: 7px;
  }

  .preview-player {
    width: 32px;
    height: 32px;
  }

  .object-toolbar,
  .utility-panel {
    gap: 8px;
  }

  .actions {
    position: static;
  }

  .actions button {
    flex: 1 1 130px;
  }
}
