body {
      font-family: sans-serif;
      margin: 0;
      padding: 0;
      background: #f7f9fc;
      color: #333;
    }

    .container {
      max-width: 1170px;
      margin: auto;
      padding: 10px;
    }
.speed-section {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 20px;
  margin-bottom: 20px;
  align-items: stretch; /* 追加：カードの高さを揃える */
}

.speed-card {
  flex: 0 1 calc(50% - 20px);
  max-width: calc(50% - 20px);
  box-sizing: border-box;
  background: #fff;
  border-radius: 12px;
  padding: 20px; /* 10px → 20pxに変更 */
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  min-height: 600px; /* 400px → 600pxに増加 */
  position: relative;
}

.speed-card h2 {
  margin: 0 0 20px 0; /* 30px → 20pxに調整 */
  height: auto; /* 固定高さを削除 */
  display: flex;
  align-items: center;
  text-align: center;
  justify-content: center;
  flex-shrink: 0; /* 追加：タイトルエリアの縮小を防ぐ */
}

.speed-card h5 {
  margin: 0 0 20px 0;
  font-size: 12px;
  color: #666;
  text-align: center;
  line-height: 1.4;
  flex-shrink: 0; /* 追加 */
}

.chart-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-grow: 1; /* 残りスペースを占有 */
  justify-content: flex-start; /* center → flex-startに変更 */
  min-height: 200px; /* 最小高さを設定 */
}

    .chart-container {
      position: relative;
      width: 120px;
      height: 120px;
      margin: 15px 0;
    }

    button {
      background: #0077ff;
      color: white;
      border: none;
      padding: 10px 16px;
      border-radius: 6px;
      cursor: pointer;
      margin-bottom: 15px;
      transition: all 0.3s ease;
    }

    .button-area {
  height: 60px; /* 固定高さ */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 15px;
}
    
    button:hover:not(:disabled) {
      background: #005fcc;
    }
    
    button:disabled {
      background: #ccc;
      cursor: not-allowed;
    }

    .compare-section {
      background: #fff;
      padding: 20px;
      border-radius: 12px;
      box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }

    form {
      display: flex;
      flex-wrap: wrap;
      gap: 15px;
      margin-bottom: 20px;
    }

    label {
      display: flex;
      flex-direction: column;
    }

    input {
      padding: 8px;
      border: 1px solid #ccc;
      border-radius: 6px;
    }

    #speedResult, #idealSpeedResult {
      font-size: 20px;
      font-weight: bold;
      color: #0077ff;
      margin: 10px 0;
    }

    #idealSpeedResult {
      color: #00cc66;
    }

    .measuring {
      opacity: 0.7;
    }

    .progress-bar {
      width: 100%;
      height: 4px;
      background: #e0e0e0;
      border-radius: 2px;
      overflow: hidden;
      margin: 10px 0;
    }

    .progress-fill {
      height: 100%;
      background: #0077ff;
      width: 0%;
      transition: width 0.3s ease;
    }

    .latency {
      font-size: 14px;
      color: #666;
      margin-top: 5px;
    }

    .google-speedtest {
      margin-top: 15px;
    }

    .google-speedtest button {
      background: #4285f4;
      font-size: 12px;
      padding: 8px 12px;
    }

    .google-speedtest button:hover:not(:disabled) {
      background: #3367d6;
    }

    .speedtest-modal {
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 80%;
      max-width: 800px;
      height: 70%;
      background: white;
      border-radius: 12px;
      box-shadow: 0 10px 30px rgba(0,0,0,0.3);
      z-index: 1000;
      display: none;
    }

    .speedtest-modal iframe {
      width: 100%;
      height: calc(100% - 50px);
      border: none;
      border-radius: 0 0 12px 12px;
    }

    .modal-header {
      padding: 15px 20px;
      border-bottom: 1px solid #eee;
      display: flex;
      justify-content: between;
      align-items: center;
    }

    .modal-close {
      background: #ff4444;
      color: white;
      border: none;
      padding: 5px 10px;
      border-radius: 4px;
      cursor: pointer;
      margin-left: auto;
    }

    .modal-overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(0,0,0,0.5);
      z-index: 999;
      display: none;
    }

    .performance-info {
      margin-top: 15px;
      padding: 15px;
      background: #f8f9fa;
      border-radius: 8px;
      font-size: 14px;
    }

    .time-savings {
      margin-top: 15px;
      padding: 15px;
      background: linear-gradient(45deg, #e8f5e8, #f0f8ff);
      border-radius: 8px;
      text-align: center;
      font-weight: bold;
      color: #2c5530;
      display: none;
    }

 /* レスポンシブ対応の改善 */
@media(max-width: 768px) {
  .speed-section {
    flex-direction: column;
    align-items: stretch;
  }
  
  .speed-card {
    flex: none;
    max-width: none;
    width: 100%;
    min-height: 500px; /* モバイルでは少し小さく */
  }
}


.chart-container {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 15px 0;
  flex-shrink: 0; /* 追加 */
}

/* 速度表示エリアの高さを統一 */
.speed-display-area {
  height: 80px; /* 固定高さ */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

#speedResult, #idealSpeedResult {
  font-size: 20px;
  font-weight: bold;
  color: #0077ff;
  margin: 10px 0;
  text-align: center;
}

#idealSpeedResult {
  color: #00cc66;
}

