* { box-sizing: border-box; }

:root {
  color-scheme: light;
  font-family: system-ui, sans-serif;
  color: #222;
  background: #f8f8f8;
}
body { margin: 0; }
button, select, input { font: inherit; }
button { cursor: pointer; }
a { color: #0058a8; }
:focus-visible { outline: 3px solid #0067bc; outline-offset: 3px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.site-header {
  padding: 1rem;
  background: white;
  border-bottom: 1px solid #ddd;
  text-align: center;
}
.site-header h1 { margin: 0; }
.site-header img { display: block; width: min(100%, 1040px); height: auto; margin: auto; }
.site-header p { margin: .75rem 0 0; }
.support { color: #a61652; font-weight: 700; }
.layout { max-width: 1400px; margin: auto; display: flex; align-items: flex-start; }
.sidebar {
  flex: 0 0 230px;
  min-width: 0;
  padding: 1rem;
  background: #f1f1f1;
  border-right: 1px solid #ddd;
}
.sidebar h2 { margin: 0 0 .65rem; font-size: 1.15rem; }
.categories { margin: 0; padding: 0; list-style: none; }
.categories button {
  width: 100%;
  min-height: 42px;
  padding: .45rem .6rem;
  border: 1px solid transparent;
  border-radius: 5px;
  color: #0058a8;
  background: transparent;
  text-align: left;
}
.categories button:hover, .categories button[aria-pressed=true] {
  border-color: #a3bbd0;
  background: #e6f1fa;
}
.shop { display: block; width: min(100%, 200px); margin: 1.25rem auto 0; }
.shop img { display: block; width: 100%; height: auto; border-radius: 6px; }
.main { flex: 1; min-width: 0; padding: 1rem; }
.controls { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.controls input, .controls select {
  max-width: 100%;
  min-height: 42px;
  padding: .45rem .6rem;
  border: 1px solid #9c9c9c;
  border-radius: 5px;
  background: white;
  color: #222;
}
.controls input { min-width: 8rem; flex: 1 1 12rem; }
#post-status { min-height: 1.4em; color: #444; margin: .65rem 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 1rem; }
.post-card { position: relative; min-width: 0; border: 1px solid #ccc; border-radius: 7px; background: white; }
.post-card a { color: #222; display: block; height: 100%; text-decoration: none; border-radius: inherit; }
.post-card a:hover h2, .post-card a:hover h3 { text-decoration: underline; }
.post-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #e8e8e8;
  border-radius: 6px 6px 0 0;
}
.post-card h2, .post-card h3 { margin: 0; padding: .65rem; font-size: 1rem; overflow-wrap: anywhere; }
.badge {
  position: absolute;
  inset: .5rem auto auto .5rem;
  color: white;
  background: #b00020;
  border-radius: 4px;
  padding: .18rem .4rem;
  font-size: .72rem;
  font-weight: 700;
}
.pagination { display: flex; justify-content: center; flex-wrap: wrap; gap: .4rem; margin-top: 1rem; }
.pagination button, .retry {
  min-width: 42px;
  min-height: 42px;
  border: 1px solid #ababab;
  border-radius: 5px;
  color: #222;
  background: white;
}
.pagination button[aria-current=page] { background: #0058a8; color: white; border-color: #0058a8; }
dialog { width: min(calc(100% - 2rem), 28rem); padding: 1.5rem; border: 0; border-radius: 9px; }
dialog::backdrop { background: rgb(0 0 0 / .65); }
dialog h2 { margin: 0 2rem .65rem 0; }
dialog p { margin: 0; overflow-wrap: anywhere; }
#popup-close-btn {
  position: absolute;
  top: .25rem;
  right: .35rem;
  min-width: 42px;
  min-height: 42px;
  color: #444;
  background: transparent;
  border: 0;
  border-radius: 50%;
  font-size: 1.6rem;
}
#popup-close-btn:hover { background: #f0f0f0; }
.post-header { color: white; background: #333; font-size: 1.35rem; font-weight: 700; }
.post-header p { margin: 0; }
.back { margin: 1rem; text-align: center; }
.post { max-width: 840px; margin: 0 auto 2rem; padding: 1rem; background: white; text-align: center; }
.post h1 { font-size: clamp(1.3rem, 4vw, 2rem); overflow-wrap: anywhere; }
.post iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 70vh;
  border: 0;
  border-radius: 7px;
  background: #222;
}
.suggestions { margin-top: 2rem; }
.suggestions .grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); }
.suggestions h2 { font-size: 1.2rem; }
@media (max-width: 720px) {
  .layout { display: block; }
  .sidebar { border-right: 0; border-bottom: 1px solid #ddd; }
  .categories { display: flex; flex-wrap: wrap; gap: .3rem; }
  .categories button { border-color: #ccc; }
  .shop { width: 78px; margin: .75rem 0 0 auto; }
  .shop img { max-height: 72px; width: auto; margin-left: auto; }
  .main { padding: .75rem; }
  .grid { gap: .65rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 145px), 1fr)); }
}
