@font-face {
    font-display: swap;
    font-weight: 400;
    font-style: normal;
    font-family: 'M PLUS 1';
    src: url("../font/MPLUS1-Regular.woff2") format("woff")
}

@font-face {
    font-display: swap;
    font-weight: 700;
    font-style: normal;
    font-family: 'M PLUS 1';
    src: url("../font/MPLUS1-Bold.woff2") format("woff")
}

#main,#nav,footer{
    font-family: 'M PLUS 1',Arial,"Hiragino Kaku Gothic ProN","Hiragino Sans",Meiryo,sans-serif
}

*,::after,::before {
    box-sizing: border-box
}

a {
    color: #313131
}

dl,h1,h2,h3,p,span {
    transform: rotate(.03deg);
    -moz-transform: rotate(.03deg);
    -webkit-transform: rotate(.03deg)
}

#header h1 a {
    display: flex;
    align-items: center
}

.about,body::before {
    display: block
}

body {
    background-color: #f0f8ff
}

#wrapper {
    margin: 0 clamp(0rem, -10rem + 40vw, 40rem);
    display: flex;
    flex-direction: column;
    height: 100svh;
}

#header {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: #ffffffc7;
    padding: 0 0 0 1em;
    backdrop-filter: blur(1px)
}

#header h1 {
    margin: 0;
    width: calc(120px + 15 * (100vw - 680px)/ 400);
}

#main,#nav p {
    display: flex;
}

#header h1 a:hover {
    background-color: #bbb
}

#header img {
    max-width: 100%;
    height: auto;
    margin: 8px 0
}

#nav {
    margin: 0 30px;
    font-size: 1em;
}

#nav p {
    padding: 7px;
    border-radius: 5px;
    background-color: #ffffffc7;
    flex-direction: row;
    justify-content: space-around;
}

.link {
    border: #fff;
    color: #006077;
    background-color: #FFF;
    border-radius: .25rem;
    cursor: pointer
}

#main {
    margin: 0 15px 15px;
    flex-wrap: wrap;
}

.bold {
    font-size: 1.17em;
    margin: 1em 0;
    font-weight: 700
}

.submit a {
    color: #fff
}

.copyrights {
    color: #747474
}

.contents ,.settings,.wordbooks,.leap,.play,.stats {
    width: 100%;
    height: 100%;
    min-height: 400px;
    border-radius: 5px;
    padding: 10px;
    text-align: center;
    background-color: #ffffffc7;
    display: flex;
    flex-direction: column;
}

.settings{
    display: none;
}

.wordbooks{
    display: none;
}

.wordbooks .link{
    margin: 20px
}

.leap{
    display: none;
}

.stats{
	display: none;
}

.play{
    display: none;
}

.turn {
	margin-top: 40px;
}

.next {
    border: 0;
    border-top: solid 5px #000;
    border-right: solid 5px #000;
    display: inline-block;
    transform: rotate(45deg);
    width: 20px;
    height: 20px;
    padding: 0;
    background-color: #FFF;
}

.forward {
    border: 0;
    border-top: solid 5px #000;
    border-left: solid 5px #000;
    display: inline-block;
    transform: rotate(-45deg);
    width: 20px;
    height: 20px;
    padding: 0;
    background-color: #FFF;
}

.means_container{
    display: flex;
}

.means{
    flex: 1;
}

.question{
    margin: 10px;
}

.question_word{
    font-size: clamp(2.5rem, 2.1625rem + 1.5000vw, 4rem);
    font-weight: bold;
    margin: 10px 0 30px;
    word-break: keep-all;
}

.ja {
    font-size: clamp(1.875rem, 1.625rem + 1vw, 2.875rem);
}

.choice{
    color: #006077;
    width:90%;
    padding: calc(1.75rem - clamp(0.75rem, 0.6937rem + 0.2500vw, 1rem));
    border: 1px solid #ededed;
    border-radius: 5px;
    margin: 3px;
    background-color:#fff;
    font-size: clamp(1.2rem, 1.1325rem + 0.3000vw, 1.5rem);
    word-break: keep-all;
}

.choice:last-child{
	color:#c20000;
	margin-top:30px;
}

.meaning {
    color: #006077;
    width:80%;
    padding: calc(1.75rem - clamp(0.75rem, 0.6937rem + 0.2500vw, 1rem));
    border: 1px solid #ededed;
    border-radius: 5px;
    margin: 3px;
    background-color:#fff;
    font-size: clamp(1.2rem, 1.1325rem + 0.3000vw, 1.5rem);
    word-break: keep-all;
    min-height: 70px;
}

.closed{
	background-color: #808080;
	color: #808080;
}

.means .submit{
	margin-top:30px;
}

.result{
    text-align: center;
    padding: 20px 40px;
    font-size: 24px;
    font-weight: bold;
    border-radius: 5px;
    position: absolute;
    top: 350px;
    left: 50%;
    transform: translate(-50%, -50%);
}

.word_container{
    padding:5px;
    border-bottom: 1px solid #ebebeb;
}

.word_container:last-of-type{
    margin-bottom: 25px;
}

