:root {
  color-scheme: light;
  --sky: #bdeeff;
  --grass: #8bd17c;
  --paper: #fffdf2;
  --white: #ffffff;
  --ink: #25323a;
  --muted: #60727c;
  --line: rgba(37, 50, 58, 0.16);
  --line-strong: rgba(37, 50, 58, 0.28);
  --blue: #4aa3df;
  --green: #5fc879;
  --yellow: #f4c44f;
  --orange: #f36f45;
  --red: #d84d7d;
  --teal: #23a7a2;
  --violet: #7f6ee7;
  --shadow: 0 18px 38px rgba(57, 91, 104, 0.18);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html,
body {
  width: 100%;
  min-width: 0;
  margin: 0;
  background: linear-gradient(180deg, #effaff 0, #f6fbef 62%, #f7fbf3 100%);
  color: var(--ink);
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

button,
select,
input {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 78px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 24px rgba(57, 91, 104, 0.12);
  z-index: 5;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 225px;
}

.brand-mark {
  position: relative;
  width: 44px;
  height: 44px;
  border: 2px solid #e09a2d;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 5px 0 #e09a2d;
  flex: none;
}

.brand-mark::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 11px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff6b8;
}

.brand-mark::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 8px;
  height: 7px;
  border-radius: 999px;
  background: #e09a2d;
}

.brand-lockup h1 {
  margin: 0;
  font-size: 1.18rem;
  line-height: 1.05;
}

.brand-lockup p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.topbar-controls {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.field-label,
.section-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.select-control {
  min-width: 150px;
  max-width: 250px;
  min-height: 42px;
  padding: 0 34px 0 12px;
  border: 2px solid var(--line);
  border-radius: 7px;
  background: var(--white);
  color: var(--ink);
  outline: none;
  box-shadow: 0 4px 0 rgba(37, 50, 58, 0.08);
}

.age-control {
  min-width: 78px;
}

.select-control:focus-visible,
.filter-chip:has(input:focus-visible),
.job-card:focus-visible,
.text-button:focus-visible {
  outline: 3px solid rgba(74, 163, 223, 0.32);
  outline-offset: 2px;
}

.finder-grid {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr) minmax(330px, 410px);
  min-height: 0;
}

.filter-panel {
  min-width: 0;
  border-right: 1px solid var(--line);
  background: #f7fbf3;
}

.filter-card {
  display: grid;
  gap: 18px;
  padding: 20px 18px;
}

.filter-card h2 {
  margin: 4px 0 8px;
  font-size: 1.35rem;
  line-height: 1.12;
}

.filter-card p,
.panel-section p,
.job-hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.filter-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.filter-group legend {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 850;
}

.chip-grid {
  display: grid;
  gap: 8px;
}

.chip-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.filter-chip {
  display: grid;
  min-width: 0;
  cursor: pointer;
}

.filter-chip input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.filter-chip span {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 0 10px;
  border: 2px solid rgba(37, 50, 58, 0.12);
  border-radius: 7px;
  background: var(--white);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 800;
  box-shadow: 0 3px 0 rgba(37, 50, 58, 0.07);
}

.filter-chip input:checked + span {
  border-color: rgba(244, 196, 79, 0.78);
  background: #fff6cc;
  box-shadow: 0 3px 0 #e4af2d;
}

.workbench-region {
  display: grid;
  grid-template-rows: minmax(315px, 44vh) minmax(0, 1fr);
  min-width: 0;
  min-height: calc(100vh - 78px);
}

.scene-region {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--sky);
}

.scene-canvas {
  position: absolute;
  inset: 0;
}

.scene-canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.scene-loading {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  max-width: min(320px, calc(100vw - 32px));
  padding: 14px 18px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--muted);
  font-weight: 850;
  text-align: center;
  box-shadow: var(--shadow);
  z-index: 2;
}

