:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --ink: #15202b;
  --muted: #687383;
  --line: #d8e0e8;
  --teal: #116a73;
  --teal-soft: #e1f3f3;
  --amber: #a35d00;
  --blue: #2457a6;
  --shadow: 0 8px 24px rgba(21, 32, 43, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 4vw, 48px) 20px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.16;
  letter-spacing: 0;
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(84px, 1fr));
  gap: 10px;
  min-width: min(460px, 100%);
}

.summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fbfcfd;
}

.summary strong {
  display: block;
  font-size: 24px;
  line-height: 1.1;
}

.summary span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

main {
  width: min(1380px, 100%);
  margin: 0 auto;
  padding: 18px clamp(14px, 3vw, 36px) 48px;
}

.visit-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
  align-items: stretch;
  margin: 0 0 18px;
}

.visit-card {
  display: grid;
  gap: 8px;
  min-height: 88px;
  border: 1px solid rgba(17, 106, 115, 0.16);
  border-radius: 8px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(225, 243, 243, 0.96), rgba(255, 255, 255, 0.98));
  box-shadow: var(--shadow);
}

.visit-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.visit-card strong {
  color: var(--teal);
  font-size: 28px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.visit-updated {
  grid-column: 1 / -1;
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 260px) minmax(150px, 210px);
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
button {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

input,
select {
  width: 100%;
  padding: 0 12px;
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(17, 106, 115, 0.22);
  outline-offset: 2px;
}

.result-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 16px;
  color: var(--muted);
  font-size: 14px;
}

button {
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.work-card {
  display: grid;
  gap: 12px;
  min-height: 232px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.badge {
  max-width: 100%;
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.number {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.work-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
  letter-spacing: 0;
}

.meta {
  display: grid;
  gap: 6px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.meta div {
  display: flex;
  gap: 8px;
  min-width: 0;
}

.meta dt {
  flex: 0 0 auto;
  color: #465466;
  font-weight: 700;
}

.meta dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: auto;
}

.rating-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.stars {
  color: var(--amber);
  font-size: 17px;
  letter-spacing: 0;
  white-space: nowrap;
}

.comment-count {
  color: #465466;
}

.open-link,
.review-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 8px;
  padding: 0 13px;
  background: var(--teal);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.open-link:hover,
.review-button:hover {
  background: #0d5961;
  color: #fff;
}

.review-button {
  height: 38px;
  border-color: var(--teal);
  background: #fff;
  color: var(--teal);
}

.review-button:hover {
  border-color: #0d5961;
}

.path-link {
  color: var(--blue);
  font-size: 13px;
  text-decoration: none;
}

.path-link:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(21, 32, 43, 0.42);
}

.review-modal {
  display: grid;
  gap: 16px;
  width: min(680px, 100%);
  max-height: min(860px, calc(100vh - 36px));
  overflow: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 18px;
  box-shadow: 0 18px 48px rgba(21, 32, 43, 0.24);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.modal-kicker {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
}

.modal-head h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.28;
  letter-spacing: 0;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
}

.icon-button:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.modal-score {
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 12px;
  background: #fbfcfd;
}

.modal-score div {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.review-form {
  display: grid;
  gap: 12px;
}

.review-form fieldset {
  margin: 0;
  border: 0;
  padding: 0;
}

.review-form legend {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.star-input {
  display: flex;
  gap: 4px;
}

.star-input button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border-color: #d4c2a1;
  color: #b9a88a;
  font-size: 25px;
  line-height: 1;
}

.star-input button.active,
.star-input button:hover {
  border-color: var(--amber);
  background: #fff7e8;
  color: var(--amber);
}

textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  font: inherit;
}

textarea:focus {
  outline: 3px solid rgba(17, 106, 115, 0.22);
  outline-offset: 2px;
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--amber);
  font-size: 14px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
}

.submit-review {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
  font-weight: 700;
}

.submit-review:hover {
  background: #0d5961;
  color: #fff;
}

.comment-panel {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.comment-panel h3 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.comment-list {
  display: grid;
  gap: 10px;
}

.comment-empty {
  margin: 0;
  color: var(--muted);
}

.comment-item {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcfd;
}

.comment-item div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.comment-item p {
  margin: 0;
  overflow-wrap: anywhere;
}

.comment-item time {
  color: var(--muted);
  font-size: 12px;
}

.empty {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 36px 18px;
  background: #fff;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 860px) {
  .topbar {
    display: grid;
  }

  .summary,
  .visit-panel,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .summary {
    min-width: 0;
  }
}

@media (max-width: 430px) {
  .topbar {
    padding-inline: 14px;
  }

  main {
    padding-inline: 12px;
  }

  .work-grid {
    grid-template-columns: 1fr;
  }

  .review-modal {
    padding: 14px;
  }

  .modal-head h2 {
    font-size: 19px;
  }

  .star-input button {
    width: 38px;
    height: 38px;
  }
}
