:root {
  --diag-primary: #0073aa;
  --diag-accent: #ff4d4d;
  --diag-bg: #ffffff;
  --diag-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

body.diag-scroll-lock {
  overflow: hidden !important;
  /* ★ 改善：iOSバグ対策のため touch-action: none; を削除しました */
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.diag-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8) !important;
  z-index: 99998 !important;
  animation: fadeIn 0.3s ease;
}

.diag-container {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 99999 !important;
  width: 90%;
  max-width: 500px;
  max-height: 85vh;
  margin: 0;
  padding: 15px 20px;
  background: var(--diag-bg);
  border-radius: 8px;
  box-shadow: var(--diag-shadow);
  font-family: sans-serif;
  box-sizing: border-box;
}

.diag-header {
  flex-shrink: 0;
  border-bottom: 1px solid #ebebeb;
  box-shadow: 0 4px 6px -6px rgba(0, 0, 0, 0.15);
  padding-bottom: 12px;
  margin-bottom: 15px;
}

/* ★ プログレスバー用にブロック要素へと変更 */
.diag-main-title {
  display: block;
  width: 100%;
  font-size: 18px;
  font-weight: bold;
  color: #333;
  margin: 0;
  line-height: 1.4;
}

.diag-step-badge {
  font-size: 12px;
  font-weight: bold;
  background: var(--diag-accent);
  color: #fff;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.1);
}

#diag-content {
  overflow-y: auto;
  flex-grow: 1;
  padding-right: 5px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
#diag-content::-webkit-scrollbar {
  width: 6px;
}
#diag-content::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.diag-loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 50px 20px;
}
.diag-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #eee;
  border-top: 5px solid var(--diag-accent);
  border-radius: 50%;
  animation: diagSpin 1s linear infinite;
}
@keyframes diagSpin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
.diag-loading-text {
  margin-top: 20px;
  font-size: 16px;
  font-weight: bold;
  color: #666;
  animation: diagPulse 1.5s infinite;
}
@keyframes diagPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.diag-container * {
  box-sizing: border-box;
}
.diag-instruction {
  font-size: 18px;
  font-weight: bold;
  text-align: center;
  margin-bottom: 20px;
}
.diag-instruction span {
  display: block;
  font-size: 14px;
  color: var(--diag-primary);
  margin-top: 5px;
}

.diag-container .num-btn,
.diag-container .wide-btn,
.diag-container .nav-btn,
.diag-container .cta-btn {
  border-radius: 4px !important;
  border: 1px solid #ccc;
  box-shadow: 0 2px 0px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  background: #fff;
  transition: 0.2s;
  font-weight: bold;
}
.diag-container .num-btn:active,
.diag-container .wide-btn:active,
.diag-container .nav-btn:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 transparent;
}
.diag-container .num-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 15px;
}

.diag-container .num-btn {
  padding: 15px;
  font-size: 20px;
  color: var(--diag-accent);
}
.diag-container .wide-btn {
  width: 100%;
  padding: 15px;
  margin-bottom: 10px;
  color: var(--diag-accent);
}

.diag-container .check-item {
  display: flex;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid #eee;
  margin-bottom: 8px;
  background: #fafafa;
  border-radius: 4px;
  cursor: pointer;
}
.diag-container .check-item input {
  margin-top: 4px;
  flex-shrink: 0;
  transform: scale(1.2);
}
.diag-container .check-text {
  margin-left: 10px;
  text-align: left;
  line-height: 1.4;
  font-size: 15px;
}

.diag-container .diag-footer {
  display: flex;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #eee;
  flex-shrink: 0;
}
.diag-container .nav-btn.next {
  background: var(--diag-primary);
  color: #fff;
  flex-grow: 1;
  margin-left: 10px;
  border: none;
  padding: 15px;
}
.diag-container .nav-btn.prev {
  background: #eee;
  color: #666;
  border: none;
  padding: 15px;
}

.diag-container .result-box {
  text-align: center;
  padding-bottom: 10px;
}
.diag-container .result-title {
  display: block;
  font-size: 24px;
  font-weight: bold;
  color: #333;
  margin-bottom: 10px;
}
.diag-container .result-score {
  font-size: 72px;
  font-weight: bold;
  color: var(--diag-accent);
  line-height: 1;
}
.diag-container .cta-btn {
  display: block;
  padding: 20px;
  background: var(--diag-accent);
  color: #fff;
  text-decoration: none;
  border: none;
  font-size: 16px;
  margin-top: 15px;
}
.diag-container .hidden {
  display: none !important;
}

.diag-container .diag-disclaimer {
  font-size: 11px;
  color: #888;
  line-height: 1.5;
  text-align: left;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px dashed #ddd;
}
