* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Source Code Pro', 'Consolas', monospace;
  background: #0d1117;
  color: #c9d1d9;
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

/* ===== ダッシュボード全体 ===== */
.dashboard {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
  padding: 8px 16px;
  gap: 8px;
}

/* ===== ヘッダー ===== */
.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 6px;
  flex-shrink: 0;
  min-height: 44px;
}

.dash-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dash-header-left h1 {
  font-size: 1.1em;
  color: #00ff41;
  text-shadow: 0 0 10px rgba(0, 255, 65, 0.3);
  white-space: nowrap;
}

.dash-subtitle {
  font-size: 0.75em;
  color: #484f58;
  letter-spacing: 0.5px;
}

.dash-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.email-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 4px;
}

.email-label {
  font-size: 0.75em;
  color: #8b949e;
}

.email-box code {
  font-size: 0.85em;
  font-weight: bold;
  color: #00ff41;
  text-shadow: 0 0 6px rgba(0, 255, 65, 0.2);
}

.email-box button,
.header-buttons button {
  padding: 3px 10px;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.75em;
  font-family: inherit;
  transition: background 0.2s;
}

.email-box button {
  background: #238636;
  color: #fff;
}

.email-box button:hover {
  background: #2ea043;
}

.header-buttons {
  display: flex;
  gap: 6px;
}

#btn-copy-result {
  background: #238636;
  color: #fff;
}

#btn-copy-result:hover {
  background: #2ea043;
}

#btn-new {
  background: #30363d;
  color: #c9d1d9;
}

#btn-new:hover {
  background: #484f58;
}

/* ===== 待機オーバーレイ ===== */
.waiting-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 17, 23, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.waiting-box {
  text-align: center;
  padding: 40px;
}

.waiting-instruction {
  font-size: 0.95em;
  color: #8b949e;
  margin-bottom: 12px;
}

.waiting-address-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 24px;
  padding: 10px 16px;
  background: #161b22;
  border-radius: 6px;
  border: 1px solid #30363d;
}

.waiting-address-row code {
  font-size: 1.15em;
  font-weight: bold;
  color: #00ff41;
  word-break: break-all;
  text-shadow: 0 0 8px rgba(0, 255, 65, 0.2);
}

.waiting-address-row button {
  padding: 6px 14px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85em;
  font-family: inherit;
  background: #238636;
  color: #fff;
  transition: background 0.2s;
  white-space: nowrap;
}

.waiting-address-row button:hover {
  background: #2ea043;
}

.spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid #30363d;
  border-top-color: #00ff41;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

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

.waiting-box p {
  font-size: 0.95em;
  color: #c9d1d9;
}

.hint {
  color: #8b949e;
  font-size: 0.85em;
  margin-top: 8px;
}

/* ===== グリッドレイアウト ===== */
.dash-grid {
  display: grid;
  grid-template-columns: 320px 1fr 1fr;
  gap: 8px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.dash-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
}

/* ===== カード ===== */
.dash-card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  overflow: hidden;
  transition: border-color 0.4s, box-shadow 0.4s;
}

.dash-card-small {
  flex: 0 0 auto;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: #1c2128;
  border-bottom: 1px solid #30363d;
  flex-shrink: 0;
}

.card-icon {
  color: #484f58;
  font-size: 0.7em;
}

.card-title {
  font-size: 0.75em;
  font-weight: bold;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.card-badge {
  margin-left: auto;
  padding: 1px 8px;
  border-radius: 8px;
  font-size: 0.7em;
  font-weight: bold;
  color: #484f58;
  border: 1px solid #30363d;
  background: transparent;
  transition: all 0.4s;
}

.card-status {
  margin-left: auto;
  font-size: 0.7em;
  color: #484f58;
}

.card-body {
  padding: 6px 10px;
  flex: 1;
  overflow-y: auto;
  font-size: 0.82em;
}

/* ===== キー・バリュー行 ===== */
.kv-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 0;
  border-bottom: 1px solid rgba(48, 54, 61, 0.4);
}

.kv-row:last-child {
  border-bottom: none;
}

.kv-label {
  color: #8b949e;
  font-size: 0.9em;
  flex-shrink: 0;
}

.kv-value {
  text-align: right;
  word-break: break-all;
  color: #c9d1d9;
  transition: color 0.3s, text-shadow 0.3s;
}

.placeholder-text {
  color: #484f58;
}

/* ===== SMTP ログ ===== */
.smtp-log {
  font-size: 0.92em;
  line-height: 1.7;
}

