/* ========================================
   レスポンシブスタイル - Material Design 3
   ======================================== */

/* ========================================
   タブレット (600px - 904px) - MD3 medium
   ======================================== */

@media (max-width: 904px) {
  .ranking-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .tabs {
    grid-template-columns: repeat(2, 1fr);
  }

  /* 2列のタブの場合ボーダー調整 */
  .tabs-section {
    top: 76px;
  }

  .site-title {
    font-size: 1.125rem;
  }

  .modal-title {
    font-size: 1.5rem;
  }

  .chart-container canvas {
    max-height: 450px;
  }
}

/* ========================================
   スマートフォン (max 599px) - MD3 compact
   ======================================== */

@media (max-width: 599px) {

  /* 基本 */
  :root {
    --sp-8: 24px;
    --sp-10: 32px;
    --sp-12: 40px;
    --sp-16: 48px;
  }

  .container {
    padding: 0 var(--sp-4);
  }

  /* ヘッダー */
  .site-header {
    padding: var(--sp-3) 0;
  }

  .site-title {
    font-size: 1rem;
  }

  .site-subtitle {
    font-size: 0.75rem;
  }

  .logo-image {
    height: 36px;
  }

  /* タブ - MD3 scrollable tabs */
  .tabs-section {
    top: 68px;
  }

  .tabs {
    grid-template-columns: repeat(2, 1fr);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }

  .tab-button {
    flex-direction: row;
    justify-content: center;
    padding: var(--sp-3) var(--sp-3);
    scroll-snap-align: start;
    min-width: 120px;
  }

  .tab-icon {
    font-size: 1.125rem;
  }

  .tab-text {
    font-size: 0.75rem;
  }

  /* グラフ切り替え */
  .chart-toggle {
    flex-direction: column;
    align-items: center;
    gap: var(--sp-2);
  }

  .btn-chart-toggle {
    width: 100%;
    max-width: 280px;
    border-radius: var(--shape-full) !important;
    border: 1px solid var(--md-outline) !important;
  }

  .btn-chart-toggle + .btn-chart-toggle {
    border-left: 1px solid var(--md-outline) !important;
  }

  .chart-container {
    padding: var(--sp-4);
  }

  .chart-container canvas {
    max-height: 320px;
  }

  /* ランキング */
  .ranking-grid {
    grid-template-columns: 1fr;
    gap: var(--sp-3);
  }

  .ranking-title {
    font-size: 1.25rem;
  }

  .card-title {
    font-size: 1rem;
    padding-left: 52px;
  }

  .rank-badge {
    width: 40px;
    height: 40px;
    font-size: 0.8125rem;
  }

  /* 第2回CTA */
  .vote-cta-title {
    font-size: 1.5rem;
  }

  .btn-vote-cta {
    width: 100%;
    max-width: 100%;
    padding: var(--sp-4) var(--sp-6);
    font-size: 0.9375rem;
  }

  /* モーダル */
  .modal-overlay.active {
    padding: var(--sp-3);
    align-items: flex-end;
  }

  .modal-container {
    max-height: 92vh;
    border-radius: var(--shape-xl) var(--shape-xl) 0 0;
  }

  .modal-content {
    padding: var(--sp-6) var(--sp-5) var(--sp-5);
  }

  .modal-title {
    font-size: 1.375rem;
  }

  .modal-close {
    width: 36px;
    height: 36px;
    font-size: 1.125rem;
  }

  .modal-image {
    max-height: 220px;
  }

  .reasons-list {
    max-height: 260px;
  }

  .reason-avatar {
    width: 36px;
    height: 36px;
  }

  .avatar-icon {
    width: 18px;
    height: 18px;
  }

  .reason-bubble {
    padding: var(--sp-3) var(--sp-3);
    border-radius: 4px var(--shape-md) var(--shape-md) var(--shape-md);
  }

  .reason-text {
    font-size: 0.8125rem;
  }

  /* フッター */
  .footer-text {
    font-size: 0.8125rem;
  }

  .btn-load-more {
    width: 100%;
    max-width: 300px;
  }

  .overview-card {
    padding: var(--sp-5);
    border-radius: var(--shape-lg);
  }

  .lead-text {
    font-size: 0.9375rem;
  }
}

/* ========================================
   超小型スマートフォン (max 360px)
   ======================================== */

@media (max-width: 360px) {
  .container {
    padding: 0 var(--sp-3);
  }

  .tab-button {
    padding: var(--sp-2) var(--sp-2);
    min-width: 100px;
  }

  .vote-cta-title {
    font-size: 1.25rem;
  }

  .vote-cta-description {
    font-size: 0.875rem;
  }
}

/* ========================================
   印刷用スタイル
   ======================================== */

@media print {
  .site-header,
  .tabs-section,
  .btn-detail,
  .btn-load-more,
  .vote-cta-section,
  .site-footer,
  .chart-toggle {
    display: none;
  }

  body {
    background: white;
    color: black;
  }

  .ranking-card {
    break-inside: avoid;
    border: 1px solid #ccc;
    box-shadow: none;
    background: white;
  }

  .card-title {
    color: black;
  }

  .card-votes {
    color: #555;
  }
}