/* =========================================
   基本リセット・横はみ出し（横揺れ）完全防止
========================================= */
*, *::before, *::after {
  box-sizing: border-box !important;
  max-width: 100% !important;
}

html, body {
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  height: 100vh;
  height: 100dvh; /* スマホのアドレスバー対策 */
  overflow: hidden !important; /* 全体の不要なスクロールを完全に停止 */
  background-color: #ffffff;
}

body {
  margin: 0 auto !important;
  max-width: 800px !important; /* デスクトップ最大幅 */
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
  word-break: break-all !important;
  overflow-wrap: break-word !important;
}

/* =========================================
   全画像・iframe要素の枠内収め
========================================= */
img, iframe, embed, object {
  max-width: 100% !important;
  height: auto !important;
  vertical-align: bottom;
  box-sizing: border-box !important;
}

iframe {
  width: 100% !important;
  border: none !important;
  display: block !important; /* 下部の微細な隙間を削除 */
  margin: 0 !important;
  padding: 0 !important;
}

/* =========================================
   上下固定レイアウト設定（Flexbox化）
========================================= */
.wrapper {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  max-width: 800px !important;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

/* 固定ヘッダー */
iframe[name="topFrame"] {
  position: static !important; /* absolute を解除 */
  width: 100% !important;
  flex-shrink: 0 !important;   /* 高さを潰さない */
  z-index: 10;
  margin: 0 !important;
  padding: 0 !important;
}

/* 固定フッター */
iframe[name="bottomFrame"] {
  position: static !important; /* absolute を解除 */
  width: 100% !important;
  flex-shrink: 0 !important;   /* 高さを潰さない */
  z-index: 10;
  margin: 0 !important;
  padding: 0 !important;
}

/* 中央CGIエリア（残り高さを自動占有） */
.cgi-iframe {
  flex: 1 1 auto !important;   /* 残りの高さを自動で埋める */
  width: 100% !important;
  height: 100% !important;
  box-sizing: border-box !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
  padding-top: 0 !important;   /* 不要になるため0にリセット */
  padding-bottom: 0 !important;/* 不要になるため0にリセット */
}

/* =========================================
   CGI出力テーブルの自動改行・枠内収め
========================================= */
div[align="center"], div {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow-x: hidden !important;
}

table {
  width: 100% !important;
  max-width: 100% !important;
  table-layout: fixed !important;
  box-sizing: border-box !important;
  margin: 0 auto !important;
}

td, th {
  max-width: 100% !important;
  word-break: break-all !important;
  overflow-wrap: break-word !important;
  white-space: normal !important;
}

table img {
  max-width: 100% !important;
  height: auto !important;
  hspace: 0 !important;
  margin: 5px auto !important;
  display: block;
}

/* =========================================
   コンテナ・ナビゲーション・フッター
========================================= */
.header-banner {
  background-color: #000066;
  padding: 2px 10px;
  color: #ffffff;
  margin-bottom: 0;
}

.header-inner {
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* メインメニュー（PC・タブレット：1行に縮小配置） */
.main-menu {
  display: flex;
  flex-wrap: nowrap !important;
  justify-content: space-between;
  align-items: center;
  gap: 2px;
  width: 100% !important;
  max-width: 800px !important;
  margin: 0 auto; /* 上下余白を5px→3pxにさらに詰めてスッキリ化 */
  padding: 0 5px;
}

.main-menu a {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
}

.main-menu a img {
  width: 100% !important;
  height: auto !important;
  max-width: 100% !important;
  object-fit: contain;
}

.sub-link {
  display: inline-block;
  padding: 8px 16px;
  color: #ffffff !important;
  text-decoration: none;
  font-size: 13px;
  border-radius: 4px;
  text-align: center;
  flex: 1;
  max-width: 250px;
}

.sub-link.orange {
  background-color: #ff6600;
}

.sub-link.navy {
  background-color: #000066;
}

.product-category {
  margin-bottom: 25px;
  border-bottom: 1px solid #CCCCCC;
  padding-bottom: 15px;
}

.category-header {
  border-top: 1px solid #CCCCCC;
  border-bottom: 1px solid #CCCCCC;
  padding: 8px 0;
  margin-bottom: 15px;
}

.category-desc {
  margin: 0;
  font-size: 14px;
  font-weight: bold;
  line-height: 1.5;
  color: #000000;
}

.category-body {
  display: flex;
  gap: 15px;
  align-items: flex-start;
}

.category-thumb {
  width: 100px;
  flex-shrink: 0;
  text-align: center;
}

.category-thumb .title-img {
  margin-top: 5px;
}

.product-list {
  list-style: none;
  padding: 0;
  margin: 0;
  flex-grow: 1;
}

.product-list li {
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 12px;
}

.product-list a {
  color: #000066;
  text-decoration: underline;
}

.note-box {
  border-top: 1px solid #CCCCCC;
  padding-top: 10px;
  font-size: 11px;
  color: #333;
  line-height: 1.5;
  margin-top: 20px;
}

/* フッター内部デザイン */
footer {
  margin: 0 !important;
  padding: 0 !important;
}

.footer-nav {
  text-align: center;
  padding: 10px 5px !important;
  margin: 0 !important;
  font-size: 13px;
}

.footer-nav a {
  color: #000066;
  text-decoration: none;
  display: inline-block;
}

.footer-nav a:not(:last-child)::after {
  content: "｜";
  color: #000066;
  margin: 0 4px;
}

.copyright-orange {
  text-align: center;
  background-color: #FF6600;
  color: #FFFFFF;
  font-size: 12px;
  padding: 8px 10px !important;
  line-height: 1.4;
  margin: 0 !important;
}

/* =========================================
   レスポンシブ対応（スマホ幅：500px以下）
========================================= */
@media screen and (max-width: 500px) {
  .main-menu {
    flex-wrap: wrap !important;
    justify-content: center;
    gap: 3px;
  }

  .main-menu a {
    flex: 0 0 auto;
  }

  .main-menu a img {
    width: auto !important;
  }

  .category-body {
    flex-direction: column;
  }

  .category-thumb {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    margin-bottom: 10px;
  }

  .category-thumb .title-img {
    margin-top: 0;
  }

  .top-sub-nav {
    flex-direction: column;
    align-items: center;
  }

  .sub-link {
    width: 100%;
    max-width: 100%;
  }
}

/* =========================================
   iPhone SE専用・極小画面対応（375px以下）
========================================= */
@media screen and (max-width: 375px) {
  td {
    padding: 6px 4px !important;
  }

  td font {
    font-size: 12px !important;
    line-height: 1.5 !important;
  }

  .main-menu img {
    max-width: 30px !important;
  }
}

/* =========================================
   スマホサイズ対応（幅 768px 以下）
   フッター非表示
========================================= */
@media screen and (max-width: 768px) {
  iframe[name="bottomFrame"] {
    display: none !important;
  }
  /* .cgi-iframe の padding 指定はすべて不要です */
}