:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #1a2332;
  --text-muted: #5c6b7a;
  --primary: #1d6fb8;
  --primary-dark: #155a96;
  --border: #dde3ea;
  --shadow: 0 4px 20px rgba(26, 35, 50, 0.08);
  --radius: 12px;
  --safe-bottom: env(safe-area-inset-bottom, 0);
  --safe-top: env(safe-area-inset-top, 0);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  padding-bottom: calc(1rem + var(--safe-bottom));
}

.site-header {
  background: linear-gradient(145deg, #1d6fb8 0%, #134d82 100%);
  color: #fff;
  padding: calc(1.25rem + var(--safe-top)) 1rem 1.5rem;
  text-align: center;
}

.site-header h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.subtitle {
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
  opacity: 0.9;
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem;
}

.search-panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.field-label + .search-wrap,
.field-label + .tool-select {
  margin-bottom: 0.85rem;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input,
.tool-select {
  width: 100%;
  padding: 0.65rem 2.25rem 0.65rem 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
}

.search-input:focus,
.tool-select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  border-color: var(--primary);
}

.tool-select {
  padding-right: 0.75rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235c6b7a' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
}

.btn-icon {
  position: absolute;
  right: 0.35rem;
  width: 2rem;
  height: 2rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
}

.btn-icon:active {
  background: rgba(0, 0, 0, 0.06);
}

.suggestions {
  list-style: none;
  margin: -0.5rem 0 0.85rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  max-height: 220px;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.suggestions li {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 0.95rem;
}

.suggestions li:last-child {
  border-bottom: none;
}

.suggestions li:active,
.suggestions li:focus {
  background: #e8f2fb;
  outline: none;
}

.suggestions .no-result {
  color: var(--text-muted);
  cursor: default;
}

.tool-detail {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.photo-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  overflow: hidden;
  background: #e8ecf1;
  margin-bottom: 0.85rem;
}

.photo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.photo-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.tool-name {
  margin: 0 0 0.75rem;
  font-size: 1.2rem;
  color: var(--primary-dark);
  border-bottom: 2px solid #e8f2fb;
  padding-bottom: 0.5rem;
}

.detail-list {
  margin: 0;
}

.detail-row {
  margin-bottom: 0.75rem;
}

.detail-row:last-child {
  margin-bottom: 0;
}

.detail-label {
  margin: 0 0 0.2rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
}

.detail-value {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.empty-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0.5rem 0 1rem;
}

.info-buttons {
  margin-top: 0.5rem;
}

.info-buttons-title {
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.info-button-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.info-chip {
  flex: 1 1 calc(50% - 0.25rem);
  min-width: calc(50% - 0.25rem);
  padding: 0.55rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--primary-dark);
  background: var(--surface);
  border: 1px solid #c5daf0;
  border-radius: 999px;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 1px 4px rgba(29, 111, 184, 0.1);
  transition: background 0.15s, transform 0.1s;
}

.info-chip:active {
  transform: scale(0.98);
  background: #e8f2fb;
}

.info-modal {
  width: min(92vw, 420px);
  max-height: 80dvh;
  margin: auto;
  padding: 0;
  border: none;
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.info-modal::backdrop {
  background: rgba(26, 35, 50, 0.45);
}

.modal-inner {
  display: flex;
  flex-direction: column;
  max-height: 80dvh;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 1rem 1rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--primary-dark);
}

.modal-close {
  position: static;
  flex-shrink: 0;
}

.modal-body {
  padding: 0.75rem 1rem 1.25rem;
  overflow-y: auto;
  font-size: 0.92rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.site-footer {
  text-align: center;
  padding: 1rem;
  color: var(--text-muted);
  font-size: 0.75rem;
}

@media (min-width: 480px) {
  .site-header h1 {
    font-size: 1.5rem;
  }

  .info-chip {
    flex: 0 1 auto;
    min-width: auto;
    padding: 0.5rem 1rem;
  }
}
