@charset "UTF-8";

:root{
  --border: rgba(0,0,0,.10);
  --muted: rgba(0,0,0,.55);
  --card: #fff;
}

.topic-main{
  gap: 12px;
}

.topic-title{
  font-size: 22px;
  font-weight: 900;
  text-align: center;
  margin: 6px 0 2px;
}

.topic-nav{
  display:grid;
  grid-template-columns: 1fr auto 1fr;
  align-items:center;
  gap: 10px;
  margin: 2px 0 10px;
}

.nav-btn{
  width: 100%;
  border: 0;
  background: transparent;
  color: #6a2cff;
  font-weight: 800;
  font-size: 14px;
  padding: 8px 6px;
}

.topic-base{
  font-weight: 900;
  letter-spacing: .02em;
  color: #111;
  text-align:center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,.04);
  min-width: 130px;
}

.topic-card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 10px 24px rgba(0,0,0,.08);
}

.topic-card h2{
  margin: 10px 0 8px;
  font-size: 18px;
}

.topic-card h3{
  margin: 12px 0 6px;
  font-size: 16px;
}

.topic-card p{
  line-height: 1.8;
  margin: 8px 0;
}

.topic-card ul{
  padding-left: 18px;
  margin: 8px 0 12px;
}

.topic-card table{
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 14px;
}

.topic-card th,
.topic-card td{
  border: 1px solid rgba(0,0,0,.12);
  padding: 10px;
  vertical-align: top;
}

.topic-card th{
  background: rgba(0,0,0,.04);
  font-weight: 900;
}

.topic-empty h2{
  font-size: 18px;
  margin-bottom: 6px;
}
.topic-empty p{
  color: var(--muted);
}

/* --- topic meta / image / separators --- */
.topic-meta{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 14px;
  background: rgba(0,0,0,.03);
}

.topic-meta .badge{
  font-weight: 900;
  font-size: 14px;
}

.topic-meta .date{
  font-weight: 800;
  font-size: 13px;
  opacity: .7;
  white-space: nowrap;
}

.topic-img{
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.12);
  float: right;
  margin: 6px 0 10px 10px;
}

.topic-table{
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 14px;
}
.topic-table th, .topic-table td{
  border: 1px solid rgba(0,0,0,.12);
  padding: 10px;
  vertical-align: top;
}
.topic-table th{
  background: rgba(0,0,0,.04);
  font-weight: 900;
}

.topic-sep{
  border: 0;
  height: 1px;
  background: rgba(0,0,0,.10);
  margin: 18px 0;
  clear: both;
}

/* 本命星へ飛んだ時、固定ヘッダーに隠れないように */
.topic-card h2[id]{
  scroll-margin-top: 88px; /* ヘッダー高さに合わせて微調整（72〜96pxくらいで） */
}

/* ジャンプした見出しを一瞬だけ強調 */
.topic-focus{
  position: relative;
  border-radius: 10px;
  padding: 6px 10px;
  margin-left: -10px;
  margin-right: -10px;
  animation: topicFocus 1.6s ease-out;
}

@keyframes topicFocus{
  0%   { background: rgba(255, 215, 0, 0.35); }
  60%  { background: rgba(255, 215, 0, 0.18); }
  100% { background: transparent; }
}

/* ===== topic: header崩れ予防 ===== */
.pwa-header .back-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  text-decoration:none;
  background: rgba(0,0,0,.04);
}

/* ===== 右下固定の切替ボタン ===== */
.topic-switch{
  position: fixed;
  right: 14px;
  bottom: calc(var(--footer-h) + 14px);
  z-index: 10001;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 12px 14px;
  border-radius: 999px;

  background: rgba(106, 44, 255, .88); /* 優しい紫 */
  color: rgba(255,255,255,.96);

  text-decoration: none;
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
}

.topic-switch:active{ transform: translateY(1px); }

/* スマホでfloat画像が潰れないように */
@media (max-width: 420px){
  .topic-img{
    width: 120px;
    height: 120px;
  }
}