/*
 * [INPUT]: MagicPath 设计 token 与 fp-shell.css 外壳变量（--paper、--ink、--forest、--coral、--lime）。
 * [OUTPUT]: /pips/ 游戏页专用棋盘轮廓栅格、8 色防撞区填充与边界线、条件角标徽章、跨格无缝拼接骨牌、骰点 SVG、骨牌托盘与胜利指南样式。
 * [POS]: src/pips 样式表，严格零内联 style 属性依赖（完美适配 style-src 'self' CSP）。
 * [PROTOCOL]: 变更时更新此头部，然后检查 CLAUDE.md
 */
.p-workbench { display: grid; gap: 20px; padding: 22px 0 10px; align-items: start; }
@media (min-width: 860px) {
  .p-workbench { grid-template-columns: minmax(0, 1.18fr) minmax(300px, .82fr); gap: 24px; }
}

.p-card { background: var(--surface); border: 1px solid #D8DED6; border-radius: 15px; padding: 18px; box-shadow: 0 3px 0 #E6E9E2; }
.p-hud { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid #E5EBE3; }
.p-hud-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.p-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: #EFF3ED; color: var(--ink); font-size: 12px; font-weight: 760; }
.p-pill.daily { background: #E2EEE4; color: #1E544B; }
.p-pill.streak { background: #FCEFE9; color: #9C3E26; }
.p-stats { display: flex; align-items: center; gap: 14px; font-size: 13px; font-weight: 740; font-variant-numeric: tabular-nums; color: #4A5B55; }

.p-board-wrap { display: flex; justify-content: center; }
.p-board-frame {
  width: 100%;
  max-width: 500px;
  padding: 14px 12px;
  background: #F4F5F0;
  border: 1.5px solid #CED8D0;
  border-radius: 13px;
}
.p-grid {
  display: grid;
  width: 100%;
  margin: 0 auto;
  touch-action: manipulation;
  user-select: none;
}
.p-grid-4x4 { max-width: 340px; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(0, 1fr)); aspect-ratio: 4 / 4; }
.p-grid-5x4 { max-width: 410px; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(0, 1fr)); aspect-ratio: 5 / 4; }
.p-grid-6x4 { max-width: 476px; grid-template-columns: repeat(6, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(0, 1fr)); aspect-ratio: 6 / 4; }

.p-cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 5px;
  border: 1px solid rgba(42, 60, 56, .20);
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  overflow: visible;
  cursor: pointer;
  transition: background-color .08s ease;
}
.p-cell.is-void {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  cursor: default;
  pointer-events: none;
}
.p-cell:not(.is-void):focus-visible { outline: 3px solid #D8784B; outline-offset: -3px; z-index: 7; }

/* 8 Pastel Region Fills */
.pr-0 { background: #E9CFC2; }
.pr-1 { background: #DCE4BB; }
.pr-2 { background: #C8DFD8; }
.pr-3 { background: #CDD9EC; }
.pr-4 { background: #E6CEE2; }
.pr-5 { background: #EDE0B6; }
.pr-6 { background: #D7D2EB; }
.pr-7 { background: #CBE3C6; }

/* Outer & Region Boundary Borders */
.pb-t { border-top: 2.5px solid #243834; }
.pb-r { border-right: 2.5px solid #243834; }
.pb-b { border-bottom: 2.5px solid #243834; }
.pb-l { border-left: 2.5px solid #243834; }

/* Placement Preview */
.p-cell.is-preview-a::after,
.p-cell.is-preview-b::after,
.p-cell.is-preview-bad::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 7px;
  pointer-events: none;
  z-index: 3;
}
.p-cell.is-preview-a::after,
.p-cell.is-preview-b::after {
  border: 2px dashed #225E55;
  background: rgba(34, 94, 85, .14);
}
.p-cell.is-preview-bad::after {
  border: 2px dashed #D14334;
  background: rgba(238, 107, 75, .20);
}

/* Seamless Placed Domino Tile */
.p-cell.has-tile.p-join-r { padding-right: 0; }
.p-cell.has-tile.p-join-l { padding-left: 0; }
.p-cell.has-tile.p-join-b { padding-bottom: 0; }
.p-cell.has-tile.p-join-t { padding-top: 0; }

.p-tile-half {
  width: 100%;
  height: 100%;
  background: #FFFDF7;
  border: 1.5px solid #7E725E;
  border-radius: 7px;
  box-shadow: 0 2px 0 rgba(42, 60, 56, .16);
  display: grid;
  place-items: center;
  position: relative;
  z-index: 2;
  color: #182B2C;
  pointer-events: none;
}
.p-cell.p-join-r .p-tile-half { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: 1px solid #C2B6A2; }
.p-cell.p-join-l .p-tile-half { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 0; }
.p-cell.p-join-b .p-tile-half { border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom: 1px solid #C2B6A2; }
.p-cell.p-join-t .p-tile-half { border-top-left-radius: 0; border-top-right-radius: 0; border-top: 0; }

.p-cell.is-hinted .p-tile-half { background: #EFF7EE; border-color: #225E55; color: #194A42; }
.p-cell.is-conflict .p-tile-half { background: #FDECE7; border-color: #C73E26; }

/* Region Condition Badge */
.p-cond-badge {
  position: absolute;
  top: -8px;
  left: 3px;
  z-index: 6;
  min-width: 22px;
  height: 19px;
  padding: 0 6px;
  border-radius: 999px;
  background: #182B2C;
  border: 1.5px solid #FFFDF7;
  color: #FFFDF7;
  font-size: 11px;
  font-weight: 840;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(24, 43, 44, .22);
}
.p-cond-badge.is-satisfied { background: #225E55; color: #FFFDF7; }
.p-cond-badge.is-conflict { background: #D14334; color: #FFFDF7; }

.p-pip-svg { width: 66%; height: 66%; display: block; pointer-events: none; }

/* Domino Tray */
.p-tray-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #E5EBE3;
}
.p-tray-label { font-size: 12px; font-weight: 760; color: #4A5B55; }
.p-tray-hint { font-size: 12px; color: #63736D; font-weight: 640; }
.p-tray {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 9px;
  margin-top: 10px;
  padding: 10px 8px;
  background: #F4F6F1;
  border: 1px solid #DCE3DB;
  border-radius: 12px;
  min-height: 70px;
}
.p-tray-domino {
  display: inline-flex;
  align-items: center;
  padding: 0;
  background: #FFFDF7;
  border: 1.5px solid #8A7D68;
  border-radius: 8px;
  box-shadow: 0 2px 0 #D8CFC0;
  cursor: pointer;
  color: #182B2C;
  transition: transform .1s ease, border-color .1s ease, opacity .12s ease;
}
.p-tray-domino:hover { border-color: #225E55; transform: translateY(-1px); }
.p-tray-domino.is-selected {
  border-color: #EE6B4B;
  box-shadow: 0 0 0 2.5px rgba(238, 107, 75, .32), 0 3px 0 #C55235;
  transform: translateY(-2px);
}
.p-tray-domino.is-selected.is-vertical { flex-direction: column; }
.p-tray-domino.is-used {
  opacity: .26;
  box-shadow: none;
  background: #ECEEE8;
}
.p-tray-domino.is-used:hover { opacity: .55; transform: none; }
.p-tray-half {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.p-tray-domino:not(.is-vertical) .p-tray-half + .p-tray-half {
  border-left: 1px solid #CCC1AE;
}
.p-tray-domino.is-selected.is-vertical .p-tray-half + .p-tray-half {
  border-left: 0;
  border-top: 1px solid #CCC1AE;
}
.p-tray-half .p-pip-svg { width: 70%; height: 70%; }

/* Actions */
.p-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.p-btn {
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #CDD8CF;
  background: #F4F7F2;
  color: var(--ink);
  font-size: 13px;
  font-weight: 720;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.p-btn:hover:not(:disabled) { border-color: #93B5A5; background: #EAEFE8; }
.p-btn:disabled { opacity: .45; cursor: not-allowed; }
.p-btn.primary { background: var(--forest); border-color: var(--forest); color: #FFFDF7; }
.p-btn.primary:hover:not(:disabled) { background: #1B4E46; }
.p-btn.coral { background: var(--coral); border-color: var(--coral); color: #FFFDF7; }
.p-btn.coral:hover:not(:disabled) { background: #DA5A3C; }
.p-btn-full { width: 100%; margin-top: 10px; }

/* Side Panel */
.p-panel { display: flex; flex-direction: column; gap: 14px; }
.p-panel-title { font-size: 15px; font-weight: 820; margin: 0 0 10px; letter-spacing: -.3px; }
.p-seg { display: flex; background: #EAEFE9; border: 1px solid #D6DFD7; border-radius: 10px; padding: 3px; gap: 3px; }
.p-seg button { flex: 1; min-height: 38px; border: 0; border-radius: 7px; background: transparent; color: #5B6C65; font-size: 13px; font-weight: 760; }
.p-seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(24, 43, 44, .12); }

.p-sizes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.p-sizes button { min-height: 38px; border-radius: 8px; border: 1px solid #D4DDD5; background: var(--paper); color: var(--ink); font-size: 13px; font-weight: 750; padding: 4px; }
.p-sizes button.on { background: var(--forest); border-color: var(--forest); color: #FFFDF7; }

.p-status { padding: 12px 14px; border-radius: 10px; background: #F1F4EE; border: 1px solid #DCE3DB; font-size: 13px; line-height: 1.45; color: #3D504A; }
.p-status.ok { background: #E3F0E7; border-color: #B6D7C2; color: #1A4E43; }
.p-status.warn { background: #FDF3DF; border-color: #E7CE98; color: #6E4E1B; }

.p-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.p-legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #4A5A54; }
.p-legend-chip {
  min-width: 28px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #182B2C;
  color: #FFFDF7;
  font-size: 11px;
  font-weight: 820;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.p-victory { background: #E8F2B5; border: 1px solid #C5D67D; border-radius: 15px; padding: 18px; color: var(--ink); }
.p-victory h3 { font-size: 20px; font-weight: 850; letter-spacing: -.5px; margin: 0 0 6px; }
.p-victory p { margin: 0 0 12px; font-size: 13px; color: #334942; }
.p-victory-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.p-callout { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; background: #EDF1E9; border: 1px solid #D5DED5; border-radius: 12px; font-size: 13px; }
.p-callout strong { display: block; font-size: 14px; margin-bottom: 2px; }
.p-callout span { color: var(--muted); font-size: 12px; }
.p-callout a { flex: none; padding: 8px 13px; border-radius: 999px; background: var(--surface); border: 1px solid #C8D4CA; color: var(--forest); font-weight: 760; font-size: 12px; text-decoration: none; white-space: nowrap; }
.p-callout a:hover { border-color: var(--forest); }

.p-guide { margin-top: 28px; display: grid; gap: 18px; }
.p-guide-nav { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; font-weight: 670; }
.p-guide-nav a { color: var(--forest); text-underline-offset: 3px; display: inline-flex; align-items: center; min-height: 36px; }
.p-guide section { background: var(--surface); border: 1px solid #D8DED6; border-radius: 15px; padding: 22px 24px; }
.p-guide h2 { font-size: 20px; letter-spacing: -.6px; margin: 0 0 12px; }
.p-guide p, .p-guide li { font-size: 14px; line-height: 1.65; color: #4A5A54; }
.p-guide ol, .p-guide ul { margin: 8px 0; padding-left: 20px; }
.p-guide details { border-top: 1px solid #E3E9E2; padding: 6px 0; }
.p-guide summary { min-height: 44px; display: flex; align-items: center; font-weight: 750; font-size: 14px; cursor: pointer; color: var(--ink); }
.p-guide details p { margin: 4px 0 12px; }

@media (max-width: 620px) {
  .p-workbench { gap: 12px; padding: 12px 0 6px; }
  .p-card { padding: 12px; border-radius: 12px; }
  .p-hud { margin-bottom: 10px; padding-bottom: 8px; }
  .p-board-frame { padding: 10px 8px; }
  .p-cell { padding: 3px; }
  .p-cond-badge { top: -7px; left: 2px; min-width: 19px; height: 17px; padding: 0 5px; font-size: 10px; }
  .p-tray { gap: 6px; padding: 8px 6px; }
  .p-tray-half { width: 29px; height: 29px; }
  .p-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .p-btn { font-size: 12px; padding: 6px; }
  .p-guide section { padding: 16px; }
}
[hidden] { display: none !important; }
