/* --- 基本レイアウト --- */
.tool-island {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
  border: 1px solid #e2e8f0;
  overflow: hidden;
  max-width: 1080px;
  margin: -60px auto 20px;
}

.island-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  background: #fff;
}

.input-panel {
  padding: 30px;
  border-right: 1px solid #f1f5f9;
  position: relative;
}

.diagnostic-panel {
  padding: 30px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* --- 読み上げエリア（ガタつき・移動の完全防止） --- */
.karuta-card-display {
  background: #fdfdfd;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  height: 360px;
  position: relative;
  display: flex;
  align-items: flex-start; /* 上端を固定 */
  justify-content: center; /* 横方向は中央 */
  padding: 40px 20px;
}

.text-canvas {
  display: flex;
  flex-direction: row-reverse;
  height: 100%;
  width: 280px;
  gap: 30px;
  justify-content: flex-start;
contain: layout;
}

.typing-text {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-family: "Sawarabi Mincho", serif;
  font-size: 1.8rem;
  font-weight: 500;
  color: #1e293b;
  line-height: 1.9;
  letter-spacing: 0.35rem;
transform: translateZ(0);
min-width: 1.8em;
  flex-shrink: 0;
}

.lower-text {
  color: #1e293b;
}

/* 決まり字装飾 */
.u-highlight {
  color: #ef4444 !important;
  font-weight: 800 !important;
}

.l-bold {
  font-weight: 800 !important;
  color: #0d65c9 !important;
}

/* --- アクションフッター（進行表示を右寄せ） --- */
.action-footer {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.progress-text {
  color: #94a3b8;
  font-size: 12px;
  font-family: monospace;
  letter-spacing: 0.05rem;
}

/* --- サイドパネル・統計 --- */
.stats-row {
  display: flex;
  width: 100%;
  justify-content: space-around;
  align-items: center;
  margin: 15px 0 0;
}

.score-circle {
  position: relative;
  width: 90px;
  height: 90px;
}

.score-circle svg {
  transform: rotate(-90deg);
}

.circle-bg {
  fill: none;
  stroke: #e2e8f0;
  stroke-width: 3;
}

.circle-progress {
  fill: none;
  stroke: #22c55e;
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dasharray 0.5s ease;
}

.score-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px;
  font-weight: 800;
}

.timer-display {
  font-size: 24px;
  font-weight: 800;
  color: #1e293b;
  font-family: monospace;
}

.score-label {
  font-weight: 800;
  color: #94a3b8;
  font-size: 10px;
  margin-top: 5px;
  text-align: center;
}

.panel-sep {
  width: 100%;
  border: none;
  border-top: 1px solid #e2e8f0;
  margin: 20px 0;
}

/* --- 序歌・スタート --- */
.start-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: #fff;
  background-image: radial-gradient(#f1f5f9 1px, transparent 1px);
  background-size: 20px 20px;
}

.joka-title {
  text-align: center;
  padding-left: 10px;
  color: #888;
  letter-spacing: 2px;
  margin-top: 0;
  width: 100%;
}

#joka-text-box {
  display: flex !important;
  justify-content: center;
  align-items: center;
  height: 300px;
  width: 100%;
  margin: 0;
  overflow: visible;
}

.joka-text {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-family: "Sawarabi Mincho", serif;
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 2.1;
  letter-spacing: 0.2rem;
  margin: 0;
}

.joka-inner-content {
  display: inline-block;
  text-align: left; /* 縦書き時の行頭揃え */
}

rt {
  font-size: 0.55rem;
line-height: 1;
    margin-bottom: 0.2rem;
  color: #64748b;
}

/* --- UI部品 --- */
.primary-btn {
  background: #22c55e;
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 12px 35px;
  font-size: 1.1rem;
  cursor: pointer;
  font-weight: bold;
}

