* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, "Malgun Gothic", sans-serif; background: #15161a; color: #e8e6e1; }
header { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 10px 14px; background: #1f2026; border-bottom: 1px solid #333; }
header h1 { font-size: 18px; margin: 0 8px 0 0; }
select, input[type=search] { background: #2a2b32; color: inherit; border: 1px solid #444; border-radius: 6px; padding: 6px 8px; }
#count { color: #999; font-size: 13px; }
main { display: flex; gap: 14px; padding: 14px; align-items: flex-start; }
#grid { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.card { background: #23242b; border: 1px solid #333; border-radius: 8px; padding: 6px; cursor: pointer; text-align: center; font-size: 13px; }
.card:hover, .card.sel { border-color: #c9a24a; }
.card img { width: 100%; aspect-ratio: 5 / 7; object-fit: contain; background: #111; border-radius: 4px; }
.card .noimg { aspect-ratio: 5 / 7; display: flex; align-items: center; justify-content: center; color: #666; background: #111; border-radius: 4px; }
#detail { position: sticky; top: 70px; width: 380px; max-height: calc(100vh - 90px); overflow: auto;
  background: #23242b; border: 1px solid #444; border-radius: 10px; padding: 14px; }
#detail img { width: 100%; border-radius: 8px; }
#detail h2 { margin: 10px 0 2px; font-size: 20px; }
#detail .sub, #detail .en { color: #aaa; font-size: 13px; }
#detail .traits { color: #c9a24a; font-style: italic; margin: 6px 0; }
#detail .text { line-height: 1.6; white-space: pre-wrap; margin: 8px 0; }
#detail .flavor { color: #999; font-style: italic; border-top: 1px solid #333; padding-top: 6px; }
#detail .stats { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
#detail .stats span { background: #31323a; border-radius: 4px; padding: 2px 6px; font-size: 13px; }
.icon { color: #c9a24a; font-weight: bold; }
.untranslated { color: #e08a5a; font-size: 12px; }
@media (max-width: 800px) { main { flex-direction: column-reverse; } #detail { position: static; width: 100%; max-height: none; } }

button { background: #c9a24a; color: #15161a; border: 0; border-radius: 6px; padding: 6px 12px; font-weight: bold; cursor: pointer; }
#gate { max-width: 360px; margin: 80px auto; text-align: center; }
#who { color: #999; font-size: 13px; margin-left: auto; }
