/* ================================================
   CRAFTn - common.css  v2
   全ページ共通スタイル
   ================================================ */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Noto+Sans+JP:wght@400;700&display=swap');

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ===== CSS VARIABLES ===== */
:root {
  --bg:          #0a1628;
  --bg2:         #0d1f3c;
  --surface:     #112244;
  --surface2:    #1a3060;
  --border:      #1e4080;
  --border-hi:   #2d6fc4;
  --accent:      #1e90ff;
  --accent-hi:   #00cfff;
  --accent-glow: rgba(30, 144, 255, 0.22);
  --gold:        #ffd700;
  --text:        #c8daf5;
  --text-muted:  #607090;
  --text-bright: #e8f4ff;
  --grid-line:   rgba(255, 255, 255, 0.028);
}

/* ===== BODY ===== */
body {
  background-color: var(--bg);
  background-image:
    repeating-linear-gradient(0deg,  transparent, transparent 31px, var(--grid-line) 31px, var(--grid-line) 32px),
    repeating-linear-gradient(90deg, transparent, transparent 31px, var(--grid-line) 31px, var(--grid-line) 32px);
  background-attachment: fixed;
  font-family: 'Noto Sans JP', sans-serif;
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 60px;
}

/* ===== SITE HEADER ===== */
.site-header {
  background: linear-gradient(180deg, #0c2040 0%, #091830 55%, #061020 100%);
  border-bottom: 3px solid var(--border);
  position: relative;
  overflow: hidden;
  padding-bottom: 28px;
}

/* 星空エフェクト */
.site-header::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    radial-gradient(1px 1px at 15% 30%, rgba(255,255,255,0.6) 0%, transparent 100%),
    radial-gradient(1px 1px at 40% 20%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 65% 60%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 80% 25%, rgba(255,255,255,0.6) 0%, transparent 100%),
    radial-gradient(1px 1px at 25% 70%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 90% 45%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(2px 2px at 60% 15%, rgba(100,180,255,0.4) 0%, transparent 100%);
  pointer-events: none;
}

/* ===== 全ページ共通：中央ロゴ ===== */
/* header-inner は非表示（全ページでheader-logoに統一） */
.header-inner { display: none; }
.site-title-link, .site-title { display: none; }

.header-logo {
  position: relative; z-index: 1;
  text-align: center;
  padding: 28px 20px 18px;
}

/* ② 全ページ同じロゴサイズ（topと統一） */
.site-logo-img {
  max-width: 320px; width: 80%; height: auto;
  display: block; margin: 0 auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 18px rgba(30,144,255,0.5));
}

.site-subtitle {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(7px, 1.4vw, 10px);
  color: var(--accent-hi);
  letter-spacing: 3px;
  margin-top: 12px;
  opacity: .8;
  display: block;
}

/* ===== 全ページ共通：ヘッダー内検索ボックス ===== */
/* ③ 横幅50%に制限 */
.global-search-outer {
  position: relative; z-index: 10;
  max-width: 460px;   /* 50%相当 */
  margin: 0 auto;
  padding: 0 20px;
}

/* ① 子ページの個別検索窓（.search-wrap）を非表示 */
.search-wrap { display: none; }
.count-label { display: none; }

.global-search-box {
  display: flex; align-items: stretch;
  background: var(--bg2);
  border: 2px solid var(--border-hi);
  border-radius: 3px; overflow: hidden;
  box-shadow: 0 0 24px var(--accent-glow), 0 6px 20px rgba(0,0,0,.55);
  transition: border-color .15s, box-shadow .15s;
}

.global-search-box:focus-within {
  border-color: var(--accent-hi);
  box-shadow: 0 0 32px rgba(0,207,255,.4), 0 6px 20px rgba(0,0,0,.55);
}

.gsearch-icon {
  display: flex; align-items: center;
  padding: 0 16px; font-size: 16px;
  background: var(--surface);
  border-right: 2px solid var(--border);
  flex-shrink: 0;
}

.global-search-box input {
  flex: 1; background: transparent;
  border: none; outline: none;
  color: var(--text-bright);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 13px; padding: 14px 12px;
}

.global-search-box input::placeholder { color: var(--text-muted); }

