:root {
  color-scheme: dark; /* açılır listeler, tarih/renk seçicileri ve kaydırma çubukları koyu temaya uysun */
  --bg: #101815;
  --panel: #18231f;
  --panel-2: #202e29;
  --line: rgba(229, 244, 232, 0.18);
  --text: #edf6ee;
  --muted: #b8c8bf;
  --accent: #f2c14e;
  --accent-2: #3ddc97;
  --danger: #ff6b6b;
  --pitch: #1f7d48;
  --pitch-dark: #18673b;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(61, 220, 151, 0.14), transparent 32rem),
    linear-gradient(135deg, #0d1412, var(--bg));
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 22px;
}

/* .topbar düzeni app.css içinde */

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-2);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.65rem, 2.6vw, 2.65rem);
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(250px, 310px) minmax(420px, 1fr) minmax(270px, 340px);
  gap: 16px;
  align-items: start;
}

.panel,
.pitch-card {
  border: 1px solid var(--line);
  background: rgba(24, 35, 31, 0.92);
  box-shadow: var(--shadow);
}

.panel {
  border-radius: 8px;
  overflow: hidden;
}

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

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

.roster-panel .panel-section:first-child {
  display: grid;
  gap: 12px;
}

.team-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.team-switch-button {
  min-width: 0;
  min-height: 38px;
  overflow: hidden;
  border: 1px solid rgba(237, 246, 238, 0.16);
  border-radius: 6px;
  background: rgba(237, 246, 238, 0.05);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-switch-button.active {
  border-color: var(--team-color);
  color: var(--text);
  box-shadow: inset 0 -3px 0 var(--team-color);
}

.team-settings {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  gap: 8px;
}

.team-settings[hidden],
.bench-strip[hidden] {
  display: none;
}

.team-settings label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.team-color-field input[type="color"] {
  padding: 4px;
  cursor: pointer;
}

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

.section-heading span {
  color: var(--muted);
  font-size: 0.9rem;
}

.position-filter {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 12px;
}

.position-filter-button {
  min-height: 34px;
  border: 1px solid rgba(237, 246, 238, 0.14);
  border-radius: 6px;
  background: rgba(237, 246, 238, 0.06);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    transform 140ms ease;
}

.position-filter-button:hover {
  transform: translateY(-1px);
  color: var(--text);
}

.position-filter-button.active {
  border-color: rgba(61, 220, 151, 0.58);
  background: rgba(61, 220, 151, 0.16);
  color: #f6fff7;
}

.player-form {
  display: grid;
  gap: 10px;
}

.form-grid,
.modifier-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

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

.player-form label,
.editor-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.position-field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.primary-position-field {
  margin-top: 3px;
}

.position-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.position-picker--editor {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.player-form .position-check,
.editor-form .position-check {
  position: relative;
  display: block;
  min-width: 0;
  font-size: 0.76rem;
  font-weight: 900;
  color: var(--text);
}

.position-check input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.position-check span {
  min-height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(237, 246, 238, 0.16);
  border-radius: 6px;
  background: rgba(237, 246, 238, 0.05);
}

.position-check input:checked + span {
  border-color: rgba(61, 220, 151, 0.75);
  background: rgba(61, 220, 151, 0.18);
  color: var(--accent-2);
}

.morale-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.morale-picker {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.morale-option {
  position: relative;
  display: grid !important;
  justify-items: center;
  gap: 5px !important;
  min-width: 0;
  min-height: 70px;
  border: 1px solid rgba(237, 246, 238, 0.16);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(237, 246, 238, 0.08), transparent 58%),
    rgba(237, 246, 238, 0.04);
  color: var(--muted) !important;
  padding: 8px 4px;
  text-align: center;
  cursor: pointer;
}

.morale-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.morale-option .morale-face {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
}

.morale-option > span:last-child {
  max-width: 100%;
  overflow: hidden;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.morale-option:has(input:checked) {
  border-color: rgba(61, 220, 151, 0.75);
  background:
    linear-gradient(180deg, rgba(61, 220, 151, 0.2), transparent 58%),
    rgba(61, 220, 151, 0.1);
  color: var(--text) !important;
  box-shadow: 0 0 0 3px rgba(61, 220, 151, 0.1);
}

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

.form-grid > .position-field {
  grid-column: 1 / -1;
}

.stat-form-grid[hidden] {
  display: none;
}

.stat-form-grid::before {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.stat-form-grid[data-stat-group="outfield"]::before {
  content: "Saha oyuncusu statları";
}

.stat-form-grid[data-stat-group="goalkeeper"]::before {
  content: "Kaleci statları";
}

.stat-form-grid input,
.modifier-grid input,
.match-entry-grid input {
  min-height: 36px;
  padding: 0 9px;
}

.file-field input {
  padding: 8px;
  min-height: 40px;
}

input,
select {
  width: 100%;
  border: 1px solid rgba(237, 246, 238, 0.16);
  border-radius: 6px;
  background: #0f1714;
  color: var(--text);
  min-height: 42px;
  padding: 0 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(61, 220, 151, 0.14);
}

input[readonly] {
  border-color: rgba(242, 193, 78, 0.34);
  background: rgba(242, 193, 78, 0.08);
  color: #ffe7a5;
  cursor: default;
}

.primary-button,
.danger-button,
.ghost-button,
.icon-button,
.chip-button,
.run-item {
  border: 0;
  border-radius: 6px;
  min-height: 40px;
  color: var(--text);
  transition:
    transform 140ms ease,
    background 140ms ease,
    border-color 140ms ease;
}

.primary-button {
  background: var(--accent);
  color: #17201c;
  padding: 0 14px;
  font-weight: 800;
}

.danger-button {
  border: 1px solid rgba(255, 107, 107, 0.58);
  background: rgba(255, 107, 107, 0.14);
  color: #ffd4d4;
  padding: 0 14px;
  font-weight: 800;
}

.ghost-button {
  background: rgba(237, 246, 238, 0.07);
  border: 1px solid rgba(237, 246, 238, 0.15);
  padding: 0 14px;
}

.icon-button {
  display: grid;
  place-items: center;
  background: var(--accent-2);
  color: #0f1714;
  font-size: 1.45rem;
  font-weight: 800;
}

.primary-button:hover,
.danger-button:hover,
.ghost-button:hover,
.icon-button:hover,
.chip-button:hover {
  transform: translateY(-1px);
}

.player-list,
.bench-list {
  display: grid;
  gap: 8px;
}

.player-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.player-chip,
.bench-chip {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 144px;
  border: 1px solid rgba(237, 246, 238, 0.13);
  border-radius: 8px;
  background: var(--panel-2);
  padding: 8px;
}

.player-chip.selected,
.bench-chip.selected {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(61, 220, 151, 0.12);
}

.player-chip.slot-fit,
.bench-chip.slot-fit {
  border-color: rgba(61, 220, 151, 0.58);
  background:
    linear-gradient(90deg, rgba(61, 220, 151, 0.12), transparent 42%),
    var(--panel-2);
}

.bench-chip {
  grid-template-columns: auto 1fr;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), #f88f46);
  color: #17201c;
  font-weight: 900;
}

.player-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.player-info {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.player-meta {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.chip-button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(255, 107, 107, 0.45);
  background: rgba(255, 107, 107, 0.1);
  color: #ffd4d4;
}

.pitch-area {
  min-width: 0;
}

.pitch-view-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.pitch-view-button {
  min-width: 0;
  min-height: 40px;
  overflow: hidden;
  border: 1px solid rgba(237, 246, 238, 0.16);
  border-radius: 6px;
  background: rgba(237, 246, 238, 0.05);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pitch-view-button.active {
  border-color: var(--accent-2);
  background: rgba(61, 220, 151, 0.12);
  color: var(--text);
  box-shadow: inset 0 -3px 0 var(--accent-2);
}

.pitch-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 12px;
  align-items: end;
}

.pitch-toolbar-buttons {
  grid-column: 1 / -1;
}

.pitch-toolbar label {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  margin-bottom: 6px;
}

.toolbar-button {
  flex: 1 1 auto;
  min-width: 0;
}

.pitch-card {
  border-radius: 8px;
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 24%),
    #07120e;
}

.bench-strip {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(237, 246, 238, 0.06), transparent 44%),
    rgba(24, 35, 31, 0.92);
  box-shadow: var(--shadow);
  padding: 12px;
  transition:
    background 140ms ease,
    border-color 140ms ease;
}

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

.bench-strip-head span {
  color: var(--muted);
  font-size: 0.9rem;
}

.bench-strip .bench-list {
  display: flex;
  gap: 10px;
  min-height: 174px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 8px;
  scrollbar-color: rgba(237, 246, 238, 0.28) transparent;
}

.bench-strip .bench-chip {
  flex: 0 0 124px;
  grid-template-columns: 1fr;
  justify-items: center;
  align-content: start;
  min-height: 0;
  gap: 7px;
  padding: 8px;
  text-align: center;
}

.bench-strip .bench-chip .player-card {
  width: 92px;
  height: 138px;
}

.bench-strip .player-info {
  width: 100%;
}

.bench-strip .player-meta {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bench-strip .selected-meta {
  margin: 0;
  align-self: center;
  padding: 0 8px;
}

.bench-strip.drop-ready {
  border-color: var(--accent-2);
  background:
    linear-gradient(180deg, rgba(61, 220, 151, 0.16), transparent 50%),
    rgba(24, 35, 31, 0.96);
}

.pitch {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  min-height: 660px;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(2, 8, 7, 0.08), rgba(2, 8, 7, 0.18)),
    url("assets/fut-saha-bg.webp") center / cover no-repeat,
    #07120e;
  border: 3px solid rgba(237, 246, 238, 0.42);
  box-shadow:
    inset 0 0 80px rgba(0, 0, 0, 0.36),
    inset 0 -52px 90px rgba(0, 0, 0, 0.24);
  isolation: isolate;
}

.pitch::before,
.pitch::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pitch::before {
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(1, 6, 6, 0.22), transparent 24%, transparent 72%, rgba(1, 6, 6, 0.18)),
    radial-gradient(ellipse at 50% 45%, transparent 0 54%, rgba(0, 0, 0, 0.28) 100%);
  opacity: 0.82;
}

.pitch::after {
  z-index: 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.06), transparent 20%, transparent 80%, rgba(255, 255, 255, 0.05));
  opacity: 0.32;
}

