body {
  font-family: Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  padding-top: 0;
  /* Leave room for fixed footer so content is not obscured */
  padding-bottom: 140px;
  margin: 0;
  background: #fafafa;
  color: #333;
  line-height: 1.5;

}

html { overflow-y: scroll; }

.logo {
    width: 500px;
    height: 150px;
    margin: 20px 0;
    margin-top: 80px;  
    display: block;
}

form {
  display: flex;
  gap: 10px;
  margin-bottom: 1em;
}

#q {
  width: 420px;
  padding: 12px 14px;
  border: 1px solid #d7d7d7;
  border-radius: 10px;
  outline: none;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

#q:focus {
  border-color: #7a9cff;
  box-shadow: 0 0 0 3px rgba(122,156,255,0.15);
}

button {
  padding: 6px !important;
  border: 0;
  border-radius: 10px;
  background: #1e232d;
  transition: background .15s ease;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: .2px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  transition: transform .05s ease, filter .15s ease, box-shadow .15s ease;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 15px;
  min-width: 120px;
  min-height: 25px;  
}

button:hover {
  filter: brightness(1.05);
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
  transform: translateY(-1px);
  background:#11141a;
}

button:active {
  transform: translateY(1px);
}

#status {
  margin-bottom: 1em;
}

#status.error {
  color: #c00;
}

#results {
  width: 80%;
  max-width: 700px;
  padding: 0;
  margin: 0;
}

.pagination {
  width: 80%;
  max-width: 600px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: 12px 0 16px;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid #dcdcdc;
  background: #fff;
  color: #333;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  box-shadow: none;
  transition: none;
}
.page-btn.prev, .page-btn.next { background: #f8f9fb; }
.page-btn:hover { background: #eef1f5; transform: none; filter: none; box-shadow: none; }
.page-btn:focus-visible { outline: 2px solid #7a9cff; outline-offset: 1px; }

.page-btn[disabled], .page-btn.disabled {
  opacity: 0.6;
  cursor: default;
}

.page-btn.active {
  background: #2b313d;
  color: #fff;
  border-color: #2b313d;
}
.page-ellipsis { color: #999; padding: 0 2px; user-select: none; }

/* Google-like result styling */
.result { margin: 0 0 22px; padding: 0; }
.result .rank { display: none; }
.result .item-header { display:flex; align-items:flex-start; gap: 10px; margin: 0 0 4px; }
.result .result-title { margin: 0; font-size: 18px; line-height: 1.25; }
.result .result-link {
  background: none; border: 0; padding: 0; margin: 0;
  color: #1a0dab; font-weight: 500; cursor: pointer; text-align: left;
}
.result .result-link:hover { text-decoration: underline; }
.result .snippet { color: #4d5156; font-size: 14px; line-height: 1.58; }
.result .btn-detail { align-self: flex-start; }

.rank {
  font-weight: bold;
  margin-right: 12px;
}

.body .title {
  font-weight: bold;
  margin-bottom: 4px;
  cursor: pointer;
}
.body .title.linklike { text-decoration: underline; }

.body .meta {
  color: #888;
  font-size: 0.9em;
  margin-bottom: 4px;
}

.body .snippet {
  color: #555;
}

.spinner {
  width: 1em;
  height: 1em;
  border: 2px solid #ccc;
  border-top-color: #333;
  border-radius: 50%;
  display: inline-block;
  animation: spin 1s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.site-footer {
  width: 100%;
  max-width: 720px;
  margin-top: 24px;
  padding: 10px 20px;
  color: #666;
  font-size: 13px;
  text-align: center;
  border-top: 1px solid #e0e0e0;
  position: fixed;
  bottom: 0;
  background-color: #ffffff;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

.site-footer .notice {
  margin-bottom: 8px;
}

.site-footer .legal {
  color: #888;
}

.full.hidden { display: none; }
.full-title { font-weight: 600; margin: 8px 0; }
.full-text { white-space: pre-wrap; line-height: 1.4; color: #222; }

.btn-more { position: fixed; bottom: 18px; right: 18px; padding: 10px 14px; border: 0; border-radius: 10px; background:#111827; color:#fff; box-shadow: 0 2px 8px rgba(0,0,0,.2); cursor: pointer; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .18s ease;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -48%) scale(.98);
  width: min(90vw, 800px);
  max-height: 80vh;
  overflow: auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  padding: 18px 20px;
  z-index: 1001;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: transform .2s cubic-bezier(.2,.8,.2,1), opacity .2s ease, visibility 0s linear .2s;
}

.modal.hidden, .modal-overlay.hidden { display: none; }
.modal-overlay.is-open { opacity: 1; visibility: visible; pointer-events: auto; }
.modal.is-open { opacity: 1; visibility: visible; pointer-events: auto; transform: translate(-50%, -50%) scale(1); transition-delay: 0s; }

.modal-title { margin: 0 0 10px; font-size: 20px; }
.modal-meta { margin: 0 0 12px; color: #666; font-size: 13px; }
.modal-body { white-space: pre-wrap; color: #222; }
.modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: #666;
  border: 0;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  max-width: 30px !important;
  min-width: 30px !important;
  height: 30px;
  border-radius: 50%;
}

.modal-footer { display: flex; justify-content: flex-end; margin-top: 12px; }
.btn-close-modal {
  padding: 8px 12px;
  border: 1px solid #d7d7d7;
  border-radius: 8px;
  background: #f7f8fa;
  color: #1e232d;
  cursor: pointer;
  font-size: 14px;
}
.btn-close-modal:hover { background: #eef1f5; }

.btn-detail {
  padding: 6px 10px;
  font-size: 0.9em;
  width: 50px;
}

.lang-switch {
  position: fixed;
  top: 12px;
  right: 12px;
  color: #555;
  font-size: 14px;
}

.lang-switch select {
  padding: 6px 8px;
  border: 1px solid #d7d7d7;
  border-radius: 8px;
  background: #fff;
}

.engine-switch {
  position: fixed;
  top: 12px;
  left: 12px;
  color: #555;
  font-size: 14px;
}

.engine-switch select {
  padding: 6px 8px;
  border: 1px solid #d7d7d7;
  border-radius: 8px;
  background: #fff;
}
.item-header { display:flex; align-items:center; gap: 10px; margin-bottom: 6px; }
.item-header .title { flex: 1; cursor: default; }

/* Compact secondary button variant for details */
.btn-detail {
  padding: 6px 10px;
  min-width: 0;
  height: auto;
  font-size: 0.85em;
  background: #f7f8fa;
  color: #1e232d;
  border: 1px solid #d7d7d7;
  border-radius: 8px;
  box-shadow: none;
  max-width: 50px !important;
  min-width: 50px !important;
}
.btn-detail:hover { background: #eef1f5; filter: none; box-shadow: none; transform: none; }
.btn-detail:active { transform: none; }
