/* ==============================================
   事前ロード
=============================================== */


@font-face {
    font-family: 'ryusenkei';
    src: url(../font/02Ryusenkei-Regular.ttf);
}


/* ==============================================
   全ページ一律
=============================================== */


html{
    font-size: 16px;
    font-family: sans-serif;
    background-color: black;
    color: rgb(255, 255, 255);
    scroll-behavior: smooth;
}

/*親要素内の子要素の配置指定。要注意*/
*{
    box-sizing: border-box;
}

body{
    margin: 0;
    background: #000;
}

p, li, td{
    line-height: 1.7;
}

a:link{
    text-decoration: none;
    color: #8ee5ff;
}

a:visited{
    text-decoration: none;
    color: #00c3ff;
}

a:hover{
    text-decoration: underline;
}

a:active{
    color: #8ee5ff;
    text-decoration: underline;
}


/* ==============================================
   main一律
=============================================== */


main{
    margin: 40px 0;
    padding: 0 4%;
}

main h2{
    font-family: ryusenkei, sans-serif;
    border-bottom: 2px solid aquamarine;
    border-left: 2px solid aquamarine;
    padding: 5px 5px 10px 5px;
    color: aquamarine;
    line-height: 1.6rem;
    font-size: 1.3rem;
}

main h2 div{
    transition: .5s;
}

main h2 div::before{
    content: '> ';
}

main h3{
    color: aquamarine;
    border-bottom: 2px solid aquamarine;
}

main h3::before{
    content: '▶';
}

main .paragraph{
    margin: 40px 0;
    padding-left: 8px;
    border-left: 2px solid aquamarine;
}

/*iframe*/

iframe {
    max-width: 100%;
}


/* ==============================================
   footer一律
=============================================== */


/*権利表示*/
.copyright{
    font-family: ryusenkei, sans-serif;
    margin: 20px 0 0 0;
    padding: 40px 0 40px 0;
    background-color: rgb(28, 31, 52);
    text-align: center;
}


/* ==============================================
   math系統のページ一律
=============================================== */


.articles p::before{
    content: '・';
}

.proof{
    color: rgb(255, 255, 255);
    background-color: #194340; 
    text-align: center;
}

.whitebox{
    border: 1px solid #FFF;
    padding: 1em; 
    line-height: 1.8em;
}

.minitext{
    font-size: 0.8rem;
}


/* ==============================================
   東大理系数学の解剖：index
=============================================== */


/*=================problemtable=================*/

#pthead td{
    text-align: center;
    font-size: 1.2em;
    font-weight: 500;
    background-color: #0e0067;
}

.problemtable-container{
    overflow-x: auto;
    min-height: 1em;
    -webkit-overflow-scrolling: touch;
}

.problemtable{
    border-collapse: collapse;
    width: max-content;
}

.problemtable th, .problemtable td{
    border: 2px solid #FFFFFF;
    padding: 10px;
    word-break: break-all;
}

.problemtable th{
    width: 100px;
    text-align: left;
    vertical-align: middle;
}

.problemtable td{
    width: 100px;
    height: 80px;
    padding: 0;
    font-size: 1rem;
    text-align: center;
}

.problemtable td img{
    width: 70px;
    transition: 0.2s;
}


.problemtable td img:hover{
    width: 80px;
    transition: 0.2s;
}

.problemtable td:has(img.fi){
    border: solid 5px #ffc20b;
}

.problemtable-exp{
  text-align: center;
  opacity: 0;
}

.shadowbox{
  height: 1px;
}

@media (max-width: 1200px) {
    .problemtable-exp{
      opacity: 1;
    }
    #problemtable-shadow1{
      height: 2339px;
      width: 5%;
      left: 95%;
      position: relative;
      background: linear-gradient(to left,rgb(0, 0, 1,0.7),rgba(0,0,0,0));
      z-index: 998;
      pointer-events: none;
    }
    #problemtable-shadow2{
      height: 2339px;
      width: 5%;
      position: relative;
      background: linear-gradient(to right,rgb(0, 0, 1,0.7),rgba(0,0,0,0));
      z-index: 998;
      pointer-events: none;
    }
}


/*=================工事中マーク=================*/

.problemtable a:not(:has(img.fi)) img {
  opacity: 0.5;
}

