:root {
  color-scheme: dark;
  --bg: #071525;
  --surface: #0d1f33;
  --surface-2: #122941;
  --line: #274058;
  --text: #f6f8fb;
  --muted: #9fb0c3;
  --blue: #4b93ff;
  --mint: #74dbb4;
  font-family: Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
}
button, input, select { font: inherit; }
button { color: inherit; cursor: pointer; }
a { color: inherit; }
h1, h2, p { margin: 0; }

.app {
  width: min(100%, 540px);
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 16px 36px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.eyebrow {
  color: var(--mint);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
h1 { margin-top: 4px; font-size: 26px; line-height: 1.1; }
.language {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 42px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.language select {
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  gap: 14px;
  align-items: center;
  margin-top: 20px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(75, 147, 255, .16), rgba(116, 219, 180, .11)), var(--surface);
}
.hero h2 { font-size: 22px; line-height: 1.15; }
.hero p { margin-top: 8px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.hero > .material-symbols-rounded {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  color: #dff7ee;
  background: rgba(116, 219, 180, .17);
  font-size: 32px;
}

.wizard {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}
.wizard-closed {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
}
.wizard h2 { font-size: 18px; line-height: 1.2; }
.wizard p { margin-top: 6px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  border: 0;
  border-radius: 13px;
  color: #061322;
  font-weight: 800;
  background: var(--mint);
}
.wizard-panel, .wizard-result { padding: 16px; }
.wizard-progress {
  height: 6px;
  margin-bottom: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #1b3149;
}
.wizard-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--blue));
}
.answer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.answer-grid button {
  display: grid;
  gap: 8px;
  min-height: 106px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  text-align: left;
  background: var(--surface-2);
}
.answer-grid button.active { border-color: var(--mint); box-shadow: 0 0 0 2px rgba(116, 219, 180, .14); }
.answer-grid .material-symbols-rounded { color: var(--mint); }
.answer-grid strong { font-size: 13px; line-height: 1.3; }
.wizard-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.wizard-actions button, .wizard-result-head button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
}
.wizard-actions button:disabled { opacity: .4; cursor: default; }
.wizard-result-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}
.match-list { display: grid; gap: 8px; margin-top: 14px; }
.match-card {
  border: 1px solid rgba(116, 219, 180, .22);
  border-radius: 14px;
  background: rgba(116, 219, 180, .08);
}
.match-card button {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 22px;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 74px;
  padding: 10px;
  border: 0;
  text-align: left;
  background: transparent;
}
.match-card .material-symbols-rounded { color: var(--mint); }
.match-card strong { display: block; font-size: 14px; line-height: 1.25; }
.match-card small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.3; }

.tools { display: grid; gap: 12px; margin-top: 18px; }
.search {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
  min-height: 50px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.search .material-symbols-rounded { color: var(--muted); }
.search input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}
.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.filters button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
}
.filters button.active {
  color: #071525;
  border-color: var(--mint);
  background: var(--mint);
}

.recommendations { margin-top: 20px; }
.section-title h2 { font-size: 16px; }
.recommendation-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.mini-card {
  display: grid;
  min-height: 116px;
  gap: 6px;
  padding: 11px 9px;
  border: 1px solid var(--line);
  border-radius: 14px;
  text-align: left;
  background: var(--surface);
}
.mini-card .material-symbols-rounded { color: var(--mint); }
.mini-card strong { font-size: 12px; line-height: 1.25; overflow-wrap: anywhere; }
.mini-card small { color: var(--muted); font-size: 11px; line-height: 1.25; }

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
}
.result-head button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  color: var(--blue);
  background: transparent;
}
.result-head .material-symbols-rounded { font-size: 18px; }

.cards { display: grid; gap: 10px; margin-top: 10px; }
.card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(13, 31, 51, .9);
}
.card-main {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 22px;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 118px;
  padding: 14px 48px 14px 14px;
  border: 0;
  text-align: left;
  background: transparent;
}
.card-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  color: var(--mint);
  background: rgba(116, 219, 180, .12);
}
.card small { display: block; color: var(--muted); font-size: 11px; line-height: 1.35; }
.card strong { display: block; margin-top: 4px; font-size: 15px; line-height: 1.25; overflow-wrap: anywhere; }
.card em {
  display: -webkit-box;
  margin-top: 6px;
  overflow: hidden;
  color: #ccd6e3;
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.favorite {
  position: absolute;
  z-index: 1;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(7, 21, 37, .78);
}
.favorite.active { color: var(--mint); border-color: rgba(116, 219, 180, .42); }

dialog {
  width: min(calc(100% - 20px), 520px);
  max-height: min(86vh, 760px);
  margin: auto auto 0;
  padding: 18px 20px max(24px, env(safe-area-inset-bottom));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 22px 22px 0 0;
  color: var(--text);
  background: var(--surface);
}
dialog::backdrop { background: rgba(0, 8, 18, .68); backdrop-filter: blur(4px); }
.handle { width: 42px; height: 4px; margin: 0 auto 20px; border-radius: 4px; background: #52657d; }
.close-sheet {
  position: absolute;
  top: 12px;
  right: 12px;
  border: 0;
  background: transparent;
}
.detail h2 { padding-right: 32px; font-size: 22px; line-height: 1.2; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tags span {
  padding: 6px 10px;
  border: 1px solid rgba(116, 219, 180, .28);
  border-radius: 999px;
  color: #c8f4e4;
  background: rgba(116, 219, 180, .1);
  font-size: 12px;
}
.body-text {
  margin-top: 18px;
  color: #dce5f1;
  font-size: 14px;
  line-height: 1.58;
}
.body-text b { color: var(--text); }
.body-text a { color: #8ab8ff; overflow-wrap: anywhere; }
.sheet-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  margin-top: 10px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  background: var(--surface-2);
}
.empty {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 180px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 410px) {
  .recommendation-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .answer-grid { grid-template-columns: 1fr; }
  .wizard-result-head { grid-template-columns: 1fr; }
}
