:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  color: #29272f;
  background: #f5f6f8;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #f5f6f8;
}

body {
  min-height: 100vh;
  margin: 0;
  background: #f5f6f8;
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

[hidden] {
  display: none !important;
}

.food-main {
  width: min(1060px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 44px;
}

.mode-tabs {
  width: fit-content;
  margin-bottom: 16px;
  padding: 3px;
  display: flex;
  gap: 2px;
  border: 1px solid #dfe2e7;
  border-radius: 7px;
  background: #fff;
}

.mode-tab {
  min-width: 126px;
  min-height: 40px;
  padding: 8px 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #66636d;
  font-weight: 700;
}

.mode-tab svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mode-tab:hover {
  background: #f6f7f9;
  color: #34323a;
}

.mode-tab.active {
  background: #29272f;
  color: #fff;
}

.food-notice {
  margin-bottom: 14px;
  padding: 10px 13px;
  border: 1px solid #9ecfc2;
  border-radius: 6px;
  background: #f1faf7;
  color: #246e61;
  font-size: 14px;
}

.food-notice.error {
  border-color: #efacb8;
  background: #fff3f5;
  color: #a82c4b;
}

.tool-panel,
.question-panel,
.results-panel {
  border: 1px solid #dfe2e7;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(35, 39, 47, 0.06);
}

.tool-panel {
  padding: 28px;
}

.wheel-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(320px, 1.1fr);
  gap: 48px;
  align-items: start;
}

.wheel-column {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.wheel-wrap {
  position: relative;
  width: min(100%, 390px);
  aspect-ratio: 1;
  margin: 4px auto 22px;
}

#wheelCanvas {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 8px 14px rgba(35, 39, 47, 0.12));
}

.wheel-pointer {
  position: absolute;
  top: -4px;
  left: 50%;
  z-index: 2;
  width: 0;
  height: 0;
  border-right: 12px solid transparent;
  border-left: 12px solid transparent;
  border-top: 25px solid #29272f;
  transform: translateX(-50%);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.14));
}

.primary-button {
  min-height: 43px;
  padding: 10px 22px;
  border: 1px solid #29272f;
  border-radius: 6px;
  background: #29272f;
  color: #fff;
  font-weight: 700;
}

.primary-button:hover:not(:disabled) {
  border-color: #e34d68;
  background: #e34d68;
}

.wheel-column .primary-button {
  width: min(100%, 260px);
}

.wheel-result {
  min-height: 26px;
  margin-top: 13px;
  color: #d9405e;
  font-size: 17px;
  font-weight: 700;
}

.food-column {
  min-width: 0;
}

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

.add-food-form input {
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #cfd3d9;
  border-radius: 6px;
  color: #29272f;
  outline: none;
}

.add-food-form input:focus {
  border-color: #6f7480;
  box-shadow: 0 0 0 3px rgba(67, 72, 82, 0.1);
}

.add-button {
  min-width: 86px;
  height: 42px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid #29272f;
  border-radius: 6px;
  background: #fff;
  color: #29272f;
  font-weight: 700;
}

.add-button:hover {
  background: #f3f4f6;
}

.add-button svg,
.delete-food svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.list-heading,
.results-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.list-heading {
  margin: 24px 0 10px;
}

.list-heading h2,
.results-heading h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
}

.list-heading span {
  color: #77747e;
  font-size: 13px;
}

.food-list {
  max-height: 370px;
  overflow-y: auto;
  border-top: 1px solid #eceef1;
}

.food-row {
  min-height: 48px;
  padding: 8px 4px 8px 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #eceef1;
}

.food-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.delete-food {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #88858e;
}

.delete-food:hover {
  background: #fff0f3;
  color: #d9405e;
}

.food-empty,
.recommend-empty,
.recommend-loading,
.recommend-error {
  color: #77747e;
  text-align: center;
}

.food-empty {
  padding: 36px 12px;
}

.recommend-layout {
  display: grid;
  grid-template-columns: minmax(340px, 0.88fr) minmax(420px, 1.12fr);
  gap: 18px;
  align-items: start;
}

.smart-kind-tabs {
  width: min(100%, 300px);
  margin-bottom: 14px;
  padding: 3px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  border: 1px solid #dfe2e7;
  border-radius: 7px;
  background: #fff;
}

.smart-kind-tab {
  min-height: 37px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #68656f;
  font-weight: 700;
}

.smart-kind-tab:hover {
  background: #f5f6f8;
  color: #302e36;
}

.smart-kind-tab.active {
  background: #e34d68;
  color: #fff;
}

.smart-workspace {
  width: 100%;
}

.question-panel,
.results-panel {
  min-width: 0;
  padding: 24px;
}

.question-group {
  margin: 0;
  padding: 0 0 20px;
  border: 0;
}

.question-group legend {
  margin-bottom: 10px;
  padding: 0;
  color: #403e46;
  font-size: 14px;
  font-weight: 700;
}

.choice-grid {
  display: grid;
  gap: 7px;
}

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

.choice-grid label {
  min-width: 0;
  cursor: pointer;
}

