/* ===== リセット・変数 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:              #f4f5f7;
  --surface:         #ffffff;
  --border:          #e2e4e9;
  --text-primary:    #1a1c22;
  --text-secondary:  #6b7280;
  --text-muted:      #9ca3af;
  --accent-monitor:  #2563eb;
  --accent-app:      #16a34a;
  --accent-tool:     #ea580c;
  --shadow-sm:       0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:       0 4px 14px rgba(0,0,0,0.09), 0 2px 4px rgba(0,0,0,0.04);
  --radius:          10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:            #0f1117;
    --surface:       #1a1d27;
    --border:        #2a2d3e;
    --text-primary:  #e8eaf0;
    --text-secondary:#9ca3af;
    --text-muted:    #6b7280;
    --shadow-sm:     0 1px 3px rgba(0,0,0,0.4);
    --shadow-md:     0 4px 14px rgba(0,0,0,0.5);
  }
}

/* ===== ベース ===== */
body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

/* ===== ヘッダー ===== */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  color: var(--text-primary);
}

.site-title h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
  font-family: 'SF Mono', 'Consolas', 'Courier New', monospace;
}

.subtitle-ts {
  font-size: 10px;
  opacity: 0.65;
  margin-top: 2px;
}

/* ===== メイン ===== */
main {
  flex: 1;
  padding: 32px 24px;
}

/* ===== カテゴリ ===== */
.category {
  margin-bottom: 36px;
}

.category-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.cat-marker {
  width: 3px;
  height: 14px;
  border-radius: 2px;
  display: block;
  flex-shrink: 0;
}
.cat-monitor { background: var(--accent-monitor); }
.cat-app     { background: var(--accent-app); }
.cat-tool    { background: var(--accent-tool); }

/* ===== カードグリッド ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 12px;
}

/* ===== カード ===== */
.card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--text-muted);
}

.card:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.card-deprecated {
  opacity: 0.65;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.card-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

.card-name {
  font-size: 14px;
  font-weight: 700;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ===== ステータスドット ===== */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-up      { background: #22c55e; box-shadow: 0 0 0 2px rgba(34,197,94,0.2); }
.status-down    { background: #ef4444; box-shadow: 0 0 0 2px rgba(239,68,68,0.2); }
.status-unknown { background: #d1d5db; }

/* ===== バッジ ===== */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  border-radius: 4px;
  padding: 1px 6px;
  line-height: 1.4;
}

.badge-old {
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid #e5e7eb;
}

@media (prefers-color-scheme: dark) {
  .badge-old {
    background: #2a2d3e;
    color: #9ca3af;
    border-color: #3a3d50;
  }
}

.badge-tailscale {
  background: #ede9fe;
  color: #7c3aed;
}

@media (prefers-color-scheme: dark) {
  .badge-tailscale {
    background: #2d2040;
    color: #a78bfa;
  }
}

/* ===== カード説明・URL ===== */
.card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  flex: 1;
  margin-bottom: 12px;
}

.card-url {
  display: inline-block;
  font-size: 11px;
  font-family: 'SF Mono', 'Consolas', 'Courier New', monospace;
  color: var(--text-muted);
  background: var(--bg);
  border-radius: 4px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  width: fit-content;
}

/* ===== フッター ===== */
footer {
  border-top: 1px solid var(--border);
  padding: 14px 0;
  background: var(--surface);
}

.footer-text {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== レスポンシブ ===== */
@media (max-width: 600px) {
  .grid {
    grid-template-columns: 1fr;
  }
  main {
    padding: 24px 0;
  }
  header .container,
  footer .container {
    padding: 0 16px;
  }
}
