:root {
  /* サロン・アイボリー・ウォールナット・真鍮・深緑フェルト（AAA昼調高級サロンのパレット） */
  --bg-ivory-top: #f6f0e4;
  --bg-ivory-mid: #ece2cf;
  --bg-ivory-bot: #dfd2bb;
  --panel-bg: rgba(252, 248, 240, 0.92);
  --panel-bg-soft: rgba(243, 235, 220, 0.88);
  --panel-border: rgba(133, 102, 60, 0.28);
  --panel-border-strong: rgba(122, 88, 43, 0.56);

  --gold: #8c6525;
  --gold-bright: #6a4712;
  --vermilion: #a61c1c;
  --vermilion-bright: #b91c1c;
  --emerald: #1f5f3b;
  --emerald-bright: #16492d;
  --sky: #255777;

  /* 盤・木枠の基準トーン */
  --walnut-light: #6a4224;
  --walnut-mid: #4a2c15;
  --walnut-dark: #2c180a;
  --felt-light: #206b42;
  --felt-mid: #165131;
  --felt-dark: #0e3821;

  /* テキスト */
  --text-main: #231a11;
  --text-sub: #4c3e2e;
  --text-muted: #766753;

  --font-serif: "Hiragino Mincho ProN", "Yu Mincho", "MS PMincho", Georgia, serif;
  --font-sans: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", -apple-system, BlinkMacSystemFont, sans-serif;
  --board-size: min(84vw, 496px);
}

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

html, body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 252, 244, 0.72), transparent 55%),
    linear-gradient(170deg, var(--bg-ivory-top) 0%, var(--bg-ivory-mid) 55%, var(--bg-ivory-bot) 100%);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body {
  display: flex;
  flex-direction: column;
}

/* 全画面高級サロン背景 */
.bg-stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.bg-artwork {
  position: absolute;
  inset: 0;
  background: url("../assets/bg-salon.jpg") center center / cover no-repeat;
  opacity: 0.62;
  filter: saturate(0.95) contrast(0.98);
}
.bg-mist {
  position: absolute;
  inset: -12%;
  will-change: transform;
}
.bg-mist-a {
  background:
    radial-gradient(ellipse 52% 38% at 22% 28%, rgba(252, 248, 240, 0.52), transparent 72%),
    radial-gradient(ellipse 46% 34% at 76% 68%, rgba(247, 240, 226, 0.48), transparent 70%);
  animation: salonDriftA 44s ease-in-out infinite alternate;
}
.bg-mist-b {
  background:
    radial-gradient(ellipse 58% 36% at 68% 24%, rgba(255, 252, 244, 0.42), transparent 72%),
    radial-gradient(ellipse 50% 40% at 26% 78%, rgba(240, 230, 210, 0.44), transparent 74%);
  animation: salonDriftB 56s ease-in-out infinite alternate;
}
.bg-wash {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 42%, rgba(250, 245, 234, 0.24) 0%, rgba(235, 223, 200, 0.34) 72%, rgba(215, 198, 168, 0.48) 100%);
}
@keyframes salonDriftA {
  0% { transform: translate3d(-2.5%, -1%, 0) scale(1); }
  100% { transform: translate3d(3%, 2%, 0) scale(1.04); }
}
@keyframes salonDriftB {
  0% { transform: translate3d(2.5%, 1.5%, 0) scale(1.03); }
  100% { transform: translate3d(-3%, -1.5%, 0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .bg-mist { animation: none; }
}

/* 繊細なペーパーグレイン */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='w'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.45 0 0 0 0 0.35 0 0 0 0 0.22 0 0 0 0.045 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23w)'/%3E%3C/svg%3E");
}

