.pd {
  --pd-ink: #1f2a24;
  --pd-muted: #5f6b62;
  --pd-primary: #2f5d50;
  --pd-primary-dark: #24463c;
  --pd-accent: #c2562f;
  --pd-line: rgba(31, 42, 36, .14);
  --pd-paper: #fffdf7;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  color: var(--pd-ink);
  font-size: 15px;
  line-height: 1.55;
}

.pd *,
.pd *::before,
.pd *::after { box-sizing: border-box; }

.pd-top {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.pd-label {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0;
  min-width: 0;
}

.pd-label b {
  font-family: Fraunces, Georgia, serif;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.01em;
}

.pd-label em {
  font-style: normal;
  font-size: 13px;
  color: var(--pd-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pd-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pd-tools button,
.pd-cta button {
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--pd-line);
  background: var(--pd-paper);
  color: var(--pd-ink);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}

.pd-tools button:hover,
.pd-cta button:hover {
  border-color: rgba(31, 42, 36, .3);
  background: #fff;
}

.pd-tools button:focus-visible,
.pd-cta button:focus-visible {
  outline: 2px solid var(--pd-primary);
  outline-offset: 2px;
}

.pd-tools button[aria-pressed="false"] {
  color: var(--pd-muted);
}

.pd-tools button.pd-primary,
.pd-cta button.pd-primary {
  background: var(--pd-primary);
  border-color: var(--pd-primary);
  color: #fffdf7;
}

.pd-tools button.pd-primary:hover,
.pd-cta button.pd-primary:hover {
  background: var(--pd-primary-dark);
  border-color: var(--pd-primary-dark);
}

.pd-tools button[hidden] { display: none; }

.pd-stage {
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 14px;
  overflow: hidden;
  line-height: 0;
  background: #6a432a;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2), 0 1px 2px rgba(0, 0, 0, .06);
  touch-action: none;
}

.pd-stage canvas {
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.pd-panel {
  margin-top: 14px;
  padding: 16px 18px;
  border: 1px solid var(--pd-line);
  border-radius: 12px;
  background: var(--pd-paper);
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 14px 18px;
  align-items: start;
}

.pd-panel[hidden] { display: none; }

.pd-score {
  margin: 0;
  line-height: 1;
}

.pd-score b {
  display: block;
  font-family: Fraunces, Georgia, serif;
  font-size: 46px;
  font-weight: 700;
  letter-spacing: -.02em;
}

.pd-score span {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--pd-muted);
}

.pd-bars {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
  display: grid;
  gap: 7px;
}

.pd-bars li {
  display: grid;
  grid-template-columns: 88px 1fr 32px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.pd-bars li > span { color: var(--pd-muted); }

.pd-bars li > b {
  display: block;
  height: 8px;
  border-radius: 4px;
  background: rgba(31, 42, 36, .1);
  overflow: hidden;
}

.pd-bars li > b > i {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--pd-primary);
  transition: width .35s ease;
}

.pd-bars li > em {
  font-style: normal;
  text-align: right;
  color: var(--pd-muted);
  font-variant-numeric: tabular-nums;
}

.pd-note {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 14px;
  color: var(--pd-muted);
  border-top: 1px solid var(--pd-line);
  padding-top: 12px;
}

.pd-note:empty { display: none; }

.pd-cta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 560px) {
  .pd-panel { grid-template-columns: 1fr; }
  .pd-score { display: flex; align-items: baseline; gap: 8px; }
  .pd-score b { font-size: 38px; }
  .pd-score span { margin: 0; }
  .pd-label em { display: none; }
  /* five buttons never fit on one phone-width row: lay them out as a grid */
  .pd-tools {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }
  .pd-tools button { padding: 9px 6px; }
  .pd-tools button.pd-primary { grid-column: span 2; }
}
