:root {
  --bg: #0b0f14;
  --card: #121820;
  --text: #e9eef7;
  --muted: #9fb0c9;
  --primary: #2f74ff;
  --secondary: #334155;
  --accent: #22c55e;
  --radius: 20px;
  /* 桌面端为比赛时间字体增加的偏移量，默认手机端为0 */
  --date-offset: 0px;
  /* 桌面端为 Match Title 字体增加的偏移量，默认手机端为0 */
  --title-offset: 0px;
}

h1, h2, h3, h4, h5, h6 {
    color: #fff!important;
    font-family: var(--wp--preset--font-family--oswald);
    font-weight: 600;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(180deg, #091016, #0b0f14 60%, #0a0e12);
  color: var(--text);
}

.app-header {
  padding: 24px 20px 8px;
  text-align: center;
}
.app-header h1 {
  margin: 0 0 6px;
  font-weight: 800;
}
.app-header p { margin: 0; color: var(--muted); }

.container { max-width: 960px; margin: 0 auto; padding: clamp(12px, 2.5vw, 20px) clamp(12px, 2.5vw, 20px) clamp(24px, 4vw, 40px); }

.controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(10px, 2vw, 16px);
  margin-bottom: clamp(14px, 3vw, 20px);
}
.control-row { display: flex; flex-direction: column; gap: 8px; }
.control-row label { color: var(--muted); font-size: 13px; }
select, input[type="number"], input[type="text"], input[type="datetime-local"] {
  background: var(--card);
  color: var(--text);
  border: 1px solid #223042;
  border-radius: 10px;
  padding: clamp(10px, 2.4vw, 12px) clamp(12px, 2.6vw, 14px);
  outline: none;
  font-size: clamp(14px, 2.2vw, 16px);
  line-height: 1.4;
  min-height: clamp(36px, 5.6vw, 42px);
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
}
select:focus, input[type="number"]:focus, input[type="text"]:focus, input[type="datetime-local"]:focus {
  border-color: rgba(47,116,255,0.65);
  box-shadow: 0 0 0 2px rgba(47,116,255,0.25);
}
input::placeholder { color: var(--muted); opacity: 0.75; }
.score-inputs { display: flex; align-items: center; gap: 12px; }
.score-inputs .colon { color: var(--muted); font-weight: 700; }

.actions { grid-column: 1 / -1; display: flex; gap: 12px; }
.actions .primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}
.actions .secondary {
  background: var(--secondary);
  color: var(--text);
  border: none;
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}
.actions button:hover { filter: brightness(1.08); }

.score-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  justify-items: center;
  gap: 0;
  background: var(--card);
  border: 1px solid #1f2a37;
  border-radius: clamp(14px, 2.2vw, var(--radius));
  padding: 0;
  aspect-ratio: 4 / 3; /* 改为 4:3 比例 */
  overflow: hidden;
  width: 100%;
  max-width: 100vw; /* 适配手机屏幕宽度 */
  --font-scale: 0.9; /* 统一字体缩放因子 */
}

.score-card::before { /* 中间分割线 */
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255,255,255,0.15);
}