.scene-toolbar {
  position: absolute;
  left: 16px;
  top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: min(520px, calc(100% - 32px));
  z-index: 3;
}

.legend-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border: 2px solid rgba(37, 50, 58, 0.12);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 850;
  box-shadow: 0 4px 0 rgba(37, 50, 58, 0.08);
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(37, 50, 58, 0.14);
  border-radius: 4px;
  background: linear-gradient(135deg, var(--orange), var(--green), var(--blue));
  flex: none;
}

.scene-readout {
  position: absolute;
  left: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  max-width: calc(100% - 32px);
  padding: 0 12px;
  border: 2px solid rgba(37, 50, 58, 0.12);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  font-weight: 850;
  box-shadow: 0 4px 0 rgba(37, 50, 58, 0.08);
  z-index: 3;
}

.scene-readout strong {
  color: #b86d16;
  font-size: 1.2rem;
}

.results-panel {
  min-width: 0;
  overflow: auto;
  background: var(--white);
}

.results-heading {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
}

.results-heading h2 {
  margin: 2px 0 0;
  font-size: 1.18rem;
  line-height: 1.18;
}

.text-button {
  min-height: 36px;
  padding: 0 12px;
  border: 2px solid rgba(37, 50, 58, 0.12);
  border-radius: 7px;
  background: #fff6cc;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 850;
  cursor: pointer;
}

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

.job-card {
  display: grid;
  grid-template-columns: 34px 44px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  padding: 12px;
  border: 2px solid rgba(37, 50, 58, 0.1);
  border-radius: var(--radius);
  background: var(--white);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(37, 50, 58, 0.07);
}

.job-card.selected {
  border-color: rgba(244, 196, 79, 0.92);
  background: #fff9df;
  box-shadow: 0 4px 0 #e4af2d;
}

.rank-badge {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 900;
  box-shadow: 0 3px 0 #e09a2d;
}

.job-card-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.job-card-main strong {
  font-size: 0.96rem;
}

.job-card-main span,
.job-card-main small {
  color: var(--muted);
  line-height: 1.35;
}

.job-card-main span {
  font-size: 0.84rem;
}

.job-card-main small {
  font-size: 0.78rem;
  font-weight: 800;
}

.job-icon,
.quest-icon {
  position: relative;
  display: block;
  width: 42px;
  height: 42px;
  border: 2px solid rgba(37, 50, 58, 0.12);
  border-radius: var(--radius);
  background: var(--blue);
  box-shadow: 0 4px 0 rgba(37, 50, 58, 0.08);
}

.job-icon::before,
.job-icon::after {
  content: "";
  position: absolute;
  display: block;
}

.job-icon.burger {
  background: var(--orange);
}

.job-icon.burger::before {
  left: 8px;
  right: 8px;
  top: 11px;
  height: 8px;
  border-radius: 8px 8px 3px 3px;
  background: #ffd98a;
}

.job-icon.burger::after {
  left: 8px;
  right: 8px;
  top: 22px;
  height: 8px;
  border-radius: 3px;
  background: #7d4a2d;
}

.job-icon.basket {
  background: var(--green);
}

.job-icon.basket::before {
  left: 9px;
  top: 15px;
  width: 22px;
  height: 16px;
  border: 4px solid #fffdf2;
  border-top: 0;
  border-radius: 0 0 5px 5px;
}

.job-icon.basket::after {
  left: 13px;
  top: 8px;
  width: 14px;
  height: 13px;
  border: 4px solid #fffdf2;
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
}

.job-icon.tree,
.job-icon.lake {
  background: var(--teal);
}

.job-icon.tree::before,
.job-icon.lake::before {
  left: 10px;
  top: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fffdf2;
}

.job-icon.tree::after,
.job-icon.lake::after {
  left: 19px;
  top: 24px;
  width: 5px;
  height: 12px;
  background: #7d4a2d;
}

.job-icon.badge,
.job-icon.ticket,
.job-icon.shirt {
  background: var(--violet);
}

