:root {
  --ink: #1c1b16;
  --muted: #5b584d;
  --bg: #f3efe6;
  --bg-deep: #ebe4d6;
  --card: #fffdf8;
  --accent: #2f6b4f;
  --accent-dark: #1f4a36;
  --accent-soft: #d6e6dc;
  --gold: #c8933b;
  --shadow: 0 18px 40px rgba(23, 33, 26, 0.12);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(1200px 600px at 0% -10%, #f8f6f0 0%, transparent 70%),
    radial-gradient(900px 500px at 100% 0%, #e7f1ea 0%, transparent 70%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  min-height: 100dvh;
  height: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

.page {
  height: 100dvh;
  min-height: 100svh;
  padding-left: clamp(14px, 4vw, 36px);
  padding-right: clamp(14px, 4vw, 36px);
  padding-top: calc(12px + env(safe-area-inset-top));
  padding-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
}

.site-header {
  padding: clamp(12px, 3vw, 18px);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(255, 248, 236, 0.95) 0%, rgba(242, 246, 239, 0.9) 55%, rgba(233, 240, 234, 0.85) 100%);
  border: 1px solid rgba(47, 107, 79, 0.12);
  box-shadow: 0 16px 32px rgba(23, 33, 26, 0.1);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: padding 0.28s ease, box-shadow 0.28s ease, transform 0.28s ease;
}

.site-header::before {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  left: -70px;
  top: -90px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.7) 0%, transparent 65%);
  opacity: 0.5;
  animation: floatBlob 16s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

.site-header::after {
  content: "";
  position: absolute;
  width: 160px;
  height: 160px;
  right: -60px;
  top: -80px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.7) 0%, transparent 65%);
  opacity: 0.6;
  animation: floatBlob 12s ease-in-out infinite reverse;
  pointer-events: none;
  z-index: 0;
}

.site-header > * {
  position: relative;
  z-index: 1;
}

.app-title {
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: clamp(1.5rem, 4.2vw, 2.4rem);
  margin: 2px 0 4px;
  letter-spacing: -0.02em;
  transform-origin: left center;
  transition: transform 0.28s ease;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  max-height: 3rem;
  overflow: hidden;
  transition: opacity 0.22s ease, transform 0.22s ease, max-height 0.22s ease;
}

.page.is-scrolled .site-header {
  padding: clamp(6px, 2vw, 10px);
  box-shadow: 0 8px 16px rgba(23, 33, 26, 0.08);
}

.page.is-scrolled .app-title {
  transform: scale(0.9);
}

.page.is-scrolled .subtitle {
  opacity: 0;
  transform: translateY(-6px);
  max-height: 0;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 600;
}

.main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 80px;
}

.search-card {
  --search-scale: 1;
  --search-lift: 0px;
  padding: 8px;
  padding-bottom: 8px;
  border-radius: calc(var(--radius-md) + 6px);
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid rgba(47, 107, 79, 0.1);
  box-shadow: 0 -12px 24px rgba(23, 33, 26, 0.12);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: fixed;
  left: 50%;
  transform: translateX(-50%) translateY(var(--search-lift)) scale(var(--search-scale));
  width: min(980px, calc(100% - 28px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  bottom: calc(4px + env(safe-area-inset-bottom));
  z-index: 20;
  backdrop-filter: blur(12px) saturate(1.1);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  transition: transform 0.24s ease, box-shadow 0.24s ease, background 0.24s ease;
  isolation: isolate;
}

.search-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 15% 0%, rgba(255, 255, 255, 0.7), transparent 60%),
    radial-gradient(circle at 80% 120%, rgba(255, 255, 255, 0.55), transparent 55%);
  opacity: 0.6;
  pointer-events: none;
  animation: floatBlob 18s ease-in-out infinite;
  z-index: 0;
}

.search-card:focus-within {
  --search-scale: 1.02;
  --search-lift: -2px;
  box-shadow: 0 -16px 28px rgba(23, 33, 26, 0.16);
}

.search-card > * {
  position: relative;
  z-index: 1;
}

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

.search-row {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  align-items: center;
}

