* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: #0d1b12;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color: #ffffff;
  padding: 0 16px 44px;
}

/* 顶部控制工具栏 */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  max-width: 1200px;
  background: rgba(18, 28, 20, 0.94);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(215, 178, 92, 0.35);
  padding: 10px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.toolbar-tip {
  color: #e6d7a8;
  font-size: 12.5px;
  line-height: 1.3;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

.btn {
  border: 1px solid rgba(255, 224, 130, 0.5);
  background: rgba(255, 255, 255, 0.08);
  color: #fff6d6;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn:hover {
  background: rgba(255, 224, 130, 0.2);
}

.btn.shot {
  background: linear-gradient(180deg, #57b867, #2f823f);
  color: #ffffff;
  border-color: #9be8a8;
}

.btn.shot:hover {
  background: linear-gradient(180deg, #66c976, #379449);
}

.btn.primary {
  background: linear-gradient(180deg, #f3c456, #d4962a);
  color: #1c1303;
  border-color: #ffe699;
}

.btn.danger {
  background: rgba(190, 48, 48, 0.28);
  border-color: rgba(255, 138, 138, 0.6);
  color: #ffd6d6;
}

.admin-only {
  display: none;
}

body.is-logged-in .admin-only {
  display: inline-flex;
}

body.is-logged-in .guest-only {
  display: none;
}

/* 每个可编辑文本后面的 +/- 字号微调控件 */
.inline-font-ctrl {
  display: none;
  align-items: center;
  gap: 2px;
  margin-left: 5px;
  vertical-align: middle;
  -webkit-text-fill-color: initial;
  filter: none;
  user-select: none;
}

body.is-logged-in .poster:not(.preview-mode) .inline-font-ctrl {
  display: inline-flex;
}

.inline-font-btn {
  width: 17px;
  height: 17px;
  border-radius: 4px;
  border: 1px solid rgba(255, 224, 130, 0.75);
  background: rgba(15, 25, 16, 0.9);
  color: #ffe89e;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.inline-font-btn:hover {
  background: rgba(255, 224, 130, 0.3);
  color: #ffffff;
}

/* 横屏海报主体 */
.poster {
  position: relative;
  width: 100%;
  max-width: 1200px;
  min-height: 620px;
  overflow: hidden;
  padding: 24px 32px 28px;
  border-radius: 0 0 18px 18px;
  background:
    radial-gradient(circle at 50% 8%, rgba(255, 240, 195, 0.42) 0%, rgba(255, 210, 110, 0.14) 28%, transparent 56%),
    radial-gradient(circle at 18% 75%, rgba(120, 210, 65, 0.35) 0%, transparent 48%),
    radial-gradient(circle at 82% 75%, rgba(120, 210, 65, 0.35) 0%, transparent 48%),
    linear-gradient(180deg,
      #4f5b42 0%,
      #6f7b4b 20%,
      #597334 42%,
      #4b7a29 62%,
      #3b6e20 80%,
      #285216 100%
    );
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* 球场草坪纹理与灯光氛围 */
.pitch-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.pitch-lines {
  position: absolute;
  left: 50%;
  bottom: -65px;
  transform: translateX(-50%) perspective(780px) rotateX(60deg);
  width: 120%;
  height: 58%;
  border: 2px solid rgba(220, 255, 175, 0.22);
  border-radius: 14px;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.04) 0px,
      rgba(255, 255, 255, 0.04) 64px,
      rgba(0, 0, 0, 0.05) 64px,
      rgba(0, 0, 0, 0.05) 128px
    );
}

.pitch-lines::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 2px solid rgba(220, 255, 175, 0.22);
}

.sparkle {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, #fffbe0 0%, rgba(255, 225, 120, 0.6) 45%, transparent 75%);
  pointer-events: none;
  z-index: 1;
}

/* 顶部标题区（早场下午茶） */
.header {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 4px 0 2px;
}

.title-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.main-title {
  font-size: clamp(28px, 3vw, 38px);
  font-weight: 900;
  letter-spacing: 3px;
  line-height: 1.15;
  background: linear-gradient(180deg, #fffdf2 0%, #ffe699 42%, #e0a338 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 3px 2px rgba(45, 22, 4, 0.85)) drop-shadow(0 0 14px rgba(255, 214, 102, 0.45));
}

.subtitle-pill {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 4px 20px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(24, 34, 24, 0.78), rgba(48, 56, 36, 0.85), rgba(24, 34, 24, 0.78));
  border: 1px solid rgba(248, 212, 122, 0.55);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  font-size: clamp(13px, 1.35vw, 16px);
  font-weight: 700;
  letter-spacing: 1px;
  color: #fff4cf;
}

.sun-icon {
  width: 17px;
  height: 17px;
  color: #ffd35a;
  filter: drop-shadow(0 0 6px rgba(255, 200, 50, 0.8));
}

/* 六场推荐折叠板块容器 */
.picks-section {
  position: relative;
  z-index: 2;
  border-radius: 16px;
  border: 1.5px solid rgba(215, 178, 92, 0.52);
  background: rgba(18, 30, 18, 0.42);
  padding: 12px 16px 16px;
  box-shadow: inset 0 1px 1px rgba(255, 248, 214, 0.25), 0 8px 20px rgba(0, 0, 0, 0.28);
}

.section-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 224, 130, 0.24);
}

