/* ---- Hot Monitor - Polished Minimalist Redesign ---- */

.hm-mode .tool-hero {
  display: none;
}

.hm-mode .tool-detail-head {
  display: none;
}

.hm-mode {
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
  backdrop-filter: none;
}

.hm-root {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.hm-root,
.hm-root * {
  box-sizing: border-box;
}

.hm-back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #64748b;
  border-radius: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.hm-back-link:hover {
  background: #f1f5f9;
  color: #334155;
}

.hm-back-link:active {
  background: #e2e8f0;
  color: #334155;
}

.hm-back-link svg {
  width: 18px;
  height: 18px;
  color: #6366f1;
}

.hm-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.hm-form-card,
.hm-result-card,
.hm-history-panel {
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  padding: 16px;
}

.hm-form-card,
.hm-result-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hm-form-header,
.hm-panel-head,
.hm-block-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.hm-form-header-icon,
.hm-block-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hm-form-header-icon {
  background: #ede9fe;
  color: #6366f1;
}

.hm-block-icon--topics {
  background: #e0f2fe;
  color: #0284c7;
}

.hm-block-icon--rules {
  background: #fef3c7;
  color: #d97706;
}

.hm-form-header-icon svg,
.hm-block-icon svg {
  width: 16px;
  height: 16px;
}

.hm-form-header > div:last-child {
  flex: 1;
}

.hm-form-header h3,
.hm-panel-head h3,
.hm-block-title-wrap h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
}

.hm-form-header p {
  margin: 4px 0 0;
  font-size: 0.78rem;
  line-height: 1.6;
  color: #64748b;
}

.hm-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hm-field > span {
  font-size: 0.78rem;
  font-weight: 600;
  color: #334155;
}

.hm-search-wrap {
  position: relative;
}

.hm-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
}

.hm-search-icon svg {
  width: 16px;
  height: 16px;
}

.hm-search-input {
  width: 100%;
  min-height: 44px;
  padding: 0 82px 0 38px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  font: inherit;
  font-size: 0.85rem;
  color: #334155;
  transition: all 0.2s;
}

.hm-search-input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  background: #fff;
}

.hm-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 56px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  display: none;
}

.hm-search-clear.is-visible {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hm-search-clear:hover {
  background: #f8fafc;
}

.hm-recent-searches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hm-recent-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

.hm-recent-chip:hover {
  background: #f1f5f9;
}

.hm-recent-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #64748b;
  font-size: 0.68rem;
  line-height: 1;
}

.hm-chip-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.hm-chip-bar::-webkit-scrollbar {
  display: none;
}

.hm-chip {
  flex-shrink: 0;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.hm-chip.is-active {
  background: #6366f1;
  border-color: #6366f1;
  color: #fff;
}

.hm-action-row,
.hm-modal-footer {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.hm-btn-primary,
.hm-btn-secondary,
.hm-inline-btn {
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.hm-btn-primary,
.hm-btn-secondary {
  min-height: 44px;
}

.hm-btn-primary {
  border: none;
  background: #6366f1;
  color: #fff;
}

.hm-btn-primary:hover {
  opacity: 0.92;
}

.hm-btn-secondary {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
}

.hm-btn-secondary:hover,
.hm-inline-btn:hover {
  background: #f1f5f9;
  color: #334155;
}

.hm-form-tip,
.hm-modal-tip {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.6;
  color: #94a3b8;
}

.hm-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
}

.hm-result-header.is-pending {
  border-color: #fde68a;
  background: #fffbeb;
}

.hm-result-header.is-failed {
  border-color: #fecaca;
  background: #fef2f2;
}

.hm-result-header-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hm-result-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22c55e;
  flex-shrink: 0;
}

.hm-result-header.is-pending .hm-result-status-dot {
  background: #d97706;
}

.hm-result-header.is-failed .hm-result-status-dot {
  background: #dc2626;
}

.hm-result-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1e293b;
}

.hm-result-meta {
  margin-top: 2px;
  font-size: 0.72rem;
  color: #64748b;
}

.hm-status-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.25);
  font-size: 0.72rem;
  font-weight: 600;
  color: #475569;
}

.hm-result-summary {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.6;
  color: #475569;
}

.hm-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.hm-meta-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  padding: 10px;
  text-align: center;
}

.hm-meta-card span {
  display: block;
  font-size: 0.7rem;
  color: #94a3b8;
}

.hm-meta-card strong {
  display: block;
  margin-top: 6px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #1e293b;
}