.gsearch-btn {
  background: var(--accent); border: none;
  color: #fff;
  font-size: 16px;
  width: 48px; flex-shrink: 0;
  cursor: pointer;
  transition: background .15s;
  display: flex; align-items: center; justify-content: center;
}
.gsearch-btn:hover { background: var(--accent-hi); color: #000; }

/* ===== メインタブナビ (トップページ) ===== */
.tab-nav-wrap {
  background: var(--bg2);
  padding-top: 30px;
  padding-bottom: 0;
  border-bottom: 3px solid var(--accent);
}

.tab-nav {
  max-width: 960px; margin: 0 auto;
  padding: 0 20px;
  display: flex; gap: 4px;
  overflow-x: auto; scrollbar-width: none;
  align-items: flex-end;
}
.tab-nav::-webkit-scrollbar { display: none; }

.tab-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  padding: 10px 18px 12px;
  background: #061020;
  border: 2px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  color: var(--text-muted);
  cursor: pointer; white-space: nowrap;
  transition: all .15s; letter-spacing: 1px;
  position: relative; flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}
.tab-btn:hover {
  color: var(--text); background: var(--surface);
  border-color: var(--border-hi);
  transform: translateY(-2px);
}
.tab-btn.active {
  color: #fff; background: var(--accent);
  border-color: var(--accent);
  border-bottom: 3px solid var(--accent);
  padding-bottom: 14px; font-size: 9px;
  box-shadow: 0 -4px 12px rgba(30,144,255,0.35);
  z-index: 2;
}

.tab-badge {
  position: absolute; top: 4px; right: 4px;
  font-family: 'Press Start 2P', monospace;
  font-size: 5px;
  background: rgba(0,0,0,0.4);
  color: rgba(255,255,255,0.5);
  padding: 1px 4px; border-radius: 2px;
  pointer-events: none;
}

/* ===== タブパネル ===== */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ===== 横断検索結果 ===== */
.search-results-panel {
  display: none;
  max-width: 880px; margin: 0 auto;
  padding: 24px 20px 48px;
  position: relative;
  z-index: 10;
  background: var(--bg);
}
.search-results-panel.visible { display: block !important; }

.search-results-header {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px; color: var(--accent-hi);
  margin-bottom: 14px;
}

.search-result-item {
  background: var(--surface); border: 1px solid var(--border);
  padding: 0;
  margin-bottom: 8px;
  display: flex; flex-direction: column;
  text-decoration: none; border-radius: 3px;
  transition: border-color .12s, background .12s;
  overflow: hidden;
}
.search-result-item:hover { border-color: var(--accent); background: var(--surface2); }

/* カード上段：カテゴリ・名前・矢印 */
.sri-top {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

/* カード下段：詳細情報 */
.sri-detail {
  padding: 8px 16px 10px;
  display: flex; flex-wrap: wrap; gap: 5px;
}
.sri-detail-tag {
  font-size: 10px; padding: 3px 8px;
  background: var(--bg2); border: 1px solid var(--border-hi);
  color: var(--text-muted); border-radius: 2px;
}

.sri-cat {
  font-family: 'Press Start 2P', monospace; font-size: 7px;
  color: var(--accent); background: var(--bg);
  border: 1px solid var(--border-hi);
  padding: 3px 7px; white-space: nowrap; flex-shrink: 0;
}
.sri-name { font-size: 14px; color: var(--text-bright); flex: 1; font-weight: bold; }
.sri-arrow { color: var(--text-muted); font-size: 14px; flex-shrink: 0; }
.no-results {
  font-family: 'Press Start 2P', monospace; font-size: 9px;
  color: var(--text-muted); text-align: center; padding: 40px 0;
}

/* ===== 子ページ用ナビ（④ topと同じ角丸タブ型） ===== */
.main-nav {
  background: var(--bg2);
  padding-top: 30px;
  padding-bottom: 0;
  border-bottom: 3px solid var(--accent);
}

.nav-inner {
  max-width: 960px; margin: 0 auto;
  padding: 0 20px;
  display: flex; gap: 4px;
  overflow-x: auto; scrollbar-width: none;
  align-items: flex-end;
}
.nav-inner::-webkit-scrollbar { display: none; }

.nav-item {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  padding: 10px 18px 12px;
  background: #061020;
  border: 2px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: all .15s;
  letter-spacing: 1px;
  position: relative;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}
.nav-item:hover {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border-hi);
  transform: translateY(-2px);
}
.nav-item.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  border-bottom: 3px solid var(--accent);
  padding-bottom: 14px;
  font-size: 9px;
  box-shadow: 0 -4px 12px rgba(30,144,255,0.35);
  z-index: 2;
}