.job-icon.badge::before,
.job-icon.ticket::before,
.job-icon.shirt::before {
  left: 11px;
  top: 11px;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: #fffdf2;
}

.detail-panel {
  min-width: 0;
  max-height: calc(100vh - 78px);
  overflow-y: auto;
  border-left: 1px solid var(--line-strong);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.job-hero {
  display: grid;
  gap: 12px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(244, 196, 79, 0.38), transparent 62%),
    #fff8d8;
}

.job-hero h2 {
  margin: 0;
  font-size: 1.52rem;
  line-height: 1.12;
}

.fit-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.fit-strip span {
  min-height: 30px;
  padding: 6px 9px;
  border: 1px solid rgba(244, 196, 79, 0.52);
  border-radius: 7px;
  background: var(--white);
  color: #6c4d11;
  font-size: 0.82rem;
  font-weight: 850;
}

.panel-section {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.panel-section h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.plain-list,
.apply-list,
.ask-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.plain-list li,
.apply-list li,
.ask-list li {
  position: relative;
  padding-left: 23px;
  line-height: 1.4;
}

.plain-list li::before,
.apply-list li::before,
.ask-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.42em;
  width: 12px;
  height: 12px;
  border-radius: 4px;
  background: var(--green);
}

.apply-list li::before {
  background: var(--blue);
}

.ask-list li::before {
  background: var(--red);
}

.age-note,
.small-note {
  margin-top: 14px;
  font-size: 0.9rem;
}

.target-list {
  display: grid;
  gap: 10px;
}

.target-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 2px solid rgba(74, 163, 223, 0.18);
  border-radius: var(--radius);
  background: var(--white);
}

.target-card a {
  color: #176b99;
  font-weight: 900;
  text-decoration: none;
}

.target-mode {
  justify-self: start;
  padding: 3px 7px;
  border: 1px solid rgba(35, 167, 162, 0.28);
  border-radius: 6px;
  background: #e9fbf4;
  color: #146963;
  font-size: 0.72rem;
  font-weight: 900;
}

.target-card a:hover {
  text-decoration: underline;
}

.target-card p {
  margin: 0;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.4;
}

.target-card small {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.noscript {
  position: fixed;
  inset: auto 16px 16px 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  z-index: 20;
}

@media (max-width: 1180px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .topbar-controls {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .finder-grid {
    grid-template-columns: 270px minmax(0, 1fr);
  }

  .detail-panel {
    grid-column: 1 / -1;
    max-height: none;
    border-left: 0;
    border-top: 1px solid var(--line-strong);
  }
}

@media (max-width: 820px) {
  .topbar {
    min-height: 154px;
    padding: 12px;
  }

  .brand-lockup {
    min-width: 0;
  }

  .topbar-controls {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
  }

  .field-label {
    align-self: center;
  }

  .select-control {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .finder-grid {
    grid-template-columns: 1fr;
  }

  .filter-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .filter-card {
    padding: 16px;
  }

  .chip-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workbench-region {
    grid-template-rows: 420px auto;
    min-height: 0;
  }

  .results-heading,
  .results-list,
  .job-hero,
  .panel-section {
    padding-left: 14px;
    padding-right: 14px;
  }
}

@media (max-width: 500px) {
  .chip-grid,
  .chip-grid.compact {
    grid-template-columns: 1fr;
  }

  .workbench-region {
    grid-template-rows: 340px auto;
  }

  .scene-toolbar {
    left: 10px;
    top: 10px;
    max-width: calc(100% - 20px);
  }

  .legend-pill {
    min-height: 34px;
    padding: 0 9px;
    font-size: 0.8rem;
  }

  .scene-readout {
    left: 10px;
    right: 10px;
    bottom: 10px;
    justify-content: space-between;
    font-size: 0.82rem;
  }

  .job-card {
    grid-template-columns: 30px 40px minmax(0, 1fr);
    padding: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