.problemtable a:not(:has(img.fi)) {
  position: relative;
}

.problemtable a:not(:has(img.fi))::after {
  content: "工事中";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  font-size: 0.75em;
  padding: 4px 6px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.problemtable a:not(:has(img.fi)):hover::after {
  opacity: 1;
}

/*=================大数評価=================*/

.problemtable td {
  position: relative; /* ラベルをセル右下に固定するため */
}

/* 共通ラベル */
.diff-label {
  position: absolute;
  bottom: 4px;
  right: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  color: white;
  padding: 1px 4px;
  border-radius: 2px;
  pointer-events: none; /* クリックを妨げない */
  box-shadow: 0 1px 2px rgba(0,0,0,0.6);
  background: rgba(0,0,0,0.6); /* デフォルト色（上書き可能） */
  opacity: 0.7;
}

/* 色分け */
.diff-A { background: rgba(46, 204, 113, 0.85); }   /* 緑 (A) */
.diff-B { background: rgba(52, 152, 219, 0.85); }   /* 青 (B) */
.diff-C { background: rgba(241, 196, 15, 0.85); }   /* 黄 (C) */
.diff-D { background: rgba(231, 76, 60, 0.85); }    /* 赤 (D) */

/* img.new を含む a を基準にする */
.problemtable a:has(img.new) {
  position: relative;
  display: inline-block;
}

/*=================新着記事バッジ=================*/

.problemtable a:has(img.new)::after {
  content: "新着";
  position: absolute;
  top: -4px;
  right: -6px;
  background: #e53935;
  color: #fff;
  font-size: 0.7em;
  padding: 2px 6px;
  border-radius: 6px;
  line-height: 1;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0.8;
  animation: newarticlemotion 1s infinite;
}

@keyframes newarticlemotion{
    0%{
        transform: scale(1);
    }
    50%{
        transform: scale(1.1);
    }
}

/*=================解答例ありバッジ=================*/

/* img.new を含む a を基準にする */
.problemtable a:has(img.ans) {
  position: relative;
  display: inline-block;
}

.problemtable a:has(img.ans)::before {
  content: "解答例あり";
  position: absolute;
  bottom: -4px;
  left: -10px;
  background: #354fe5;
  color: #fff;
  font-size: 0.7em;
  padding: 2px 6px;
  border-radius: 6px;
  line-height: 1;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0.8;
}


/* ==============================================
   東大理系数学の解剖：各解説ページ
=============================================== */


/*=================一覧に戻る=================*/

.gouts::before{
    color: #ffffff;
    background-color: #002b28;
    content: "◀ 一覧に戻る";
    border: 2px solid #194340;
    padding: 5px;
}


/*=================飛び出す解答=================*/

/* チェックボックスは非表示にする */
.toggle-box input {
  display: none;
}

/* ラベル（見出し） */
.toggle-label {
  font-size: 0.8em;
  display: block;
  background: rgb(0, 87, 58);
  padding: 6px;
  cursor: pointer;
  border: 1px solid #606060;
  user-select: none;
}

/* 中身（最初は非表示） */
.toggle-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: #aaaaaa;
  padding: 0 10px;
  border-left: 1px solid #ccc;
  border-right: 1px solid #ccc;
  border-bottom: 1px solid #ccc;
  color: black;
  text-align: center;
}

/* チェックが入ったら中身を表示 */
.toggle-box input:checked ~ .toggle-content {
  max-height: 300px; /* 十分大きい値にしておく */
  padding: 10px;
}

.toggle-box input:checked ~ .longanswer {
  max-height: 2000px;
  padding: 10px;
}

.longanswer img{
  max-width: 400px!important;
}

/*=================emphbox(青box)=================*/

.emphbox {
    border: 2px solid #FFF;
    border-radius: 6px;
    padding: 1em;
    background-color: #191c43;
    font-size: 0.85em;
}

.emphbox img{
    max-width: 100%;
    height: auto;
}


/*=================problist(赤box)=================*/

.problist {
    display: grid;
    gap: 10px;                    /* ブロック同士の間隔 */
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    padding: 10px;
    background-color: rgb(40, 0, 0);
    border-radius: 5px;
    box-sizing: border-box;       /* これ重要 */
}

/* スマホ幅はもっと下限を下げる */
@media (max-width: 480px) {
    .problist {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }
}