button, input, select {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

.serif { font-family: var(--font-serif); }
.hidden { display: none !important; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(215, 200, 174, 0.35); }
::-webkit-scrollbar-thumb { background: rgba(133, 102, 60, 0.4); border-radius: 999px; }

.panel {
  background: var(--panel-bg);
  backdrop-filter: blur(5px);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  box-shadow: 0 10px 26px -14px rgba(56, 39, 18, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.btn-salon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  background: linear-gradient(180deg, #fcf9f2, #efe6d5);
  border: 1px solid rgba(133, 102, 60, 0.38);
  color: var(--text-main);
  box-shadow: 0 1px 2px rgba(60, 40, 15, 0.1);
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  white-space: nowrap;
  text-decoration: none;
}
.btn-salon:hover:not(:disabled) {
  background: linear-gradient(180deg, #fffdf9, #e7dac3);
  border-color: var(--gold);
}
.btn-salon:active:not(:disabled) { transform: translateY(1px); }
.btn-salon:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-salon.sm { padding: 5px 10px; font-size: 11.5px; }
.btn-salon.lg { padding: 11px 20px; font-size: 14px; border-radius: 9px; }

.btn-salon.gold {
  background: linear-gradient(160deg, #8b5a22, #5f3a11);
  color: #fcf7eb;
  border-color: #4d2e0c;
  font-weight: 700;
  box-shadow: 0 3px 8px rgba(77, 46, 12, 0.24);
}
.btn-salon.gold:hover:not(:disabled) {
  background: linear-gradient(160deg, #9b672b, #6d4315);
  border-color: #3f2408;
}

.btn-salon.emerald {
  background: linear-gradient(160deg, #256e45, #174b2e);
  color: #f4fbf6;
  border-color: #103821;
  font-weight: 700;
  box-shadow: 0 3px 8px rgba(23, 75, 46, 0.25);
}
.btn-salon.emerald:hover:not(:disabled) {
  background: linear-gradient(160deg, #2c8051, #1c5b38);
}

.btn-salon.danger {
  background: linear-gradient(180deg, #fdf3f2, #f7dfdd);
  border-color: rgba(166, 28, 28, 0.4);
  color: var(--vermilion);
}
.btn-salon.danger:hover:not(:disabled) {
  background: #f5d2cf;
  border-color: var(--vermilion);
}

.btn-salon.sky {
  background: linear-gradient(160deg, #2d6285, #1e455f);
  border-color: #16364b;
  color: #f6f9fb;
  font-weight: 700;
  box-shadow: 0 3px 8px rgba(30, 69, 95, 0.24);
}
.btn-salon.sky:hover:not(:disabled) {
  background: linear-gradient(160deg, #357097, #23506e);
}

.input-salon {
  width: 100%;
  padding: 8px 11px;
  border-radius: 7px;
  background: #fffdf8;
  border: 1px solid rgba(133, 102, 60, 0.36);
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input-salon::placeholder { color: #9c8f7e; }
.input-salon:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(140, 101, 37, 0.16);
}

/* Overlays & Toasts */
.toast-container {
  position: fixed;
  top: 66px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 95;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  width: min(92vw, 480px);
}
.toast {
  padding: 10px 16px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 10px 26px rgba(42, 28, 12, 0.26);
  backdrop-filter: blur(8px);
  animation: toastIn 0.22s ease-out;
}
.toast.pass {
  background: rgba(254, 247, 226, 0.97);
  border: 1.5px solid #b47b1e;
  color: #6b4308;
}
.toast.warn {
  background: rgba(254, 240, 240, 0.97);
  border: 1.5px solid var(--vermilion);
  color: #841212;
}
.toast.info {
  background: rgba(240, 247, 251, 0.97);
  border: 1.5px solid var(--sky);
  color: #193e57;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 85;
  background: rgba(29, 22, 14, 0.56);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-box {
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 22px;
  background: #fbf7ef;
  border: 1.5px solid rgba(133, 102, 60, 0.65);
  border-radius: 12px;
  box-shadow: 0 22px 52px rgba(32, 20, 8, 0.38);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--panel-border);
}
.modal-close {
  font-size: 26px;
  line-height: 1;
  color: var(--text-muted);
  padding: 0 6px;
}
.modal-close:hover { color: var(--vermilion); }

.salon-icon {
  width: 1.25em;
  height: 1.25em;
  object-fit: contain;
  vertical-align: -0.24em;
  display: inline-block;
  flex-shrink: 0;
  user-select: none;
  pointer-events: none;
}
.salon-icon.sm { width: 15px; height: 15px; vertical-align: -0.18em; }
.salon-icon.md { width: 22px; height: 22px; }
.salon-icon.lg { width: 28px; height: 28px; }
.salon-icon.xl { width: 42px; height: 42px; vertical-align: middle; }

.inline-icon-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.btn-salon.gold .salon-icon,
.btn-salon.emerald .salon-icon,
.btn-salon.sky .salon-icon {
  filter: drop-shadow(0 0 1.5px rgba(255, 250, 236, 0.8));
}
