:root {
  --bg-night: #141726;
  --bg-card: #1e2338;
  --bg-input: #121524;
  --bg-result: #161a2c;
  --text-main: #f3efe6;
  --text-muted: #b7bfd6;
  --accent-gold: #f6df9e;
  --accent-border: #d8c79e;
  --line-subtle: rgba(255, 255, 255, 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  background: radial-gradient(circle at top, #1d233d 0%, var(--bg-night) 65%);
  color: var(--text-main);
  line-height: 1.75;
  min-height: 100dvh;
}

.wrap {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: clamp(18px, 4vw, 36px) clamp(14px, 3.5vw, 24px) 64px;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: clamp(16px, 3vw, 24px);
}

.site-nav a {
  color: var(--accent-border);
  text-decoration: none;
  font-size: clamp(0.8rem, 2.2vw, 0.9rem);
  border: 1px solid rgba(216, 199, 158, 0.35);
  padding: 6px 12px;
  border-radius: 999px;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  background: rgba(216, 199, 158, 0.14);
  border-color: var(--accent-gold);
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--line-subtle);
  border-radius: 16px;
  padding: clamp(18px, 4vw, 28px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}

h1 {
  margin: 0 0 8px;
  font-size: clamp(1.3rem, 4vw, 1.75rem);
  color: var(--accent-gold);
  letter-spacing: 0.04em;
}

.muted {
  color: var(--text-muted);
  font-size: clamp(0.85rem, 2.3vw, 0.95rem);
  margin: 0;
}

.form-group {
  margin-top: 14px;
}

.form-group label {
  display: block;
  font-size: clamp(0.85rem, 2.4vw, 0.95rem);
  color: var(--text-main);
}

input[type="text"],
textarea {
  width: 100%;
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 11px 13px;
  font-family: inherit;
  font-size: 16px;
  margin-top: 6px;
}

input[type="text"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-gold);
}

/* 5色小瓶グリッド：スマホ2〜3列、PC5列 */
.bottles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(10px, 2.5vw, 14px);
  margin: 20px 0 12px;
}

@media (min-width: 720px) {
  .bottles {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

button.bottle {
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  padding: clamp(14px, 3vw, 18px) 8px;
  min-height: 92px;
  color: #fff;
  font-family: inherit;
  font-size: clamp(0.88rem, 2.3vw, 0.98rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.2s ease;
  touch-action: manipulation;
}

button.bottle:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

button.bottle:active:not(:disabled) {
  transform: translateY(0);
}

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

.bottle-sub {
  font-size: clamp(0.72rem, 1.9vw, 0.8rem);
  opacity: 0.9;
}

.b-blue {
  background: linear-gradient(145deg, #2d52a8, #182347);
}

.b-yellow {
  background: linear-gradient(145deg, #b38b1e, #5c4409);
}

.b-green {
  background: linear-gradient(145deg, #297a5e, #12382b);
}

.b-red {
  background: linear-gradient(145deg, #a6324e, #4a1220);
}

.b-black {
  background: linear-gradient(145deg, #34384a, #0e1017);
  border-color: rgba(246, 223, 158, 0.35);
}

/* 調合中の簡単ロードアニメ */
.loading-box {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
  padding: 22px 16px;
  border-radius: 14px;
  background: var(--bg-result);
  border: 1px dashed rgba(246, 223, 158, 0.45);
}

.loading-box.is-active {
  display: flex;
}

.brew-orb {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid rgba(246, 223, 158, 0.22);
  border-top-color: var(--accent-gold);
  animation: brew-spin 0.9s linear infinite, brew-pulse 1.8s ease-in-out infinite;
}

.loading-text {
  font-size: clamp(0.88rem, 2.5vw, 0.98rem);
  color: var(--accent-gold);
  text-align: center;
}

@keyframes brew-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes brew-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(246, 223, 158, 0.35);
  }
  50% {
    box-shadow: 0 0 18px 4px rgba(246, 223, 158, 0.2);
  }
}

/* 処方箋結果エリア */
.result-box {
  display: none;
  background: var(--bg-result);
  border: 1px solid var(--accent-border);
  border-radius: 14px;
  padding: clamp(16px, 3.5vw, 22px);
  margin-top: 18px;
  animation: fade-in 0.3s ease;
}

.result-box.is-visible {
  display: block;
}

.herb-name {
  font-size: clamp(1.2rem, 3.8vw, 1.5rem);
  color: var(--accent-gold);
  margin: 4px 0 6px;
}

.btn-link {
  display: inline-block;
  margin-top: 14px;
  background: var(--accent-border);
  color: var(--bg-night);
  text-decoration: none;
  font-weight: bold;
  font-size: clamp(0.88rem, 2.5vw, 0.95rem);
  padding: 10px 18px;
  border-radius: 10px;
}

.btn-link:hover {
  background: var(--accent-gold);
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
