.phd { max-width: 980px; }
.phd-desc { font-size: 14px; color: #27331f; margin-bottom: 14px; }

.phd-layout { display: flex; gap: 16px; align-items: flex-start; }

.phd-sidebar {
  flex: 0 0 200px; display: flex; flex-direction: column; gap: 4px;
  max-height: 480px; overflow-y: auto; padding-right: 4px;
}
.phd-cat-btn {
  display: flex; justify-content: space-between; align-items: center; gap: 6px;
  text-align: left; padding: 8px 10px; font-size: 13px; font-weight: 700; color: #27331f;
  background: #f3f4f8; border: 1px solid #d9e0d4; border-radius: 6px; cursor: pointer;
}
.phd-cat-btn:hover { background: #e7ebe4; }
.phd-cat-active { background: #19616a; border-color: #19616a; color: #fff; }
.phd-cat-count { font-size: 11px; font-weight: 700; color: #5b6b56; }
.phd-cat-active .phd-cat-count { color: #d7ecee; }

.phd-main { flex: 1; min-width: 0; }
.phd-search-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.phd-search-row label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 700; color: #27331f; flex: 1 1 200px; }
.phd-search-row input {
  padding: 9px 11px; font-size: 14.5px; border: 1px solid #d9e0d4; border-radius: 6px;
}
.phd-search-row input:focus { outline: 2px solid #19616a; outline-offset: 1px; }
.phd-count { flex-basis: 100%; font-size: 12.5px; color: #5b6b56; margin: 0; }

.phd-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px;
  max-height: 420px; overflow-y: auto; padding: 4px;
}
.phd-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px;
  background: #f3f4f8; border: 1px solid #d9e0d4; border-radius: 8px; cursor: pointer;
}
.phd-card:hover { background: #e7ebe4; border-color: #19616a; }
.phd-card img { image-rendering: pixelated; border-radius: 4px; }
.phd-card-name { font-size: 11px; color: #27331f; text-align: center; line-height: 1.2; word-break: break-word; }

.phd-loading, .phd-hint, .phd-error { font-size: 13px; color: #5b6b56; padding: 10px 4px; }
.phd-error { color: #a13d3d; }

.phd-detail {
  margin-top: 14px; padding: 14px; background: #f3f4f8; border: 1px solid #d9e0d4; border-radius: 8px;
}
.phd-detail-inner { display: flex; gap: 14px; align-items: flex-start; }
.phd-detail-img { image-rendering: pixelated; border-radius: 6px; flex: 0 0 auto; }
.phd-detail-body { flex: 1; min-width: 0; }
.phd-detail-name { font-size: 16px; font-weight: 700; color: #27331f; margin-bottom: 6px; }
.phd-detail-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.phd-tag {
  font-size: 11px; font-weight: 700; color: #fff; background: #5b6b56;
  padding: 2px 8px; border-radius: 999px;
}

.phd-output {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  background: #fff; border: 1px solid #d9e0d4; border-radius: 6px; flex-wrap: wrap;
}
.phd-output code { flex: 1; font-size: 13px; word-break: break-all; color: #27331f; }
.phd-btn {
  padding: 6px 14px; font-size: 13px; font-weight: 700; border-radius: 6px; border: 1px solid #d9e0d4;
  background: #fff; color: #27331f; cursor: pointer;
}
.phd-btn-primary { background: #19616a; border-color: #19616a; color: #fff; }
.phd-btn-primary:hover { background: #144e55; }

.phd-note { margin-top: 16px; font-size: 13px; color: #5b6b56; }
.phd-note a { color: #19616a; }

@media (max-width: 640px) {
  .phd-layout { flex-direction: column; }
  .phd-sidebar { flex-direction: row; flex-wrap: wrap; max-height: none; flex-basis: auto; }
  .phd-detail-inner { flex-direction: column; align-items: flex-start; }
}
