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

:root {
  --bg:      #e4e1d8;
  --surface: #ffffff;
  --border:  rgba(0,0,0,0.09);
  --text:    #2a2825;
  --text-2:  #6a6560;
  --ring:    #dd2020;
  --ring-glow: rgba(221,32,32,0.35);
  --gold:    #d4920a;
  --cat-game: #2a2825;
  --cat-tool: #5a5650;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Yu Gothic', sans-serif;
  min-height: 100vh;
}

/* ===== PAGE ===== */
.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 28px 60px;
}

/* ===== HEADER ===== */
.header {
  padding: 36px 0 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.logo { text-align: center; }
.logo-main {
  display: block;
  font-size: clamp(24px, 4vw, 38px);
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text);
  font-family: Georgia, serif;
}
.logo-sub {
  display: block;
  font-size: 12px;
  letter-spacing: 0.25em;
  color: var(--text-2);
  margin-top: 4px;
}

.controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ===== FILTER ===== */
.filter-nav { display: flex; gap: 4px; }

.filter-btn {
  padding: 6px 18px;
  border: 1.5px solid rgba(0,0,0,0.18);
  background: rgba(255,255,255,0.6);
  color: var(--text-2);
  font-size: 12px;
  letter-spacing: 0.06em;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.18s;
  font-family: inherit;
}
.filter-btn:hover { background: white; color: var(--text); border-color: rgba(0,0,0,0.3); }
.filter-btn.active {
  background: var(--text);
  color: white;
  border-color: var(--text);
}

/* ===== VIEW TOGGLE ===== */
.view-btns {
  display: flex;
  background: rgba(255,255,255,0.6);
  border: 1.5px solid rgba(0,0,0,0.18);
  border-radius: 8px;
  overflow: hidden;
}

.view-btn {
  width: 36px; height: 32px;
  border: none;
  background: transparent;
  color: rgba(0,0,0,0.3);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 7px;
  transition: all 0.15s;
}
.view-btn svg { width: 100%; height: 100%; fill: currentColor; }
.view-btn + .view-btn { border-left: 1.5px solid rgba(0,0,0,0.12); }
.view-btn.active { background: var(--text); color: white; }
.view-btn:hover:not(.active) { color: rgba(0,0,0,0.6); background: rgba(255,255,255,0.8); }

/* ===== ICON VIEW ===== */
.icon-view { padding: 12px 0 24px; }

.icon-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px 24px;
  padding: 16px 0;
}

/* ===== ICON ITEM ===== */
.icon-item {
  position: relative;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* dot marker under each icon (subtle position indicator) */
.icon-item::before {
  content: '';
  position: absolute;
  bottom: 28px;
  left: 50%; transform: translateX(-50%);
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(0,0,0,0.12);
  z-index: 0;
}

.icon-tile {
  position: relative;
  width: 100%;
  aspect-ratio: 300 / 169;   /* 1200×676 OGP比率 */
  background: #f2efe8;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  box-shadow: 0 3px 12px rgba(0,0,0,0.09), 0 1px 3px rgba(0,0,0,0.06);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* OGP image — no crop */
.artwork-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f2efe8;
  display: block;
}

/* SVG fallback — fills tile */
.icon-tile svg {
  width: 100%;
  height: 100%;
  display: block;
  flex-shrink: 0;
}

.icon-item:hover .icon-tile {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 10px 28px rgba(0,0,0,0.14), 0 3px 8px rgba(0,0,0,0.08);
}

.icon-tile svg { width: 100%; height: 100%; display: block; }

/* selection ring */
.icon-ring {
  position: absolute;
  inset: -5px;
  border-radius: 22px;
  border: 3px solid var(--ring);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  box-shadow: 0 0 0 2px var(--ring-glow), inset 0 0 0 2px var(--ring-glow);
}

.icon-item.selected .icon-ring {
  opacity: 1;
  animation: ring-pulse 1.8s ease-in-out infinite;
}

@keyframes ring-pulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--ring-glow), inset 0 0 0 2px var(--ring-glow); }
  50% { box-shadow: 0 0 0 5px var(--ring-glow), inset 0 0 0 5px var(--ring-glow); }
}

/* tooltip (number + name) */
.icon-tooltip {
  position: absolute;
  top: -38px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: stretch;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(0,0,0,0.22);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s, transform 0.12s;
  transform: translateX(-50%) translateY(4px);
  z-index: 10;
}
.icon-item:hover .icon-tooltip,
.icon-item.selected .icon-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.tooltip-num {
  background: #333;
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  display: flex; align-items: center;
  font-family: Georgia, serif;
}
.tooltip-name {
  background: white;
  color: var(--text);
  font-size: 11px;
  padding: 4px 10px;
  display: flex; align-items: center;
}