.log-row {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.log-tag {
  color: #484f58;
  display: inline-block;
  width: 70px;
}

.log-placeholder {
  color: #484f58;
  transition: color 0.3s;
}

/* ===== ステータスカラー ===== */
.status-pass {
  color: #00ff41 !important;
  font-weight: bold;
  text-shadow: 0 0 6px rgba(0, 255, 65, 0.3);
}

.status-fail {
  color: #f85149 !important;
  font-weight: bold;
  text-shadow: 0 0 6px rgba(248, 81, 73, 0.3);
}

.status-none {
  color: #d29922 !important;
  font-weight: bold;
  text-shadow: 0 0 6px rgba(210, 153, 34, 0.3);
}

/* ===== バッジ状態 ===== */
.badge-pass {
  background: rgba(0, 255, 65, 0.1);
  color: #00ff41;
  border-color: rgba(0, 255, 65, 0.4);
  text-shadow: 0 0 6px rgba(0, 255, 65, 0.3);
}

.badge-fail {
  background: rgba(248, 81, 73, 0.1);
  color: #f85149;
  border-color: rgba(248, 81, 73, 0.4);
  text-shadow: 0 0 6px rgba(248, 81, 73, 0.3);
}

.badge-none {
  background: rgba(210, 153, 34, 0.1);
  color: #d29922;
  border-color: rgba(210, 153, 34, 0.4);
  text-shadow: 0 0 6px rgba(210, 153, 34, 0.3);
}

/* ===== カードハイライト（結果表示時） ===== */
.dash-card.revealed {
  border-color: #58a6ff;
  box-shadow: 0 0 12px rgba(88, 166, 255, 0.15);
}

.dash-card.revealed .card-icon {
  color: #58a6ff;
}

@keyframes cardReveal {
  0% { box-shadow: 0 0 0 rgba(88, 166, 255, 0); }
  50% { box-shadow: 0 0 20px rgba(88, 166, 255, 0.3); }
  100% { box-shadow: 0 0 12px rgba(88, 166, 255, 0.15); }
}

.dash-card.revealing {
  animation: cardReveal 0.6s ease forwards;
}

/* ===== リスク評価 ===== */
.risk-label {
  font-size: 1em;
  font-weight: bold;
  color: #484f58;
  margin-bottom: 4px;
  transition: color 0.3s, text-shadow 0.3s;
}

.risk-verdict {
  font-size: 0.88em;
  color: #8b949e;
  line-height: 1.5;
}

#card-risk.risk-low {
  border-color: rgba(0, 255, 65, 0.4);
}

#card-risk.risk-low .risk-label {
  color: #00ff41;
  text-shadow: 0 0 8px rgba(0, 255, 65, 0.3);
}

#card-risk.risk-medium {
  border-color: rgba(210, 153, 34, 0.4);
}

#card-risk.risk-medium .risk-label {
  color: #d29922;
  text-shadow: 0 0 8px rgba(210, 153, 34, 0.3);
}

#card-risk.risk-high {
  border-color: rgba(248, 81, 73, 0.4);
}

#card-risk.risk-high .risk-label {
  color: #f85149;
  text-shadow: 0 0 8px rgba(248, 81, 73, 0.3);
}

/* ===== 推奨対応策 ===== */
.risk-recommendations {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(48, 54, 61, 0.6);
}

.rec-title {
  font-size: 0.8rem;
  color: #8b949e;
  margin-bottom: 6px;
  font-weight: bold;
}

.rec-list {
  margin: 0;
  padding-left: 18px;
  list-style: none;
}

.rec-list li {
  position: relative;
  padding-left: 4px;
  margin-bottom: 4px;
  font-size: 0.78rem;
  color: #c9d1d9;
  line-height: 1.5;
}

.rec-list li::before {
  content: '▹';
  position: absolute;
  left: -14px;
  color: #8b949e;
}

.rec-priority {
  font-size: 0.72rem;
  font-weight: bold;
  margin-top: 6px;
  margin-bottom: 3px;
  padding: 2px 6px;
  border-radius: 3px;
  display: inline-block;
}

.rec-priority-high {
  color: #f85149;
  background: rgba(248, 81, 73, 0.1);
}

.rec-priority-medium {
  color: #d29922;
  background: rgba(210, 153, 34, 0.1);
}

.rec-priority-low {
  color: #8b949e;
  background: rgba(139, 148, 158, 0.1);
}

.rec-list-high li::before {
  color: #f85149;
}

.rec-list-medium li::before {
  color: #d29922;
}

.rec-list-low li::before {
  color: #8b949e;
}

.rec-all-ok {
  font-size: 0.78rem;
  color: #00ff41;
  margin-top: 6px;
}

/* ===== 複数DKIM署名 ===== */
.dkim-signature-block {
  padding-bottom: 4px;
  margin-bottom: 4px;
}

.dkim-signature-block + .dkim-signature-block {
  border-top: 1px solid rgba(48, 54, 61, 0.6);
  padding-top: 4px;
}

