/* public/styles/manuscripts-ranking.css */

html, body {
  height: 100%;
  overflow: hidden;     /* 既存 */
  overflow-x: hidden;   /* ✅ 横スクロールを完全に殺す */
}

.screen {
  position: fixed;
  inset: 0;
  background: #fff;
  overflow-x: hidden;   /* ✅ 念のため */
}

#logicView {
  position: absolute;
  width: 430px;
  height: 932px;
  overflow: hidden;     /* ✅ ここで外側のはみ出しを抑える */
  overflow-x: hidden;

  background: url("../img/background.png") no-repeat center top;
  background-size: cover;

  display: flex;
  flex-direction: column;

  border: 1px solid #cfd8e3;
  border-radius: 28px;
}

.hero {
  position: relative;
  width: 100%;
  height: 160px;
  overflow: visible;
}
.hero-img {
  width: 100%;
  height: 100%;
  background-image: url("/img/sityuboheader.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.logo {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
  height: 80px;
  background-image: url("/img/logo.png");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  z-index: 2;
  pointer-events: none;
}

.main-content {
  padding: 14px 16px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

/* 月タブ */
.month-tabs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.month-tabs::-webkit-scrollbar { display: none; }

.month-tab {
  flex: 0 0 auto;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.12);
  background: rgba(255,255,255,0.86);
  font-weight: 900;
  font-size: 13px;
  color: #1f2430;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform .08s ease, filter .12s ease;
}
.month-tab:active { transform: translateY(1px) scale(0.995); }
.month-tab:focus-visible { outline: 3px solid rgba(37,99,235,.35); outline-offset: 2px; }

.month-tab[aria-selected="true"]{
  border-color: rgba(37,99,235,.35);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(240,248,255,0.92));
  box-shadow: 0 10px 22px rgba(0,0,0,0.10), inset 0 1px 0 rgba(255,255,255,0.85);
}

.section-title {
  margin: 2px 0 0;
  font-weight: 900;
  font-size: 16px;
  color: #1f2430;
  text-shadow: 0 1px 0 rgba(255,255,255,0.7);
}

/* TOP3：縦並び */
.podium {
  display: grid;
  gap: 12px;

  overflow: auto;
  padding: 6px 2px 14px;
  min-height: 0;

  overscroll-behavior: contain; /* ついで：変な引っ張りを抑える */
}

/* カード（共通） */
.podium-card {
  width: 100%;
  border-radius: 18px;
  border: 1px solid rgba(0,0,0,0.12);
  background: rgba(255,255,255,0.78);
  box-shadow: 0 14px 28px rgba(0,0,0,0.12);
  padding: 14px 12px 12px;
  position: relative;
  display: grid;
  gap: 8px;
}

