@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap");

:root {
  --bg: #f3f6fb;
  --panel: #ffffff;
  --text: #12193b;
  --muted: #4a5a97;
  --line: #d6ddf2;
  --accent: #1133af;
  --accent-strong: #0d2890;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at 15% 10%, #e6ebff, var(--bg) 35%, #eef2ff 100%);
  color: var(--text);
  font: 16px/1.45 "Poppins", "Segoe UI", Tahoma, sans-serif;
}

.app {
  width: min(960px, 92vw);
  margin: 28px auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 12px 34px rgba(16, 42, 128, 0.08);
}

.search {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.search input,
.search button {
  font: inherit;
}

.search input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: #fcfdff;
}

.search input:focus {
  outline: 2px solid #1133af;
  outline-offset: 1px;
}

.search button {
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  padding: 12px 18px;
  cursor: pointer;
}

.search button:hover {
  background: var(--accent-strong);
}

.chart-panel {
  margin: 0 0 16px;
  padding: 14px 12px 34px;
  border: 1px solid #dde3fb;
  border-radius: 12px;
  background: linear-gradient(180deg, #fcfdff, #f5f8ff);
}

.chart-bars {
  margin-top: 8px;
  display: flex;
  align-items: flex-end;
  gap: var(--bucket-gap, 4px);
  min-height: calc(var(--stack-height, 122px) + 14px);
  max-height: calc(var(--stack-height, 122px) + 14px);
  overflow: visible;
  padding: 6px var(--chart-side-padding, 26px) 0;
  border-top: 0;
  border-bottom: 1px solid #e3e9fb;
}

.chart-empty {
  color: var(--muted);
  padding: 10px 0;
}

.bucket {
  width: var(--bucket-width, 12px);
  min-width: var(--bucket-width, 12px);
  max-width: var(--bucket-width, 12px);
  flex: 0 0 var(--bucket-width, 12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  position: relative;
}

.blob-stack {
  width: 100%;
  height: var(--stack-height, 122px);
  display: flex;
  flex-direction: column-reverse;
  align-items: stretch;
  justify-content: flex-start;
  gap: var(--blob-gap, 1px);
  padding-bottom: 0;
  overflow: hidden;
}

.email-blob {
  display: block;
  width: 100%;
  height: var(--blob-height, 4px);
  box-sizing: border-box;
  border-radius: 999px;
  border: 0;
  opacity: 0.9;
  transition: transform 0.08s ease, opacity 0.08s ease, filter 0.08s ease, box-shadow 0.08s ease;
  cursor: pointer;
}

.email-blob:hover,
.email-blob:focus {
  opacity: 1;
  filter: saturate(1.1) brightness(1.04);
  transform: scaleX(1.08);
  box-shadow: 0 0 0 1px rgba(17, 51, 175, 0.35);
  outline: none;
}

.bucket-label {
  width: auto;
  font-size: clamp(0.82rem, 2.5vw, 0.95rem);
  font-weight: 600;
  line-height: 1.1;
  color: #253d93;
  text-align: center;
  white-space: nowrap;
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  margin-top: 0;
  pointer-events: none;
}

.chart-touch-popup {
  position: fixed;
  left: 0;
  top: 0;
  transform: translate(-50%, -100%);
  z-index: 9999;
  max-width: min(320px, calc(100vw - 24px));
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(10, 37, 140, 0.35);
  background: #1133af;
  color: #ffffff;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(10, 35, 120, 0.28);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chart-touch-popup.chart-touch-popup--below {
  transform: translate(-50%, 0);
}

.chart-touch-popup[hidden] {
  display: none;
}

.chart-touch-date {
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.2;
}

.chart-touch-detail {
  font-size: 0.79rem;
  line-height: 1.32;
  opacity: 0.95;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.chart-touch-open {
  font-size: 0.74rem;
  font-weight: 600;
  opacity: 0.95;
  padding-top: 2px;
}

.status {
  margin: 14px 0;
  color: var(--muted);
}

.results {
  margin: 0;
  padding-left: 22px;
}

.results-pagination {
  margin-top: 10px;
  display: flex;
  justify-content: center;
}

.results-more-btn {
  border: 1px solid #b7c6fb;
  border-radius: 10px;
  background: #eef2ff;
  color: #1133af;
  font: inherit;
  font-weight: 600;
  padding: 10px 14px;
  cursor: pointer;
}

.results-more-btn:hover,
.results-more-btn:focus {
  background: #1133af;
  color: #ffffff;
  border-color: #1133af;
}

.results-more-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.results li {
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e4e9fa;
}

.result-link {
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
}

.result-link:hover,
.result-link:focus {
  text-decoration: underline;
}

.result-snippet {
  margin: 6px 0 0;
  color: var(--text);
}

.result-meta {
  margin-top: 5px;
  color: #2f4388;
  font-size: 0.84rem;
}

mark {
  background: #1133af;
  color: #ffffff;
  padding: 0 2px;
  border-radius: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 640px) {
  .app {
    margin: 16px auto;
    padding: 16px;
  }

  .search {
    grid-template-columns: 1fr;
  }

  .search button {
    width: 100%;
  }
}
