/* ============================================================
   점수판(스코어보드) 전용 스타일
   - 보드는 체육관 전광판처럼 항상 어두운 배경(사이트 테마와 무관)
   - 태블릿 전체화면을 1급 시민으로: 큰 탭 타깃, vh 기반 숫자 크기
   ============================================================ */

.tool-intro { padding: clamp(28px, 5vw, 56px) 0 clamp(20px, 3vw, 32px); }
.tool-intro .lead { color: var(--color-text-sub); max-width: 62ch; }
.tool-intro .lead-note { font-size: .88rem; color: var(--color-text-sub); opacity: .85; }

/* ---- 보드(전광판) ---- */
.sb-board {
  position: relative;
  background: #101318;
  border: 1px solid #262c36;
  border-radius: var(--radius);
  padding: 14px;
  overflow: hidden;
}
.sb-panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}
@media (max-width: 420px) {
  .sb-panels { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}

/* ---- 팀 패널 ---- */
.sb-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 210px;
  background: #161b22;
  border: 1px solid #262c36;
  border-top: 4px solid var(--team, #4da3ff);
  border-radius: 10px;
  overflow: hidden;
  touch-action: manipulation;
}
.sb-panel.is-lead { box-shadow: inset 0 0 0 1px var(--team); }
.sb-panel.is-win {
  box-shadow: inset 0 0 0 2px var(--team), 0 0 22px color-mix(in srgb, var(--team) 45%, transparent);
}

.sb-panel-top {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 8px 0;
}
.sb-name {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  text-align: center;
  color: #dfe6f1;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 2px;
}
.sb-name:hover { border-color: #2c3440; }
.sb-name:focus { outline: none; border-color: var(--team); background: #0d1015; }
.sb-color {
  flex: none;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 2px solid rgba(255,255,255,.25);
  border-radius: 50%;
  background: var(--team);
  cursor: pointer;
}
.sb-remove {
  flex: none;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #5b6675;
  font-size: .95rem;
  line-height: 1;
  cursor: pointer;
}
.sb-remove:hover { color: #ff7a7a; background: #20262f; }

/* 순위 배지: 1위 팀에만 표시 */
.sb-rank {
  position: absolute;
  top: 10px;
  left: 8px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  color: #0d1015;
  background: var(--team);
  border-radius: 999px;
  padding: 2px 8px;
  pointer-events: none;
}

/* 점수: 패널의 몸통 전체가 탭 타깃 */
.sb-score {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-size: clamp(3.2rem, 13vw, 6rem);
  line-height: 1;
  color: var(--team);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.sb-score:active { transform: scale(.96); }

.sb-panel-btns {
  display: flex;
  border-top: 1px solid #262c36;
}
.sb-panel-btns button {
  flex: 1;
  font: inherit;
  font-size: 1.25rem;
  font-weight: 700;
  padding: 10px 0;
  border: 0;
  background: transparent;
  color: #aab4c2;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sb-panel-btns button:active { background: #20262f; }
.sb-panel-btns .sb-minus { border-right: 1px solid #262c36; }
.sb-panel-btns .sb-plus { color: var(--team); }

/* 탭할 때 떠오르는 +N 표시 */
.sb-float {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translateX(-50%);
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--team);
  pointer-events: none;
  animation: sb-rise .65s ease-out forwards;
}
@keyframes sb-rise {
  from { opacity: .95; transform: translate(-50%, 0); }
  to   { opacity: 0;   transform: translate(-50%, -46px); }
}

/* 팀 추가 타일: 혼자 새 줄로 넘어가도 부담스럽지 않게 낮은 높이 허용 */
.sb-add {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: #6b7686;
  background: transparent;
  border: 2px dashed #2c3440;
  border-radius: 10px;
  cursor: pointer;
}
.sb-add:hover { color: #aab4c2; border-color: #4a5567; }

/* ---- 보드 위 버튼 ---- */
.sb-fs-corner {
  position: absolute;
  right: 14px;
  bottom: 14px;
  font: inherit;
  font-size: .8rem;
  padding: 6px 10px;
  border: 1px solid #3a4453;
  border-radius: 8px;
  background: rgba(16, 19, 24, .85);
  color: #aab4c2;
  cursor: pointer;
}
.sb-fs-corner:hover { color: #fff; border-color: #6b7686; }
.sb-fs-tools {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 8px;
  opacity: .35;
  transition: opacity .15s ease;
}
.sb-fs-tools:hover, .sb-board.is-fs:active .sb-fs-tools { opacity: 1; }
.sb-fs-btn {
  font: inherit;
  font-size: .85rem;
  padding: 8px 12px;
  border: 1px solid #3a4453;
  border-radius: 8px;
  background: rgba(16, 19, 24, .85);
  color: #cfd6e4;
  cursor: pointer;
}

/* ---- 승리 오버레이 ---- */
.sb-winner {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(10, 12, 16, .88);
  cursor: pointer;
  text-align: center;
  padding: 16px;
}
.sb-winner-label {
  margin: 0;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .3em;
  text-indent: .3em;
  color: #8a94a4;
}
.sb-winner-name {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 800;
  font-size: clamp(2rem, 8vw, 4.5rem);
  line-height: 1.2;
  color: var(--win, #ffd54a);
  word-break: keep-all;
}
.sb-winner-hint { margin: 8px 0 0; font-size: .8rem; color: #6b7686; }

/* ---- 전체화면 ---- */
.sb-board.is-fs {
  width: 100%;
  height: 100%;
  border-radius: 0;
  border: 0;
  display: flex;
  flex-direction: column;
}
.sb-board.is-fs .sb-panels { flex: 1; grid-template-columns: repeat(var(--cols, 2), 1fr); grid-auto-rows: 1fr; }
.sb-board.is-fs .sb-score { font-size: min(30vh, calc(66vw / var(--cols, 2) / 2)); }
.sb-board.is-fs .sb-name { font-size: clamp(1rem, 3vh, 1.6rem); pointer-events: none; }
.sb-board.is-fs .sb-color,
.sb-board.is-fs .sb-remove,
.sb-board.is-fs .sb-add,
.sb-board.is-fs .sb-fs-corner { display: none; }
.sb-board.is-fs .sb-panel-btns button { padding: 14px 0; font-size: 1.5rem; }
/* requestFullscreen 미지원 브라우저용 고정 오버레이 */
body.sb-body-fs { overflow: hidden; }
body.sb-body-fs .sb-board { position: fixed; inset: 0; z-index: 1000; }

/* ---- 조작판 ---- */
.sb-controls { margin-top: var(--space-4); display: grid; gap: var(--space-4); }
.sb-ctrl-head { display: flex; align-items: baseline; justify-content: space-between; }
.sb-lab-strong { font-weight: 700; }
.sb-save-note {
  font-size: .78rem;
  color: var(--color-text-sub);
  opacity: 0;
  transition: opacity .25s ease;
}
.sb-save-note::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  background: #3ddc84;
  vertical-align: 1px;
}
.sb-save-note.is-on { opacity: 1; }

.sb-field { display: grid; grid-template-columns: 92px 1fr; gap: var(--space-3); align-items: center; }
@media (max-width: 560px) { .sb-field { grid-template-columns: 1fr; gap: var(--space-1); } }
.sb-lab { font-size: .88rem; font-weight: 700; color: var(--color-text-sub); }
.sb-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.sb-chip {
  font: inherit;
  font-size: .9rem;
  padding: 7px 14px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
}
.sb-chip[aria-pressed="true"] {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  font-weight: 700;
}
.sb-target-wrap { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
#target {
  font: inherit;
  width: 110px;
  padding: 7px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
}
#target:focus { outline: none; border-color: var(--color-primary); }
.sb-target-hint { font-size: .82rem; color: var(--color-text-sub); }
.sb-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sb-field-actions { align-items: start; }
.sb-fs-main { padding: var(--space-3); font-size: 1.05rem; font-weight: 700; }
.sb-tip { margin: -6px 0 0; font-size: .82rem; color: var(--color-text-sub); text-align: center; }

/* ---- 저장 안내 카드 ---- */
.sb-keep { margin-top: var(--space-4); }
.sb-keep-title { margin: 0 0 var(--space-3); font-size: 1.15rem; }
.sb-keep-list { margin: 0 0 var(--space-3); padding-left: 0; list-style: none; display: grid; gap: 6px; }
.sb-keep-list li { padding-left: 22px; position: relative; }
.sb-keep-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .52em;
  width: 10px;
  height: 6px;
  border-left: 2px solid #3ddc84;
  border-bottom: 2px solid #3ddc84;
  transform: rotate(-45deg);
}
.sb-keep-note { margin: 0; font-size: .92rem; color: var(--color-text-sub); }

/* ---- 본문 공통(다른 도구와 동일 패턴) ---- */
.prose { margin-top: var(--space-6); }
.prose h2 { margin-bottom: var(--space-3); }
.prose details {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-2);
}
.prose summary { cursor: pointer; font-weight: 700; }
.prose details p { margin: var(--space-3) 0 var(--space-1); }

@media (prefers-reduced-motion: reduce) {
  .sb-float { animation: none; display: none; }
  .sb-score:active { transform: none; }
}