.latency {
  font-size: 14px;
  color: #666;
  margin-top: 5px;
  text-align: center;
}

.performance-info {
  margin-top: auto; /* 追加：下に押し付ける */
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  font-size: 14px;
  flex-shrink: 0; /* 追加 */
}

/* プログレスバーがない場合の代替スペース */
.placeholder-space {
  height: 30px; /* プログレスバーの高さ分 */
  margin: 10px 0;
}



    /* 初期状態でチャートを非表示 */
    #transferChart {
      display: none;
    }

    /* 転送詳細表示のスタイル */
    .transfer-details {
      margin-top: 15px;
      padding: 15px;
      background: #f8f9fa;
      border-radius: 8px;
      border-left: 4px solid #0077ff;
      display: none;
    }

    .transfer-comparison {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .transfer-item {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 8px 0;
    }

    .speed-label {
      font-weight: 500;
      color: #555;
      flex: 1;
    }

    .time-value {
      font-weight: bold;
      font-size: 16px;
      text-align: right;
      min-width: 100px;
    }

    .time-value.current {
      color: #0077ff;
    }

    .time-value.ideal {
      color: #00cc66;
    }

    .time-value.savings {
      color: #ff6b6b;
    }

    .savings-highlight {
      border-top: 2px solid #e9ecef;
      padding-top: 12px;
      margin-top: 8px;
    }

    .savings-highlight .speed-label {
      color: #333;
      font-weight: 600;
    }

    /* パフォーマンス比較のスタイル修正 */
    .performance-comparison {
      display: flex;
      flex-direction: column;
      width: 100%;
    }

    .performance-header {
      display: flex;
      width: 100%;
      margin-bottom: 10px;
      padding-bottom: 8px;
      border-bottom: 2px solid #e9ecef;
    }

    .performance-column {
      flex: 1;
      text-align: center;
      display: flex;
      justify-content: center;
      align-items: center;
    }

    /* ヘッダーのスキップ用の空カラム */
    .performance-column.label-column {
      flex: 0 0 140px;
    }

    .column-title {
      font-weight: bold;
      font-size: 14px;
      padding: 8px;
      border-radius: 6px;
      width: 100%;
      text-align: center;
    }

    .user-title {
      background: #e3f2fd;
      color: #0077ff;
    }

    .ideal-title {
      background: #e8f5e8;
      color: #00cc66;
    }

    .performance-item {
      display: flex;
      align-items: center;
      margin: 5px 0;
      padding: 8px 0;
      border-bottom: 1px solid #f0f0f0;
      width: 100%;
    }

    .performance-label {
      flex: 0 0 140px;
      font-weight: 500;
      color: #555;
      font-size: 13px;
      text-align: left;
    }

    .performance-values {
      display: flex;
      flex: 1;
      width: 100%;
    }

    .performance-values .performance-status {
      flex: 1;
      text-align: center;
      font-weight: bold;
      font-size: 14px;
      padding: 4px 8px;
      border-radius: 4px;
      margin: 0 4px;
      display: flex;
      justify-content: center;
      align-items: center;
    }

    .status-untested {
      color: #999;
      background: #f8f9fa;
      border: 1px dashed #ddd;
    }

    .status-excellent { 
      color: #28a745; 
      background: #d4edda;
    }

    .status-good { 
      color: #17a2b8; 
      background: #d1ecf1;
    }

    .status-fair { 
      color: #856404; 
      background: #fff3cd;
    }

    .status-poor { 
      color: #fd7e14; 
      background: #fce4c8;
    }

    .status-bad { 
      color: #dc3545; 
      background: #f8d7da;
    }

    .status-untested {
      color: #999;
      background: #f8f9fa;
      border: 1px dashed #ddd;
    }

    .status-excellent { 
      color: #28a745; 
      background: #d4edda;
    }

    .status-good { 
      color: #17a2b8; 
      background: #d1ecf1;
    }

    .status-fair { 
      color: #856404; 
      background: #fff3cd;
    }

    .status-poor { 
      color: #fd7e14; 
      background: #fce4c8;
    }

    .status-bad { 
      color: #dc3545; 
      background: #f8d7da;
    }

    @media(max-width: 768px) {
      .performance-columns {
        grid-template-columns: 1fr;
        gap: 10px;
      }
      
      .performance-header {
        grid-template-columns: 100px 1fr 1fr;
      }
      
      .performance-item {
        grid-template-columns: 100px 1fr 1fr;
        gap: 4px;
      }
      
      .performance-label {
        font-size: 12px;
      }
      
      .performance-status {
        font-size: 12px;
        padding: 3px 4px;
      }
    }