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

:root {
  --primary: #ff6b35;
  --primary-dark: #e2551f;
  --primary-light: #fff0ea;
  --accent: #1e88e5;
  --bg: #f8f5f2;
  --card: #ffffff;
  --text: #2d2a26;
  --text-muted: #7a726b;
  --border: #e8e2db;
  --shadow: 0 10px 40px rgba(120, 80, 60, 0.08);
  --radius: 18px;
}

html {
  font-size: 16px;
}

body {
  font-family: "Vazirmatn", system-ui, -apple-system, sans-serif;
}

.app {
  max-width: 860px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  text-align: center;
  padding: 1rem 0 1.6rem;
  position: relative;
}

.back-btn {
  position: absolute;
  top: 0.5rem;
  right: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--card);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.25s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.back-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  transform: translateX(-3px);
  box-shadow: 0 4px 16px rgba(255, 107, 53, 0.15);
}

.title {
  font-size: clamp(1.5rem, 4vw, 2.3rem);
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--primary) 0%, #ff9a3c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-top: 1.6rem;
}

.title .arrow {
  display: inline-block;
  -webkit-text-fill-color: var(--accent);
  font-weight: 400;
  margin: 0 0.15rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: clamp(0.85rem, 2.2vw, 1rem);
  margin-top: 0.4rem;
}

/* Search */
.search-section {
  position: relative;
  margin-bottom: 1.4rem;
}

.input-wrap {
  display: flex;
  gap: 0.6rem;
  background: var(--card);
  padding: 0.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 2px solid transparent;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 10px 40px rgba(255, 107, 53, 0.18);
}

.word-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 1.1rem;
  padding: 0.7rem 1rem;
  color: var(--text);
  min-width: 0;
}

.word-input::placeholder {
  color: #b8afa7;
}

.search-btn {
  background: linear-gradient(135deg, var(--primary) 0%, #ff8a3c 100%);
  color: #fff;
  border: none;
  padding: 0.7rem 2rem;
  border-radius: 14px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  box-shadow: 0 6px 20px rgba(255, 107, 53, 0.35);
  white-space: nowrap;
}

.search-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255, 107, 53, 0.45);
}

.search-btn:active {
  transform: translateY(0);
  filter: brightness(0.95);
}

/* Suggestions */
.suggestions {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  z-index: 100;
  border: 1px solid var(--border);
  max-height: 280px;
  overflow-y: auto;
}

.suggestions:empty {
  display: none;
}

.suggestion-item {
  padding: 0.75rem 1.1rem;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-bottom: 1px solid #f3efe9;
}

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

.suggestion-item:hover,
.suggestion-item.active {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.suggestion-item .icon {
  color: var(--primary);
  flex-shrink: 0;
}

.suggestion-item mark {
  background: transparent;
  color: var(--primary);
  font-weight: 700;
}

/* Result */
.result {
  animation: fadeUp 0.4s ease;
}

.result.hidden {
  display: none;
}

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

.result-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.8rem 1.6rem;
  border: 1px solid var(--border);
}

.result-word-fa {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 700;
  padding: 0.25rem 1rem;
  border-radius: 999px;
  font-size: 0.95rem;
  margin-bottom: 1.2rem;
}

/* Main equivalent */
.main-equiv {
  text-align: center;
  padding: 1.5rem 1rem;
  background: linear-gradient(160deg, #fffaf7 0%, #fff 100%);
  border-radius: 16px;
  border: 1px dashed #ffd4c2;
  margin-bottom: 1.6rem;
}

.main-devanagari {
  font-family: "Tiro Devanagari Hindi", "Vazirmatn", sans-serif;
  font-size: clamp(2rem, 7vw, 3.2rem);
  font-weight: 400;
  color: var(--text);
  line-height: 1.3;
}

.main-roman {
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  color: var(--primary-dark);
  font-weight: 600;
  margin-top: 0.2rem;
  letter-spacing: 0.3px;
}

.lang-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  margin-right: 0.4rem;
  vertical-align: middle;
  font-family: "Vazirmatn", sans-serif;
  direction: ltr;
  unicode-bidi: embed;
}

.lang-badge.alt {
  background: #7e57c2;
}

/* Section titles */
.section-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title::before {
  content: "";
  width: 4px;
  height: 18px;
  background: var(--primary);
  border-radius: 4px;
}

/* Alternatives */
.alternatives {
  margin-bottom: 1.6rem;
}

.alt-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.alt-item {
  background: #f6f2ee;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.55rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.alt-item:hover {
  transform: translateY(-2px);
  border-color: #d9cfc5;
}

.alt-devanagari {
  font-family: "Tiro Devanagari Hindi", sans-serif;
  font-size: 1.25rem;
}

.alt-sep {
  color: #c8bdb3;
  font-size: 0.8rem;
}

.alt-roman {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Examples */
.examples {
  display: grid;
  gap: 1rem;
}

.example-card {
  background: #faf8f5;
  border: 1px solid var(--border);
  border-right: 4px solid var(--primary);
  border-radius: 12px;
  padding: 1rem 1.1rem;
}

.example-fa {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.5rem;
  direction: rtl;
}

.example-hi {
  font-family: "Tiro Devanagari Hindi", sans-serif;
  font-size: 1.15rem;
  color: var(--text);
  margin-bottom: 0.2rem;
  direction: ltr;
  text-align: left;
}

.example-roman {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  direction: ltr;
  text-align: left;
}

/* Not found */
.not-found {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.not-found .emoji {
  font-size: 2.8rem;
  display: block;
  margin-bottom: 0.8rem;
}

/* Responsive */
@media (max-width: 560px) {
  .app {
    padding: 1rem 0.7rem 2rem;
  }

  .back-btn {
    top: 0;
    padding: 0.4rem 0.8rem;
    font-size: 0.82rem;
  }

  .title {
    margin-top: 2.4rem;
  }

  .input-wrap {
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.5rem;
  }

  .word-input {
    text-align: center;
    font-size: 1rem;
    padding: 0.6rem;
  }

  .search-btn {
    width: 100%;
    padding: 0.65rem;
  }

  .result-card {
    padding: 1.3rem 1rem;
  }

  .main-equiv {
    padding: 1.2rem 0.7rem;
  }

  .alt-list {
    flex-direction: column;
  }

  .alt-item {
    justify-content: center;
  }
}