.pitch-lines,
.arrow-layer,
#slotLayer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.pitch-lines {
  z-index: 1;
  display: none;
  pointer-events: none;
  transform: perspective(660px) rotateX(10deg) scaleY(1.03);
  transform-origin: 50% 66%;
  opacity: 0.86;
}

.center-line {
  position: absolute;
  left: 4%;
  right: 4%;
  top: 50%;
  border-top: 2px solid rgba(237, 246, 238, 0.45);
}

.center-circle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 30%;
  aspect-ratio: 1;
  border: 2px solid rgba(237, 246, 238, 0.45);
  border-radius: 50%;
  transform: translate(-50%, -50%) scaleY(0.72);
}

.box {
  position: absolute;
  border: 2px solid rgba(237, 246, 238, 0.45);
}

.box-top {
  left: 28%;
  width: 44%;
  height: 13%;
  top: -2px;
}

.box-bottom {
  left: 16%;
  width: 68%;
  height: 22%;
  bottom: -2px;
}

.goal {
  position: absolute;
  height: 4%;
  background: rgba(237, 246, 238, 0.18);
  border: 2px solid rgba(237, 246, 238, 0.5);
}

.goal-top {
  left: 42%;
  width: 16%;
  top: -2px;
}

.goal-bottom {
  left: 34%;
  width: 32%;
  bottom: -2px;
}