/* ===== パンくず ===== */
.breadcrumb {
  max-width: 1000px; margin: 0 auto; padding: 10px 24px;
  font-size: 11px; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
}
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent-hi); }
.breadcrumb-sep { color: var(--border-hi); }

/* ===== ページヒーロー（コンパクト統一サイズ） ===== */
.page-hero {
  background: linear-gradient(135deg, var(--surface) 0%, var(--bg2) 100%);
  border-bottom: 2px solid var(--border);
  padding: 18px 24px 14px;
  text-align: center;
  position: relative; overflow: hidden;
}
.page-hero::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg,
    transparent 0%, var(--accent) 30%, var(--accent-hi) 50%, var(--accent) 70%, transparent 100%);
}
.page-hero-icon { font-size: 24px; display: block; margin-bottom: 6px; }
.page-title {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(12px, 2vw, 16px);
  color: var(--text-bright);
  text-shadow: 0 0 14px var(--accent-glow);
  margin-bottom: 4px;
}
.page-desc { font-size: 13px; color: var(--text-muted); }

/* panel-hero（index.html タブ内用、page-heroと同サイズ） */
.panel-hero {
  background: linear-gradient(135deg, var(--surface) 0%, var(--bg2) 100%);
  border-bottom: 2px solid var(--border);
  padding: 18px 24px 14px;
  text-align: center;
  position: relative; overflow: hidden;
}
.panel-hero::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg,
    transparent 0%, var(--accent) 30%, var(--accent-hi) 50%, var(--accent) 70%, transparent 100%);
}
.panel-hero-icon { font-size: 24px; display: block; margin-bottom: 6px; }
.panel-title {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(12px, 2vw, 16px);
  color: var(--text-bright);
  text-shadow: 0 0 14px var(--accent-glow);
  margin-bottom: 4px;
}
.panel-desc { font-size: 13px; color: var(--text-muted); }

/* ===== セクションタイトル ===== */
.sec-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px; color: var(--accent);
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 12px;
  letter-spacing: 2px;
}
.sec-title::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--border-hi), transparent);
}

/* ===== 子ページ内検索 ===== */
.search-wrap { max-width: 960px; margin: 28px auto 0; padding: 0 24px; }

.search-box {
  display: flex; align-items: stretch;
  background: var(--bg2); border: 2px solid var(--border-hi); overflow: hidden;
  transition: border-color .15s;
}
.search-box:focus-within { border-color: var(--accent-hi); box-shadow: 0 0 16px var(--accent-glow); }

.search-box-icon {
  display: flex; align-items: center;
  padding: 0 14px; font-size: 15px;
  background: var(--surface); border-right: 2px solid var(--border); flex-shrink: 0;
}
.search-box input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text-bright); font-family: 'Noto Sans JP', sans-serif;
  font-size: 13px; padding: 12px 14px;
}
.search-box input::placeholder { color: var(--text-muted); }
.count-label {
  text-align: right; font-family: 'Press Start 2P', monospace;
  font-size: 7px; color: var(--text-muted); margin-top: 8px;
}

/* ===== 子ページ内フィルタータブ ===== */
.filter-tabs {
  display: flex; gap: 6px;
  max-width: 960px; margin: 20px auto 0; padding: 0 24px;
  overflow-x: auto; scrollbar-width: none;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}
.filter-tabs::-webkit-scrollbar { display: none; }

.ftab {
  font-family: 'Press Start 2P', monospace; font-size: 8px;
  padding: 10px 16px 8px;
  border: 2px solid var(--border);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer; transition: all .15s; white-space: nowrap;
  position: relative;
}
.ftab.active {
  background: var(--surface2); color: var(--accent-hi);
  border-color: var(--accent);
  border-bottom: 2px solid var(--surface2);
  z-index: 2; margin-bottom: -2px;
}
.ftab:hover:not(.active) { background: var(--surface); color: var(--text); border-color: var(--border-hi); }

/* ===== カテゴリグリッド ===== */
.cat-section { max-width: 960px; margin: 0 auto; padding: 36px 20px 60px; }

.cat-section-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px; color: var(--accent);
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 12px; letter-spacing: 2px;
}
.cat-section-title::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--border-hi), transparent);
}

