@charset "UTF-8";

/* =======================================
   Freematch 個人杯トーナメントページ専用CSS
   main.css / freematch.css トーン統一版
======================================= */

.inner.white-bg {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  color: var(--text);
  max-width: 1000px;
  margin: auto;
}

/* --- タイトル・説明カード --- */
.thread-info {
  margin-bottom: 24px;
  max-width: 900px;
  margin-inline: auto;
}

.thread-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  border-left: 4px solid var(--accent);
  padding-left: 8px;
  margin-bottom: 12px;
}

.thread-content {
  background: color-mix(in srgb, var(--accent) 6%, var(--bg-elev));
  border-radius: var(--radius);
  padding: 12px 16px;
  border: 1px solid var(--border);
  color: var(--text);
}

/* --- トグル切替（トーナメント / 総当たり） --- */
.switch-buttons {
  display: flex;
  justify-content: center;
  margin: 1.5em 0;
  gap: 8px;
  max-width: 600px;
  margin-inline: auto;
}

.switch-buttons label {
  flex: 1;
  text-align: center;
  border-radius: 8px;
  overflow: hidden;
}

.switch-buttons a {
  display: block;
  padding: 10px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--bg-elev);
  transition: all 0.2s ease;
}

.switch-buttons input[type="radio"]:checked+a {
  background: color-mix(in srgb, var(--accent) 18%, var(--bg-elev));
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 0 8px rgba(68, 214, 44, 0.3);
}

.switch-buttons a:hover {
  border-color: var(--accent);
}
.switch-buttons input[type="radio"] {
  display: none;
}

/* --- 参加者フォーム --- */
.entry-grid {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 10px 20px;
  margin: 20px auto;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  max-width: 600px;
}

.entry-label {
  font-weight: bold;
  text-align: center;
  border-bottom: 2px solid var(--accent);
  color: var(--text);
  padding-bottom: 4px;
}

#players input.player_name,
#player_count {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
}

/* --- トーナメント生成ボタン --- */
.controls {
  text-align: center;
  margin: 24px 0;
}

.button,
#screenshot-button {
  display: inline-block;
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 10px 20px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
}

.button:hover,
#screenshot-button:hover {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  box-shadow: 0 0 12px rgba(68, 214, 44, 0.3);
  transform: translateY(-1px);
}

.delete-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.delete-link:hover {
  text-decoration: underline;
}

hr {
  border: 0;
  /* デフォルトのボーダーを無効に */
  border-top: 2px solid var(--accent-color);
  /* 上部に太い線を追加 */
  margin: 20px 0;
  /* 上下にマージンを追加 */
}

/* タブのスタイル */
.tabs {
  display: flex;
  border-bottom: 2px solid #ccc;
}

.tab {
  padding: 10px 20px;
  cursor: pointer;
  background-color: var(--main-bg-color);
  border: 1px solid #ccc;
  border-bottom: none;
  color: var(--main-text-color);
}

.tab.active {
  background-color: var(--secondary-bg-color);
  font-weight: bold;
  color: var(--secondary-text-color);
}

.tab-container {
  display: none;
}

.tab-container.active {
  display: block;
}

/* スレッド一覧のスタイル */
/* スレッドリスト */
.index-thread-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* 各スレッド項目 */
.index-thread-item {
  display: flex;
  background-color: var(--main-bg-color);
  padding: 15px;
  margin-bottom: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  align-items: center;
  /* 中央揃え */
  gap: 15px;
  /* 項目間に間隔を追加 */
  border: 1px solid var(--accent-color);
  position: relative;
  /* カテゴリを枠上に表示するために相対位置にする */
}

.index-thread-item a {
  display: block;
  /* リストアイテム全体をリンクとして表示 */
  width: 100%;
  /* リストアイテム全体をリンク対象に */
  color: inherit;
  /* リンクの色を親要素に合わせる */
  text-decoration: none;
  /* リンク下線を消す */
}

.index-thread-item:hover {
  background-color: var(--accent-color);
}

.index-thread-item:hover h2 a {
  color: white;
}