.slot {
  position: absolute;
  width: calc(var(--card-width, 130px) + 16px);
  min-height: calc(var(--card-height, 195px) + 34px);
  transform: translate(-50%, -50%);
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 5px;
  border: 1px dashed var(--team-color, rgba(237, 246, 238, 0.4));
  border-radius: 8px;
  background: rgba(15, 23, 20, 0.34);
  padding: 7px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.slot.occupied {
  border-style: solid;
  border-color: transparent;
  background: transparent;
  padding: 0;
}

.slot.selected {
  box-shadow: 0 0 0 4px rgba(61, 220, 151, 0.22);
  border-color: var(--team-color, var(--accent-2));
}

.slot.slot-moving {
  cursor: grabbing;
  z-index: 5;
}

.position-label {
  color: rgba(237, 246, 238, 0.7);
  font-size: 0.78rem;
  font-weight: 800;
}

.empty-slot {
  color: rgba(237, 246, 238, 0.64);
  font-size: 0.8rem;
  text-align: center;
}

.arrow-layer {
  z-index: 2;
  color: var(--accent);
  pointer-events: none;
}

.run-arrow {
  fill: none;
  stroke: currentColor;
  stroke-width: 7;
  stroke-linecap: round;
  marker-end: url(#arrowHead);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.28));
  pointer-events: stroke;
  cursor: pointer;
}

.run-arrow.selected {
  color: var(--accent-2);
  stroke-width: 8.5;
}

.draft-arrow {
  fill: none;
  stroke: currentColor;
  stroke-width: 7;
  stroke-dasharray: 2.5 2;
  stroke-linecap: round;
  marker-end: url(#arrowHead);
  pointer-events: none;
}

.run-origin,
.draft-origin {
  fill: currentColor;
  stroke: rgba(5, 18, 13, 0.9);
  stroke-width: 2.5;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.36));
}

.run-origin.selected {
  fill: currentColor;
  stroke: rgba(237, 246, 238, 0.92);
}

#slotLayer {
  z-index: 3;
  pointer-events: none;
}

