/* tokens: brand.css */
/* 見本ボード: goal list (left) + preview of that board (right). Tokens follow board.css */
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); font-family: var(--font-ui); background: var(--bg); }
.main { min-width: 0; }
.sp { padding: 32px clamp(16px, 3vw, 40px) 48px; display: flex; flex-direction: column; gap: 18px; max-width: 1480px; }
.sp h1 { margin: 0; font-size: 1.6rem; font-weight: 700; }
.sp-lead { margin: 6px 0 0; font-size: 0.875rem; line-height: 1.7; color: var(--muted); }
.sp-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.sp-muted { margin: 0; font-size: 0.75rem; color: var(--muted); }
.sp-k { font-size: 0.6875rem; font-weight: 700; color: var(--muted); }
.sp-k-up { font-size: 0.75rem; font-weight: 800; letter-spacing: 0.06em; }

.sp-btn {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 12px;
  font-weight: 800; font-size: 0.875rem; text-decoration: none; white-space: nowrap;
}
.sp-btn-ghost { background: #fff; border: 1px solid #c9dbfb; color: var(--accent-ink); }
.sp-btn-ghost:hover { background: #f3f7fe; }
.sp-btn-primary { background: var(--accent); color: #fff; }
.sp-btn-primary:hover { background: var(--accent-ink); }

.sp-split { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }

/* goals */
.sp-goals {
  flex: 1 1 280px; max-width: 340px; background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 8px 0; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto;
}
.sp-goal-group { padding: 8px 0 4px; }
.sp-goal-k { font-size: 0.6875rem; font-weight: 800; color: var(--muted); padding: 4px 16px; }
.sp-goal {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 10px 16px; min-height: 44px; color: inherit; text-decoration: none;
}
.sp-goal:hover { background: #f8fafc; }
.sp-goal.is-on { background: #eef4ff; box-shadow: inset 3px 0 0 var(--accent); }
.sp-goal-name { font-size: 0.875rem; font-weight: 700; }
.sp-goal-n { font-size: 0.6875rem; color: var(--muted); white-space: nowrap; }

/* preview */
.sp-preview { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 14px; transition: opacity 0.15s ease; }
.sp-preview.is-loading { opacity: 0.55; }
.sp-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.sp-title-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; }
.sp-title-row h2 { margin: 6px 0 2px; font-size: 1.375rem; font-weight: 700; }
.sp-hint { font-size: 0.8125rem; color: var(--muted); }
.sample-tag { font-size: 0.6875rem; font-weight: 800; color: #92400e; background: #fef3c7; border-radius: 999px; padding: 2px 8px; }
.sp-inds { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sp-inds .sp-k { margin-right: 4px; }
.sp-ind {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 700; text-decoration: none;
  border: 1px solid var(--line); background: #fff; color: #334155;
}
.sp-ind:hover { border-color: #9db8ea; }
.sp-ind.is-on { border-color: var(--accent); background: #eef4ff; color: var(--accent-ink); }

.sp-verdict { margin: 0; font-size: 1.125rem; line-height: 1.6; font-weight: 700; }
.sp-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.sp-tile { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.sp-tile.is-issue { border-color: #f3d9b5; background: #fffaf3; }
.sp-tile-label { font-size: 0.75rem; font-weight: 700; color: #475569; }
.tile-tag { font-size: 0.625rem; font-weight: 800; color: var(--accent-ink); background: #eaf1ff; border-radius: 999px; padding: 1px 7px; }
.sp-tile.is-issue .tile-tag { color: #92400e; background: #fde7c7; }
.sp-tile-value { font-family: var(--font-num); font-size: 1.625rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.sp-tile-prev { font-size: 0.75rem; font-weight: 700; color: var(--muted); }
.tone-up { color: var(--up); } .tone-down { color: var(--down); }
.judge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.6875rem; font-weight: 800; line-height: 1.5; white-space: nowrap; }
.judge-up { background: #e6f6f2; color: #0f766e; }
.judge-mid { background: #e8eefc; color: #1e40af; }
.judge-down { background: #fde7c7; color: #92400e; }
.judge-none, .judge-na-chip { background: #f1f3f5; color: var(--muted); font-weight: 600; }

.sp-scroll { overflow-x: auto; }
.sp-bars { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; min-width: 720px; align-items: flex-end; }
.sp-bars li { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sp-bar { height: 80px; display: flex; align-items: flex-end; background: #f1f4f8; border-radius: 8px; overflow: hidden; }
.sp-bar i { display: block; width: 100%; background: #93b4f5; border-radius: 6px 6px 0 0; transition: height 0.3s ease; }
.sp-bars li.is-worst .sp-bar i { background: #f59e0b; }
.sp-bars li.is-last .sp-bar i { background: var(--accent-ink); }
.sp-bar-label { font-size: 0.75rem; font-weight: 700; line-height: 1.3; min-height: 2.6em; }
.sp-bar-users { font-family: var(--font-num); font-size: 0.875rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.sp-bar-users small { font-family: var(--font-ui); font-size: 0.6875rem; font-weight: 600; color: var(--muted); }
.sp-bar-go { font-size: 0.6875rem; color: var(--muted); }
.sp-bars li.is-worst .sp-bar-go { font-weight: 800; color: #92400e; }

@media (max-width: 860px) {
  .sp-goals { max-width: none; position: static; max-height: 320px; }
  .sp-tiles { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .sp-preview, .sp-bar i { transition: none; }
}

/* v5: the preview's いまの状態 matches the board — no boxes, no chips */
.sp-verdict .v-issue { color: #b45309; }
.sp-tiles { gap: 0; }
.sp-tile { border: 0; border-left: 1px solid #eef1f5; border-radius: 0; padding: 2px 16px; gap: 2px; background: none; }
.sp-tile:first-child { border-left: 0; padding-left: 0; }
.sp-tile.is-issue { background: none; }
.sp-tile.is-issue .sp-tile-value { color: #b45309; }
.sp-tile-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.sp-tile-prev.tone-up { color: var(--up, #0f766e); } .sp-tile-prev.tone-down { color: #b45309; }
.sp-tile-note { font-size: 0.75rem; color: var(--muted); }
.jt { font-weight: 800; } .jt-up { color: #0f766e; } .jt-mid { color: #1e40af; } .jt-down { color: #b45309; }
@media (max-width: 860px) { .sp-tile { border-left: 0; padding: 8px 0 0; border-top: 1px solid #eef1f5; } .sp-tile:first-child { border-top: 0; padding-top: 0; } }

/* the preview marks the same issue as the board: the stretch in orange (top line), its arrows' rates in orange;
   seven steps fit the card (labels wrap) instead of scrolling past the last step */
.sp-bars { min-width: 0; gap: 4px; }
.sp-bars li.is-worst .sp-bar i { background: #93b4f5; }
.sp-bars li.is-last.is-worst .sp-bar i { background: var(--accent-ink); }
.sp-bars li.is-issue .sp-bar { box-shadow: inset 0 3px 0 #f59e0b; }
.sp-bars li.is-issue .sp-bar-label { color: #92400e; }
.sp-bar-label { overflow-wrap: anywhere; }
@media (max-width: 860px) { .sp-bars { min-width: 560px; } }

/* phones-only parts (hidden on PC) */
.sp-only, .sp-goal-pick, .sp-open-bar { display: none; }
@media (max-width: 640px) {
  .pc-only { display: none; }
  .sp-only { display: inline; }
  .sp-head .sp-btn-ghost { display: none; }
  .sp-split { flex-direction: column; align-items: stretch; gap: 12px; }
  /* 「ゴール 買う ▾」 — the list opens under it */
  .sp-goal-pick {
    display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 0 14px; box-sizing: border-box;
    font: inherit; font-size: 0.9375rem; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 12px; cursor: pointer;
  }
  .sp-goal-pick .sp-k { margin: 0; }
  .sp-goal-pick > span[aria-hidden] { margin-left: auto; color: var(--muted); }
  .sp-goals { flex: none; max-width: none; position: static; max-height: none; }
  .sp-goals.is-folded { display: none; }
  /* 3 numbers on one row, like the board */
  .sp-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .sp-tile { border: 0 !important; padding: 0 !important; }
  /* the 7 steps stacked: name · people, then the bar across — nothing off-screen */
  .sp-scroll { overflow: visible; }
  .sp-bars { flex-direction: column; align-items: stretch; gap: 0; min-width: 0; }
  .sp-bars li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; padding: 9px 0; border-top: 1px solid #eef1f5; }
  .sp-bar-label { min-height: 0; font-size: 0.8125rem; }
  .sp-bar { grid-column: 1 / -1; order: 3; height: 6px; border-radius: 99px; align-items: stretch; }
  .sp-bar i { width: var(--w) !important; height: 6px !important; border-radius: 99px; }
  .sp-bar-go { grid-column: 1 / -1; order: 4; }
  .sp-bars li.is-issue .sp-bar { box-shadow: none; }
  .sp-card-head .sp-btn-primary { display: none; }
  .sp-open-bar { display: block; position: sticky; bottom: 0; padding: 10px 0 12px; background: linear-gradient(rgba(244, 246, 250, 0), var(--bg) 30%); }
  .sp-open-bar .sp-btn { display: flex; justify-content: center; min-height: 48px; }
}