/* カテゴリ */
.index-thread-category {
  font-weight: bold;
  color: var(--accent-color);
  position: absolute;
  /* 絶対位置 */
  top: -10px;
  /* 枠の上に配置 */
  right: 15px;
  /* 左から10px */
  background-color: var(--main-bg-color);
  /* 背景色をアイテムの背景色に合わせる */
  padding: 5px 10px;
  border-radius: 5px;
  border: 1px solid var(--accent-color);
  /* 枠線を追加 */
  font-size: 0.9em;
}

.index-thread-expirydate {
  font-weight: bold;
  color: var(--accent-color);
  position: absolute;
  /* 絶対位置 */
  top: -10px;
  /* 枠の上に配置 */
  left: 15px;
  /* 左から10px */
  background-color: var(--main-bg-color);
  /* 背景色をアイテムの背景色に合わせる */
  padding: 5px 10px;
  border-radius: 5px;
  border: 1px solid var(--accent-color);
  /* 枠線を追加 */
  font-size: 0.9em;
}


/* 画像 */
/* 親に固定サイズを与える */
.index-thread-image {
  max-width: 100px;
  height: 100px;
  overflow: hidden;
  border-radius: 8px;
}

/* 画像を枠にフィットさせる */
.index-thread-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}



.baseinput {
  width: 150px;
  height: 30px;
  color: black;
  background: lightgray;
  border: none
}

/* --- コメント一覧 --- */
.comment-list {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: 800px;
}

.comment-item {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.comment-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 10px rgba(68, 214, 44, 0.25);
}

.comment-media {
  display: block;
  max-width: 40%;
  margin-top: 10px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}


/* トーナメント表 */

.freecontainer {
  position: relative;
  width: auto;
  margin: 20px auto;
}

.controls {
  text-align: center;
  margin-bottom: 30px;
}

select,
button {
  font-size: 16px;
}

.tournament {
  display: flex;
  justify-content: space-between;
  position: relative;
}

.round {
  display: grid;
  position: relative;
  gap: 10px;
}

.match {
  width: 100px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  position: relative;
  margin: auto 0;
}

.hidden {
  visibility: hidden;
}

input,
select {
  width: 100%;
  height: 100%;
  font-size: 14px;
  text-align: center;
  color: black;
  margin-right: 0px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
}

.player_name {
  height: auto;
  width: 100%;
  max-width: 150px;
  font-size: 16px;
  color: black;
}

/* トーナメント内の線描画用SVGだけに適用 */
.freecontainer svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}



line {
  stroke: #333;
  stroke-width: 2;
}

line.active {
  stroke: red;
  stroke-width: 3;
}


.bye-label {
  position: absolute;
  font-size: 10px;
  color: white;
  pointer-events: none;
}

.bye {
  background-color: #999;
  color: #999;
  pointer-events: none;
  border: 1px solid #ccc;
  opacity: 1 !important;
}



@media only screen and (max-width: 768px) {
  .freecontainer {
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    padding-bottom: 20px;
  }


  .match {
    width: 80px;
    height: 26px;
  }

  input,
  select {
    font-size: 12px;
    padding: 2px;
  }

  svg {
    min-width: 500px;
  }
}

/* 総当たり表 */
.league-table {
  border-collapse: collapse;
  margin: 20px auto;
  width: 100%;
  table-layout: fixed;
  font-size: clamp(10px, 2.5vw, 14px);
  /* 画面に応じて文字縮小 */
}

.league-table th,
.league-table td {
  border: 1px solid #ccc;
  padding: 0.4em;
  text-align: center;
  height: 48px;
  font-size: inherit;
  word-break: break-word;
  white-space: normal;
  /* 折り返し有効に */
  line-height: 1.2;
}

.league-table th {
  background-color: #f7f7f7;
  font-weight: bold;
}

.league-cell {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease;
}

.league-cell:hover {
  background-color: #eef;
}


/* challenger（挑戦者求ム）*/
.challenger_card {
  display: flex;
  background-color: var(--main-bg-color);
  border: 1px solid var(--accent-color);
  border-radius: 10px;
  padding: 16px;
  margin: 20px 0;
  color: var(--main-text-color);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  gap: 20px;
  position: relative;
  /* 作成日時を右上に配置するために親要素を相対位置に */
}