.hm-block {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hm-block-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.hm-block-title-wrap span {
  font-size: 0.72rem;
  color: #94a3b8;
}

.hm-inline-btn {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
}

.hm-topic-list,
.hm-history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hm-topic-item,
.hm-history-item {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  padding: 14px;
}

.hm-topic-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.hm-topic-item:hover {
  border-color: #c7d2fe;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
}

.hm-topic-rank {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #f8fafc;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 800;
}

.hm-topic-rank.is-top1 {
  background: #f59e0b;
  color: #fff;
}

.hm-topic-rank.is-top2 {
  background: #94a3b8;
  color: #fff;
}

.hm-topic-rank.is-top3 {
  background: #fb923c;
  color: #fff;
}

.hm-topic-main {
  min-width: 0;
}

.hm-topic-meta,
.hm-tag-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.hm-topic-meta {
  margin-bottom: 8px;
}

.hm-topic-main h4 {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.55;
  color: #1e293b;
  word-break: break-word;
}

.hm-platform-badge,
.hm-group-badge,
.hm-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 0.68rem;
  font-weight: 600;
}

.hm-platform-badge {
  color: #fff;
}

.hm-group-badge,
.hm-tag {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
}

.hm-tag--success {
  background: #eefdf3;
  border-color: #bbf7d0;
  color: #15803d;
}

.hm-tag--danger {
  background: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
}

.hm-rank-text,
.hm-history-main span,
.hm-panel-tag,
.hm-panel-count {
  font-size: 0.72rem;
  color: #94a3b8;
}

.hm-rule-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hm-rule-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hm-rule-group-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #334155;
}

.hm-panel-tag {
  margin: 0 0 4px;
  font-weight: 600;
}

.hm-panel-count {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-weight: 600;
}

.hm-history-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.hm-history-main strong {
  font-size: 0.82rem;
  font-weight: 700;
  color: #1e293b;
}

.hm-empty-state,
.hm-loading-state {
  text-align: center;
  padding: 24px 14px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  font-size: 0.82rem;
  color: #94a3b8;
}

.hm-empty-state.is-error {
  color: #dc2626;
  background: #fef2f2;
  border-color: #fecaca;
}

.hm-empty-state--compact {
  padding: 18px 12px;
}

.hm-loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.hm-loading-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #e2e8f0;
  border-top-color: #6366f1;
  border-radius: 999px;
  animation: hm-spin 0.8s linear infinite;
}

.hm-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(env(safe-area-inset-top, 0px), 16px)
    16px
    max(env(safe-area-inset-bottom, 0px), 16px);
}

body.hm-modal-open {
  overflow: hidden;
}

.hm-modal {
  width: min(100%, 480px);
  max-height: min(720px, calc(100dvh - 40px));
  overflow-y: auto;
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-sizing: border-box;
}

.hm-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hm-modal-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
}

.hm-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  font-size: 1rem;
  cursor: pointer;
}

.hm-modal-close:hover {
  background: #f1f5f9;
}

.hm-modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hm-modal-body textarea,
.hm-modal-body input[type="text"] {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  font: inherit;
  font-size: 0.85rem;
  line-height: 1.6;
  color: #334155;
  transition: all 0.2s;
}

.hm-modal-body textarea {
  min-height: 160px;
  resize: vertical;
  padding: 12px;
}

.hm-modal-body input[type="text"] {
  min-height: 44px;
  padding: 0 12px;
}

.hm-modal-body textarea:focus,
.hm-modal-body input[type="text"]:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  background: #fff;
}

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

@media (max-width: 640px) {
  .hm-modal-overlay {
    padding:
      max(env(safe-area-inset-top, 0px), 18px)
      14px
      max(env(safe-area-inset-bottom, 0px), 24px);
  }

  .hm-modal {
    width: min(100%, 420px);
    max-height: min(700px, calc(100dvh - 52px));
    transform: translateY(-3vh);
  }

  .hm-meta-grid,
  .hm-action-row,
  .hm-modal-footer {
    grid-template-columns: 1fr;
  }

  .hm-result-header,
  .hm-panel-head,
  .hm-history-main,
  .hm-block-head {
    flex-direction: column;
    align-items: stretch;
  }

  .hm-status-chip,
  .hm-inline-btn {
    width: 100%;
  }

  .hm-topic-item {
    grid-template-columns: 1fr;
  }

  .hm-topic-rank {
    width: 44px;
  }
}
