:root{
  --bg:#f5f5f4;
  --card:#ffffff;
  --text:#111111;
  --muted:#7a7a7a;
  --line:#e7e7e7;

  --brand:#6d28d9;
  --brand2:#8b5cf6;
  --brandSoft:#f4edff;

  --shadow:
    0 10px 30px rgba(0,0,0,.05),
    0 2px 10px rgba(0,0,0,.03);

  --max:430px;
}

*{
  margin:0;
  padding:0;
  box-sizing:border-box;
}

html{
  scroll-behavior:smooth;
}

body{
  font-family:Inter,sans-serif;
  background:var(--bg);
  color:var(--text);
  -webkit-font-smoothing:antialiased;
}

a{
  color:inherit;
  text-decoration:none;
}

button,
input{
  font-family:inherit;
}

.app{
  max-width:var(--max);
  margin:0 auto;
  min-height:100vh;
  background:var(--bg);
}

/* =========================
TOP BAR
========================= */

.topbar{
  padding:
    calc(env(safe-area-inset-top) + 14px)
    18px
    12px;

  display:flex;
  align-items:center;
  justify-content:space-between;
}

.top-left{
  display:flex;
  align-items:center;
  gap:10px;
}

.back-btn{
  width:38px;
  height:38px;
  border:none;
  background:transparent;
  border-radius:50%;
  display:grid;
  place-items:center;
  cursor:pointer;
}

.back-btn svg{
  width:22px;
  height:22px;
}

.top-label{
  font-size:15px;
  font-weight:700;
  letter-spacing:-.02em;
}

.top-right{
  display:flex;
  align-items:center;
  gap:12px;
}

.top-icon{
  width:38px;
  height:38px;
  border:none;
  background:#fff;
  border-radius:50%;
  display:grid;
  place-items:center;
  box-shadow:var(--shadow);
}

.top-icon svg{
  width:18px;
  height:18px;
  stroke:var(--brand);
}

/* =========================
LOGO
========================= */

.hero{
  padding:14px 18px 8px;
  text-align:center;
}

.hero-logo{
  width: clamp(180px, 52vw, 240px);
  height: auto;
  display: inline-block;
  object-fit: contain;
}

/* =========================
SEARCH BAR
========================= */

.search-wrap{
  padding:18px;
}

.search-form{
  position:relative;
}

.search-input{
  width:100%;
  height:66px;
  border-radius:999px;
  border:2px solid #ddd;
  background:#fff;

  padding:0 64px 0 24px;

  font-size:20px;
  outline:none;

  box-shadow:var(--shadow);
}

.search-input:focus{
  border-color:var(--brand2);
}

.search-btn{
  position:absolute;
  right:8px;
  top:8px;

  width:50px;
  height:50px;
  border:none;
  border-radius:50%;
  background:var(--brand);
  color:#fff;

  display:grid;
  place-items:center;
  cursor:pointer;
}

.search-btn svg{
  width:22px;
  height:22px;
  stroke:#fff;
}

/* =========================
TRENDING
========================= */

.section{
  padding:10px 18px 24px;
}

.section-head{
  font-size:22px;
  font-weight:800;
  letter-spacing:-.03em;
  margin-bottom:16px;
}

.trend-list{
  background:#fff;
  border-radius:24px;
  overflow:hidden;
  box-shadow:var(--shadow);
}

.trend-item{
  display:grid;
  grid-template-columns:42px 1fr 36px;
  gap:18px;
  align-items:center;

  min-height:92px;
  padding:0 20px;

  border-bottom:1px solid var(--line);
  cursor:pointer;
}

.trend-item:last-child{
  border-bottom:none;
}

.rank{
  font-size:16px;
  font-weight:900;
}

.term{
  font-size:17px;
  font-weight:500;
  line-height:1.4;
}

.mini-search svg{
  width:20px;
  height:20px;
  stroke:#666;
}

/* =========================
RESULTS
========================= */

.results{
  padding:0 18px 40px;
}

.result-card{
  background:#fff;
  border-radius:22px;
  overflow:hidden;
  margin-bottom:14px;
  box-shadow:var(--shadow);
  cursor:pointer;
}

.result-card img{
  width:100%;
  height:190px;
  object-fit:cover;
  display:block;
}

.result-body{
  padding:14px;
}

.result-tag{
  display:inline-flex;
  align-items:center;
  gap:6px;

  font-size:11px;
  font-weight:800;
  letter-spacing:.14em;
  text-transform:uppercase;

  color:var(--brand);
  margin-bottom:10px;
}

.result-title{
  font-size:20px;
  line-height:1.2;
  font-weight:800;
  letter-spacing:-.03em;
  margin-bottom:8px;
}

