:root {
  --fes-bg: #f6f1e8;
  --fes-card: #ffffff;
  --fes-ink: #2a2320;
  --fes-muted: #6f665e;
  --fes-accent: #b37a2f;
  --fes-accent-dark: #8f5f24;
  --fes-border: #e4d8c8;
}

.fes-sim {
  border: 1px solid var(--fes-border);
  padding: 24px;
  background: linear-gradient(180deg, #fff9ef 0%, #f2e9dc 100%);
  max-width: 980px;
  width: 100%;
  color: var(--fes-ink);
  font-family: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", serif;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.fes-sim,
.fes-sim * {
  box-sizing: border-box;
}

.fes-sim::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 10% 12%, rgba(179, 122, 47, 0.12), transparent 45%),
    radial-gradient(circle at 88% 8%, rgba(90, 64, 38, 0.08), transparent 50%);
  pointer-events: none;
}

.fes-sim__header {
  position: relative;
  margin-bottom: 16px;
}

.fes-sim__header h3 {
  margin: 0 0 6px;
  font-size: 26px;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.4);
}

.fes-sim__header p {
  margin: 0;
  color: var(--fes-muted);
  font-size: 14px;
}

.fes-sim__inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  position: relative;
  min-width: 0;
}

.fes-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.fes-field label {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.fes-field input,
.fes-field select {
  padding: 11px 12px;
  border: 1px solid #e8dcc9;
  border-radius: 8px;
  font-size: 14px;
  background: #fffdf8;
  width: 100%;
  box-sizing: border-box;
}

.fes-field--search {
  position: relative;
  z-index: 10;
}

.fes-help {
  font-size: 11px;
  color: var(--fes-muted);
}

.fes-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--fes-card);
  border: 1px solid var(--fes-border);
  z-index: 1000;
  display: none;
  max-height: 240px;
  overflow: auto;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  border-radius: 6px;
}

.fes-search-results button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  background: var(--fes-card);
  border: none;
  border-bottom: 1px solid #f0ebe2;
  cursor: pointer;
}

.fes-search-results button:hover {
  background: #f7efe6;
}

.fes-button-wrap {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
}

.fes-button {
  display: inline-flex;
  align-self: center;
  justify-self: center;
  margin: 0 auto;
  max-width: 380px;
  width: auto;
  padding: 12px 16px;
  background: linear-gradient(180deg, #c7923d 0%, #9f6a2b 100%);
  color: #fff;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: transform 0.2s ease, background 0.2s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), inset 0 -1px 0 rgba(0, 0, 0, 0.12), 0 12px 24px rgba(155, 102, 41, 0.22);
}

.fes-button:active {
  transform: translateY(0);
}

.fes-button:hover {
  background: linear-gradient(180deg, #b98235 0%, #8f5f24 100%);
  transform: translateY(-1px);
}

.fes-sim__results {
  margin-top: 20px;
  padding: 18px;
  background: var(--fes-card);
  border: 1px solid var(--fes-border);
  border-radius: 10px;
  position: relative;
  box-shadow: 0 16px 32px rgba(50, 34, 18, 0.08);
}

.fes-results-title {
  margin: 0 0 10px;
  font-size: 16px;
  letter-spacing: 0.04em;
  position: relative;
}

.fes-results-title::after {
  content: "";
  display: block;
  width: 36px;
  height: 2px;
  margin-top: 6px;
  background: linear-gradient(90deg, #c7923d, transparent);
}

.fes-result-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed #eadfcd;
}

.fes-result-row:last-child {
  border-bottom: none;
}

.fes-note {
  margin-top: 8px;
  color: var(--fes-muted);
  font-size: 12px;
}

@keyframes fesFadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fes-sim__inputs .fes-field {
  animation: fesFadeUp 0.4s ease both;
}

.fes-sim__inputs .fes-field:nth-child(1) { animation-delay: 0.02s; }
.fes-sim__inputs .fes-field:nth-child(2) { animation-delay: 0.04s; }
.fes-sim__inputs .fes-field:nth-child(3) { animation-delay: 0.06s; }
.fes-sim__inputs .fes-field:nth-child(4) { animation-delay: 0.08s; }
.fes-sim__inputs .fes-field:nth-child(5) { animation-delay: 0.10s; }
.fes-sim__inputs .fes-field:nth-child(6) { animation-delay: 0.12s; }
.fes-sim__inputs .fes-field:nth-child(7) { animation-delay: 0.14s; }
.fes-sim__inputs .fes-field:nth-child(8) { animation-delay: 0.16s; }

@media (max-width: 640px) {
  .fes-sim {
    padding: 18px;
    max-width: 100%;
  }

  .fes-sim__header {
    margin-bottom: 12px;
  }

  .fes-sim__header h3 {
    font-size: 22px;
  }

  .fes-sim__header p {
    font-size: 13px;
    line-height: 1.6;
  }

  .fes-sim__inputs {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .fes-button-wrap {
    grid-column: 1 / -1;
  }

  .fes-field {
    background: linear-gradient(180deg, #ffffff 0%, #fbf8f2 100%);
    border: 1px solid #eadcc7;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 10px 22px rgba(36, 24, 12, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    width: 100%;
  }

  .fes-field--wide {
    grid-column: span 1;
  }

  .fes-field--stack {
    grid-column: span 1;
  }

  .fes-field label {
    font-size: 12px;
    letter-spacing: 0.05em;
  }

  .fes-button {
    width: min(100%, 320px);
    max-width: 320px;
    border-radius: 999px;
    justify-self: center;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    justify-content: center;
    box-shadow: 0 12px 24px rgba(213, 75, 47, 0.18);
  }

  .fes-sim__results {
    margin-top: 16px;
    padding: 16px;
  }

  .fes-results-title {
    font-size: 15px;
    letter-spacing: 0.04em;
    position: relative;
  }

  .fes-results-title::after {
    content: "";
    display: block;
    width: 32px;
    height: 2px;
    margin-top: 6px;
    background: linear-gradient(90deg, #c7923d, transparent);
  }

  .fes-result-row {
    flex-direction: column;
  }
}
.fes-field--wide {
  grid-column: span 2;
}

.fes-field--stack {
  grid-column: span 2;
}
