/* =========================================================================
   style.css — 조색 작업대 화면 (PC 가로 넓은 화면 기준)
   ========================================================================= */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: #23262b;
  color: #e8eaed;
  font-family: "맑은 고딕", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
}

/* ---------- 상단 제목 ---------- */
.topbar {
  padding: 14px 28px;
  background: #171a1e;
  border-bottom: 1px solid #34383e;
}
.topbar h1 { margin: 0; font-size: 20px; letter-spacing: 1px; }
.topbar__sub { margin-left: 12px; font-size: 14px; font-weight: normal; color: #9aa0a6; }

/* ---------- 작업대 전체 ---------- */
.bench {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 28px 48px;
}
.bench-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 24px;
  align-items: start;
}
.bench-main { min-width: 0; }
.panel--ingredients { margin-top: 0; position: sticky; top: 18px; }
.panel--ingredients .button-row { flex-direction: column; flex-wrap: nowrap; }
.panel--ingredients .ing-btn { width: 100%; }

/* ---------- 손님 차 색 / 통 / 내 색 을 나란히 ---------- */
.compare {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 40px;
  margin-bottom: 32px;
}

.swatch-box {
  flex: 1 1 0;
  max-width: 420px;
  min-width: 260px;
  text-align: center;
}
.swatch-box__title {
  margin: 0 0 10px;
  font-size: 16px;
  color: #b9bec4;
  letter-spacing: 2px;
}
.swatch {
  height: 400px;
  border-radius: 10px;
  border: 3px solid #4a4f56;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color .12s linear;
}
/* 아직 아무것도 안 부은 통: 흰 페인트와 헷갈리지 않게 체크무늬로 */
.swatch--empty {
  background-color: transparent;
  background-image:
    linear-gradient(45deg, #3a3e44 25%, transparent 25%, transparent 75%, #3a3e44 75%),
    linear-gradient(45deg, #3a3e44 25%, transparent 25%, transparent 75%, #3a3e44 75%);
  background-size: 28px 28px;
  background-position: 0 0, 14px 14px;
}
.swatch__empty-text { color: #9aa0a6; font-size: 15px; }
.swatch:not(.swatch--empty) .swatch__empty-text { display: none; }

/* ---------- 가운데 통 그림 ---------- */
.tub-area { text-align: center; flex: 0 0 auto; }
.tub-area__title {
  margin: 0 0 10px;
  font-size: 16px;
  color: #b9bec4;
  letter-spacing: 2px;
}
.tub-area__label { margin: 10px 0 0; font-size: 14px; color: #9aa0a6; }

.tub {
  position: relative;
  width: 150px;
  height: 300px;               /* 통 크기에 따라 JS 가 바꿉니다 */
  margin: 0 auto;
  background: #2c3036;
  border: 4px solid #6d747c;
  border-top: none;
  border-radius: 0 0 16px 16px;
  overflow: hidden;
}
.tub--none {                    /* 통을 아직 안 올린 상태 */
  border-style: dashed;
  border-top: 4px dashed #6d747c;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tub__paint {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 0;                   /* 담긴 양에 따라 JS 가 바꿉니다 */
  background: transparent;
  /* 높이는 0.1L 단위로 뚝뚝 바뀝니다(화면에 적히는 자릿수와 같게).
     그 칸과 칸 사이를 이 전환이 이어 붙여서 부드럽게 차오르는 것으로 보입니다.
     --fill-tween 은 "한 칸을 채우는 시간"이고 JS(setupFillTween)가 넣어 줍니다. */
  transition: height var(--fill-tween, .2s) linear, background-color .12s linear;
}
.tub__ticks { position: absolute; inset: 0; pointer-events: none; }
.tub__tick {
  position: absolute;
  left: 0; right: 0;
  height: 0;
  border-top: 1px solid rgba(255,255,255,.45);
}
.tub__tick--major { border-top-color: rgba(255,255,255,.75); }
.tub__empty-text { color: #7c838b; font-size: 14px; }

/* ---------- 버튼 묶음 ---------- */
.panel {
  margin-top: 26px;
  padding: 18px 20px;
  background: #1c1f24;
  border: 1px solid #34383e;
  border-radius: 10px;
}
.panel__title { margin: 0 0 14px; font-size: 15px; color: #b9bec4; letter-spacing: 2px; }
.panel__note { margin: 14px 0 0; font-size: 13px; color: #7c838b; }

.button-row { display: flex; flex-wrap: wrap; gap: 14px; }

/* 원료 버튼 — 각자 자기 색으로 보입니다 */
.ing-btn {
  width: 130px;
  padding: 0;
  font-family: inherit;
  color: #1a1c20;
  background: #fff;
  border: 3px solid #4a4f56;
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
}
.ing-btn:hover { border-color: #cfd4da; }
.ing-btn:disabled { cursor: not-allowed; opacity: .45; }
.ing-btn__chip { display: block; height: 74px; }
.ing-btn__name {
  display: block;
  padding: 8px 4px;
  font-size: 14px;
  background: #2c3036;
  color: #e8eaed;
}

/* =========================================================================
   S1-4 / S1-5 / S1-6 에서 더해진 부분
   — 꾹 눌러 붓기, 총량 표시와 목표량 눈금선, 넘침 표현
   ========================================================================= */

/* ---------- 색 견본 아래 작은 설명줄 ---------- */
.swatch-box__caption {
  margin: 10px 0 0;
  min-height: 20px;              /* 글자가 생겼다 사라져도 화면이 들썩이지 않게 */
  font-size: 14px;
  color: #b9bec4;
}
.swatch-box__caption--overflow { color: #7c838b; font-weight: bold; }
.swatch-box__caption--overflow.is-on { color: #ff8a65; }

/* ---------- 통 주변 ---------- */
.tub-wrap { position: relative; display: inline-block; }

/* 담긴 총량 "3.2L / 5.0L" — 통 바로 아래에 크게 */
.tub-area__amount {
  margin: 12px 0 0;
  font-size: 26px;
  font-weight: bold;
  letter-spacing: 1px;
  color: #f1f3f5;
  font-variant-numeric: tabular-nums;   /* 숫자 폭이 일정해 흔들리지 않게 */
}
.tub-area__warn { margin: 6px 0 0; min-height: 18px; font-size: 13px; color: #ffb74d; }

/* ---------- 손님에게 필요한 양 눈금선 ---------- */
.tub__tick--target {
  border-top: 3px dashed #ffd166;
  z-index: 2;
}
.tub__tick-label {
  position: absolute;
  right: 4px;
  top: -18px;
  font-size: 12px;
  font-weight: bold;
  color: #ffd166;
  text-shadow: 0 0 3px #000, 0 0 3px #000;   /* 페인트 위에서도 읽히게 */
  white-space: nowrap;
}

/* ---------- 붓는 중: 위에서 내려오는 페인트 줄기 ---------- */
.tub__stream {
  display: none;
  position: absolute;
  top: 0;
  bottom: 0;                     /* 페인트 표면 높이에 맞춰 JS 가 바꿉니다 */
  left: 50%;
  width: 18px;
  margin-left: -9px;
  border-radius: 0 0 9px 9px;
  background: #fff;
  box-shadow: 0 0 10px rgba(255,255,255,.25);
  z-index: 1;
  /* 줄기 끝(페인트 표면)도 페인트와 같은 속도로 따라 내려오게 합니다 */
  transition: bottom var(--fill-tween, .2s) linear, background-color .12s linear;
}
/* 줄기 위에 흐르는 결을 얹어 "졸졸 흐르는" 느낌을 냅니다 */
.tub__stream::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,.35) 0 6px,
    rgba(0,0,0,.12)      6px 14px
  );
  animation: stream-flow .35s linear infinite;
}
@keyframes stream-flow {
  from { background-position-y: 0; }
  to   { background-position-y: 14px; }
}

/* 붓는 동안 색 견본은 전환 효과를 끕니다 (색이 늦게 따라오면 끊겨 보입니다).

   ※ 통 안 페인트와 줄기는 반대로 전환을 켜 둡니다.
     높이를 0.1L 단위로만 그리기 때문에, 전환이 없으면 계단처럼 튑니다.
     전환 시간이 딱 "한 칸 채우는 시간"이라 실제 속도대로 흐르는 것으로 보입니다. */
body.is-pouring .swatch { transition: none; }

/* 붓는 중 통 안 페인트도 "색"만 즉시 바뀌게 합니다 (높이 전환은 그대로 둡니다) */
body.is-pouring .tub__paint {
  transition: height var(--fill-tween, .2s) linear;
}

/* 페인트 표면에 살짝 밝은 선을 얹어 액체처럼 보이게 */
.tub__paint::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: rgba(255,255,255,.35);
}

/* ---------- 꽉 참 / 넘침 ---------- */
.tub.is-full { border-color: #ffd166; }
.tub.is-overflowing {
  border-color: #ff7043;
  animation: tub-shake .18s linear infinite;
}
@keyframes tub-shake {
  0%   { transform: translateX(0); }
  25%  { transform: translateX(-1.5px); }
  75%  { transform: translateX(1.5px); }
  100% { transform: translateX(0); }
}

/* 통 밖으로 흘러내리는 물방울 4개 */
.spill {
  position: absolute;
  inset: 0;
  pointer-events: none;
  visibility: hidden;
  color: #fff;                   /* 지금 페인트 색을 JS 가 넣어 줍니다 */
}
.spill.is-on { visibility: visible; }
.spill__drop {
  position: absolute;
  top: 0;
  width: 10px;
  height: 16px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: currentColor;
  box-shadow: 0 0 6px rgba(0,0,0,.45);
  animation: spill-fall .8s linear infinite;
}
.spill__drop--l1 { left: -8px;  animation-delay: 0s;    }
.spill__drop--l2 { left: 2px;   animation-delay: .35s;  }
.spill__drop--r1 { right: -8px; animation-delay: .18s;  }
.spill__drop--r2 { right: 2px;  animation-delay: .55s;  }
@keyframes spill-fall {
  0%   { top: -4%;  opacity: 0;   transform: scaleY(.6); }
  15%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { top: 104%; opacity: 0;   transform: scaleY(1.3); }
}

/* ---------- 원료 버튼: 꾹 누르기용 ---------- */
.ing-btn {
  touch-action: none;            /* 손가락으로 눌렀을 때 화면이 밀리지 않게 */
  user-select: none;
  -webkit-user-select: none;
}
.ing-btn.is-pouring {
  border-color: #ffd166;
  box-shadow: 0 0 0 3px rgba(255,209,102,.35);
  transform: translateY(2px);
}
.ing-btn.is-pouring .ing-btn__name { background: #3a3524; color: #ffe9a8; }

/* =========================================================================
   S1-7 에서 더해진 부분 — 완성 / 새 문제 버튼과 결과 화면
   ========================================================================= */

/* ---------- 완성 / 새 문제 버튼 ---------- */
.panel--actions { text-align: center; }
.button-row--actions { justify-content: center; gap: 20px; }

.big-btn {
  min-width: 190px;
  padding: 16px 28px;
  font-family: inherit;
  font-size: 19px;
  font-weight: bold;
  letter-spacing: 2px;
  color: #1a1c20;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}
.big-btn--finish { background: #ffd166; }
.big-btn--finish:hover:enabled { background: #ffdf94; }
.big-btn--hint { background: #405366; color: #f1f3f5; }
.big-btn--hint:hover:enabled { background: #526b84; }
.hint-text {
  display: inline-block;
  margin: 14px 0 0;
  padding: 10px 16px;
  color: #d9eaff;
  background: #263848;
  border: 1px solid #526b84;
  border-radius: 8px;
}
.big-btn--new {
  background: #2c3036;
  color: #e8eaed;
  border: 2px solid #6d747c;
}
.big-btn--new:hover:enabled { border-color: #b9bec4; }
.big-btn:disabled { opacity: .4; cursor: not-allowed; }

.panel__note--action {
  margin-top: 14px;
  min-height: 20px;              /* 글이 생겼다 사라져도 화면이 들썩이지 않게 */
  font-size: 15px;
}
.panel__note--action.is-warn { color: #ffb74d; font-weight: bold; }
.panel__note--action.is-done { color: #ffd166; font-weight: bold; }

/* ---------- 결과 화면 ----------
   기본은 display:none 입니다. "완성"을 누르기 전에는
   점수를 담은 글자가 화면에 아예 그려지지 않습니다. */
.result {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(10, 11, 13, .82);
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: auto;
}
.result.is-on { display: flex; }

.result__box {
  width: 100%;
  max-width: 900px;
  padding: 28px 32px 32px;
  background: #1c1f24;
  border: 2px solid #4a4f56;
  border-radius: 14px;
  text-align: center;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .6);
}

.result__verdict {
  margin: 0;
  font-size: 30px;
  font-weight: bold;
  letter-spacing: 2px;
}
.result.is-pass    .result__verdict { color: #9ccc65; }
.result.is-reject  .result__verdict { color: #ff8a65; }

.result__score {
  margin: 6px 0 22px;
  font-size: 58px;
  font-weight: bold;
  letter-spacing: 2px;
  color: #f1f3f5;
  font-variant-numeric: tabular-nums;
}
.result__score-unit { font-size: 24px; margin-left: 4px; color: #b9bec4; }

/* 손님 차 색과 내가 칠한 색을 나란히, 크게 */
.result__compare {
  display: flex;
  gap: 24px;
  justify-content: center;
  align-items: flex-end;
}
.result__side { flex: 1 1 0; max-width: 380px; }
.result__side-title {
  margin: 0 0 8px;
  font-size: 15px;
  color: #b9bec4;
  letter-spacing: 2px;
  font-weight: normal;
}
.result__swatch {
  height: 220px;
  border-radius: 10px;
  border: 3px solid #4a4f56;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .25);
}

.result__detail {
  margin: 20px 0 22px;
  font-size: 15px;
  color: #b9bec4;
  line-height: 1.6;
}

/* =========================================================================
   S2-1 / S2-2 / S2-3 에서 더해진 부분
   — 돈·원료 창고 상태 표시줄, 상점 패널, 원료 버튼의 남은 양 표시
   ========================================================================= */

/* hidden 이 붙은 요소는 무조건 감춥니다 (다른 규칙에 밀리지 않게) */
[hidden] { display: none !important; }

/* ---------- 상단 줄: 제목 + 상점 버튼 ---------- */
.topbar__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.shop-toggle {
  padding: 9px 20px;
  font-family: inherit;
  font-size: 15px;
  font-weight: bold;
  letter-spacing: 1px;
  color: #1a1c20;
  background: #ffd166;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
.shop-toggle:hover { background: #ffdf94; }
.shop-toggle.is-open { background: #2c3036; color: #ffd166; border: 2px solid #ffd166; }

/* ---------- 상태 표시줄 (돈 + 원료 보유량) ---------- */
.status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 12px;
  padding: 10px 14px;
  background: #12151a;
  border: 1px solid #34383e;
  border-radius: 10px;
}
.status__money { display: flex; align-items: baseline; gap: 8px; }
.status__money-label {
  font-size: 24px;
  letter-spacing: 2px;
  color: #9aa0a6;
}
.status__money-value {
  font-size: 26px;
  letter-spacing: 1px;
  color: #ffd166;
  font-variant-numeric: tabular-nums;   /* 숫자 폭이 일정해 흔들리지 않게 */
}
.status__divider { width: 1px; align-self: stretch; background: #34383e; }
.status__stock { display: flex; flex: 1 1 430px; align-items: center; gap: 12px; }
.status__stock-label { font-size: 13px; letter-spacing: 2px; color: #9aa0a6; }

.stock-strip { display: flex; width: 100%; align-items: flex-end; gap: 12px; flex-wrap: nowrap; }
.stock-chip {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 6px;
  background: #1c1f24;
  border: 1px solid #3d434a;
  border-radius: 8px;
}
.stock-chip__buy {
  width: 28px;
  height: 28px;
  padding: 0;
  font: 700 22px/24px inherit;
  color: #171a1e;
  background: #ffd166;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.stock-chip__buy-row {
  display: flex;
  width: 100%;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.stock-chip__price {
  color: #ffd166;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.stock-chip__buy:hover:enabled { background: #ffdf94; }
.stock-chip__buy:disabled { opacity: .35; cursor: not-allowed; }
.stock-chip__pour {
  width: 100%;
  min-width: 54px;
  padding: 5px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
}
.stock-chip__pour:hover:enabled {
  border-color: #ffd166;
  background: #292d33;
}
.stock-chip__pour.is-pouring {
  border-color: #ffd166;
  background: #3a3524;
  box-shadow: 0 0 0 3px rgba(255, 209, 102, .3);
  transform: translateY(2px);
}
.stock-chip__pour:disabled { cursor: not-allowed; opacity: .45; }
.stock-chip__name { font-size: 13px; color: #b9bec4; }
.stock-chip.is-empty { opacity: .55; }

/* ---------- 상점 패널 ---------- */
.panel--shop {
  position: fixed;
  z-index: 40;
  inset: 5vh 5vw;
  margin: 0;
  padding: 22px;
  overflow-y: auto;
  border-color: #6b5a25;
  background: #1f1c14;
  box-shadow: 0 0 0 100vmax rgba(10, 11, 13, .82), 0 18px 60px rgba(0,0,0,.65);
}
.shop-head { display: flex; align-items: center; justify-content: space-between; }
.panel__title--shop { margin-bottom: 0; color: #ffd166; }
.shop-close {
  padding: 7px 16px;
  font-family: inherit;
  font-size: 14px;
  color: #e8eaed;
  background: #2c3036;
  border: 1px solid #6d747c;
  border-radius: 7px;
  cursor: pointer;
}
.shop-close:hover { border-color: #b9bec4; }

.shop-list {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.shop-item {
  flex: 1 1 180px;
  max-width: 240px;
  padding: 12px;
  background: #14171b;
  border: 1px solid #3d434a;
  border-radius: 10px;
  text-align: center;
}
.shop-item__chip {
  height: 46px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.25);
}
.shop-item__name { margin: 8px 0 2px; font-size: 15px; font-weight: bold; }
.shop-item__price { margin: 0; font-size: 14px; color: #ffd166; font-variant-numeric: tabular-nums; }
.shop-item__have { margin: 4px 0 10px; font-size: 13px; color: #9aa0a6; }
.shop-item__buttons { display: flex; gap: 8px; justify-content: center; }
.buy-btn {
  flex: 1 1 0;
  padding: 9px 6px;
  font-family: inherit;
  font-size: 15px;
  font-weight: bold;
  color: #1a1c20;
  background: #cfd4da;
  border: none;
  border-radius: 7px;
  cursor: pointer;
}
.buy-btn:hover:enabled { background: #fff; }
.buy-btn:disabled { opacity: .35; cursor: not-allowed; }
.shop-item__reason {
  margin: 8px 0 0;
  min-height: 17px;              /* 글이 생겼다 사라져도 화면이 들썩이지 않게 */
  font-size: 12px;
  color: #ff8a65;
}

/* ---------- 원료 버튼 아래의 보유량 막대 (S3-1) ---------- */
.ing-btn__stock {
  display: block;
  padding: 6px 4px 7px;
  font-size: 13px;
  background: #23272d;
  color: #b9bec4;
}
.ing-btn__word { display: block; margin-top: 4px; }
.ing-btn.is-empty .ing-btn__word { color: #ff8a65; font-weight: bold; }
.ing-btn.is-empty .ing-btn__chip {
  /* 재고가 없는 원료는 색 위에 빗금을 얹어 한눈에 구분되게 */
  background-image: repeating-linear-gradient(
    45deg,
    rgba(0,0,0,.55) 0 7px,
    rgba(0,0,0,0)   7px 14px
  );
}


/* =========================================================================
   S2-4 / S2-5 에서 더해진 부분
   — 손님 안내줄, 응대한 손님 수, 결과 화면의 수리비 표시
   ========================================================================= */

/* 색 견본 위의 짧은 안내줄 ("3번째 손님이 긁힌 차를 몰고 왔습니다") */
.swatch-box__lead {
  margin: 0 0 10px;
  min-height: 18px;              /* 글자가 바뀌어도 화면이 들썩이지 않게 */
  font-size: 14px;
  color: #9aa0a6;
}
.swatch-box--car .swatch-box__lead { color: #ffd166; }
.swatch-box--car .swatch-box__title { color: #ffd166; }
.swatch-box--car .swatch { border-color: #6b5a25; }

/* 손님에게 필요한 양 — 견본 바로 아래에 눈에 띄게 */
.swatch-box__caption--need {
  font-size: 18px;
  font-weight: bold;
  color: #f1f3f5;
  font-variant-numeric: tabular-nums;
}

/* 상태 표시줄의 "응대한 손님 N명" */
.status__served { display: flex; align-items: baseline; gap: 8px; }
.status__served-label { font-size: 13px; letter-spacing: 2px; color: #9aa0a6; }
.status__served-value {
  font-size: 20px;
  color: #e8eaed;
  font-variant-numeric: tabular-nums;
}
.status__served-comma { color: #6d747c; }
.status__rating-value { color: #ffd166; }
.result__stars {
  display: block;
  margin-bottom: 4px;
  color: #ffd166;
  font-size: 34px;
  letter-spacing: 5px;
  line-height: 1;
}

/* 결과 화면 — 받은 수리비 (또는 거절) */
.result__fee {
  margin: 0 0 22px;
  font-size: 22px;
  color: #b9bec4;
  letter-spacing: 1px;
}
.result__paint-cost {
  margin: -14px 0 20px;
  color: #7c838b;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.result__fee strong {
  font-size: 34px;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
}
.result.is-pass   .result__fee strong { color: #9ccc65; }
.result.is-reject .result__fee strong { color: #ff8a65; }

/* 결과 화면 — 지금 가진 돈 */
.result__money {
  margin: 0 0 22px;
  font-size: 17px;
  font-weight: bold;
  color: #ffd166;
  font-variant-numeric: tabular-nums;
}
.result__recipe {
  display: grid;
  gap: 8px;
  margin: 18px 0;
  text-align: left;
}
.result__recipe p {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 12px;
  margin: 0;
  padding: 11px 14px;
  background: #eef1f4;
  border-radius: 8px;
}
.result__recipe strong { color: #343a40; }
.result__recipe span { color: #505860; }


/* =========================================================================
   S3-1 / S3-2 / S3-6 에서 더해진 부분
   — 원료 보유량 막대, 내가 가진 통 목록, 상점의 빈 통
   ========================================================================= */

/* ---------- 원료 보유량 막대 (S3-1) ----------
   조색 화면에서는 남은 양을 이 막대와 짧은 말로만 보여줍니다.
   칸이 굵고 개수가 적어서(기본 6칸), 막대를 자로 재도 남은 양을 알 수 없습니다.
   켜진 칸의 색은 그 원료의 색입니다 (JS 가 color 로 넣어 줍니다). */
.stock-bar {
  display: inline-flex;
  gap: 3px;
  vertical-align: middle;
}
.stock-chip .stock-bar {
  width: 100%;
  flex-direction: column-reverse;
  height: 105px;
}
.stock-chip .stock-bar__seg { width: 100%; min-width: 32px; height: 14px; }

@media (max-width: 700px) {
  .topbar { padding: 12px; }
  .status { gap: 10px; padding: 10px; }
  .status__stock { flex: 1 0 100%; width: 100%; }
  .stock-strip { gap: 7px; }
  .stock-chip { padding: 6px 4px; }
  .stock-chip__buy { width: 30px; height: 30px; line-height: 26px; flex: 0 0 30px; }
  .stock-chip__buy-row { gap: 3px; }
  .stock-chip__price { font-size: 9px; }
  .stock-chip__pour { min-width: 0; padding: 6px; }
  .stock-chip .stock-bar { height: 126px; }
  .stock-chip .stock-bar__seg { min-width: 28px; height: 17px; }
}
.stock-bar__seg {
  width: 12px;
  height: 14px;
  border-radius: 2px;
  background: #14171b;
  border: 1px solid #454b53;
}
.stock-bar__seg.is-on {
  background: currentColor;
  border-color: rgba(255, 255, 255, .55);
}

/* 상태 표시줄의 원료 칸 — 막대 + 짧은 말 */
.stock-chip__word {
  font-size: 13px;
  font-weight: bold;
  color: #cfd4da;
}
.stock-chip.is-empty .stock-chip__word { color: #ff8a65; }

/* 원료 버튼 안의 막대는 가운데로 */
.ing-btn__stock .stock-bar { display: flex; justify-content: center; }

@media (max-width: 900px) {
  .bench-layout { grid-template-columns: 1fr; }
  .panel--ingredients { position: static; }
  .panel--ingredients .button-row { flex-direction: row; flex-wrap: wrap; }
  .panel--ingredients .ing-btn { width: 130px; }
}

/* ---------- 내가 가진 통 목록 (S3-2) ----------
   통이 6~8개로 늘어나도 저절로 여러 줄로 접히도록 격자로 배치합니다. */
.tub-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.tub-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 10px 10px;
  font-family: inherit;
  color: #e8eaed;
  background: #2c3036;
  border: 2px solid #4a4f56;
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
}
.tub-card:hover:enabled { border-color: #7f8792; }
.tub-card:disabled { cursor: not-allowed; }
.tub-card__head { font-size: 15px; font-weight: bold; letter-spacing: 1px; }

/* 통 안에 든 색 자리. 빈 통이면 체크무늬로 "아무것도 없음"을 보여줍니다. */
.tub-card__chip {
  width: 100%;
  height: 42px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, .25);
}
.tub-card__chip.is-empty {
  border-style: dashed;
  border-color: #5a6068;
  background-color: transparent;
  background-image:
    linear-gradient(45deg, #3a3e44 25%, transparent 25%, transparent 75%, #3a3e44 75%),
    linear-gradient(45deg, #3a3e44 25%, transparent 25%, transparent 75%, #3a3e44 75%);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
}
.tub-card__state { font-size: 13px; color: #b9bec4; font-variant-numeric: tabular-nums; }
.tub-card.is-filled .tub-card__state { color: #e8eaed; font-weight: bold; }
.tub-card__badge { min-height: 16px; font-size: 12px; color: #ffd166; font-weight: bold; }

/* 작업대에 올라와 있는 통 */
.tub-card.is-selected {
  border-color: #ffd166;
  background: #3a3524;
  opacity: 1;
}
/* 고를 수 없는 통(내용물이 든 통)은 흐리게 */
.tub-card:disabled:not(.is-selected) { opacity: .5; }

/* 제목 옆의 "(3개 · 빈 통 3개)" */
.panel__count { font-size: 13px; color: #9aa0a6; letter-spacing: 0; }

/* ---------- 상점: 구역 제목과 빈 통 (S3-6) ---------- */
.shop-section-title {
  margin: 18px 0 0;
  font-size: 14px;
  letter-spacing: 2px;
  color: #ffd166;
}
.shop-note--stock { color: #9aa0a6; }

/* 빈 통 칸은 원료 칸과 살짝 다른 테두리로 구분합니다 */
.shop-item--tub { border-color: #4a545f; }

/* 빈 통 그림 — 작업대의 통을 작게 흉내 낸 모양 */
.shop-item__tubpic {
  height: 46px;
  margin: 0 auto;
  width: 46px;
  background: #23272d;
  border: 3px solid #8d949c;
  border-top: none;
  border-radius: 0 0 8px 8px;
}

/* ---------- 상점이 열려 있는 동안에는 붓기 잠금 (S3-1 보강) ----------
   상점을 열면 원료 버튼이 전부 잠기고, 왜 잠겼는지 한 줄로 알려 줍니다.
   통에 담긴 것은 그대로 남아 있으니 상점을 닫으면 이어서 조색할 수 있습니다. */
.shop-note--lock { color: #ffb74d; }

.ing-btn.is-locked {
  border-style: dashed;
  border-color: #6d747c;
}

.panel__note--lock {
  margin-top: 8px;
  padding: 8px 12px;
  background: #35301f;
  border-left: 4px solid #ffd166;
  border-radius: 4px;
  color: #ffd166;
  font-size: 15px;
  font-weight: bold;
}

/* =========================================================================
   S3-3 / S3-4 / S3-5 에서 더해진 부분
   — 재고가 든 통, 재고 페인트 붓기 버튼, 버리기, 빈 통 부족 안내
   ========================================================================= */

/* ---------- 통 한 칸 = 고르는 카드 + 버리기 버튼 (S3-5) ----------
   카드가 버튼이라 그 안에 또 버튼을 넣을 수 없어서, 둘을 한 칸에 위아래로 담습니다. */
.tub-slot {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tub-slot .tub-card { flex: 1; }

/* 버리기 — 되돌릴 수 없는 일이라 눈에 띄되, 실수로 먼저 눌리지 않게
   카드보다 작고 차분하게 둡니다. 누르면 확인 창이 먼저 뜹니다. */
.tub-discard {
  padding: 6px 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: bold;
  color: #ffab91;
  background: #2c3036;
  border: 1px solid #7a4b3f;
  border-radius: 8px;
  cursor: pointer;
}
.tub-discard:hover:enabled {
  color: #fff;
  background: #6d3428;
  border-color: #c1573f;
}
.tub-discard[hidden] { display: none; }

/* ---------- 재고 페인트 붓기 버튼 (S3-4) ----------
   원료 버튼(.ing-btn)과 같은 모양·같은 조작입니다.
   구분이 되도록 테두리만 조금 다르게 했습니다. */
.ing-btn--stockpaint { border-color: #5c6470; }
.ing-btn--stockpaint .ing-btn__chip {
  border-bottom: 1px solid rgba(255, 255, 255, .18);
}
.ing-btn--stockpaint .ing-btn__word {
  font-size: 13px;
  font-weight: bold;
  color: #cfd4da;
  font-variant-numeric: tabular-nums;
}

/* 재고가 하나도 없을 때의 안내 한 줄 */
.panel__note--none { color: #9aa0a6; font-style: normal; }
.panel__note--none[hidden] { display: none; }
.status__xp { min-width: 150px; }
.status__xp progress { width: 130px; height: 8px; display: block; accent-color: #f2b84b; }
.level-notice { position: fixed; z-index: 30; top: 90px; left: 50%; transform: translateX(-50%); background: #fff1b8; color: #422f00; border: 2px solid #e3a51f; border-radius: 12px; padding: 12px 20px; font-weight: 800; box-shadow: 0 6px 24px #0003; }
.game-over { z-index: 50; }
.final-record { margin: 18px 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.final-record p { margin: 0; padding: 12px; border-radius: 8px; background: #f3f4f6; }

/* ---------- 모바일 화면 ---------- */
@media (max-width: 700px) {
  body { min-width: 0; }
  .topbar h1 { font-size: 18px; }
  .status {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 7px 12px;
  }
  .status__divider { display: none; }
  .status__money-value { font-size: 21px; }
  .status__served { flex-wrap: nowrap; gap: 5px; white-space: nowrap; }
  .status__served-label { font-size: 11px; letter-spacing: 0; }
  .status__served-value { font-size: 16px; }
  .status__xp { min-width: 0; }
  .status__xp progress { display: inline-block; width: 58px; }
  .status__stock { grid-column: 1 / -1; }

  .stock-chip { min-width: 0; }
  .stock-chip__buy-row { min-width: 0; }
  .stock-chip__price { max-width: 34px; overflow: hidden; font-size: 8px; }
  .stock-chip .stock-bar { height: 72px; gap: 2px; }
  .stock-chip .stock-bar__seg { height: 10px; }

  .bench { padding: 12px 12px 30px; }
  .compare {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 12px;
  }
  .swatch-box { flex: 1 1 0; width: auto; min-width: 0; max-width: none; }
  .swatch-box__title,
  .tub-area__title { margin-bottom: 7px; font-size: 12px; letter-spacing: 0; white-space: nowrap; }
  .compare .swatch-box__lead { display: none; }
  .swatch { height: 125px; border-width: 2px; border-radius: 7px; }
  .tub-area { flex: 0 0 84px; width: 84px; }
  .tub-area > .swatch-box__lead { display: none; }
  .tub { width: 80px; height: 125px !important; border-width: 3px; }
  .tub-area__amount { margin-top: 8px; font-size: 17px; letter-spacing: 0; white-space: nowrap; }
  .tub-area__label { margin-top: 5px; font-size: 10px; }
  .tub-area__warn { font-size: 10px; }
  .swatch-box__caption { margin-top: 8px; font-size: 11px; }
  .swatch-box__caption--need { font-size: 13px; white-space: nowrap; }
  .tub__tick-label { right: 2px; font-size: 9px; }
  .panel { padding: 12px 10px; }
  .panel--actions { margin-top: 12px; }
  .button-row--actions { flex-direction: row; flex-wrap: nowrap; gap: 8px; }
  .button-row--actions .big-btn {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    padding: 12px 7px;
    font-size: 14px;
    letter-spacing: 0;
  }
  .panel__note--action { margin-top: 9px; min-height: 0; font-size: 12px; }

  .result { padding: 8px; align-items: flex-start; }
  .result__box { margin: 8px 0; padding: 20px 12px 24px; border-radius: 10px; }
  .result__verdict { font-size: 24px; }
  .result__score { font-size: 38px; }
  .result__stars { font-size: 25px; letter-spacing: 2px; }
  .result__score-unit { font-size: 17px; }
  .result__compare { gap: 10px; }
  .result__swatch { height: 130px; }
  .result__detail { font-size: 13px; }
  .result__recipe p { grid-template-columns: 72px 1fr; gap: 6px; padding: 9px; font-size: 12px; }
  .final-record { grid-template-columns: 1fr; }
}