.section-heading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 800;
  color: #ffe89e;
  letter-spacing: 1px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75);
}

.collapse-btn {
  border: 1px solid rgba(255, 224, 130, 0.6);
  background: rgba(255, 224, 130, 0.16);
  color: #fff3c4;
  padding: 4px 12px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.collapse-btn:hover {
  background: rgba(255, 224, 130, 0.3);
}

.picks-section.collapsed .cards-grid {
  display: none;
}

.picks-section.collapsed .section-bar {
  padding-bottom: 0;
  border-bottom: none;
}

/* 横屏 3 列 x 2 行卡片网格 */
.cards-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px 18px;
  padding-top: 14px;
}

.match-card {
  --card-top: rgba(128, 134, 92, 0.82);
  --card-mid: rgba(84, 112, 54, 0.86);
  --card-bot: rgba(46, 86, 30, 0.92);
  position: relative;
  min-width: 0;
  min-height: 192px;
  border-radius: 16px;
  padding: 14px 14px 13px;
  text-align: center;
  background: linear-gradient(180deg,
    var(--card-top) 0%,
    var(--card-mid) 52%,
    var(--card-bot) 100%
  );
  border: 2px solid #d7b25c;
  box-shadow:
    inset 0 1px 1px rgba(255, 248, 214, 0.55),
    inset 0 0 18px rgba(255, 224, 130, 0.14),
    0 10px 22px rgba(0, 0, 0, 0.4);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

/* 预览模式或未登录模式下，已配置链接的比赛卡片支持悬停显示“点击观看视频”并跳转 */
.watch-hover-badge {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translate(-50%, 6px);
  z-index: 8;
  pointer-events: none;
  opacity: 0;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(14, 24, 15, 0.94);
  border: 1px solid #ffd54f;
  color: #ffe89e;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.4px;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.55);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

body:not(.is-logged-in) .match-card[data-watch-url]:not([data-watch-url=""]),
.poster.preview-mode .match-card[data-watch-url]:not([data-watch-url=""]) {
  cursor: pointer;
}

body:not(.is-logged-in) .match-card[data-watch-url]:not([data-watch-url=""]):hover,
.poster.preview-mode .match-card[data-watch-url]:not([data-watch-url=""]):hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 2px rgba(255, 248, 214, 0.65),
    0 0 20px rgba(255, 224, 130, 0.5),
    0 14px 26px rgba(0, 0, 0, 0.52);
}

body:not(.is-logged-in) .match-card[data-watch-url]:not([data-watch-url=""]):hover .watch-hover-badge,
.poster.preview-mode .match-card[data-watch-url]:not([data-watch-url=""]):hover .watch-hover-badge {
  opacity: 1;
  transform: translate(-50%, 0);
}

.match-card.featured {
  border-color: #ff9c52;
  box-shadow:
    inset 0 1px 2px rgba(255, 235, 195, 0.7),
    0 0 20px rgba(255, 92, 36, 0.78),
    0 10px 24px rgba(0, 0, 0, 0.45);
}

.card-controls {
  position: absolute;
  top: 5px;
  right: 5px;
  display: flex;
  gap: 3px;
  z-index: 6;
}

.card-ctrl-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(0, 0, 0, 0.48);
  color: #ffd56b;
  font-size: 9.5px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.card-ctrl-btn:hover {
  background: rgba(255, 224, 130, 0.25);
}

.card-ctrl-btn.has-link {
  border-color: #8ce99a;
  color: #b2f2bb;
}

.card-color-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

body:not(.is-logged-in) .card-controls,
.poster.preview-mode .card-controls {
  display: none;
}

.top-hearts {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  gap: 4px;
  z-index: 4;
}

.match-card.featured .top-hearts {
  display: flex;
}

.inline-hearts {
  display: none;
  align-items: center;
  gap: 2px;
  vertical-align: middle;
  margin-left: 4px;
}

.match-card.featured .inline-hearts {
  display: inline-flex;
}

.heart {
  width: 15px;
  height: 15px;
  fill: #ff2e3a;
  filter: drop-shadow(0 2px 4px rgba(120, 0, 10, 0.75));
}

.heart.sm {
  width: 13px;
  height: 13px;
}

/* 第一行：比赛标题 */
.match-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 4px 10px 8px 10px;
  border-bottom: 1px solid rgba(255, 224, 130, 0.34);
  min-width: 0;
  width: 100%;
}

