:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --card: #fff;
  --ink: #1c1c1f;
  --muted: #5c5c66;
  --line: #d9dbe1;
  --hdmi: #5b9bd5;
  --dp: #70ad47;
  --typec: #c65911;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

.top, .panel, #result {
  width: min(1100px, calc(100% - 32px));
  margin-left: auto;
  margin-right: auto;
}

.top { padding: 28px 0 8px; }

h1 { margin: 0 0 8px; font-size: 28px; font-weight: 600; }

h2 { margin: 28px 0 10px; font-size: 18px; }

p { margin: 0; color: var(--muted); line-height: 1.5; }

.panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 16px;
  margin-top: 18px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--line);
}

label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }

select, button {
  font: inherit;
  color: var(--ink);
}

select {
  height: 36px;
  padding: 0 8px;
  background: #fff;
  border: 1px solid var(--line);
}

fieldset {
  grid-column: 1 / -1;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
}

legend { padding: 0 6px; color: var(--ink); }

.check {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  margin-right: 18px;
  color: var(--ink);
}

.byte {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
  color: var(--ink);
}

.byte select option:disabled { color: #b0b0b8; }

#export { margin-left: 8px; }

.card {
  position: relative;
  margin: 0 0 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left-width: 6px;
}

.card.hdmi { border-left-color: var(--hdmi); }
.card.dp { border-left-color: var(--dp); }
.card.typec { border-left-color: var(--typec); }
.card.byte-mismatch { background: #fde9e9; }
.card.weak {
  background: #f0f0f0;
  border-color: #d5d5d5;
}
.card.weak.hdmi { border-left-color: #b7cbe0; }
.card.weak.dp { border-left-color: #b7c9a8; }
.card.weak.typec { border-left-color: #e0c2ad; }
.card.weak .tag { background: #9a9a9a; }
.card.weak .name,
.card.weak .meta { color: #8d8d8d; }
.card.weak.byte-mismatch { background: #f6e8e8; }
.byte-flag {
  color: #fff;
  background: #c00000;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
}

.card header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: baseline;
  padding: 12px 14px 0;
}

.tag {
  padding: 2px 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.hdmi .tag { background: var(--hdmi); }
.dp .tag { background: var(--dp); }
.typec .tag { background: var(--typec); }

.name { font-weight: 600; }

.meta { color: var(--muted); font-size: 13px; }

.pop { position: relative; display: inline-block; }

.pop:hover,
.pop:focus-within,
.pop.open { z-index: 30; }

.card:has(.pop:hover),
.card:has(.pop:focus-within),
.card:has(.pop.open) { z-index: 30; }

.pop:hover::after,
.pop:focus-within::after,
.pop.open::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 14px;
}

.pop:hover .pop-panel,
.pop:focus-within .pop-panel {
  display: block !important;
}

.count {
  height: auto;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  cursor: help;
}

.count:hover, .count:focus { background: transparent; }

.pop-panel {
  position: absolute;
  z-index: 31;
  top: calc(100% + 8px);
  left: 0;
  width: min(520px, 70vw);
  max-height: 280px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(28, 28, 31, 0.12);
}

.pop-panel ul { margin: 0; padding-left: 18px; }

.pop-panel li {
  margin: 2px 0;
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 14px 12px;
}

.timing {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 0 14px 14px;
  padding: 10px 12px;
  background: #f7f8fa;
  border: 1px solid var(--line);
}

.timing[hidden] { display: none; }

.timing h3 {
  margin: 0 0 6px;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--line);
  font-size: 12px;
  font-weight: 600;
}

.timing .established h3 { border-bottom-color: #8d6e63; }
.timing .standard h3 { border-bottom-color: #5b9bd5; }
.timing .video h3 { border-bottom-color: #ed7d31; }
.timing .detailed h3 { border-bottom-color: #70ad47; }

.timing ul { margin: 0; padding: 0; list-style: none; }

.timing li {
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.timing .none { color: var(--muted); }

button {
  height: 32px;
  padding: 0 12px;
  background: #fff;
  border: 1px solid var(--line);
  cursor: pointer;
}

button:hover { background: #f0f1f4; }

pre {
  margin: 0;
  padding: 0 14px 14px;
  overflow: auto;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre;
}

.empty { padding: 24px 0; color: var(--muted); }

.mark { font-size: 12px; color: var(--muted); }

.feedback-open {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  height: 40px;
  padding: 0 16px;
  color: #fff;
  background: var(--ink);
  border: 0;
  border-radius: 20px;
}

.feedback-open:hover { background: #333; }

.feedback {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: end center;
  padding: 16px;
  background: rgb(0 0 0 / 35%);
}

.feedback[hidden] { display: none; }

.feedback-card {
  width: min(480px, 100%);
  max-height: min(86vh, 760px);
  overflow: auto;
  padding: 16px;
  background: #fff;
  border-radius: 10px;
}

.feedback-head, .feedback-actions, .review-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.feedback-card label, .review label {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  font-size: 13px;
}

.feedback-card input, .feedback-card textarea, .review input, .review textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--line);
  font: inherit;
}

.feedback-card textarea, .review textarea { min-height: 96px; resize: vertical; }

.feedback-actions { margin-top: 12px; }

.primary { color: #fff; background: var(--ink); border-color: var(--ink); }

.ghost { background: transparent; }

.feedback-status { margin-top: 10px; }

.token {
  display: inline-block;
  margin: 0 4px;
  padding: 1px 6px;
  font-family: Consolas, "Courier New", monospace;
  background: #f4f5f7;
}

.thread { margin-top: 12px; }

.bubble {
  margin: 8px 0;
  padding: 8px 10px;
  background: #f4f5f7;
  border-radius: 8px;
}

.bubble.owner { background: #e7f2fb; }

.bubble small { display: block; color: var(--muted); }

.review {
  width: min(860px, calc(100% - 32px));
  margin: 24px auto 48px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 150px 150px auto;
  gap: 12px;
  align-items: end;
  margin-top: 16px;
}

.filters[hidden] { display: none; }

.review-item {
  margin-top: 16px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
}

@media (max-width: 720px) {
  .panel { grid-template-columns: 1fr; }
  .timing { grid-template-columns: 1fr 1fr; }
  .filters { grid-template-columns: 1fr; }
}