.choice-grid input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-grid span {
  min-height: 39px;
  padding: 8px 5px;
  display: grid;
  place-items: center;
  border: 1px solid #d7dae0;
  border-radius: 6px;
  background: #fff;
  color: #65626c;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.choice-grid input:checked + span {
  border-color: #29272f;
  background: #29272f;
  color: #fff;
}

.choice-grid input:focus-visible + span {
  outline: 3px solid rgba(66, 99, 235, 0.22);
  outline-offset: 1px;
}

.recommend-button {
  width: 100%;
}

.results-heading {
  min-height: 32px;
  margin-bottom: 13px;
}

.results-heading button {
  padding: 5px 7px;
  border: 0;
  background: transparent;
  color: #d9405e;
  font-size: 14px;
  font-weight: 700;
}

.recommendation-results {
  min-height: 350px;
}

.recommend-empty,
.recommend-loading,
.recommend-error {
  min-height: 350px;
  display: grid;
  place-content: center;
  gap: 9px;
}

.recommend-empty svg {
  width: 43px;
  height: 43px;
  margin: 0 auto;
  fill: none;
  stroke: #a3a0a8;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.recommend-error {
  color: #a82c4b;
}

.recommend-row {
  min-width: 0;
  min-height: 55px;
  padding: 8px 2px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid #eceef1;
}

.recommend-row:first-child {
  border-top: 1px solid #eceef1;
}

.recommend-row.chosen {
  margin: 0 -8px;
  padding-right: 10px;
  padding-left: 10px;
  background: #f1faf7;
}

.result-rank {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #eef0f3;
  color: #5d5a64;
  font-size: 12px;
  font-weight: 800;
}

.result-main {
  min-width: 0;
}

.result-main > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.result-main strong {
  min-width: 0;
  overflow: hidden;
  color: #302e36;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-main small {
  margin-top: 3px;
  display: block;
  overflow: hidden;
  color: #77747e;
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.type-label {
  flex: 0 0 auto;
  padding: 2px 5px;
  border-radius: 4px;
  background: #eef3fb;
  color: #42608a;
  font-size: 10px;
  font-weight: 700;
}

.type-label.store {
  background: #fff0f3;
  color: #b83d57;
}

.drink-brand {
  min-width: 0;
  overflow: hidden;
  color: #b83d57;
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-actions {
  display: grid;
  grid-template-columns: 43px 62px;
  align-items: center;
  gap: 5px;
}

.map-link {
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid #d7dae0;
  border-radius: 5px;
  color: #5a6576;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.map-link:hover {
  border-color: #42608a;
  color: #42608a;
}

.choose-result {
  min-width: 62px;
  height: 34px;
  padding: 0 9px;
  border: 1px solid #cfd3d9;
  border-radius: 5px;
  background: #fff;
  color: #3b3941;
  font-size: 13px;
  font-weight: 700;
}

.choose-result:hover:not(:disabled) {
  border-color: #d9405e;
  color: #d9405e;
}

.chosen-result {
  margin-top: 14px;
  padding: 11px 12px;
  border-left: 3px solid #e34d68;
  background: #fff4f6;
  color: #a82c4b;
  font-size: 14px;
  font-weight: 700;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 840px) {
  .wheel-layout,
  .recommend-layout {
    grid-template-columns: 1fr;
  }

  .wheel-layout {
    gap: 30px;
  }

  .wheel-wrap {
    width: min(100%, 360px);
  }
}

@media (max-width: 560px) {
  .food-main {
    width: calc(100% - 24px);
    padding: 16px 0 30px;
  }

  .mode-tabs {
    width: 100%;
  }

  .smart-kind-tabs {
    width: 100%;
  }

  .mode-tab {
    min-width: 0;
    flex: 1;
    padding-right: 8px;
    padding-left: 8px;
  }

  .tool-panel,
  .question-panel,
  .results-panel {
    padding: 16px;
  }

  .wheel-wrap {
    width: min(100%, 300px);
  }

  .recommendation-results,
  .recommend-empty,
  .recommend-loading,
  .recommend-error {
    min-height: 290px;
  }
}

@media (max-width: 350px) {
  .food-main {
    width: calc(100% - 16px);
  }

  .mode-tab {
    gap: 4px;
    font-size: 14px;
  }

  .mode-tab svg {
    width: 17px;
    height: 17px;
  }

  .tool-panel,
  .question-panel,
  .results-panel {
    padding: 13px;
  }

  .wheel-wrap {
    width: min(100%, 270px);
  }

  .add-button {
    min-width: 44px;
    padding: 0 10px;
  }

  .add-button span {
    display: none;
  }

  .recommend-row {
    grid-template-columns: 24px minmax(0, 1fr) auto;
    gap: 6px;
  }

  .result-rank {
    width: 22px;
    height: 22px;
  }

  .choose-result {
    min-width: 54px;
    padding: 0 6px;
    font-size: 12px;
  }

  .result-actions {
    grid-template-columns: 40px 54px;
    gap: 4px;
  }

  .map-link {
    font-size: 11px;
  }
}