.choice_container{
    margin-bottom: 40px;
    margin-top: auto;
    display: inline-block;
}
    

.word {
    font-size: 20px;
    margin-bottom: 5px;
}

.meanings{
    margin-bottom: 10px;
}

.clear{
    margin: 15px;
    font-size: 18px;
}

.toggle-button {
    display: inline-block;
    position: relative;
    width: 60px;
    height: 30px;
    border-radius: 50px;
    background-color: #dddddd;
    cursor: pointer;
    transition: background-color .4s;
  }
  
  .toggle-button:has(:checked) {
      background-color: #4bd865;
  }
  
  .toggle-button::after {
      position: absolute;
      top: 0;
      left: 0;
      width: 30px;
      height: 30px;
      border-radius: 50%;
      box-shadow: 0 0 5px rgb(0 0 0 / 20%);
      background-color: #fff;
      content: '';
      transition: left .4s;
  }
  
  .toggle-button:has(:checked)::after {
      left: 30px;
  }
  
  .toggle-button input {
      display: none;
  }

.range input{
    text-align: center;
    padding: 5px;
}

footer {
    width: 100%;
    background-color: #ffffffc7;
    text-align: center;
    padding: 3px;
    margin-top: auto;
}

footer p{
    font-size:14px;
}

.submit {
    padding: 1em 4em;
    color: #fff;
    border: #fff;
    background-color: #1671df;
    border-radius: .25rem;
    cursor: pointer
}

.register, .confirm, .wordbook {
    padding: .5em 1.5em;
    background-color: #309b61;
}

.wordbook{
    margin: 10px;
}

.submit:disabled {
    color: rgb(149 149 149);
    background-color: #797d885c
}


.prog-bar{
    margin-bottom: 15px;
	display: inline-block;
    width:100%;
    height:5px;
    background:#eee;	/*ãƒãƒ¼ã®èƒŒæ™¯è‰²*/
    border-radius:5px;
    position:relative;
    overflow: hidden;
}
.prog-bar span{
    display: block;
	height:100%;
	background:#00aec9;	/*ãƒãƒ¼ã‚«ãƒ©ãƒ¼*/
	position:absolute;
	animation: progress 10s normal;	/*ã‚¢ãƒ‹ãƒ¡ãƒ¼ã‚·ãƒ§ãƒ³ã‚¹ãƒ”ãƒ¼ãƒ‰*/
	animation-fill-mode: forwards;
}
@keyframes progress {
	0% {width: 100%}
    100% {width: 0}
}

@media screen and (min-width: 760px) {
    html {
      scrollbar-gutter: stable;
    }
}

/* グラフ全体レイアウト */
.gauge-wrapper {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

/* SVG円グラフ */
.circular-chart {
  max-width: 120px;
  max-height: 120px;
  width: 100%;
  height: auto;
}
.circle-bg {
  fill: none;
  stroke: #eee;
  stroke-width: 3.8;
}
.circle {
  fill: none;
  stroke-width: 2.8;
  stroke: #00bcd4;
  stroke-linecap: round;
  transition: stroke-dasharray 0.6s ease;
}
.percentage {
  fill: #333;
  font-size: 0.4em;
  text-anchor: middle;
  font-weight: bold;
}
.label {
  text-align: center;
  font-weight: 600;
  font-size: 0.9em;
  margin-bottom: 0.5em;
}

/* スコアと連続表示 */
.stability-score,
.streak {
  text-align: center;
  font-weight: bold;
  margin: 1em 0 0.5em;
  color: #444;
}

/* 統計テーブル */
.word-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.9rem;
}
.word-table th,
.word-table td {
  border: 1px solid #ccc;
  padding: 0.5rem;
  text-align: center;
}
.word-table th {
  background-color: #f5f5f5;
  font-weight: 600;
  cursor: pointer;
}
.word-table th:hover {
  background-color: #e0f7fa;
}
.word-table tbody tr:nth-child(even) {
  background-color: #fafafa;
}
.word-table tbody tr:hover {
  background-color: #e3f2fd;
}

