/* =====================================================
   FLASHBACK 倉庫 ── 2000年代個人ゲームサイト風
   ===================================================== */

/* ── 全体リセット ── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: auto;
}

/* ── ページ背景 ── 2000年代の定番：薄青+縦ライン */
body {
  background-color: #BBCCE0;
  background-image: repeating-linear-gradient(
    180deg,
    rgba(255,255,255,.10) 0px,
    rgba(255,255,255,.10) 1px,
    transparent 1px,
    transparent 5px
  );
  font-family: Arial, "MS PGothic", "ＭＳ Ｐゴシック", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  font-size: 12px;
  line-height: 1.6;
  color: #222222;
}

/* ── サイト外枠 ── センタリングされた白ボックス */
.site-shell {
  max-width: 800px;
  margin: 0 auto;
  background: #EEF4FF;
  border-left: 1px solid #8899BB;
  border-right: 1px solid #8899BB;
  min-height: 100vh;
}

a              { color: #0033BB; }
a:visited      { color: #663399; }
a:hover        { color: #FF3300; text-decoration: underline; }

button, input, select {
  font: inherit;
}

:focus-visible {
  outline: 2px solid #ff8800;
  outline-offset: 2px;
}

/* ══════════════════════════════════════════════════
   MASTHEAD ── 紺ヘッダー
══════════════════════════════════════════════════ */
.masthead {
  background: #0A2D88;
  border-bottom: 4px solid #FF8800;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255,255,255,.15);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #fff;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  background: #FF8800;
  color: #000000;
  font-size: 15px;
  font-weight: 900;
  border: 2px solid #ffffff;
}

.brand strong {
  display: block;
  font-size: 15px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 1px;
}

.brand small {
  display: block;
  font-size: 10px;
  color: #99BBEE;
}

.quick-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  justify-content: flex-end;
}

/* ナビボタン ── 2000年代のタブ風 */
.quick-nav a {
  display: inline-block;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: bold;
  color: #ffffff;
  background: #2244AA;
  border: 1px solid #6688DD;
  text-decoration: none;
}

.quick-nav a:hover {
  background: #3355CC;
  color: #ffffff;
}

.topbar-badge {
  font-size: 10px;
  color: #FFCC44;
  background: #0A2055;
  border: 1px solid #FFCC44;
  padding: 1px 6px;
  white-space: nowrap;
}

/* ── HERO ── */
.hero {
  position: relative;
  display: grid;
  min-height: 130px;
  overflow: hidden;
  background: #071e66;
}

.hero-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 14px 16px;
}

.eyebrow {
  color: #FFCC00;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.hero h1 {
  font-size: clamp(1.3rem, 3vw, 1.9rem);
  line-height: 1.15;
  color: #ffffff;
  text-shadow: 1px 1px 0 #000, 2px 2px 0 #000;
}

.hero p:not(.eyebrow) {
  color: #99BBDD;
  font-size: 11px;
  line-height: 1.6;
  max-width: 500px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

/* ══════════════════════════════════════════════════
   ボタン
══════════════════════════════════════════════════ */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 3px 12px;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  text-decoration: none;
  background: #2244AA;
  border: 1px solid #AABBEE;
  color: #ffffff;
}

.button:hover {
  background: #3355CC;
  color: #ffffff;
}

.button.primary {
  background: #CC6600;
  border-color: #FFCC66;
  color: #ffffff;
}

.button.primary:hover {
  background: #DD7700;
  color: #ffffff;
}

.button.is-disabled {
  filter: grayscale(.7);
  opacity: .6;
  pointer-events: none;
}

.icon-button {
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}

.tab-button {
  cursor: pointer;
  color: inherit;
}

/* ══════════════════════════════════════════════════
   MAIN
══════════════════════════════════════════════════ */
main {
  padding: 8px 8px 16px;
}

/* ── ニューステッカー ── */
.ticker {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: stretch;
  margin-bottom: 8px;
  border: 1px solid #99AABB;
  background: #ffffff;
  overflow: hidden;
}

.ticker span {
  display: flex;
  align-items: center;
  padding: 0 10px;
  background: #CC3300;
  color: #ffffff;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}

.ticker p {
  margin: 0;
  padding: 5px 0;
  font-size: 11px;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  animation: ticker-scroll 28s linear infinite;
}

@keyframes ticker-scroll {
  0%   { transform: translateX(70vw); }
  100% { transform: translateX(-100%); }
}

/* ── 絞り込みパネル ── */
.control-panel {
  display: grid;
  grid-template-columns: minmax(180px,1fr) auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 8px;
  padding: 8px;
  background: #ffffff;
  border: 1px solid #99AABB;
}

.search-box,
.select-row label {
  display: grid;
  gap: 3px;
  font-size: 10px;
  font-weight: bold;
  color: #335577;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.search-box input,
.select-row select {
  min-height: 24px;
  border: 1px solid #99AABB;
  border-bottom-color: #668;
  border-right-color: #668;
  background: #F8FCFF;
  color: #222;
  padding: 2px 6px;
  font-size: 12px;
}

.search-box input { width: 100%; }
.search-box input::placeholder { color: #AABBCC; }

.select-row {
  display: flex;
  gap: 8px;
}

.select-row select { padding: 2px 4px; }

.category-tabs {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 2px;
}

.filter-tools {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px dotted #aabbcc;
}

.favorite-filter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #334f6b;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
}

.reset-button {
  min-height: 24px;
  padding: 2px 9px;
  border: 1px solid #7799aa;
  background: #edf3f8;
  color: #223f5a;
  cursor: pointer;
}

.tab-button {
  min-height: 24px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: bold;
  background: #DDEEFF;
  border: 1px solid #7799CC;
  color: #223366;
}

.tab-button:hover {
  background: #CCDDFF;
}

.tab-button[aria-pressed="true"] {
  background: #1144AA;
  border-color: #88AADD;
  color: #ffffff;
}

/* ══════════════════════════════════════════════════
   コンテンツグリッド
══════════════════════════════════════════════════ */
.content-grid {
  display: grid;
  grid-template-columns: 210px minmax(0,1fr);
  gap: 8px;
  align-items: start;
}

.side-rail {
  display: grid;
  align-content: start;
  gap: 8px;
}

/* ── パネル共通 ── 白地＋色帯ヘッダーが2000年代の定番 */
.rail-box,
.catalog {
  background: #ffffff;
  border: 1px solid #99AABB;
}

.rail-box {
  overflow: hidden;
}

.rail-box > *:not(h2):not(.ranking-list) {
  padding: 7px 8px;
}

.rail-box .ranking-list {
  padding: 6px 8px 6px 26px;
}

/* 色帯ヘッダー ── セクションごとに色を変えるのが2000年代らしい */
.rail-box h2 {
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 900;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* 各セクションで色を変える */
#pickup h2    { background: #993300; border-bottom: 1px solid #CC5500; }
#pickup h2::before { content: "☆ "; }

.rail-box:not(#pickup):not(#about) h2 {
  background: #336699;
  border-bottom: 1px solid #4488BB;
}
.rail-box:not(#pickup):not(#about) h2::before { content: "▶ "; }

#about h2 {
  background: #336633;
  border-bottom: 1px solid #558855;
}
#about h2::before { content: "● "; }

/* アクセスカウンターセクション用 */
.rail-box.counter-box h2 {
  background: #663399 !important;
  border-bottom: 1px solid #8855BB !important;
}

.rail-box p {
  font-size: 11px;
  color: #555;
  line-height: 1.65;
}

/* ── フィーチャードリスト ── */
.featured-list {
  display: grid;
  gap: 4px;
}

.featured-item,
.ranking-list button,
.card-button {
  width: 100%;
  border: 0;
  text-align: left;
  background: transparent;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.featured-item {
  display: grid;
  grid-template-columns: 7px 1fr;
  gap: 6px;
  align-items: center;
  padding: 4px 5px;
  background: #F0F4FF;
  border: 1px solid #CCDDEE;
  font-size: 11px;
}

.featured-item:hover {
  background: #E0EAFF;
  border-color: #8899CC;
}

.featured-item > span {
  grid-row: 1 / span 2;
  width: 7px;
  height: 30px;
  background: var(--accent, #3366CC);
}

.featured-item strong,
.featured-item small {
  display: block;
  grid-column: 2;
}

.featured-item small,
.ranking-list small {
  font-size: 10px;
  color: #778899;
}

/* ── ランキング ── */
.ranking-list {
  display: grid;
  gap: 3px;
  font-size: 11px;
}

.ranking-list li::marker {
  color: #CC6600;
  font-weight: 900;
}

.ranking-list button {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  padding: 2px 0;
  font-size: 11px;
}

.ranking-list button:hover { color: #0033BB; }

/* ── アクセスカウンター ── */
.counter-display {
  display: flex;
  gap: 2px;
  font-family: "Courier New", "Lucida Console", monospace;
  font-size: 18px;
  font-weight: 700;
  color: #00CC44;
  background: #111111;
  border: 2px inset #333333;
  padding: 3px 8px;
  letter-spacing: 2px;
  width: fit-content;
}

.counter-note {
  font-size: 10px !important;
  color: #778899 !important;
  margin-top: 4px !important;
  padding-top: 0 !important;
}

/* ══════════════════════════════════════════════════
   カタログ
══════════════════════════════════════════════════ */
.catalog {
  min-width: 0;
  overflow: hidden;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 10px;
  background: #1A3FA8;
  border-bottom: 1px solid #4466CC;
}

.section-heading .eyebrow { display: none; }

.section-heading > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-heading h2 {
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.section-heading h2::before {
  content: "▶ ";
  color: #FFCC00;
  font-size: 9px;
}

.result-count {
  color: #FFCC00;
  font-size: 11px;
  font-weight: 900;
}

/* ── ゲームグリッド ── */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px,1fr));
  gap: 6px;
  padding: 8px;
  background: #E8F0FA;
}

.game-card {
  position: relative;
  background: #ffffff;
  border: 1px solid #AABBCC;
}

.favorite-button {
  position: absolute;
  z-index: 2;
  top: 6px;
  right: 6px;
  width: 30px;
  height: 30px;
  border: 1px solid #ffcc44;
  background: #112244;
  color: #ffcc44;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.favorite-button:hover,
.favorite-button[aria-pressed="true"] {
  background: #ffcc44;
  color: #332200;
}

.game-card:hover {
  border-color: #5577CC;
  background: #F8FAFF;
}

.card-button {
  display: grid;
  height: 100%;
  min-height: 270px;
}

/* ── サムネイル ── */
.thumb {
  position: relative;
  display: block;
  min-height: 105px;
  overflow: hidden;
  background: #001633;
  border-bottom: 1px solid #99AABB;
}

.thumb.large {
  min-height: 160px;
  border: 1px solid #99AABB;
}

.thumb-image {
  display: block;
  width: 100%;
  height: 100%;
  min-height: inherit;
  object-fit: cover;
}

.thumb-grid {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(100,150,220,.2) 1px, transparent 1px),
    linear-gradient(90deg, rgba(100,150,220,.2) 1px, transparent 1px);
  background-size: 12px 12px;
}

.thumb-sprite {
  position: absolute;
  top: 48%;
  left: 50%;
  width: 54px;
  height: 42px;
  transform: translate(-50%, -50%) rotate(-6deg);
  background:
    linear-gradient(#FFCC00,#FFCC00) 19px 0 / 12px 42px no-repeat,
    linear-gradient(#FFCC00,#FFCC00) 0 16px / 54px 10px no-repeat,
    linear-gradient(var(--accent,#3366CC),var(--accent,#3366CC))
      10px 6px / 32px 28px no-repeat;
  filter: drop-shadow(3px 3px 0 rgba(0,0,0,.4));
}

/* ── カード本文 ── */
.card-body {
  display: grid;
  gap: 4px;
  align-content: start;
  padding: 7px;
}

.card-meta {
  color: #3366AA;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.card-title {
  font-size: 13px;
  font-weight: bold;
  line-height: 1.3;
  color: #111;
}

.card-description {
  font-size: 11px;
  color: #555;
  line-height: 1.6;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.tag-row span {
  padding: 1px 5px;
  border: 1px solid #CCDDEE;
  font-size: 10px;
  color: #445566;
  background: #F0F6FF;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-top: auto;
}

/* ── ステータス ── */
.status-pill {
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 900;
  border: 1px solid rgba(0,0,0,.2);
  color: #000000;
}

.status-playable    { background: #00CC44; border-color: #009933; }
.status-unavailable { background: #FFCC00; border-color: #CC9900; }
.status-archived    { background: #AABBCC; border-color: #889AAA; color: #333; }

.plays {
  font-size: 10px;
  color: #778899;
}

.empty-state {
  margin: 8px;
  padding: 8px;
  font-size: 12px;
  color: #778899;
  border: 1px dashed #AABBCC;
  background: #FAFCFF;
}

/* ══════════════════════════════════════════════════
   FOOTER
══════════════════════════════════════════════════ */
.footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  font-size: 11px;
  color: #557799;
  background: #1A3FA8;
  border-top: 3px solid #FF8800;
}

.footer p { margin: 0; }

.footer a { color: #99BBFF; }
.footer strong { color: #ffffff; }

/* ══════════════════════════════════════════════════
   DIALOG
══════════════════════════════════════════════════ */
.detail-dialog {
  width: min(680px, calc(100vw - 2rem));
  color: #222;
  border: 2px solid #3366CC;
  background: #ffffff;
  padding: 0;
  box-shadow: 4px 4px 8px rgba(0,0,0,.3);
}

.detail-dialog::backdrop { background: rgba(0,0,0,.6); }

.close-dialog {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  background: #CC2200;
  border: 1px solid #FF4422;
  color: #ffffff;
}

.close-dialog:hover { background: #EE3300; }

.dialog-hero {
  display: grid;
  grid-template-columns: 160px 1fr;
}

.dialog-hero > div { padding: 10px 12px; }

.dialog-hero h2 {
  margin: .2rem 0 .5rem;
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  line-height: 1.15;
  color: #111;
}

.dialog-hero p:not(.card-meta) {
  margin: 0;
  color: #555;
  line-height: 1.65;
  font-size: 11px;
}

.detail-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 4px;
  margin: 6px 10px;
}

.detail-list div {
  padding: 5px;
  border: 1px solid #CCDDEE;
  background: #F5F8FF;
}

.detail-list dt {
  color: #336699;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-list dd {
  margin: 2px 0 0;
  color: #333;
  font-size: 11px;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  padding: 8px 10px;
  border-top: 1px solid #CCDDEE;
  background: #F0F4FF;
}

/* ══════════════════════════════════════════════════
   アニメーション
══════════════════════════════════════════════════ */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.blink {
  animation: blink 1s step-end infinite;
  color: #FF3300;
  font-weight: 900;
}

.badge-new {
  display: inline-block;
  font-size: 9px;
  font-weight: 900;
  color: #ffffff;
  background: #FF0000;
  border: 1px solid #CC0000;
  padding: 0 4px;
  margin-left: 4px;
  animation: blink 1s step-end infinite;
  vertical-align: middle;
}

/* ══════════════════════════════════════════════════
   レスポンシブ
══════════════════════════════════════════════════ */
@media (max-width: 800px) {
  .site-shell {
    border-left: none;
    border-right: none;
  }

  .content-grid,
  .control-panel {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    padding: 12px;
  }

  .side-rail {
    order: 2;
    grid-template-columns: repeat(2, minmax(0,1fr));
  }

  .catalog { order: 1; }

  .dialog-hero { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .quick-nav { justify-content: flex-start; }

  .hero h1 { font-size: 1.25rem; }

  .ticker { grid-template-columns: 1fr; }
  .ticker span { justify-content: center; padding: 4px; }
  .ticker p { padding: 4px 8px; }

  .side-rail,
  .detail-list { grid-template-columns: 1fr; }

  .game-grid { grid-template-columns: 1fr; }

  .select-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .select-row select { width: 100%; }

  .footer { display: block; }
  .footer p + p { margin-top: 4px; }
}