.match-title-text {
  font-size: clamp(19px, 1.85vw, 24px);
  font-weight: 900;
  letter-spacing: 0.2px;
  line-height: 1.25;
  white-space: nowrap;
  text-align: center;
  background: linear-gradient(180deg, #ffffff 0%, #ffe885 48%, #ffb732 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 3px rgba(18, 10, 1, 0.95)) drop-shadow(0 0 8px rgba(255, 210, 75, 0.35));
}

.match-card.featured .match-title-text {
  background: linear-gradient(180deg, #ffffff 0%, #ffd97d 45%, #ff7b39 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 3px rgba(30, 7, 1, 0.95)) drop-shadow(0 0 10px rgba(255, 135, 60, 0.45));
}

.match-title-text:focus {
  -webkit-text-fill-color: #ffe885;
  background: rgba(0, 0, 0, 0.45);
}

/* 中部主体：推荐与赔率居中展示 */
.card-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
}

.card-right-col {
  flex: 1;
  min-width: 0;
  text-align: center;
}

/* 可更换图标容器 */
.logo-slot {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

body.is-logged-in .poster:not(.preview-mode) .logo-slot {
  cursor: pointer;
}

body.is-logged-in .poster:not(.preview-mode) .logo-slot:hover {
  transform: scale(1.06);
  box-shadow: 0 0 0 2px rgba(255, 224, 130, 0.85);
}

.mini-crest-slot {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.mini-crest-slot img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.55));
}