.search-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.86));
  border: 1px solid rgba(47, 107, 79, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  flex: 1 1 240px;
  position: relative;
  transition: background 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.search-input:focus-within {
  border-color: rgba(47, 107, 79, 0.4);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 0 0 3px rgba(47, 107, 79, 0.16), 0 6px 16px rgba(23, 33, 26, 0.12);
}

.search-icon {
  width: 18px;
  height: 18px;
  color: var(--muted);
  display: grid;
  place-items: center;
}

.search-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

input[type="search"] {
  flex: 1 1 auto;
  border: none;
  background: transparent;
  font-size: 1rem;
  color: var(--ink);
  padding: 0 30px 0 0;
  min-width: 0;
}

input[type="search"]:focus {
  outline: none;
}

input[type="search"]::-webkit-search-cancel-button {
  display: none;
}

button {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(47, 107, 79, 0.25);
}

.clear-btn {
  background: transparent;
  color: var(--accent-dark);
  font-weight: 600;
  font-size: 0.85rem;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 999px;
  box-shadow: none;
  transition: opacity 0.2s ease;
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
}

.clear-btn:hover {
  transform: none;
  box-shadow: none;
}

#search:placeholder-shown + .clear-btn {
  opacity: 0;
  pointer-events: none;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.hint-details {
  position: relative;
  flex: 0 0 auto;
}

.hint-details summary {
  list-style: none;
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(47, 107, 79, 0.12);
  color: var(--accent-dark);
  font-weight: 700;
  border: 1px solid rgba(47, 107, 79, 0.18);
}

.info-icon {
  font-size: 0.9rem;
  line-height: 1;
}

.hint-details summary::-webkit-details-marker {
  display: none;
}

.hint-details[open] summary {
  background: rgba(47, 107, 79, 0.18);
}

.hint-details .hint {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  margin: 0;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.98);
  border: 1px solid rgba(47, 107, 79, 0.12);
  box-shadow: 0 8px 16px rgba(23, 33, 26, 0.08);
  max-width: 320px;
}

.results {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 16px;
}

.results-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.results-bar h2 {
  margin: 0 0 2px;
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

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

.sort-note {
  font-size: 0.75rem;
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px dashed rgba(28, 27, 22, 0.2);
}

.results-list {
  display: grid;
  gap: 14px;
}

.result-card {
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(255, 253, 248, 0.9));
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid rgba(47, 107, 79, 0.08);
  box-shadow: 0 12px 24px rgba(23, 33, 26, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  animation: cardIn 360ms cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
  animation-delay: var(--stagger, 0ms);
}

.result-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 15% -10%, rgba(255, 255, 255, 0.55), transparent 55%);
  opacity: 0.6;
  pointer-events: none;
}

.result-card > * {
  position: relative;
  z-index: 1;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.card-head h3 {
  margin: 0;
  font-size: 1.2rem;
}

.ek-price {
  background: rgba(47, 107, 79, 0.12);
  color: var(--accent-dark);
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  white-space: nowrap;
}

.card-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.card-details {
  border-radius: var(--radius-sm);
  border: 1px solid rgba(47, 107, 79, 0.08);
  background: rgba(255, 253, 248, 0.85);
  overflow: hidden;
}

.card-details summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 600;
  color: var(--accent-dark);
}

.card-details summary::-webkit-details-marker {
  display: none;
}

.card-details summary::after {
  content: ">";
  font-size: 0.85rem;
  transform: rotate(90deg);
  transition: transform 0.2s ease;
  color: var(--muted);
}

.card-details[open] summary {
  background: rgba(47, 107, 79, 0.08);
}

.card-details[open] summary::after {
  transform: rotate(-90deg);
}

.details-meta {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

.card-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.card-details .card-grid {
  padding: 0 12px 12px;
}

.card-field {
  background: rgba(255, 253, 248, 0.85);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  border: 1px solid rgba(47, 107, 79, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.card-field span {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 4px;
}

.card-field strong {
  font-size: 0.95rem;
}

.empty-state {
  text-align: center;
  padding: 30px 20px;
  background: #fff7e9;
  border-radius: var(--radius-md);
  border: 1px solid rgba(200, 147, 59, 0.25);
}

.empty-state h3 {
  margin: 0 0 8px;
  font-family: "Fraunces", "Times New Roman", serif;
}

.hidden {
  display: none;
}

@keyframes floatBlob {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(12px, 10px) scale(1.05);
  }
  100% {
    transform: translate(0, 0) scale(1);
  }
}

@keyframes cardIn {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-header,
  .search-card,
  .search-input,
  .app-title,
  .subtitle {
    transition: none;
  }

  .site-header::before,
  .site-header::after,
  .search-card::before {
    animation: none;
  }

  .result-card {
    animation: none;
    opacity: 1;
    transform: none;
  }
}


@media (max-width: 600px) {
  .subtitle {
    display: none;
  }
}

@media (min-width: 720px) {
  .page {
    gap: 20px;
  }

  .search-row {
    flex-wrap: nowrap;
  }

  .results-list {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

@media (min-width: 900px) {
  .page {
    max-width: 980px;
    margin: 20px auto;
    border-radius: 32px;
    background: rgba(255, 253, 248, 0.45);
    border: 1px solid rgba(47, 107, 79, 0.12);
    box-shadow: 0 24px 60px rgba(23, 33, 26, 0.18);
  }
}

@media (min-width: 1024px) {
  .main {
    gap: 28px;
  }

  .result-card {
    padding: 20px;
  }
}