/* 第一版样式覆写：三列结构、非绝对居中层、经典卡片背景 */
.score-card--v1 { 
  grid-template-columns: 1fr auto 1fr; 
  gap: clamp(10px, 2vw, 16px);
  background: radial-gradient(1200px 600px at 50% -200px, rgba(47,116,255,0.12), transparent), var(--card);
  padding: clamp(16px, 3vw, 24px);
  aspect-ratio: 16 / 9; /* 第二张图片设为 16:9 */
}
.score-card--v1::before { display: none; }
.score-card--v1 .center { position: static; transform: none; padding: 8px 16px; }
.score-card--v1 .team { flex-direction: row; }
.score-card--v1 .team img { width: clamp(56px, 10vw, 86px); height: clamp(56px, 10vw, 86px); background: #10161c; }
.score-card--v1 .team-info { align-items: flex-start; }
.score-card--v1 .match-title { font-size: calc(var(--font-scale, 1) * clamp(12px, 1.5vw, 14px) + var(--title-offset, 0px)); }
.score-card--v1 .relation { font-size: calc(var(--font-scale, 1) * clamp(12px, 1.5vw, 14px)); }
.score-card--v1 .score { font-size: calc(var(--font-scale, 1) * clamp(34px, 8.5vw, 72px)); }
.score-card--v1 .date { font-size: calc(var(--font-scale, 1) * clamp(10px, 1.4vw, 11px) + var(--date-offset, 0px)); }
.score-card--v1 .team-name { font-size: calc(var(--font-scale, 1) * clamp(16px, 2.2vw, 22px)); }
.score-card--v1 .team-league { font-size: calc(var(--font-scale, 1) * clamp(12px, 1.8vw, 14px)); width: 100%;}

.team { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; height: 100%; width: 100%; }
.team-home, .team-away { padding: clamp(16px, 3vw, 24px); }
.team img { width: clamp(90px, 18vw, 160px); height: clamp(90px, 18vw, 160px); border-radius: clamp(12px, 2vw, 18px); background: transparent; border: none; }
.team-home img { background: var(--home-bg, #10161c); }
.team-away img { background: var(--away-bg, #10161c); }
.team-info { display: flex; flex-direction: column; align-items: center; }
.team-name { font-size: calc(var(--font-scale, 1) * clamp(18px, 2.6vw, 24px)); font-weight: 700; text-align: center; }
.team-league { color: var(--muted); text-align: center; font-size: calc(var(--font-scale, 1) * clamp(12px, 1.8vw, 14px)); }

.center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; padding: 0; pointer-events: none; }
.match-title { font-size: calc(var(--font-scale, 1) * clamp(14px, 1.8vw, 16px)); font-weight: 700; margin-bottom: 4px; }
.relation { font-size: calc(var(--font-scale, 1) * clamp(14px, 1.8vw, 16px)); color: var(--accent); font-weight: 700; letter-spacing: 0.5px; }
.score { font-size: calc(var(--font-scale, 1) * var(--score-size, clamp(40px, 10vw, 86px))); font-weight: 800; line-height: 1; color: #ffffff; text-shadow: 0 2px 6px rgba(0,0,0,0.6); }
.score .colon-display { color: var(--muted); padding: 0 8px; }
.date { margin-top: 6px; font-size: calc(var(--font-scale, 1) * clamp(11px, 1.6vw, 12px) + var(--date-offset, 0px)); color: var(--muted); }

.tips { margin-top: 16px; color: var(--muted); font-size: 13px; }

.watermark {
  position: absolute;
  right: clamp(10px, 2.4vw, 14px);
  bottom: clamp(8px, 2vw, 12px);
  font-size: clamp(10px, 1.6vw, 12px);
  color: rgba(255,255,255,0.75);
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  pointer-events: none;
  user-select: none;
  z-index: 2;
}

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

/* 桌面端提升比赛时间字体5px，手机端保持不变 */
@media (min-width: 721px) {
  :root { --date-offset: 5px; --title-offset: 5px; }
}

@media (max-width: 520px) {
  /* 保持左右布局，避免在手机端堆叠，等比缩小由宽度控制 */
  .score-card { grid-template-columns: 1fr 1fr; }
  /* 第二张图在手机端整体上移一点，使内容更靠上 */
  .score-card--v1 { align-items: start; padding-top: clamp(8px, 2vw, 12px); padding-bottom: clamp(8px, 2vw, 12px); }
  .score-card--v1 .center { margin-top: -6px; }
}

#datetimeInput[type="datetime-local"] {
  color-scheme: dark;
}

/* 阵容图样式 */
.formation-card {
  position: relative;
  background: #2f6e2f;
  border: 1px solid #1f2a37;
  border-radius: clamp(14px, 2.2vw, var(--radius));
  width: 100%;
  aspect-ratio: 3 / 4; /* 竖版球场 */
  overflow: hidden;
  --pad: 3%;
  --line: rgba(255,255,255,0.85);
}
.pitch-stripes { /* 草皮深浅条纹作为真实子层，确保导出包含 */
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    180deg,
    rgba(255,255,255,0.12) 0px,
    rgba(255,255,255,0.12) 28px,
    rgba(0,0,0,0.12) 28px,
    rgba(0,0,0,0.12) 56px
  );
  z-index: 1;
}
.pitch-lines { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
/* 边线（四边） */
.pitch-lines .touchline { position: absolute; background: var(--line); }
.pitch-lines .touchline.top { left: var(--pad); right: var(--pad); top: var(--pad); height: 2px; }
.pitch-lines .touchline.bottom { left: var(--pad); right: var(--pad); bottom: var(--pad); height: 2px; }
.pitch-lines .touchline.left { top: var(--pad); bottom: var(--pad); left: var(--pad); width: 2px; }
.pitch-lines .touchline.right { top: var(--pad); bottom: var(--pad); right: var(--pad); width: 2px; }
/* 角球圆弧 */
.pitch-lines .corner-arc { position: absolute; width: 4.5%; height: 4.5%; border: 2px solid transparent; border-radius: 50%; }
.pitch-lines .corner-arc.tl { left: var(--pad); top: var(--pad); border-right-color: var(--line); border-bottom-color: var(--line); }
.pitch-lines .corner-arc.tr { right: var(--pad); top: var(--pad); border-left-color: var(--line); border-bottom-color: var(--line); }
.pitch-lines .corner-arc.bl { left: var(--pad); bottom: var(--pad); border-right-color: var(--line); border-top-color: var(--line); }
.pitch-lines .corner-arc.br { right: var(--pad); bottom: var(--pad); border-left-color: var(--line); border-top-color: var(--line); }
/* 中线与中圈 */
.pitch-lines .center-line { position: absolute; left: var(--pad); right: var(--pad); top: 50%; height: 2px; background: var(--line); }
.pitch-lines .center-circle {
  position: absolute; left: 50%; top: 50%; width: 20%; aspect-ratio: 1 / 1;
  border: 2px solid var(--line); border-radius: 50%; transform: translate(-50%, -50%);
}
.pitch-lines .center-spot {
  position: absolute; left: 50%; top: 50%; width: clamp(4px, 0.8vw, 6px); height: clamp(4px, 0.8vw, 6px);
  background: rgba(255,255,255,0.95); border-radius: 50%; transform: translate(-50%, -50%);
}
/* 球门框（上下居中，开口朝内） */
.pitch-lines .goal-frame { position: absolute; left: 50%; width: 20%; height: 4%; transform: translateX(-50%); border: 2px solid var(--line); }
.pitch-lines .goal-frame.top { top: calc(var(--pad) + 2%); border-bottom: none; /* 顶部开口向下（朝内） */ }
.pitch-lines .goal-frame.bottom { bottom: calc(var(--pad) + 2%); border-top: none; /* 底部开口向上（朝内） */ }
/* 顶部禁区与小禁区 */
.pitch-lines .penalty-box.top {
  position: absolute; left: calc(var(--pad) + 18%); right: calc(var(--pad) + 18%); top: calc(var(--pad) + 10%); height: 18%;
  border: 2px solid var(--line);
}
.pitch-lines .goal-area.top {
  position: absolute; left: calc(var(--pad) + 34%); right: calc(var(--pad) + 34%); top: calc(var(--pad) + 10%); height: 8%;
  border: 2px solid var(--line);
}
.pitch-lines .penalty-spot.top {
  position: absolute; left: 50%; top: calc(var(--pad) + 10% + 9%);
  width: clamp(4px, 0.8vw, 6px); height: clamp(4px, 0.8vw, 6px); background: rgba(255,255,255,0.95); border-radius: 50%; transform: translate(-50%, -50%);
}
.pitch-lines .penalty-arc.top {
  position: absolute; left: calc(50% - 10%); width: 20%; height: 10%;
  top: calc(var(--pad) + 10% + 18% - 1px); /* 紧贴禁区底边 */
  border: 2px solid var(--line); border-bottom: none; border-radius: 999px 999px 0 0;
}
/* 底部禁区与小禁区 */
.pitch-lines .penalty-box.bottom {
  position: absolute; left: calc(var(--pad) + 18%); right: calc(var(--pad) + 18%); bottom: calc(var(--pad) + 10%); height: 18%;
  border: 2px solid var(--line);
}
.pitch-lines .goal-area.bottom {
  position: absolute; left: calc(var(--pad) + 34%); right: calc(var(--pad) + 34%); bottom: calc(var(--pad) + 10%); height: 8%;
  border: 2px solid var(--line);
}
.pitch-lines .penalty-spot.bottom {
  position: absolute; left: 50%; bottom: calc(var(--pad) + 10% + 9%);
  width: clamp(4px, 0.8vw, 6px); height: clamp(4px, 0.8vw, 6px); background: rgba(255,255,255,0.95); border-radius: 50%; transform: translate(-50%, 50%);
}
.pitch-lines .penalty-arc.bottom {
  position: absolute; left: calc(50% - 10%); width: 20%; height: 10%;
  bottom: calc(var(--pad) + 10% + 18% - 1px); /* 紧贴禁区顶边 */
  border: 2px solid var(--line); border-top: none; border-radius: 0 0 999px 999px;
}
.formation-title {
  position: absolute;
  top: clamp(8px, 2.5vw, 16px);
  left: 50%; transform: translateX(-50%);
  font-weight: 800;
  font-size: calc(var(--font-scale, 1) * clamp(16px, 2.4vw, 22px) + var(--title-offset, 0px));
}
.players-layer { position: absolute; inset: 0; z-index: 3; }
.player { position: absolute; transform: translate(-50%, -50%); text-align: center; }
.player .badge {
  width: clamp(26px, 4.8vw, 42px);
  height: clamp(26px, 4.8vw, 42px);
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.9);
  background: #d93636; /* 默认红色 */
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  margin: 0 auto 4px;
}
.player.gk .badge { background: #3bb043; }
.player .name { font-size: calc(var(--font-scale, 1) * clamp(11px, 1.8vw, 14px)); font-weight: 700; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.55); }

.player-inputs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.player-inputs .pi { display: flex; gap: 6px; align-items: center; }
.player-inputs .pi label { min-width: 46px; color: var(--muted); font-size: 12px; }
.player-inputs .pi input { flex: 1; min-width: 0; }

/* Player inputs responsiveness: 3→2→1 columns */
@media (max-width: 820px) {
  .player-inputs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .player-inputs { grid-template-columns: 1fr; }
  .player-inputs .pi { gap: 8px; }
}