:root {
  --bg: #f4efe3;
  --bg-accent: #f8c06c;
  --panel: rgba(250, 246, 238, 0.88);
  --panel-strong: rgba(255, 252, 246, 0.96);
  --border: rgba(32, 24, 10, 0.14);
  --text: #1d160d;
  --muted: #625746;
  --accent: #b24c2e;
  --accent-dark: #8e351a;
  --shadow: 0 24px 60px rgba(84, 42, 16, 0.15);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(248, 192, 108, 0.65), transparent 30%),
    radial-gradient(circle at right, rgba(178, 76, 46, 0.18), transparent 24%),
    linear-gradient(160deg, #f6f1e8 0%, #efe4d2 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent 80%);
}

.page-shell {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3rem 0 4rem;
}

.hero {
  max-width: 780px;
  margin-bottom: 2rem;
  animation: rise 0.7s ease-out both;
}

.eyebrow,
.results-label,
.label {
  margin: 0 0 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.8rem;
  color: var(--accent-dark);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2.8rem, 7vw, 5.8rem);
  line-height: 0.92;
  max-width: 10ch;
}

.intro {
  margin-top: 1rem;
  max-width: 56ch;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 1.25rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.search-panel {
  padding: 1.4rem;
  position: sticky;
  top: 1.25rem;
  align-self: start;
  animation: rise 0.85s ease-out both;
}

.search-form {
  display: grid;
  gap: 0.85rem;
}

.toggle-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  color: var(--text);
  font-size: 0.98rem;
}

.toggle-row input {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
}

input,
button {
  font: inherit;
}

input {
  width: 100%;
  border: 1px solid rgba(29, 22, 13, 0.12);
  border-radius: 18px;
  padding: 1rem 1.05rem;
  background: rgba(255, 252, 246, 0.92);
  color: var(--text);
  outline: none;
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

input:focus {
  border-color: rgba(178, 76, 46, 0.5);
  box-shadow: 0 0 0 4px rgba(178, 76, 46, 0.12);
}

button {
  border: 0;
  border-radius: 18px;
  cursor: pointer;
}

#submit-button {
  padding: 0 1.2rem;
  min-width: 132px;
  background: linear-gradient(135deg, var(--accent) 0%, #d9773e 100%);
  color: #fff8f0;
  font-weight: 700;
  transition: transform 140ms ease, filter 140ms ease;
}

#submit-button:hover,
.chip:hover {
  transform: translateY(-1px);
  filter: saturate(1.08);
}

#submit-button:disabled {
  cursor: progress;
  opacity: 0.72;
}

.tips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-top: 1rem;
  color: var(--muted);
}

.chip {
  padding: 0.55rem 0.85rem;
  background: rgba(178, 76, 46, 0.08);
  color: var(--accent-dark);
}

.status {
  margin-top: 1.2rem;
  min-height: 2.8rem;
  color: var(--muted);
  line-height: 1.5;
}

.results-panel {
  padding: 1.4rem;
  animation: rise 1s ease-out both;
}

.results-head {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 1rem;
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2.4rem);
}

.results-count {
  color: var(--muted);
}

.results-list {
  display: grid;
  gap: 0.9rem;
}

.empty-state {
  min-height: 280px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 2rem;
  color: var(--muted);
  border: 1px dashed rgba(29, 22, 13, 0.16);
  border-radius: 24px;
  background: rgba(255, 252, 246, 0.45);
}

.tweet-card {
  padding: 1rem;
  border: 1px solid rgba(29, 22, 13, 0.08);
  background: var(--panel-strong);
  border-radius: 24px;
  display: grid;
  gap: 0.85rem;
  animation: rise 0.45s ease both;
}

.tweet-top,
.tweet-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.tweet-author {
  display: grid;
  gap: 0.15rem;
}

.tweet-name {
  font-weight: 700;
}

.tweet-handle,
.metric,
.tweet-time {
  color: var(--muted);
}

.tweet-text {
  line-height: 1.6;
  font-size: 1.02rem;
  white-space: pre-wrap;
}

.tweet-media {
  display: grid;
  gap: 0.75rem;
}

.media-card {
  margin: 0;
  overflow: hidden;
  border-radius: 20px;
  background: rgba(29, 22, 13, 0.05);
  border: 1px solid rgba(29, 22, 13, 0.08);
}

.tweet-image,
.tweet-video,
.tweet-embed {
  display: block;
  width: 100%;
  max-height: 560px;
  border: 0;
  background: #120d08;
}

.tweet-image,
.tweet-video {
  object-fit: contain;
}

.tweet-embed {
  min-height: 360px;
}

.tweet-meta {
  justify-content: flex-start;
}

.metric {
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  background: rgba(29, 22, 13, 0.05);
}

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

.raw-panel {
  margin-top: 1rem;
  border-top: 1px solid rgba(29, 22, 13, 0.08);
  padding-top: 1rem;
}

.raw-panel summary {
  cursor: pointer;
  color: var(--accent-dark);
  font-weight: 700;
}

pre {
  margin: 0.85rem 0 0;
  max-height: 360px;
  overflow: auto;
  padding: 1rem;
  border-radius: 18px;
  background: #20180f;
  color: #f5e9d6;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.85rem;
  line-height: 1.5;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .search-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 1rem, 1120px);
    padding-top: 1.2rem;
  }

  .panel {
    border-radius: 22px;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  #submit-button {
    min-height: 52px;
  }

  h1 {
    max-width: 12ch;
  }
}