.pick-line {
  font-size: clamp(16px, 1.55vw, 19px);
  font-weight: 800;
  color: #ffffff;
  line-height: 1.25;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.odds-line {
  font-size: clamp(13.5px, 1.3vw, 15.5px);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.2px;
  color: #dcebc6;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
  margin-top: 3px;
}

.main-title:focus {
  -webkit-text-fill-color: #ffe99e;
  background: rgba(0, 0, 0, 0.35);
}

/* 底部盘口与时间 */
.card-footer {
  padding-top: 6px;
  border-top: 1px solid rgba(255, 232, 163, 0.16);
}

.market-line {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  color: #f3f7e6;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
  margin-bottom: 2px;
}

.time-line {
  font-size: 11.5px;
  font-weight: 600;
  color: #e8f0d8;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

/* 视频推广区容器与板块旁边的“添加相同板块”按钮 */
.promo-stack {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.promo-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.promo-row .video-promo-section {
  flex: 1;
  min-width: 0;
}

.video-promo-section {
  position: relative;
  border-radius: 16px;
  padding: 16px 20px;
  background: linear-gradient(180deg, rgba(112, 122, 76, 0.84) 0%, rgba(44, 80, 28, 0.92) 100%);
  border: 2px solid #d7b25c;
  box-shadow:
    inset 0 1px 1px rgba(255, 248, 214, 0.5),
    0 10px 22px rgba(0, 0, 0, 0.38);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
}

.promo-remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 1px solid rgba(255, 160, 160, 0.75);
  background: rgba(155, 28, 28, 0.88);
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: none;
  z-index: 5;
}

body.is-logged-in .poster:not(.preview-mode) .video-promo-section.cloned-promo .promo-remove-btn {
  display: inline-block;
}

.promo-side-action {
  display: none;
  flex-shrink: 0;
}

body.is-logged-in .poster:not(.preview-mode) .promo-side-action {
  display: flex;
  align-items: center;
}

.add-same-promo-btn {
  white-space: nowrap;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 12.5px;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.qr-box {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: rgba(16, 26, 16, 0.55);
  border: 1px solid rgba(255, 224, 130, 0.45);
  border-radius: 12px;
  padding: 8px 10px;
}

.qr-canvas {
  width: 76px;
  height: 76px;
  border-radius: 8px;
  background: #ffffff;
  padding: 5px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: 1.5px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
}

.qr-cell {
  background: #141c14;
  border-radius: 1px;
}

.qr-cell.empty {
  background: transparent;
}

.qr-caption {
  font-size: 11.5px;
  font-weight: 700;
  color: #ffe89e;
  letter-spacing: 0.4px;
}

.video-info-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.video-title {
  font-size: 16px;
  font-weight: 900;
  color: #fff3c4;
  letter-spacing: 0.6px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75);
}

.video-link-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #f3f8e8;
}

.action-link {
  color: #ffe07d;
  font-weight: 800;
  text-decoration: underline;
  word-break: break-all;
}

.action-link:hover {
  color: #ffffff;
}

.contact-card-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  background: rgba(15, 25, 15, 0.52);
  border: 1px solid rgba(255, 224, 130, 0.38);
  border-radius: 12px;
  padding: 10px 14px;
  text-align: right;
}

.contact-label {
  font-size: 23px;
  line-height: 1.25;
  color: #e4eecf;
  font-weight: 700;
}

.contact-id {
  font-size: 15px;
  font-weight: 900;
  color: #ffe484;
  letter-spacing: 0.5px;
  line-height: 1.45;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75);
}

/* 仅在“已登录且非预览模式”下显示可编辑边框 */
body.is-logged-in .poster:not(.preview-mode) [contenteditable="true"] {
  outline: 1px dashed rgba(255, 232, 150, 0.45);
  border-radius: 4px;
  padding: 0 3px;
  cursor: text;
}

body.is-logged-in .poster:not(.preview-mode) [contenteditable="true"]:focus {
  outline: 2px solid #ffd54f;
  background-color: rgba(0, 0, 0, 0.35);
}

body:not(.is-logged-in) [contenteditable="true"],
.poster.preview-mode [contenteditable="true"] {
  outline: none !important;
  cursor: inherit;
}

/* 弹窗通用样式 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 380px;
  background: #18241b;
  border: 1px solid #d7b25c;
  border-radius: 14px;
  padding: 18px;
  color: #fff8e6;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
}

.modal-title {
  font-size: 16px;
  font-weight: 800;
  color: #ffe082;
  margin-bottom: 12px;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.preset-item {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 224, 130, 0.35);
  border-radius: 10px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: #f3f7e6;
  font-size: 11px;
}

.preset-item:hover {
  border-color: #ffd54f;
  background: rgba(255, 224, 130, 0.16);
}

.modal-section {
  margin-bottom: 12px;
}

.modal-label {
  display: block;
  font-size: 12px;
  color: #d7cfa8;
  margin-bottom: 6px;
}

.modal-input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 224, 130, 0.45);
  background: rgba(0, 0, 0, 0.35);
  color: #ffffff;
  font-size: 13px;
}

.modal-error {
  color: #ff8a8a;
  font-size: 12px;
  min-height: 18px;
  margin-top: 4px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

@media (max-width: 860px) {
  body {
    padding: 0 8px 36px;
  }
  .poster {
    padding: 18px 14px 24px;
  }
  .cards-grid {
    grid-template-columns: 1fr;
  }
  .promo-row {
    flex-direction: column;
    align-items: stretch;
  }
  .promo-side-action {
    justify-content: flex-end;
  }
  .video-promo-section {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .contact-card-box {
    align-items: center;
    text-align: center;
  }
}