.slot {
  pointer-events: auto;
}

.selected-card {
  min-height: 84px;
  border: 1px solid rgba(237, 246, 238, 0.13);
  border-radius: 8px;
  background: #0f1714;
  padding: 12px;
}

.slot.occupied {
  width: calc(var(--card-width, 130px) + 12px);
  min-height: calc(var(--card-height, 195px) + 22px);
}

.pitch--compact .position-label {
  font-size: 0.66rem;
}

.pitch--compact .empty-slot {
  font-size: 0.64rem;
}

.pitch--two-teams .slot.inactive-team {
  opacity: 0.88;
}

.pitch--two-teams .slot.active-team {
  opacity: 1;
}

.selected-profile {
  display: grid;
  gap: 13px;
}

.selected-profile-card {
  display: grid;
  justify-items: center;
}

.profile-identity {
  display: grid;
  justify-items: center;
  gap: 5px;
  text-align: center;
}

.profile-identity strong {
  margin-bottom: 0;
  font-size: 1.12rem;
}

.profile-stat-grid,
.match-log-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.profile-stat {
  display: grid;
  gap: 5px;
  min-width: 0;
  min-height: 66px;
  align-content: center;
  border: 1px solid rgba(237, 246, 238, 0.13);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(237, 246, 238, 0.07), transparent 62%),
    rgba(237, 246, 238, 0.04);
  padding: 8px 6px;
  text-align: center;
}

.profile-stat span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.profile-stat strong {
  margin: 0;
  color: var(--text);
  font-size: 1.18rem;
  line-height: 1;
}

.profile-summary {
  border-top: 1px solid rgba(237, 246, 238, 0.1);
  border-bottom: 1px solid rgba(237, 246, 238, 0.1);
}

.profile-actions {
  display: grid;
  gap: 8px;
}

.match-log-panel {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(237, 246, 238, 0.13);
  border-radius: 8px;
  background: rgba(15, 23, 20, 0.55);
  padding: 10px;
}

.match-entry-grid {
  display: grid;
  grid-template-columns: minmax(120px, 0.9fr) minmax(150px, 1.3fr) repeat(3, minmax(64px, 0.55fr));
  gap: 8px;
  align-items: end;
}

.opta-match-details {
  grid-column: 1 / -1;
  border: 1px solid rgba(237, 246, 238, 0.12);
  border-radius: 6px;
  background: rgba(237, 246, 238, 0.035);
}

.opta-match-details summary {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 900;
}

.opta-action-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  border-top: 1px solid rgba(237, 246, 238, 0.1);
  padding: 10px;
}

.opta-action-grid label {
  min-width: 0;
}

.match-note-field {
  grid-column: 1 / span 4;
}

.match-entry-actions {
  display: flex;
  gap: 8px;
  align-items: end;
}

.match-add-button {
  min-width: 90px;
}

.match-log-list {
  display: grid;
  gap: 7px;
  max-height: 180px;
  overflow: auto;
  padding-right: 2px;
}

.match-log-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(237, 246, 238, 0.1);
  border-radius: 8px;
  background: rgba(237, 246, 238, 0.04);
  padding: 8px;
}

.player-chip {
  grid-template-columns: 1fr;
  justify-items: center;
  align-content: start;
  min-height: 174px;
  gap: 6px;
  padding: 7px 5px;
  text-align: center;
}

.player-chip .player-card {
  --card-width: 72px;
  --card-height: 108px;
}

.player-chip .card-name {
  font-size: 7px;
}

.player-chip .card-stats {
  gap: 1px;
}

.player-chip .card-stats strong {
  font-size: 6px;
}

.player-chip .card-stats em {
  font-size: 4px;
}

.player-chip .morale-face {
  min-width: 13px;
  min-height: 13px;
}

.player-chip .player-info {
  width: 100%;
}

.player-chip .player-meta {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.7rem;
}

.player-chip .player-name {
  max-width: 100%;
  line-height: 1.15;
}

.player-chip .chip-button {
  min-height: 26px;
  padding: 0 8px;
  font-size: 0.72rem;
}

.match-log-actions {
  display: flex;
  gap: 7px;
  align-items: center;
}

.match-edit-button {
  min-height: 30px;
  padding: 0 9px;
}

