@font-face {
  font-family: ComicSansMS; /* set name */
  src: url(Comic-Sans-MS.ttf); /* url of the font */
}
body {
  margin: 0;
  font-family: ComicSansMS, sans-serif;
  background-color: #7b7b7b;
  color: #202124;
}
.topbar {
  background-color: #7b7b7b;
  border-bottom: 1px solid #e8eaed;
  padding: 16px 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.search-row {
  display: flex;
  align-items: center;
  max-width: 1040px;
  margin: 0 auto;
  gap: 16px;
}
.search-logo {
  font-size: 24px;
  font-weight: bold;
  color: #1a73e8;
}
.search-form {
  flex: 1;
  display: flex;
  border: 1px solid #dfe1e5;
  border-radius: 24px;
  padding: 10px 16px;
  background: #fff;
}
.search-input {
  border: none;
  width: 100%;
  font-size: 16px;
  outline: none;
  background: transparent;
}
.search-button {
  border: none;
  background: #1a73e8;
  color: white;
  font-size: 14px;
  padding: 10px 16px;
  border-radius: 20px;
  cursor: pointer;
}
.page-meta {
  max-width: 1040px;
  margin: 18px auto 0;
  color: #5f6368;
  font-size: 14px;
}
.content {
  margin: 40px 450px 40px 40px;
  display: block;
}
.results-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 260px));
}
.result-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: white;
  border: 1px solid #e8eaed;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(60,64,67,0.15);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  text-align: center;
}
.result-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(60,64,67,0.16);
}

.result-card.active {
  outline: 3px solid #1a73e8;
  box-shadow: 0 8px 20px rgba(26,115,232,0.12);
  transform: translateY(-4px);
}
.result-image {
  width: 260px;
  height: 260px;
  display: block;
  object-fit: cover;
}
.result-info {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px 14px 14px;
  min-height: 45px;
}
.result-title {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: #202124;
}
.result-source {
  margin: 0;
  font-size: 16px;
  color: #5f6368;
}
.details-panel {
  position: fixed;
  top: 100px;
  right: 40px;
  width: 340px;
  height: calc(100vh - 180px);
  overflow-x: hidden;
  overflow-y: auto;
  background: white;
  border: 1px solid #e8eaed;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(60,64,67,0.18);
  z-index: 20;
}

#detailsClose {
  position: absolute;
  top: 8px;
  right: 10px;
  background: transparent;
  border: none;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  color: #5f6368;
  font-weight: bold;
  display: none;
}

#detailsClose:hover {
  color: #202124;
}
.details-title {
  margin: 0 0 10px;
  font-size: 20px;
  line-height: 1.2;
  text-align: center;
}
.details-preview {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e8eaed;
  margin-bottom: 18px;
  background: #f1f3f4;
}
.details-preview img {
  width: 100%;
  display: block;
}
.details-meta {
  display: grid;
  gap: 10px;
  font-size: 20px;
  color: #3c4043;
}
.details-meta strong {
  color: #202124;
}
.details-description {
  margin: 16px 0 0;
  color: #5f6368;
  line-height: 1.5;
  font-size: 14px;
}
.footer-note {
  margin-top: 20px;
  font-size: 13px;
  color: #5f6368;
}
.thumbnail {
  max-width: 150px;
  max-height: 150px;
  margin: 10px;
}
@media (max-width: 960px) {
  body {
    padding-right: 0;
  }
  .content {
    margin: 24px;
  }
  .results-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 110px));
  }
  .result-image {
    width: 100%;
    height: 110px;
  }
  .details-panel {
    position: static;
    top: auto;
    width: auto;
    height: auto;
    max-height: none;
    overflow: visible;
    margin-top: 24px;
    padding: 18px;
  }
  .details-title {
    font-size: 18px;
  }
  .details-meta {
    font-size: 16px;
  }
  .details-description {
    font-size: 15px;
  }
}

@media (max-width: 640px) {
  .content {
    margin: 16px;
  }
  .results-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 110px));
    gap: 14px;
  }
  .result-card {
    border-radius: 14px;
  }
  .result-image {
    height: 110px;
  }
  .details-panel {
    margin-top: 20px;
    padding: 16px;
    border-radius: 14px;
  }
  .details-preview {
    border-radius: 12px;
  }
  .details-meta {
    display: block;
    gap: 6px;
  }
  .details-description {
    line-height: 1.6;
  }
  .details-panel {
    position: fixed;
    top: 20px;
    left: 40px;
    display: none;
    overflow-x: hidden;
    overflow-y: auto;
    background: white;
    border: 1px solid #e8eaed;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 24px rgba(60,64,67,0.18);
    z-index: 40;
    max-height: 80%;
  }
  #detailsClose {
    top: 10px;
    right: 10px;
    display: block;
  }
  .result-info {
    padding: 6px;
    min-height: 75px;
  }
}

body.modal-open {
  overflow: hidden;
  height: 100vh;
}

.bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 15;
  display: none;
}