.result-meta{
  font-size:13px;
  color:var(--muted);
}

.empty{
  background:#fff;
  border-radius:22px;
  padding:28px 18px;
  box-shadow:var(--shadow);
}

.empty h3{
  font-size:22px;
  margin-bottom:8px;
}

.empty p{
  color:var(--muted);
  line-height:1.6;
}

.loading{
  padding:22px;
  text-align:center;
  color:var(--muted);
  font-weight:600;
}

/* =========================
FOOTER SPACE
========================= */

.spacer{
  height:30px;
}

/* =========================
SMALL DEVICES
========================= */

@media (max-width:360px){

  .hero-logo{
  width: clamp(160px, 48vw, 200px);
}

  .search-input{
    font-size:18px;
    height:62px;
  }

  .term{
    font-size:16px;
  }

  .result-title{
    font-size:18px;
  }

}


.hero-subtext{
  margin-top:8px;
  font-size:13px;
  line-height:1.5;
  font-weight:500;
  color:var(--muted);
  letter-spacing:-0.01em;
  max-width:300px;
  margin-left:auto;
  margin-right:auto;
}


/* =========================
X TRENDS SEARCH INPUT ONLY
SCOPE: .x-search
========================= */

.x-search {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 18px 16px 10px;
}

/* container */
.x-search .search-form {
  width: 100%;
  max-width: 720px;

  display: flex;
  align-items: center;
  gap: 10px;

  padding: 6px;

  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.08);

  background: linear-gradient(
    180deg,
    rgba(255,255,255,0.04),
    rgba(255,255,255,0.02)
  );

  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  box-shadow:
    0 10px 30px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.04);

  transition: all .25s ease;
}

/* focus state */
.x-search .search-form:focus-within {
  border-color: rgba(249,115,22,0.5);
  box-shadow:
    0 0 0 3px rgba(249,115,22,0.15),
    0 18px 40px rgba(0,0,0,0.5);
}

/* input */
.x-search .search-form input {
  flex: 1;
  height: 46px;

  border: none;
  outline: none;
  background: transparent;

  color: #f5f5f5;

  font-size: 15px;
  font-weight: 500;

  padding: 0 12px;
}

/* placeholder */
.x-search .search-form input::placeholder {
  color: rgba(154,160,166,0.65);
  font-weight: 400;
}

/* button */
.x-search .search-btn {
  width: 46px;
  height: 46px;

  border: none;
  border-radius: 14px;

  background: rgba(249,115,22,0.12);
  color: #f97316;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;

  transition: all .2s ease;
}

.x-search .search-btn:hover {
  background: rgba(249,115,22,0.18);
  transform: translateY(-1px);
}

.x-search .search-btn:active {
  transform: scale(0.96);
}

/* icon */
.x-search .search-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}

/* mobile */
@media (max-width: 480px) {
  .x-search .search-form {
    border-radius: 16px;
    padding: 5px;
  }

  .x-search .search-form input {
    font-size: 14px;
  }

  .x-search .search-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }
}


/* =========================
INPUT TEXT → DARK MODE FIX
========================= */

.x-search .search-form input {
  color: #111111 !important;
  -webkit-text-fill-color: #111111 !important;

  caret-color: #f97316 !important;

  opacity: 1 !important;
}

/* placeholder adjusted for dark text UI */
.x-search .search-form input::placeholder {
  color: rgba(0, 0, 0, 0.45);
}


/* =========================
SEARCH SUGGESTIONS DROPDOWN
========================= */

.suggestions{
  width:100%;
  max-width:720px;
  margin:6px auto 0;

  border-radius:14px;
  overflow:hidden;

  background:rgba(15,15,15,0.92);
  border:1px solid rgba(255,255,255,0.08);

  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  display:none;

  box-shadow:0 20px 50px rgba(0,0,0,0.45);

  position:relative;
  z-index:50;
}

.suggestions.active{
  display:block;
}

.suggestion-item{
  padding:12px 14px;

  display:flex;
  align-items:center;
  justify-content:space-between;

  cursor:pointer;

  color:#f5f5f5;

  font-size:14px;

  transition:background .15s ease;
}

.suggestion-item:hover{
  background:rgba(255,255,255,0.06);
}

.suggestion-left{
  display:flex;
  flex-direction:column;
  gap:2px;
}

.suggestion-title{
  font-weight:500;
  color:#fff;
}

.suggestion-meta{
  font-size:12px;
  color:rgba(255,255,255,0.5);
}

.suggestion-icon{
  width:18px;
  height:18px;
  opacity:0.6;
}