/* 左：画像 */
.challenger_image {
  width: 120px;
  height: 120px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.challenger_image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

/* 右：テキスト情報全体 */
.challenger_text {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* 各情報ブロックの調整 */
.challenger_header_info,
.challenger_bottom_info {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-bottom: 10px;
}

/* ラベル付きの情報項目 */
.challenger_item {
  margin-bottom: 6px;
}

.challenger_label {
  font-weight: bold;
  color: var(--accent-color);
  margin-right: 6px;
}

.challenger_content {
  margin: 4px 0 0 0;
  color: var(--third-text-color);
  white-space: pre-wrap;
}

/* 作成日時を右上に配置 */
.challenger_created_at {
  position: absolute;
  top: -10px;
  right: 16px;
  font-size: 0.9em;
  color: var(--third-text-color);
  background-color: var(--main-bg-color);
  border: 1px solid var(--accent-color);
  padding: 3px;
}

@media screen and (max-width: 600px) {
  .challenger_card {
    font-size: 1.5rem;
  }
}

.copy-button {
  background-color: var(--accent-color);
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
  margin-left: 10px;
}

.copy-button:hover {
  background-color: var(--main-bg-color);
  color: var(--main-text-color);
  border: 1px solid var(--accent-color);
}


/* 画像UI */
.file-upload {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 10px;
  border: 2px dashed #ccc;
  border-radius: 10px;
  text-align: center;
  width: 200px;
  transition: all 0.3s;
}

.file-upload:hover {
  background-color: #f0f0f0;
}

.file-upload i {
  font-size: 24px;
  color: #555;
}

.file-upload span {
  font-size: 14px;
  color: #555;
}

#fileInput {
  display: none;
}

.a-button {
  border: 1px solid var(--accent-color);
  padding: 5px 10px;
  background-color: var(--accent-color);
  border-radius: 5px;
  font-weight: bold;
  color: white;
  position: absolute;
  bottom: -10px;
  right: 15px;
  font-size: 0.9em;
}

/* recaptchaスタイル */
.g-recaptcha {
  display: flex;
  justify-content: center;
  margin: 20px 0;
}

/* SNS */
.x-share-fixed {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 4px;
  z-index: 400;
  background-color: #fff;
  border: 1px solid var(--accent-color);
  border-radius: 8px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

@media screen and (max-width: 600px) {
  .x-share-fixed {
    bottom: 90px;
  }
}

.x-share-fixed img {
  width: 25px;
  height: auto;
  vertical-align: middle;
}


/* タイトル＋Xボタンの行レイアウト */
.thread-header {
    display: flex;
    align-items: center;
    justify-content: space-between;  /* PC時：ボタン右寄せ */
    gap: 12px;
    margin-bottom: 10px;
}

.thread-title {
    margin: 0;
    font-size: 18px; /* ここはお好みで */
}

/* Xシェアボタン（小さめ） */
.btn-xpost {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;          /* 小さめ */
    font-size: 12px;            /* 小さめ */
    font-weight: 600;
    border: 1px solid var(--accent);
    border-radius: 999px;       /* ピル型で控えめ */
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 8%, transparent);
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    text-decoration: none;
    white-space: nowrap;        /* 1行に収める */
}

.btn-xpost svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.btn-xpost:hover {
    background: color-mix(in srgb, var(--accent) 16%, transparent);
    box-shadow: 0 0 8px rgba(68, 214, 44, 0.25);
    transform: translateY(-1px);
}

.btn-xpost:active {
    transform: translateY(0);
    box-shadow: 0 0 4px rgba(68, 214, 44, 0.2) inset;
}

/* スマホでは縦並び＆中央寄せ */
@media (max-width: 560px) {
    .thread-header {
        flex-direction: column;
        align-items: center; /* タイトル・ボタンどちらも中央 */
        text-align: center;
        gap: 6px;
    }

    .thread-title {
        font-size: 17px; /* 少しだけ小さくてもOK */
    }

    .btn-xpost {
        margin-top: 2px;
        font-size: 13px;   /* ちょい大きくしてタップしやすく */
        padding: 6px 12px;
    }

    .btn-xpost svg {
      min-width: 20px;
    }
}