.match-log-row strong,
.match-log-row span,
.match-note {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-log-row strong {
  margin: 0 0 3px;
  color: var(--text);
  font-size: 0.9rem;
}

.match-log-row span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.match-note {
  margin-top: 3px;
  color: #d7e7dd;
  font-size: 0.78rem;
  font-weight: 700;
}

.editor-form {
  display: grid;
  gap: 10px;
}

.editor-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
}

.selected-card p {
  margin: 0;
  color: var(--muted);
}

.selected-card strong {
  display: block;
  margin-bottom: 5px;
  font-size: 1.05rem;
}

.selected-meta {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.45;
}

.position-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.position-badge {
  min-height: 22px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(237, 246, 238, 0.16);
  border-radius: 6px;
  background: rgba(237, 246, 238, 0.06);
  color: var(--muted);
  padding: 0 8px;
  font-size: 0.74rem;
  font-weight: 900;
}

.position-badge--primary {
  border-color: rgba(61, 220, 151, 0.68);
  background: rgba(61, 220, 151, 0.16);
  color: var(--accent-2);
}

.selected-action {
  margin-top: 10px;
}

.panel-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
  font-weight: 700;
  margin-bottom: 10px;
}

.run-list {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.run-item {
  display: grid;
  gap: 9px;
  border: 1px solid rgba(237, 246, 238, 0.14);
  background: #0f1714;
  padding: 9px;
  text-align: left;
}

.run-item.selected {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(61, 220, 151, 0.14);
}

.run-pick {
  min-height: 28px;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
  text-align: left;
  font-weight: 800;
}

.run-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(86px, 0.9fr) auto;
  gap: 8px;
  align-items: end;
}

.run-controls select,
.run-distance-label {
  min-width: 0;
}

.run-distance-label {
  display: grid;
  gap: 5px;
}

.run-distance-label span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.run-distance {
  width: 100%;
  accent-color: var(--accent-2);
}

.run-item span,
.run-pick {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.run-delete {
  min-height: 30px;
  border: 1px solid rgba(255, 107, 107, 0.45);
  background: rgba(255, 107, 107, 0.1);
  color: #ffd4d4;
  border-radius: 6px;
  padding: 0 9px;
}

.full-button {
  width: 100%;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(4, 10, 8, 0.72);
  backdrop-filter: blur(8px);
}

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

.modal {
  width: min(860px, 100%);
  max-height: min(760px, calc(100vh - 44px));
  overflow: auto;
  border: 1px solid rgba(237, 246, 238, 0.18);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.5);
  padding: 16px;
}

.modal--wide {
  width: min(940px, 100%);
}

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

.modal-close {
  min-width: 82px;
}

.create-player-layout {
  display: grid;
  grid-template-columns: minmax(190px, 230px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.create-preview {
  position: sticky;
  top: 0;
  display: grid;
  justify-items: center;
  gap: 12px;
  min-height: 304px;
  border: 1px solid rgba(237, 246, 238, 0.13);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(61, 220, 151, 0.1), transparent 42%),
    #0f1714;
  padding: 16px 12px;
}

.create-preview-meta {
  display: grid;
  gap: 4px;
  width: 100%;
  text-align: center;
}

.create-preview-meta strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 0.98rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.create-preview-meta span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.create-fields {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.summary {
  display: grid;
  gap: 8px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(237, 246, 238, 0.1);
  color: var(--muted);
}

.summary-row:last-child {
  border-bottom: 0;
}

.summary-row strong {
  color: var(--text);
}

.drop-ready {
  border-color: var(--accent-2);
  background: rgba(61, 220, 151, 0.14);
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: 280px 1fr;
  }

  .tactics-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 14px;
  }

  .modal-head {
    align-items: stretch;
    flex-direction: column;
  }

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

  .toolbar-button {
    min-width: 0;
  }

  .pitch {
    min-height: 0;
  }

  .bench-strip .bench-list {
    min-height: 154px;
  }

  .bench-strip .bench-chip {
    flex-basis: 106px;
  }

  .bench-strip .bench-chip .player-card {
    width: 78px;
    height: 117px;
  }

  .modal-backdrop {
    padding: 12px;
  }

  .modal {
    max-height: calc(100vh - 24px);
  }

  .create-player-layout {
    grid-template-columns: 1fr;
  }

  .create-preview {
    position: static;
    min-height: auto;
  }

  .form-grid,
  .modifier-grid,
  .match-entry-grid,
  .opta-action-grid,
  .stat-form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .profile-stat-grid,
  .match-log-summary {
    grid-template-columns: 1fr 1fr;
  }

  .match-note-field,
  .match-entry-actions,
  .match-add-button {
    grid-column: 1 / -1;
  }

  .match-entry-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}
