:root {
  color-scheme: light;
  --page-bg: #ffffff;
  --text: #171717;
  --muted: #7a7f86;
  --border: #e5e7eb;
  --toolbar-border: #edf0f2;
  --search-bg: #eef1f4;
  --card-hover: #f8fafc;
  --active: #0a59f7;
  --toast-bg: #1f2937;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--page-bg);
  color: var(--text);
  font-family: Arial, "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 54px;
  padding: 8px 18px;
  border-bottom: 1px solid rgba(237, 240, 242, 0.72);
  background: rgba(255, 255, 255, 0.68);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
}

.page-title {
  flex-shrink: 0;
  margin: 0;
  color: #0f172a;
  font-size: 18px;
  font-weight: 600;
  line-height: 30px;
  white-space: nowrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(356px, 48vw);
  height: 30px;
  padding: 0 13px;
  border-radius: 18px;
  background: var(--search-bg);
  color: var(--muted);
}

.search-icon {
  font-size: 17px;
  line-height: 1;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}

.search-box input::placeholder {
  color: #9aa0a6;
}

.symbol-count {
  flex: 1;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.view-actions {
  display: flex;
  overflow: hidden;
  border: 1px solid #cfd5dc;
  border-radius: 4px;
}

.view-button {
  width: 30px;
  height: 30px;
  border: 0;
  border-right: 1px solid #cfd5dc;
  background: #fff;
  color: #4b5563;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.view-button:last-child {
  border-right: 0;
}

.view-button.is-active {
  border-color: var(--active);
  background: #edf4ff;
  color: var(--active);
}

main {
  padding: 10px 20px 28px;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 240px;
  color: var(--muted);
  font-size: 14px;
}

.loading[hidden] {
  display: none;
}

.loading-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #d9dee5;
  border-top-color: var(--active);
  border-radius: 50%;
  animation: loading-spin 800ms linear infinite;
}

@keyframes loading-spin {
  to {
    transform: rotate(360deg);
  }
}

.message {
  margin: 22px auto;
  max-width: 720px;
  padding: 14px 16px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff1f2;
  color: #991b1b;
  font-size: 14px;
  line-height: 1.6;
}

.symbol-list {
  min-height: 240px;
}

.grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 28px 18px;
}

.symbol-card {
  display: flex;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: center;
}

.grid-view .symbol-card {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 128px;
  padding: 14px 10px;
}

.symbol-card:hover,
.symbol-card:focus-visible {
  border-color: var(--border);
  background: var(--card-hover);
  outline: 0;
}

.symbol-glyph {
  display: block;
  font-family: "HMSymbolVF";
  font-size: 42px;
  font-weight: normal;
  line-height: 1;
}

.symbol-list.is-symbol-font-loading .symbol-glyph {
  opacity: 0;
}

.symbol-name {
  display: block;
  width: 100%;
  margin-top: 18px;
  overflow: hidden;
  color: #0f172a;
  font-size: 13px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-view {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.list-view .symbol-card {
  align-items: center;
  gap: 18px;
  width: 100%;
  min-height: 58px;
  padding: 8px 12px;
  text-align: left;
}

.list-view .symbol-glyph {
  width: 56px;
  font-size: 32px;
  text-align: center;
}

.list-view .symbol-name {
  margin-top: 0;
  font-size: 14px;
}

.toast {
  position: fixed;
  z-index: 3;
  max-width: min(240px, calc(100vw - 24px));
  padding: 9px 12px;
  border-radius: 6px;
  background: var(--toast-bg);
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(4px);
  transition: opacity 160ms ease, transform 160ms ease;
  white-space: nowrap;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

@media (max-width: 640px) {
  .toolbar {
    align-items: center;
    flex-wrap: wrap;
  }

  .page-title {
    width: 100%;
  }

  .search-box {
    width: 100%;
  }

  .symbol-count {
    flex: 1 1 calc(100% - 78px);
  }

  main {
    padding: 10px 12px 22px;
  }

  .grid-view {
    grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
    gap: 18px 10px;
  }
}