/* ヒートマップ */
.heatmap {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: center;
  margin-top: 1rem;
}
.heat-cell {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  cursor: pointer;
}
.heat-legend {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5em;
  margin-top: 0.5em;
  font-size: 0.75em;
}
.heat-legend span {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

/* レビューリスト */
.review-list {
  list-style: none;
  padding-left: 0;
  margin: 0.5rem auto 1rem;
  max-width: 400px;
}
.review-list li {
  padding: 0.4em 0.6em;
  margin: 0.2em 0;
  background-color: #e0f7fa;
  border-radius: 4px;
  text-align: center;
}

/* セクション見出し */
.heat-section h3,
.history-section h3,
.review-section h3,
.wordlist-section h3 {
  text-align: center;
  margin-top: 1.5rem;
  color: #333;
}

.stat-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
    align-items: center;
    justify-content: space-evenly;
  }
  
  .stat-controls label {
    display: flex;
    flex-direction: column;
    font-size: 0.95em;
  }
  
  .stat-controls select, #history-days-select {
    margin-top: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #ccc;
    min-width: 120px;
  }

  .score-level-box {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
  }
  .score-level-modern {
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 8px;
    font-weight: bold;
    background: linear-gradient(90deg, #f8f8f8 60%, #fff 100%);
    min-width: 145px;
  }
  .score-level-modern .score-badge {
    display: inline-block;
    min-width: 2.2em;
    text-align: center;
    border-radius: 6px;
    color: #fff;
    margin-right: 8px;
    font-weight: bold;
  }
  .score-level-modern .score-label {
    color: #333;
  }

.score-level-modern {
  font-size: clamp(0.9em, 1.5vw, 1.1em); /* 最小を0.75→0.9に */
  gap: clamp(6px, 1.2vw, 14px);
  min-width: clamp(140px, 20vw, 230px);  /* 最小を140→150に */
  padding: clamp(6px, 1vw, 10px);
}

.score-badge {
  font-size: clamp(1.0em, 1.6vw, 1.2em); /* 見やすい太さ */
  padding: clamp(4px, 0.6vw, 8px) clamp(8px, 1vw, 12px);
}

.score-label {
  font-size: clamp(0.8em, 1.2vw, 1em); /* 0.7→0.8へ */
}

.score-level-modern span:last-child {
  font-size: clamp(0.65em, 0.9vw, 0.8em); /* 小さすぎを防ぐ */
}

.word-card-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 0;
    margin: 0;
}
.word-card {
    display: flex;
    border-bottom: 1.5px solid #e0e7ef;
    position: relative;
}
.word-card-header {
    font-weight: bold;
    font-size: 1.22em;
    color: #1a2233;
    display: flex;
    align-items: center;
    gap: 8px;
}
.word-card-history-btn {
    margin-left: auto;
    align-self: flex-start;
    color: #fff;
    background-color: #1671DF;
    border: none;
    border-radius: 8px;
    padding: 7px 18px;
    font-size: 1em;
    cursor: pointer;
    margin-top: 2px;
}

/* モーダル */
#word-history-modal {
  animation: fadeInModal 0.18s;
}
@keyframes fadeInModal {
  from { opacity: 0; }
  to { opacity: 1; }
}

#close-history-modal {
  background: none;
  border: none;
  color: #888;
  font-size: 1.5em;
  cursor: pointer;
  transition: color 0.15s;
}
#close-history-modal:hover {
  color: #2563eb;
}
#word-history-body h3 {
  margin-top: 0;
  font-size: 1.18em;
  color: #2563eb;
  letter-spacing: 0.01em;
}
.word-history-section {
  margin: 12px 0 18px 0;
  padding: 10px 0 12px 0;
  border-bottom: 1px solid #e5e7eb;
}
.word-history-section:last-child {
  border-bottom: none;
}
.word-history-label {
  font-weight: 600;
  color: #374151;
}
.word-history-records {
  font-size: 0.97em;
  color: #374151;
  margin-top: 2px;
  line-height: 1.7;
}
#word-history-modal {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(30,41,59,0.28);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
  }
  #word-history-content {
    background: #fff;
    padding: 18px 8px 8px 8px;
    border-radius: 14px;
    max-width: 98vw;
    max-height: 90vh;
    min-width: 360px;
    overflow: auto;
    position: relative;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  }
  #close-history-modal {
    position: absolute;
    top: 8px; right: 12px;
    font-size: 1.7em;
    background: none;
    border: none;
    cursor: pointer;
    color: #888;
  }
  #word-history-body h2 {
    margin-bottom: 10px;
    font-size: 1.1em;
    letter-spacing: 0.02em;
    word-break: break-all;
  }
  .dir-tab-btn {
    padding: 7px 16px;
    border-radius: 8px;
    border: none;
    background: #bae6fd;
    cursor: pointer;
    font-weight: bold;
  }
  .meaning-tab-btn {
    padding: 6px 12px;
    border-radius: 7px;
    border: none;
    background: #e0e7ef;
    cursor: pointer;
    font-size: 0.98em;
    white-space: nowrap;
  }
  .meaning-tab-btn.active {
    background: #bae6fd;
    color: #2563eb;
  }
  .word-history-section {
    margin-bottom: 10px;
  }
  .word-history-label {
    font-weight: bold;
  }
  .word-history-summary {
    margin-bottom: 8px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 0.97em;
    display: flex;
    flex-direction: column;
    text-align: center;
  }
  .word-history-records {
    margin-bottom: 4px;
  }
  .word-history-records table {
    border-collapse: collapse;
    width: 100%;
    min-width: 220px;
    font-size: 0.97em;
  }
  .word-history-records th,
  .word-history-records td {
    padding: 4px 4px;
  }
  .word-history-records th {
    background: #f1f5f9;
  }

.quick-range {
  padding: 4px 10px;
  font-size: 0.85em;
  border-radius: 5px;
  cursor: pointer;
}

#stat-label, #stat-label-all{
	font-size:0.8em;
	color:#222;
}

#show-details{
	padding: 0.5em 2em;
}