.problist > .autof {
    max-width: 100%;
    font-size: 0.85em;
    background: rgba(119, 70, 70, 0.26);
    padding: 10px;
    border-radius: 6px;
}



/*=================右サイドナビ=================*/

#side-toggle {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 1000;
  font-size: 20px;
  padding: 8px 12px;
  background: #002b28;
  color: #fff;
  border: 2px solid aquamarine;
  cursor: pointer;
  display: none;
}

#side-nav {
  position: fixed;
  top: 0;
  right: 0;
  width: 260px;
  height: 100%;
  background: #0a0a0a;
  border-left: 2px solid aquamarine;
  padding: 12px;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 999;
  overflow-y: auto;
}

#side-nav.open {
  transform: translateX(0);
}

#side-close {
  background: none;
  border: none;
  color: aquamarine;
  font-size: 22px;
  cursor: pointer;
  margin-bottom: 12px;
}

#side-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

#side-nav li {
  margin-bottom: 8px;
}

#side-nav a {
  color: #aaa;
  font-size: 0.9rem;
  text-decoration: none;
  line-height: 1.4;
}

#side-nav a.active {
  color: aquamarine;
  font-weight: bold;
}

/* ===== PC表示（常時表示） ===== */
@media (min-width: 1000px) {
  #side-toggle {
    display: none;
  }

  #side-nav {
    transform: translateX(0);
  }

  main {
    margin-right: 280px;
  }
}

/* ===== モバイル表示 ===== */
@media (max-width: 999px) {
  #side-toggle {
    display: block;
  }
}

/* ===== 問題番号バッジ ===== */
#problem-badge {
  color: aquamarine;
  font-weight: bold;
  font-size: 1.1rem;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid aquamarine;
  display: none;
}

/*=================サイドバーの暗幕=================*/

#side-overlay {
  position: fixed;
  inset: 0; /* top/right/bottom/left: 0; の省略形 */
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 998;
}

/* サイドバーが開いている時だけ表示 */
#side-overlay.show {
  opacity: 1;
  pointer-events: auto;
}



/*=================上に戻る=================*/

.go-top-float {
  position: fixed;
  right: 20px;
  bottom: 80px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #002b28;
  border: 2px solid aquamarine;
  color: aquamarine;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  opacity: 0;
  pointer-events: none;
  transition: 0.3s;
  z-index: 999;
}

.go-top-float.show {
  opacity: 1;
  pointer-events: auto;
}

.go-top-float:hover {
  box-shadow: 0 0 12px aquamarine;
  transform: translateY(-4px);
}


/*=================画像拡大モーダル=================*/
#img-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 9999;
}

#img-modal img {
  position: absolute;
  inset: 0;
  margin: auto;
  max-width: 90%;
  max-height: 90%;
  cursor: zoom-out;
}

/* クリックできることを示す */
.clickable-img {
  cursor: zoom-in;
  width: 100%;
  border: 4px solid #02075c;
}


/*=================ブックマークボタン=================*/

.bookmark-box {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  padding-left: 10px;
  width: 100%;
  height: 3em;
  background-color: #003586;
  border-radius: 4px;
}

#bookmark-btn {
  font-size: 2.3em;
  background: none;
  border: none;
  cursor: pointer;
  color: #888;
  transition: 0.2s;
  translate: 0 -2px;
}

#bookmark-btn.bookmarked {
  color: rgb(58, 209, 255);
}

#bookmark-btn:hover {
  transform: scale(1.1);
  transition: 0.2s;
}


/*=================ブックマーク一覧=================*/

#bookmarks {
  margin-top: 40px;
  border: solid aquamarine 1px;
  padding: 6px;
  border-radius: 6px;
}

#bookmark-list {
  list-style: none;
  padding: 0;
  border: solid #FFF 2px;
}

#bookmark-list li {
  margin: 0;
  border: solid #FFF 2px;
  padding: 1em 1em;
  background-color: #101e1a;
}

#bookmark-list li::before {
  content: "■ ";
}


/*=================カウントダウンタイマー=================*/

#countdown{
  margin-top: 1em;
  padding: 1em;
  text-align: center;
  font-weight: bold;
  color: yellow;
  border: solid 2px #ffffff;
  background-color: #191c43;
  border-radius: 6px;
}