.sub-btn {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #64748b;
  padding: 4px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.chip {
  cursor: pointer;
  text-align: center;
  padding: 7px 0;
  background: #fff;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #e2e8f0;
  color: #64748b;
}

.chip:has(input:checked) {
  background: #2563eb;
  color: #fff;
  border-color: #1d4ed8;
}

.chip input {
  display: none;
}

.filter-chips {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.option-group-title {
  font-size: 11px;
  font-weight: 800;
  color: #94a3b8;
  margin-bottom: 8px;
  text-transform: uppercase;
}

/* --- レスポンシブ --- */
@media (max-width: 768px) {
  .island-grid {
    grid-template-columns: 1fr;
  }
  
  .input-panel {
    border-right: none;
    border-bottom: 1px solid #f1f5f9;
  }
  
/*  .karuta-card-display {
    justify-content: flex-end;
    height: 300px;
    padding: 40px 40px 0 0;
  }*/
  
  .text-canvas {
    width: 100%;
    gap: 15px;
  }
  
  .typing-text {
    font-size: 1.5rem;
    line-height: 1.6;
  }
  
  #joka-text-box {
    height: 250px;
  }
  
  .joka-text {
    font-size: 1.5rem;
    line-height: 2.0;
  }
}
/* --- スマホ共通の基本設定 --- */
@media (max-width: 768px) {
    .karuta-card-display {
        justify-content: flex-end;
        height: 300px;
        /* まずは最小の SE (375px) 向けの数値を指定 */
        padding: 40px 33px 0 0 !important; 
    }
}

/* --- iPhone Pro (402px相当) 以上のとき上書き --- */
@media (min-width: 390px) and (max-width: 768px) {
    .karuta-card-display {
        padding-right: 45px !important;
    }
}

/* --- iPhone Pro (414px相当) 以上のとき上書き --- */
@media (min-width: 410px) and (max-width: 768px) {
    .karuta-card-display {
        padding-right: 50px !important;
    }
}

/* --- iPhone Plus (430px相当) 以上のとき上書き --- */
@media (min-width: 420px) and (max-width: 768px) {
    .karuta-card-display {
        padding-right: 60px !important;
    }
}

/* --- iPhone Pro Max (440px相当) 以上のとき上書き --- */
@media (min-width: 435px) and (max-width: 768px) {
    .karuta-card-display {
        padding-right: 60px !important;
    }
}

/* --- スライダー全体のベース（溝の部分） --- */
#speed-range {
    -webkit-appearance: none; /* 標準のデザインを解除 */
    appearance: none;
    width: 100px;
    height: 6px;             /* 溝の太さ */
    background: #e2e8f0;    /* 溝の色 */
    border-radius: 10px;
    outline: none;
}

/* --- つまみ部分（Chrome, Safari用） --- */
#speed-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;             /* 丸の横幅 */
    height: 18px;            /* 丸の高さ */
    background: #2563eb;    /* 丸の色 */
    cursor: pointer;
    border-radius: 50%;      /* 正円にする */
    border: 2px solid #fff; /* 白い縁取りを入れると見やすい */
    box-shadow: 0 1px 3px rgba(0,0,0,0.2); /* 軽い影で立体感を出す */
    transition: transform 0.1s ease;
}

/* つまみを触った（ホバー）時の演出 */
#speed-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);   /* 少し大きくして「触ってる感」を出す */
}

/* --- つまみ部分（Firefox用） --- */
#speed-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #2563eb;
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
/* 決まり字ラベル（縦読み） */
.joka-filter-label{
  display:none;
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-family: "Sawarabi Mincho", serif;
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 2.1;
  letter-spacing: 0.35rem;
  color: #94a3b8;
}

/* all以外のとき：序歌を消してラベルを出す（JSでis-filtered付与） */
#start-overlay.is-filtered #joka-title,
#start-overlay.is-filtered #joka-poem{
  display: none !important;
}
#start-overlay.is-filtered #joka-filter-label{
  display: flex !important;
}

#joka-text-box{ position: relative; }

#joka-filter-label{
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-family: "Sawarabi Mincho", serif;
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 2.1;
  letter-spacing: 0.35rem;
  color: #94a3b8;
}
