:root {
  color-scheme: dark;
  --bg: #1d221b;
  --ink: #f5f5f5;
  --muted: #b9b9b9;
  --line: #707070;
  --soft-line: #4f564d;
  --panel: #080808;
  --accent-orange: #eb9957;
  --accent-green: #35cb89;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Yu Gothic", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  font-size: 15px;
  letter-spacing: 0;
}

button {
  font: inherit;
}

.app {
  position: relative;
  width: min(1400px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.site-header {
  position: relative;
  display: grid;
  place-items: center;
  row-gap: 0;
  min-height: 72px;
  overflow: hidden;
  margin-bottom: 22px;
}

.site-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.site-title {
  position: relative;
  margin: 0;
  font-size: clamp(18px, 2.6vw, 26px);
  font-weight: 800;
  line-height: 1;
  text-align: center;
  z-index: 1;
}

.site-subtitle {
  position: relative;
  margin: -7px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  z-index: 1;
}

.material-select-panel {
  display: none;
}

.material-select-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.material-select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 38px 0 12px;
  color: var(--ink);
  background: #1f1f1f;
  font: inherit;
  font-size: 15px;
}

.material-select:focus {
  outline: none;
  border-color: var(--accent-green);
  box-shadow: 0 0 0 1px var(--accent-green);
}

.material-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px 14px;
}

.material-button {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 10px;
  color: var(--ink);
  background: #1f1f1f;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
}

.material-button:hover {
  border-color: var(--accent-green);
}

.material-button.is-active {
  border-color: var(--accent-orange);
  background: #3d3d3d;
  color: #fffbd4;
  box-shadow: inset 0 0 0 1px var(--accent-orange);
}

.material-button img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  image-rendering: auto;
}

.material-button span {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.selected-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 64px;
  margin-top: 24px;
  border-top: 2px solid var(--soft-line);
  border-bottom: 2px solid var(--soft-line);
  color: var(--ink);
  font-size: 18px;
}

.selected-bar img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.selected-name {
  overflow-wrap: anywhere;
  text-align: center;
}

.results {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2px minmax(0, 1fr);
  gap: 28px;
  margin-top: 26px;
  align-items: stretch;
  min-height: 500px;
}

.divider {
  background: var(--soft-line);
  align-self: stretch;
  min-height: 0;
}

.result-column {
  min-width: 0;
  padding-bottom: 4px;
}

.result-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.25;
}

.result-heading img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex: 0 0 auto;
}

.result-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
}

.quantity-filters {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-basis: 100%;
  margin-left: 32px;
}

.quantity-filter {
  display: inline-grid;
  place-items: center;
  width: 112px;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px 9px;
  color: var(--ink);
  background: #1f1f1f;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
}

.quantity-filter:hover {
  border-color: var(--accent-green);
}

.quantity-filter.is-active {
  border-color: var(--accent-orange);
  background: #3d3d3d;
  color: #fffbd4;
}

.result-list {
  display: grid;
  gap: 8px;
}

.result-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  border-left: 3px solid transparent;
  padding: 3px 0 3px 10px;
  color: var(--ink);
  line-height: 1.45;
}

.result-item strong {
  min-width: 0;
  font-size: 15px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.result-item .via,
.result-item .qty {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
}

.equipment .result-item {
  border-left-color: var(--accent-orange);
}

.derived .result-item {
  border-left-color: var(--accent-green);
}

.empty {
  color: var(--muted);
  font-size: 15px;
}

.site-footer {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 18px;
  margin-top: 38px;
}

.recipe-link {
  display: grid;
  justify-items: center;
  gap: 5px;
  color: var(--ink);
  text-decoration: none;
  text-align: center;
}

.recipe-link:hover .recipe-title {
  color: var(--accent-green);
}

.recipe-kicker {
  color: var(--muted);
  font-size: 12px;
}

.recipe-title-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.recipe-title {
  font-size: 16px;
  font-weight: 800;
}

.recipe-title-row img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.copyright {
  justify-self: end;
  max-width: min(720px, 100%);
  margin: 0;
  color: #aeb7aa;
  font-size: 11px;
  line-height: 1.65;
  text-align: right;
}

.app-version {
  margin: -8px 0 0;
  color: #8f9a8c;
  font-size: 11px;
  line-height: 1;
}

@media (max-width: 980px) {
  .app {
    width: min(100vw - 28px, 1400px);
    padding-top: 32px;
    padding-bottom: 48px;
  }

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

  .results {
    grid-template-columns: 1fr;
    gap: 30px;
    min-height: 0;
  }

  .divider {
    height: 2px;
    min-height: 0;
  }

}

@media (max-width: 620px) {
  .material-select-panel {
    display: block;
  }

  .material-grid {
    display: none;
  }

  .selected-bar {
    font-size: 15px;
  }

  .result-item {
    display: grid;
    gap: 4px;
  }

  .copyright {
    justify-self: center;
    text-align: center;
  }
}