.dkim-sig-header {
  font-size: 0.85em;
  color: #58a6ff;
  font-weight: bold;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dkim-primary-tag {
  font-size: 0.8em;
  padding: 0 4px;
  background: rgba(88, 166, 255, 0.1);
  border: 1px solid rgba(88, 166, 255, 0.3);
  border-radius: 3px;
  color: #58a6ff;
}

/* ===== DNSレコード表示 ===== */
.dns-record {
  margin-top: 4px;
  padding: 4px 8px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 3px;
  font-size: 0.88em;
  line-height: 1.4;
  color: #00ff41;
  word-break: break-all;
  white-space: pre-wrap;
}

.dns-record .dns-prompt {
  color: #00ff41;
  font-weight: bold;
}

.dns-record .dns-cmd {
  color: #8b949e;
}

.dns-record .dns-value {
  color: #00ff41;
  text-shadow: 0 0 4px rgba(0, 255, 65, 0.15);
}

/* ===== 解釈ボックス ===== */
.interp-box {
  margin-top: 4px;
  padding: 4px 8px;
  border-left: 2px solid #58a6ff;
  background: rgba(88, 166, 255, 0.05);
  font-size: 0.88em;
  line-height: 1.5;
  color: #8b949e;
}

.interp-box strong {
  color: #c9d1d9;
}

/* ===== メール経路 ===== */
.route-body {
  font-size: 0.9em;
}

.route-hop {
  padding: 2px 0 2px 10px;
  border-left: 2px solid #30363d;
  position: relative;
  margin-bottom: 2px;
  line-height: 1.4;
}

.route-hop::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 8px;
  width: 6px;
  height: 6px;
  background: #30363d;
  border-radius: 50%;
}

.route-hop-num {
  color: #58a6ff;
  font-weight: bold;
  font-size: 0.85em;
}

.route-detail {
  color: #8b949e;
  font-size: 0.85em;
}

/* ===== ヘッダー表示ボタン ===== */
#btn-show-headers {
  background: #1f6feb;
  color: #fff;
}

#btn-show-headers:hover {
  background: #388bfd;
}

/* ===== ヘッダーモーダル ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 17, 23, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(4px);
}

.modal-dialog {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  width: 90%;
  max-width: 800px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid #30363d;
  flex-shrink: 0;
}

.modal-title {
  font-size: 0.9em;
  font-weight: bold;
  color: #c9d1d9;
}

.modal-close {
  background: none;
  border: none;
  color: #8b949e;
  font-size: 1.4em;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  font-family: inherit;
}

.modal-close:hover {
  color: #f85149;
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.modal-section {
  margin-bottom: 16px;
}

.modal-section:last-child {
  margin-bottom: 0;
}

.modal-section-title {
  font-size: 0.8em;
  font-weight: bold;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.modal-pre {
  padding: 10px 12px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 4px;
  font-size: 0.82em;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  color: #c9d1d9;
  margin: 0;
}

/* 構文ハイライト */
.auth-hl-header-name {
  color: #e6edf3;
  font-weight: bold;
}

.auth-hl-pass {
  color: #00ff41;
  font-weight: bold;
  text-shadow: 0 0 4px rgba(0, 255, 65, 0.2);
}

.auth-hl-fail {
  color: #f85149;
  font-weight: bold;
  text-shadow: 0 0 4px rgba(248, 81, 73, 0.2);
}

.auth-hl-warn {
  color: #d29922;
  font-weight: bold;
  text-shadow: 0 0 4px rgba(210, 153, 34, 0.2);
}

.auth-hl-field {
  color: #79c0ff;
}

.auth-hl-value {
  color: #a5d6ff;
}

.auth-hl-comment {
  color: #6e7681;
  font-style: italic;
}

.auth-hl-separator {
  color: #484f58;
}

/* ===== スクロールバー ===== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: #0d1117;
}

::-webkit-scrollbar-thumb {
  background: #30363d;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #484f58;
}

/* ===== カード横並び行 ===== */
.dash-card-row {
  display: flex;
  gap: 8px;
}

.dash-card-row > .dash-card {
  flex: 1;
  min-width: 0;
}

/* ===== レスポンシブ ===== */
@media (max-width: 1280px) {
  .dash-grid {
    grid-template-columns: 1fr 1fr;
  }

  .dash-col-left {
    grid-column: 1 / -1;
    flex-direction: row;
  }

  .dash-col-left .dash-card {
    flex: 1;
  }

  body {
    overflow: auto;
  }

  .dashboard {
    height: auto;
    min-height: 100vh;
  }
}

@media (max-width: 768px) {
  .dash-grid {
    grid-template-columns: 1fr;
  }

  .dash-col-left {
    flex-direction: column;
  }

  .dash-card-row {
    flex-direction: column;
  }

  .dash-header {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }

  .dash-header-left {
    justify-content: center;
  }

  .dash-header-right {
    justify-content: center;
  }
}
