/* Web Patio - shared stylesheet
   Phase 1: visual preservation, responsive safeguards and navigation.
   Legacy presentational attributes remain temporarily as a fallback. */

/* 基本カラー */
:root {
  color-scheme: light;
  --patio-bg: #F0F0F0;
  --patio-text: #000000;
  --patio-link: #0000FF;
  --patio-visited: #800080;
  --patio-hover: #DD0000;
  --patio-accent: #8080C0;
}

/* 基本設定 */
html {
  box-sizing: border-box;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

*, *::before, *::after {
  box-sizing: inherit;
}

body {
  margin: 8px;
  background-color: var(--patio-bg);
  color: var(--patio-text);
  font-family: "MS UI Gothic", Osaka, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a:link { color: var(--patio-link); }
a:visited { color: var(--patio-visited); }
a:hover,
a:focus-visible { color: var(--patio-hover); }

a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

table { max-width: 100%; }
th, td { font-family: inherit; }

.num {
  font-size: 12px;
  font-family: Verdana, Helvetica, Arial, sans-serif;
}

.s1 {
  font-size: 10px;
  font-family: Verdana, Helvetica, Arial, sans-serif;
}

.s2 {
  font-size: 10px;
  font-family: "MS UI Gothic", Osaka, sans-serif;
}

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

input, select, textarea, button {
  max-width: 100%;
  font: inherit;
}

textarea { vertical-align: top; }

/* スレッド一覧：アイコン列とアイコン画像のサイズを確保 */
.topic-list th:first-child,
.topic-list td:first-child {
  width: 26px;
  min-width: 26px;
  text-align: center;
  vertical-align: middle;
}

.topic-list th:first-child img,
.topic-list td:first-child img {
  display: inline-block;
  width: 16px;
  height: 16px;
  max-width: none;
  object-fit: contain;
  vertical-align: middle;
}

/* ページ送り・下部ナビゲーション：PC表示 */
.patio-pagination {
  margin: 14px auto;
  width: 95%;
}

.patio-pagination .page-prev,
.patio-pagination .page-next {
  display: none;
}

.patio-bottom-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
  width: 95%;
  margin: 22px auto 16px;
}

.patio-bottom-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 18px;
  border: 1px solid var(--patio-accent);
  border-radius: 3px;
  background: #FFFFFF;
  color: #0000AA;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}

.patio-bottom-nav a:hover {
  background: var(--patio-accent);
  color: #FFFFFF;
}

/* スマートフォン向け */
@media (max-width: 640px) {
  body {
    margin: 6px;
    font-size: 14px;
  }

  table { max-width: 100%; }

  td, th {
    overflow-wrap: anywhere;
  }

  /* スレッド一覧：タイトルの幅を優先 */
  .topic-list {
    width: 100%;
    table-layout: auto;
  }

  .topic-list th:first-child,
  .topic-list td:first-child {
    width: 26px;
    min-width: 26px;
  }

  .topic-list td:nth-child(2) {
    width: auto;
    overflow-wrap: break-word;
  }

  /* 作成者列を非表示 */
  .topic-list th:nth-child(3),
  .topic-list td:nth-child(3) {
    display: none;
  }

  /* 返信・参照列 */
  .topic-list th:nth-child(4),
  .topic-list td:nth-child(4) {
    width: 32px;
  }

  .topic-list th:nth-child(5),
  .topic-list td:nth-child(5) {
    width: 42px;
  }

  /* 最終更新列と投稿者名 */
  .topic-list th:nth-child(6),
  .topic-list td:nth-child(6) {
    width: 90px;
  }

  .topic-list td:nth-child(6) .s2 {
    display: none;
  }

  /* ページ送り：タップしやすい番号ボタン */
  .patio-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 95%;
    margin: 18px auto;
    font-size: 14px;
  }

  .patio-pagination .pagination-label,
  .patio-pagination .pagination-bracket {
    display: none;
  }

  .patio-pagination a,
  .patio-pagination .page-current {
    display: inline-flex;
    min-width: 44px;
    min-height: 44px;
    padding: 0 10px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--patio-accent);
    border-radius: 3px;
    background: #FFFFFF;
    color: var(--patio-link);
    text-decoration: none;
    box-sizing: border-box;
    font-weight: normal;
  }

  .patio-pagination .page-current {
    background: var(--patio-accent);
    color: #FFFFFF;
    font-weight: bold;
  }

  .patio-pagination .page-prev,
  .patio-pagination .page-next {
    display: inline-flex;
    padding: 0 12px;
  }

  /* 下部共通ナビゲーション：スマホ表示 */
  .patio-bottom-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 95%;
    margin: 24px auto 14px;
  }

  .patio-bottom-nav a {
    display: flex;
    min-height: 46px;
    padding: 10px 14px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--patio-accent);
    border-radius: 3px;
    background: #FFFFFF;
    color: var(--patio-link);
    text-align: center;
    text-decoration: none;
    box-sizing: border-box;
  }

  .patio-bottom-nav a:active {
    background: #EEEEF8;
  }
}
/* Web Patio palette: exact colors from init.cgi; background colors only */
:root {
  --patio-col1: #8080C0;
  --patio-col2: #FFFFFF;
  --patio-col3: #DCDCED;
}

.patio-bg-col1 { background-color: var(--patio-col1); }
.patio-bg-col2 { background-color: var(--patio-col2); }
.patio-bg-col3 { background-color: var(--patio-col3); }