/* category badge on tile (top-right corner) */
.icon-badge {
  position: absolute;
  top: 8px; right: 8px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 3px;
  z-index: 2;
}
.icon-badge.game { background: rgba(0,0,0,0.12); color: #2a2825; }
.icon-badge.tool { background: rgba(0,0,0,0.07); color: #5a5650; }

/* icon title below tile */
.icon-name {
  margin-top: 9px;
  font-size: 12px;
  color: var(--text-2);
  text-align: center;
  line-height: 1.3;
}

/* hidden when filtered */
.icon-item.is-hidden {
  display: none;
}

/* entrance animation */
@keyframes itemIn {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.icon-item { animation: itemIn 0.35s ease both; }

/* ===== GALLERY VIEW ===== */
.gallery-view { display: flex; flex-direction: column; gap: 0; min-height: 480px; }
.gallery-view.hidden, .icon-view.hidden { display: none; }

/* Detail panel */
.gallery-detail-wrap {
  padding: 24px 24px 0;
  position: relative;
}

.gallery-detail {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  padding: 28px 32px;
  display: flex;
  gap: 32px;
  align-items: center;
  min-height: 200px;
  border: 1.5px solid var(--border);
}

.detail-artwork {
  flex: 0 0 260px;
  aspect-ratio: 300 / 169;
  border-radius: 12px;
  overflow: hidden;
  background: #f2efe8;
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.detail-artwork svg   { width: 100%; height: 100%; display: block; }
.detail-artwork .artwork-img {
  width: 100%; height: 100%;
  object-fit: contain;
  background: #f2efe8;
}

.detail-info { flex: 1; min-width: 0; }

.detail-badge-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}

.detail-number {
  background: var(--text);
  color: white;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 4px;
  font-family: Georgia, serif;
  letter-spacing: 0.04em;
}

.detail-category {
  font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 3px;
}
.detail-category.game { background: rgba(0,0,0,0.10); color: #2a2825; }
.detail-category.tool { background: rgba(0,0,0,0.06); color: #5a5650; }

.detail-title {
  font-size: clamp(18px, 2.5vw, 26px);
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 8px;
}

.detail-desc {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
  margin-bottom: 16px;
}

.detail-open {
  display: inline-block;
  padding: 9px 22px;
  background: var(--text);
  color: white;
  border-radius: 6px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: opacity 0.15s, transform 0.15s;
}
.detail-open:hover { opacity: 0.82; transform: translateY(-1px); }

/* speech bubble pointer */
.detail-pointer {
  width: 0; height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-top: 14px solid var(--surface);
  position: absolute;
  bottom: -14px;
  left: var(--pointer-x, 50%);
  transform: translateX(-50%);
  z-index: 2;
  filter: drop-shadow(0 3px 3px rgba(0,0,0,0.1));
  transition: left 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Gallery strip */
.gallery-strip-wrap {
  padding: 28px 24px 20px;
  overflow: hidden;
}

.gallery-strip {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding: 16px 20px 12px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
}
.gallery-strip::-webkit-scrollbar { display: none; }

/* Strip item */
.strip-item {
  flex: 0 0 130px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  scroll-snap-align: center;
  position: relative;
}

.strip-tile {
  width: 160px;
  aspect-ratio: 300 / 169;
  border-radius: 10px;
  overflow: hidden;
  background: #f2efe8;
  border: 1.5px solid var(--border);
  box-shadow: 0 2px 10px rgba(0,0,0,0.09);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.strip-tile svg            { width: 100%; height: 100%; display: block; }
.strip-tile .artwork-img   { width: 100%; height: 100%; object-fit: contain; background: #f2efe8; }

.strip-item:hover .strip-tile {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.14);
}

/* strip selection ring */
.strip-ring {
  position: absolute;
  inset: -5px;
  border-radius: 18px;
  border: 3px solid var(--ring);
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 0 0 2px var(--ring-glow);
  transition: opacity 0.15s;
}
.strip-item.selected .strip-ring {
  opacity: 1;
  animation: ring-pulse 1.8s ease-in-out infinite;
}

.strip-name {
  margin-top: 7px;
  font-size: 11px;
  color: var(--text-2);
  text-align: center;
  line-height: 1.25;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.strip-item.selected .strip-name { color: var(--text); font-weight: 600; }

/* ===== FOOTER AD ===== */
.footer-ad {
  margin-top: 40px;
  text-align: center;
}

/* ===== FOOTER ===== */
.footer {
  text-align: center;
  padding: 28px 0 8px;
  font-size: 12px;
  color: var(--text-2);
  opacity: 0.7;
}
.footer a { color: inherit; text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* ===== RESPONSIVE ===== */

/* タブレット縦 */
@media (max-width: 900px) {
  .icon-grid { grid-template-columns: repeat(2, 1fr); gap: 22px 18px; }
  .detail-artwork { flex: 0 0 200px; }
}

/* スマホ横 */
@media (max-width: 640px) {
  .page { padding: 0 14px 48px; }
  .header { padding: 24px 0 16px; }
  .controls { gap: 10px; }
  .icon-grid { grid-template-columns: repeat(2, 1fr); gap: 14px 12px; }
  .icon-tile { border-radius: 10px; }
  .gallery-detail {
    flex-direction: column;
    gap: 14px;
    padding: 18px 18px;
  }
  .detail-artwork { flex: none; width: 100%; }
  .gallery-detail-wrap { padding: 12px 12px 0; }
  .gallery-strip-wrap { padding: 18px 12px 14px; }
  .strip-tile { width: 130px; }
}

/* スマホ縦 */
@media (max-width: 400px) {
  .icon-grid { grid-template-columns: 1fr; }
  .icon-tile { border-radius: 10px; }
}
