/* =========================
   Design Tokens
========================= */

:root {
  color-scheme: light dark;

  /* layout */
  --radius: 14px;

  /* motion */
  --ease: cubic-bezier(.2, .9, .3, 1);
  --dur-base: 320ms;

  /* =================
     Light Theme
  ================= */

  /* background */
  --color-bg-base: #f6f9fc;
  --color-bg-subtle: #eef4fb;
  --color-bg-elevated: #ffffff;

  /* text */
  --color-text-primary: #0b1220;
  --color-text-secondary: #6b7280;

  /* brand */
  --color-accent: #4f9cff;
  --color-accent-strong: #2d7be6;

  /* glass */
  --color-glass-bg: rgba(255, 255, 255, 0.72);
  --color-glass-border: rgba(255, 255, 255, 0.4);

  /* effects */
  --shadow-soft: 0 8px 28px rgba(16, 24, 40, 0.06);
  --shadow-strong: 0 20px 60px rgba(16, 24, 40, 0.08);
}

/* =========================
   Dark Theme
========================= */

@media (prefers-color-scheme: dark) {
  :root {
    /* background */
    --color-bg-base: #071026;
    --color-bg-subtle: #07152a;
    --color-bg-elevated: #0b162f;

    /* text */
    --color-text-primary: #e6eef8;
    --color-text-secondary: #9aa3b2;

    /* brand */
    --color-accent: #6aa8ff;
    --color-accent-strong: #3f8cff;

    /* glass */
    --color-glass-bg: rgba(12, 16, 24, 0.6);
    --color-glass-border: rgba(255, 255, 255, 0.06);

    /* effects */
    --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.6);
    --shadow-strong: 0 30px 80px rgba(0, 0, 0, 0.7);
  }
}

/* =========================
   Manual Override
========================= */

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --color-bg-base: #071026;
  --color-bg-subtle: #07152a;
  --color-bg-elevated: #0b162f;

  --color-text-primary: #e6eef8;
  --color-text-secondary: #9aa3b2;

  --color-accent: #6aa8ff;
  --color-accent-strong: #3f8cff;

  --color-glass-bg: rgba(12, 16, 24, 0.6);
  --color-glass-border: rgba(255, 255, 255, 0.06);

  --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.6);
  --shadow-strong: 0 30px 80px rgba(0, 0, 0, 0.7);
}

/* =========================
   Reset / Base
========================= */

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  height: 100dvh;
  color: var(--color-text-primary);
  background: linear-gradient(
    180deg,
    var(--color-bg-base),
    var(--color-bg-subtle)
  );
  display: flex;
  justify-content: center;
  align-items: center;
}

/* =========================
   Background Layer
========================= */

#background {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
}

/* =========================
   Layout
========================= */

.app-root {
  width: 100%;
  max-width: 1200px;
  height: 100%;
  padding: clamp(16px, 4vw, 32px);
  display: flex;
}

.layout {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.center-panel {
  width: 100%;
  display: flex;
  justify-content: center;
}

/* =========================
   Card
========================= */

.card {
  width: 100%;
  max-width: 880px;
  padding: clamp(16px, 3vw, 24px);
  border-radius: calc(var(--radius) + 2px);

  background: var(--color-glass-bg);
  border: 1px solid var(--color-glass-border);
  backdrop-filter: blur(16px) saturate(140%);

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

  display: flex;
  flex-direction: column;
  gap: 16px;

  transition:
    transform var(--dur-base) var(--ease),
    box-shadow var(--dur-base) var(--ease);
}

.card:focus-within {
  transform: translateY(-4px);
  box-shadow: var(--shadow-strong);
}

/* =========================
   Header
========================= */

.card-header {
  display: flex;
  align-items: center;
}

.brand {
  font-weight: 600;
  font-size: 1rem;
  color: var(--color-accent-strong);
}

/* =========================
   Search
========================= */

.search-area {
  width: 100%;
}

.searchbar {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;

  padding: clamp(10px, 2vw, 14px);
  border-radius: 999px;

  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--color-bg-elevated) 95%, transparent),
    color-mix(in srgb, var(--color-bg-elevated) 85%, transparent)
  );

  border: 1px solid
    color-mix(in srgb, var(--color-accent) 20%, transparent);
}

.searchbar:focus-within {
  border-color: var(--color-accent);
}

/* =========================
   Input
========================= */

.icon {
  flex: 0 0 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;

  font-size: clamp(15px, 2.5vw, 20px);
  color: var(--color-text-primary);
  min-width: 0;
}

.search-input::placeholder {
  color: var(--color-text-secondary);
}

/* =========================
   Responsive
========================= */

@media (min-width: 768px) {
  .card {
    flex-direction: row;
    align-items: center;
  }

  .card-header {
    margin-right: 16px;
  }

  .search-area {
    flex: 1;
  }
}