.cat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
@media (max-width: 700px) { .cat-grid { grid-template-columns: repeat(2, 1fr); } }

.cat-card {
  background: var(--surface); border: 2px solid var(--border); border-radius: 4px;
  padding: 24px 12px 18px; text-align: center; text-decoration: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  position: relative; overflow: hidden; min-height: 128px;
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.cat-card::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(30,144,255,.05) 0%, transparent 60%);
  pointer-events: none;
}
.cat-card:not(.coming):hover {
  transform: translateY(-5px); border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(0,0,0,.5), 0 0 16px var(--accent-glow);
}
.cat-card.coming { opacity: .5; pointer-events: none; }

.cat-icon-wrap { font-size: 32px; margin-bottom: 10px; line-height: 1; }
.cat-label {
  font-family: 'Press Start 2P', monospace; font-size: 9px;
  color: var(--text-bright); display: block; margin-bottom: 5px;
}
.cat-desc { font-size: 10px; color: var(--text-muted); display: block; line-height: 1.5; }

.badge-coming {
  position: absolute; top: 7px; right: 7px;
  font-family: 'Press Start 2P', monospace; font-size: 6px;
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text-muted); padding: 2px 5px; border-radius: 2px;
}

/* ===== COMING SOON ===== */
.coming-panel { max-width: 880px; margin: 0 auto; padding: 80px 20px; text-align: center; }
.coming-icon { font-size: 54px; display: block; margin-bottom: 20px; opacity: .5; }
.coming-title {
  font-family: 'Press Start 2P', monospace; font-size: 13px;
  color: var(--text-muted); margin-bottom: 12px;
}
.coming-desc { font-size: 12px; color: #3a5070; line-height: 1.9; }

/* ===== カード共通 ===== */
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px; max-width: 960px; margin: 20px auto 60px; padding: 0 24px;
}
.card {
  background: var(--surface); border: 2px solid var(--border);
  position: relative; overflow: hidden;
  transition: transform .12s, border-color .12s, box-shadow .12s;
}
.card:hover {
  transform: translateY(-3px); border-color: var(--accent);
  box-shadow: 0 6px 0 #000, 0 0 16px var(--accent-glow);
}
.card-top {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  background: linear-gradient(90deg, var(--surface2) 0%, var(--surface) 100%);
  border-bottom: 2px solid var(--border);
}
.card-name {
  font-family: 'Press Start 2P', monospace; font-size: 9px;
  color: var(--text-bright); text-shadow: 1px 1px 0 #000; line-height: 1.7;
}
.card-body { padding: 12px 16px; }
.mat-label {
  font-family: 'Press Start 2P', monospace; font-size: 7px;
  color: var(--accent-hi); margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.mat-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.materials { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.mat-tag {
  font-size: 11px; padding: 4px 10px;
  background: var(--bg2); border: 1px solid var(--border-hi); color: var(--text);
}
.effect-label {
  font-family: 'Press Start 2P', monospace; font-size: 7px; color: #88cc44;
  margin: 10px 0 8px; display: flex; align-items: center; gap: 6px;
}
.effect-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.effect-text {
  font-size: 11px; color: #b8e0b0;
  background: rgba(0,40,0,0.4); border: 1px solid #2a4a2a; padding: 6px 10px;
}

/* ===== フッター ===== */
.site-footer {
  background: var(--bg2); border-top: 2px solid var(--border);
  padding: 24px; text-align: center;
}
.site-footer p {
  font-family: 'Press Start 2P', monospace; font-size: 7px; color: var(--text-muted);
}

/* ===== ユーティリティ ===== */
.hidden { display: none !important; }

@media (max-width: 600px) {
  .card-grid { grid-template-columns: 1fr; }
  .cat-grid  { grid-template-columns: repeat(2, 1fr); }
}

/* ポーションページ独自検索（グローバル検索で代替するため非表示） */
.search-wrap-portion { display: none; }

/* 検索結果カードの効果表示 */
.sri-effect {
  padding: 6px 16px 10px;
  display: flex; align-items: center; gap: 8px;
  border-top: 1px solid var(--border);
}
.sri-effect-label {
  font-family: 'Press Start 2P', monospace; font-size: 7px;
  color: #88cc44; white-space: nowrap; flex-shrink: 0;
}
.sri-effect-text {
  font-size: 11px; color: #b8e0b0;
}
