.spg.container {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1rem;
}
.spg-form label {
    margin-right: 1rem;
}
.spg-game {
    margin-top: 1.2rem;
}
.spg-status {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: .6rem;
}
.spg-timer {
    flex: 1;
    height: 8px;
    background: #eee;
    border-radius: 4px;
    overflow: hidden;
}
#timerBar {
    height: 100%;
    width: 100%;
    background: #10b981;
    transition: width .1s linear;
}
.spg-question {
    font-size: 1.4rem;
    font-weight: 700;
    margin: .8rem 0;
}
.spg-choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .6rem;
}
.spg-choices button {
    padding: .8rem;
    border: 1px solid #ddd;
    border-radius: .4rem;
    background: #fff;
    cursor: pointer;
}
.spg-choices button.correct {
    border-color: #10b981;
}
.spg-choices button.wrong {
    border-color: #ef4444;
}
.spg-feedback {
    min-height: 1.6rem;
    margin-top: .5rem;
    font-weight: 700;
}
.spg-result {

}
.spg-tabs {
    margin: 1rem 0;
    display: flex;
    gap: .5rem;
}
.tab-btn {
    padding: .4rem .8rem;
    border: 1px solid #ddd;
    background: #f8fafc;
    cursor: pointer;
}
.tab-btn.active {
    background: #78BC4E !important;
    color: #fff !important;
    border-color: #78BC4E !important;
}
.spg-history table {
    width: 100%;
    border-collapse: collapse;
}
.spg-history th, .spg-history td {
    border: 1px solid #e5e7eb;
    padding: .4rem;
    text-align: center;
}

/* タイルの見た目 */
.tile{
  --tile-border: #e5e7eb;
  --tile-bg: #fff;
  --tile-active: #78BC4E;
  border: 1.5px solid var(--tile-border);
  background: var(--tile-bg);
  border-radius: .75rem;
  padding: .9rem .8rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .25rem;
  min-height: 84px;               /* タイル高さ */
  color: #111; font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.tile .tile-title{ font-size: 0.95rem; }
.tile .tile-sub{ font-size: .8rem; opacity: .7; }

/* 選択・ホバー・フォーカス */
.btn-check:checked + .tile{
  color:#fff; background: var(--tile-active);
  border-color: var(--tile-active);
  box-shadow: 0 2px 10px rgba(13,110,253,.25);
}
.tile:hover{ border-color:#bfc5ce; }
.btn-check:focus + .tile,
.tile:focus-visible{
  outline: 3px solid rgba(13,110,253,.35);
  outline-offset: 2px;
}

/* タブの土台：下線 */
.tab-rail{
  border-bottom: 2px solid #dee2e6; /* Bootstrapの境界色に合わせる */
}

/* タブ本体：上だけ角丸・下は線に乗せる */
.tab-btn{
  appearance: none;
  border: 1px solid #dee2e6;
  border-bottom: none;                /* 下側は線に乗せる */
  border-radius: .5rem .5rem 0 0;     /* 上だけ角丸 */
  background: #f8f9fa;
  color: #212529;
  padding: .6rem 1.2rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: color .15s, background-color .15s, border-color .15s, box-shadow .15s;
}

/* 均等に並べる（6学年が1行で収まるよう幅を抑える） */
.tab-btn {
  flex: 1 1 0;
  min-width: 3.5rem;
  max-width: 8rem;
  padding: .5rem .4rem;
  font-size: 0.9rem;
  text-align: center;
}

/* ホバー／フォーカス */
.tab-btn:hover{ background:#fff; }
.tab-btn:focus-visible{
  outline: 0;
  box-shadow: 0 0 0 .2rem rgba(13,110,253,.25); /* bs-primary */
}

/* 選択状態：色強調＆下線と密着させる */
.tab-btn.active{
  background: #fff;
  border-color: var(--bs-primary);
  color: var(--bs-primary);
  margin-bottom: -2px; /* .tab-rail の下線（2px）に食い込ませる */
}

/* タブを折り返さず1行に収める */
.tab-rail {
  flex-wrap: nowrap;
}

/* スマホ幅でも6つ並べる（さらに詰める） */
@media (max-width: 575.98px){
  .tab-btn { min-width: 2.75rem; padding: .4rem .25rem; font-size: 0.8rem; }
  .tab-rail > .flex-grow-1{ display:none !important; }
}
