/* style.css */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;700&display=swap');

body {
  font-family: 'Noto Sans JP', sans-serif;
  background-color: #f5f5f5;
  margin: 0;
  padding: 1em;
  color: #333;
}

h1 {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 1em;
}

.input-area {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1em;
  margin-bottom: 2em;
  flex-wrap: wrap;
}

input[type="number"] {
  padding: 0.75em;
  font-size: 1rem;
  width: 160px;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

button {
  padding: 0.75em 1.5em;
  font-size: 1rem;
  background-color: #e63946;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  transition: background-color 0.3s ease;
}

button:hover {
  background-color: #d62839;
}

#userDataArea, .ranking {
  max-width: 800px;
  margin: 0 auto 2em auto;
  background: #fff;
  padding: 2em;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

h2 {
  text-align: center;
  margin-bottom: 1em;
  font-size: 1.5rem;
  color: #333;
}

h3 {
  font-size: 1.2rem;
  margin-top: 1.5em;
  color: #555;
}

ul {
  list-style: none;
  padding-left: 0;
}

ul li {
  padding: 0.5em 0;
  border-bottom: 1px solid #eee;
}

ul li:last-child {
  border-bottom: none;
}

/* recentScoresList */
#recentScoresList {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1em;
  padding: 0;
  margin: 0;
}

#recentScoresList li {
  background: #f0f0f0;
  padding: 0.5em 1em;
  border-radius: 8px;
  font-size: 1.1rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 成績カード */
.stats-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1em;
  margin-top: 1em;
}

.stat-card {
  background: #f0f0f0;
  padding: 1em;
  border-radius: 8px;
  text-align: center;
  width: 120px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.stat-label {
  font-size: 0.85rem;
  color: #777;
  margin-bottom: 0.5em;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: #333;
}

/* ランキング共通 */
.ranking-card {
  display: flex;
  align-items: center;
  background: #f0f0f0;
  border-radius: 8px;
  padding: 0.75em 1em;
  margin-bottom: 0.5em;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  flex-wrap: wrap;
}

.rank-badge {
  font-size: 1.5rem;
  width: 2.5em;
  text-align: center;
  margin-right: 0.75em;
}

.gold { color: #FFD700; }
.silver { color: #C0C0C0; }
.bronze { color: #CD7F32; }

.rank-content {
  display: flex;
  flex-direction: column;
  gap: 0.25em;
}

.rank-name {
  font-weight: bold;
  font-size: 1.1rem;
}

.rank-scores {
  font-size: 0.9rem;
  color: #555;
}

/* 月別ランキング用カードスタイル */
.ranking-block {
  background: #fff;
  border-radius: 12px;
  padding: 1.5em;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  flex: 1;
  min-width: 280px;
  max-width: 400px;
  margin: 1em;
  text-align: center;
}

.ranking-block h2 {
  font-size: 1.3rem;
  margin-bottom: 1em;
}

.ranking-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ranking-list li {
  display: flex;
  justify-content: space-between;
  font-size: 1rem;
  padding: 0.4em 0;
  border-bottom: 1px solid #eee;
}

.ranking-list li:last-child {
  border-bottom: none;
}

.ranking-list li .rank {
  font-weight: bold;
  color: #1d3557;
  margin-right: 0.5em;
}

.ranking-list li .name {
  flex-grow: 1;
  text-align: left;
}

.ranking-list li .score {
  color: #555;
}

/* リンク */
.rank-link a {
  display: inline-block;
  background-color: #457b9d;
  color: #fff;
  padding: 0.4em 0.8em;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.85rem;
  margin-top: 0.3em;
  transition: background-color 0.3s ease;
}

.rank-link a:hover {
  background-color: #1d3557;
}

.btn-link {
  display: inline-block;
  background-color: #457b9d;
  color: #fff;
  padding: 0.75em 1.5em;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  transition: background-color 0.3s ease;
}

.btn-link:hover {
  background-color: #1d3557;
}

.btn-monthly {
  background: linear-gradient(135deg, #ff6f61, #d62839);
  font-size: 1.05rem;
  padding: 0.85em 2em;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.btn-monthly:hover {
  background: linear-gradient(135deg, #e63946, #ba1e30);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

/* レイアウト */
.dashboard {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2em;
  padding: 16px;
}

.chart {
  background: #f9f9f9;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  height: auto; 
  overflow: visible;
}

.chart h2 {
  font-size: 1.1rem;
  margin: 0 0 0.5em 0;
  text-align: center;
}

.chart.full-width {
  width: 100%;
}

canvas {
  width: 100% !important;
  height: 300px !important;
  font-size: 0.8rem !important;
}

#histogramChart {
  height: 600px !important;
}
.ranking-card.fancy {
  display: flex;
  align-items: center;
  background: #ffffff;
  border-radius: 12px;
  padding: 1em;
  margin-bottom: 1em;
  box-shadow: 0 4px 8px rgba(0,0,0,0.05);
  transition: transform 0.2s ease;
  border-left: 5px solid #457b9d;
}

.ranking-card.fancy:hover {
  transform: translateY(-2px);
}

.rank-medal {
  font-size: 2rem;
  margin-right: 1em;
  width: 2.5em;
  text-align: center;
}

.rank-medal.gold { color: #FFD700; }
.rank-medal.silver { color: #C0C0C0; }
.rank-medal.bronze { color: #CD7F32; }

.rank-info .username {
  font-weight: bold;
  font-size: 1.2rem;
  color: #333;
}

.rank-info .score-details {
  font-size: 0.9rem;
  color: #555;
  margin-top: 0.3em;
}




/* モバイル対応 */
@media (max-width: 600px) {
  body {
    padding: 0.5em;
  }

  input[type="number"] {
    width: 100%;
  }

  button {
    width: 100%;
  }

  .input-area {
    flex-direction: column;
  }

  #recentScoresList {
    flex-direction: column;
    align-items: center;
  }

  .stat-card {
    width: 100px;
  }

  .ranking-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .rank-badge {
    margin-bottom: 0.5em;
  }

  .dashboard {
    flex-direction: column;
    align-items: center;
    padding: 0;
  }

  .ranking-block {
    width: 90% !important;
    max-width: 95vw;
    margin-bottom: 1em;
  }

  .ranking-list li {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25em;
    padding: 0.5em 0.75em;
  }

  .chart canvas {
    height: 240px !important;
  }

  .chart.full-width canvas {
    height: 300px !important;
  }

  #histogramChart {
    height: 600px !important;
  }

  .rank-link a {
    width: 100%;
    text-align: center;
  }
}