/* 丸（順位） */
.medal{
  position: absolute;
  top: 12px;
  left: 12px;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: #fff;
  border: 2px solid rgba(255,255,255,0.85);
  box-shadow: 0 10px 18px rgba(0,0,0,0.18);
  z-index: 2;
}
.medal.gold   { background: linear-gradient(180deg, #ffd86a, #f5b400); }
.medal.silver { background: linear-gradient(180deg, #cfd7df, #9aa6b2); }
.medal.bronze { background: linear-gradient(180deg, #f1b08b, #c47a4c); }

/* タイトル/メタ（丸と被らない） */
.podium-title{
  font-weight: 900;
  font-size: 15px;
  color: #1f2430;
  line-height: 1.35;

  padding-left: 52px;
  min-height: 40px;

  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
}
.podium-meta{
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: rgba(31,36,48,0.86);
  padding-left: 52px;
}
.podium-meta span{
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ボタン（共通） */
.podium-button{
  margin-top: 4px;
  width: 100%;
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(37,99,235,.25);
  background: linear-gradient(180deg, rgba(37,99,235,.95), rgba(37,99,235,.80));
  color: #fff;
  font-weight: 900;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.podium-button:active{ transform: translateY(1px) scale(0.995); }
.podium-button:focus-visible{ outline: 3px solid rgba(37,99,235,.35); outline-offset: 2px; }

.podium-empty {
  padding: 14px 6px;
  text-align: center;
  color: #536579;
}

/* =========================================================
   ✅ 1位だけ特別枠（派手な装飾）
   ========================================================= */
.podium-card:first-child{
  border: 2px solid rgba(245, 180, 0, 0.75);
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 216, 106, 0.35), rgba(255,255,255,0) 55%),
    radial-gradient(circle at 85% 25%, rgba(255, 240, 190, 0.35), rgba(255,255,255,0) 55%),
    rgba(255,255,255,0.86);
  box-shadow:
    0 18px 40px rgba(0,0,0,0.18),
    0 0 0 4px rgba(255, 216, 106, 0.18);
  transform: translateZ(0);

  overflow: hidden; /* ✅ 重要：疑似要素のはみ出しをカード内でクリップ */
}

/* 1位：薄いラメ（ドット） */
.podium-card:first-child::before{
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
  pointer-events: none;
  background-image: radial-gradient(rgba(255, 216, 106, 0.22) 1px, transparent 1.2px);
  background-size: 10px 10px;
  opacity: 0.7;
}

/* 1位：斜めのキラッ（自然ループ版）
   - 最後は opacity 0 で待機 → 次ループへ
   - inset は 0 にしてカード外へ出さない
*/
.podium-card:first-child::after{
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
  pointer-events: none;

  background: linear-gradient(
    120deg,
    rgba(255,255,255,0) 44%,
    rgba(255,255,255,0.60) 50%,
    rgba(255,255,255,0) 56%
  );

  transform: translateX(-140%);
  opacity: 0;

  animation: shine 3.2s ease-in-out infinite;
  mix-blend-mode: screen;
}

/* ✅ ループ終端が不自然にならないように
   0-60% で通過 → 60-100% は opacity 0 で待機
*/
@keyframes shine{
  0%   { transform: translateX(-140%); opacity: 0; }
  10%  { opacity: 0.55; }
  55%  { transform: translateX(140%); opacity: 0.55; }
  60%  { transform: translateX(140%); opacity: 0; }
  100% { transform: translateX(140%); opacity: 0; }
}

/* 1位：タイトルを少し強調 */
.podium-card:first-child .podium-title{
  font-size: 16px;
  text-shadow: 0 1px 0 rgba(255,255,255,0.7);
}

/* 1位：メダルを少し大きく */
.podium-card:first-child .medal{
  width: 42px;
  height: 42px;
  top: 10px;
  left: 10px;
  box-shadow:
    0 14px 22px rgba(0,0,0,0.22),
    inset 0 2px 0 rgba(255,255,255,0.65);
}

/* 1位：ボタンもゴールド寄りに */
.podium-card:first-child .podium-button{
  border: 1px solid rgba(245, 180, 0, 0.45);
  background: linear-gradient(180deg, rgba(245, 180, 0, 0.98), rgba(221, 153, 0, 0.92));
  color: #1f2430;
  box-shadow: 0 10px 18px rgba(0,0,0,0.12);
}

/* 低モーション環境ではアニメ停止 */
@media (prefers-reduced-motion: reduce){
  .podium-card:first-child::after{ animation: none; opacity: 0; }
}

/* モーダル */
.modal.hidden{ display:none; }
.modal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  padding: 16px;
}
.modal-content{
  width: min(420px, 100%);
  max-height: min(700px, 86vh);
  overflow: hidden;
  background: rgba(255,255,255,0.97);
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.25);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  position: relative;
}
.close-button{
  position: absolute;
  right: 18px;
  top: 14px;
  font-size: 26px;
  font-weight: 900;
  cursor: pointer;
  user-select: none;
}
#manuscript-modal-title{
  margin: 0;
  padding-right: 34px;
  font-weight: 900;
  font-size: 16px;
}
.manuscript-body{
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 14px;
  background: #f8fafc;
  padding: 12px;
  overflow: auto;
  line-height: 1.7;
  white-space: pre-wrap;
  font-size: 14px;
  color: #1f2430;
}
.modal-footer{
  display:flex;
  justify-content:flex-end;
  gap: 10px;
}
.copy-button{
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 900;
  border: 1px solid rgba(0,0,0,0.12);
  background: #fff;
  color: #1f2430;
  cursor: pointer;
}
.copy-button:active{ transform: translateY(1px); }
.copy-button:disabled{
  opacity: .5;
  cursor: not-allowed;
}
.ok-button{
  border-radius: 999px;
  padding: 10px 28px;
  font-weight: 900;
  border: 1px solid rgba(0,0,0,0.12);
  background: rgba(97,146,181,0.95);
  color: #fff;
  cursor: pointer;
}
.ok-button:active{ transform: translateY(1px); }
