/*
 * workshop.css — 장소: 공방 (왼쪽 보관함 / 가운데 연금솥 / 오른쪽 연금 일지)
 *   위쪽 상태 막대와 왼쪽 책갈피는 shell.css
 */

/* ───────── 세 칸 배치 ───────── */
.ws-main {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(380px, 1fr) minmax(250px, 320px);
  gap: 14px;
  height: 100%;
  min-height: 0;
}

/* ───────── 보관함 ───────── */
.inv-tabs {
  display: flex;
  gap: 2px;
  flex-wrap: nowrap;
  margin: 0 -4px 0;
  padding: 0 4px;
  border-bottom: var(--px) solid var(--wood-dark);
}
.inv-tab {
  position: relative;
  top: var(--px);
  flex: 1 1 auto;
  min-width: 0;
  margin: var(--px) 1px 0;
  padding: 4px 4px 3px;
  white-space: nowrap;
  text-align: center;
  border: 0;
  background: var(--paper-3);
  box-shadow: 0 calc(-1 * var(--px)) 0 0 var(--wood-dark), calc(-1 * var(--px)) 0 0 0 var(--wood-dark), var(--px) 0 0 0 var(--wood-dark);
  color: var(--ink-2);
  font-size: 13.5px;
  letter-spacing: -0.3px;
  cursor: pointer;
}
.inv-tab:hover { background: var(--paper-2); }
.inv-tab.is-active {
  background: var(--paper);
  color: var(--red-dark);
  font-weight: 700;
  padding-bottom: 6px;
  margin-top: 0;
}
.inv-scroll { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -8px; padding: 12px 8px 4px; }
.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 12px 6px; }
.inv-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
/* 아이콘 칸: 살짝 파인 홈 (보관함·연금솥 공용) */
.slot-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  background: var(--paper-2);
  box-shadow:
    inset var(--px) var(--px) 0 rgba(94, 70, 48, 0.22),
    inset calc(-1 * var(--px)) calc(-1 * var(--px)) 0 rgba(255, 252, 240, 0.7),
    0 0 0 var(--px) var(--paper-edge);
  transition: background-color 0.1s, transform 0.1s;
}
.inv-item:hover .slot-box { background: var(--gold-soft); transform: translateY(-2px); }
.inv-item:active .slot-box { transform: translateY(1px); }
.inv-item.is-used-up { cursor: default; }
.inv-item.is-used-up .item-icon { filter: grayscale(1); opacity: 0.45; }
.inv-item.is-used-up:hover .slot-box { background: var(--paper-2); transform: none; }
.inv-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  color: var(--ink-2);
}
.inv-empty { grid-column: 1 / -1; margin: 30px 0; text-align: center; color: var(--ink-soft); }

/* ───────── 연금솥 ───────── */
.ws-cauldron { align-items: center; }
.cauldron-stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  min-height: 0;
  padding-bottom: 6px;
  background:
    radial-gradient(ellipse 38% 46% at 50% 72%, rgba(255, 190, 100, 0.32), transparent 70%);
}
.cauldron-stage::after { /* 바닥 그림자 */
  content: '';
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 280px;
  height: 18px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse, rgba(58, 39, 24, 0.28), transparent 70%);
  z-index: -1;
}
/* 솥 뒤 선반 장식 */
.stage-shelf {
  position: absolute;
  top: 3%;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateX(-50%);
  pointer-events: none;
}
.shelf-items { display: flex; align-items: flex-end; gap: 14px; padding: 0 22px; }
.shelf-items img { width: 64px; height: 64px; margin-bottom: -4px; image-rendering: pixelated; }
.shelf-plank {
  position: relative;
  width: 100%;
  height: 12px;
  background: var(--wood);
  box-shadow: inset 0 3px 0 var(--wood-light), inset 0 -3px 0 var(--wood-dark), 0 0 0 3px var(--ink);
}
.shelf-plank::before,
.shelf-plank::after { /* 선반 받침 */
  content: '';
  position: absolute;
  top: 12px;
  width: 12px;
  height: 18px;
  background: var(--wood-dark);
  box-shadow: 0 0 0 3px var(--ink);
  clip-path: inset(0 -3px -3px -3px);
}
.shelf-plank::before { left: 26px; }
.shelf-plank::after { right: 26px; }
@media (max-height: 720px) { .stage-shelf { display: none; } }

.ws-cauldron .cauldron-sprite { --scale: 4; }
@media (max-height: 820px) { .ws-cauldron .cauldron-sprite { --scale: 3; } }

/* 결과물이 솥에서 튀어 오르는 효과 */
.cauldron-pop {
  position: absolute;
  left: 50%;
  top: 18%;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transform: translateX(-50%);
  pointer-events: none;
  animation: pop-up 1.8s ease-out both;
}
.cauldron-pop .pop-label {
  padding: 1px 10px;
  background: var(--paper);
  box-shadow: 0 0 0 2px var(--ink);
  font-family: var(--font-title);
  font-size: 17px;
  white-space: nowrap;
}
.cauldron-pop.is-fail .pop-label { color: var(--ink-soft); }
@keyframes pop-up {
  0% { opacity: 0; transform: translate(-50%, 70px) scale(0.6); }
  25% { opacity: 1; transform: translate(-50%, 0) scale(1.05); }
  35% { transform: translate(-50%, 0) scale(1); }
  80% { opacity: 1; transform: translate(-50%, -8px); }
  100% { opacity: 0; transform: translate(-50%, -26px); }
}

.cauldron-slots { display: flex; align-items: flex-start; justify-content: center; gap: 4px; margin: 10px 0 4px; }
.slot-plus { align-self: center; margin-top: -18px; color: var(--wood-light); font-family: var(--font-title); font-size: 24px; }
.cauldron-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 92px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.cauldron-slot .slot-box { width: 82px; height: 82px; }
.cauldron-slot.is-filled .slot-box { background: #fbf5e4; }
.cauldron-slot.is-filled:hover .slot-box { background: #f7dccf; }
.slot-empty { color: var(--ink-soft); font-size: 13px; opacity: 0.8; }
.slot-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--ink-2); min-height: 20px; }

.cauldron-buttons { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; }
.cauldron-result { min-height: 58px; display: flex; align-items: center; justify-content: center; margin-top: 8px; }
.result-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 16px 4px 6px;
  background: var(--paper-2);
  box-shadow: 0 0 0 2px var(--paper-edge);
  animation: fade-in 0.3s ease-out;
}
.result-card.is-success { background: var(--green-soft); box-shadow: 0 0 0 2px #9fbb86; }
.result-card.is-fail { background: #eadfcf; }
.result-label { font-size: 12.5px; color: var(--ink-soft); }
.result-card.is-success .result-label { color: var(--green); font-weight: 700; }
.result-name { font-family: var(--font-title); font-size: 18px; }

/* ───────── 연금 일지 (줄 쳐진 공책) ───────── */
.ws-log { --face: #fcf7ea; }
.log-list {
  flex: 1;
  min-height: 0;
  margin: 0 -6px;
  padding: 0 8px 0 34px;
  overflow-y: auto;
  list-style: none;
  font-size: 14.5px;
  line-height: 27px;
  background-image:
    linear-gradient(90deg, transparent 24px, rgba(166, 61, 44, 0.4) 24px, rgba(166, 61, 44, 0.4) 26px, transparent 26px),
    repeating-linear-gradient(transparent 0 26px, rgba(61, 106, 134, 0.2) 26px 27px);
  background-attachment: local;
}
.log-line { position: relative; padding: 0; animation: fade-in 0.35s ease-out; transition: opacity 0.4s; }
.log-day { position: absolute; left: -32px; width: 26px; text-align: center; font-size: 11px; color: var(--red); }
.log-line.is-success { color: var(--green); }
.log-line.is-fail { color: #8a4b2a; }
.log-line.is-discover { color: var(--purple); font-weight: 700; }
.log-line.is-discover::before { content: '✦ '; color: var(--gold); }
.log-line.is-warn { color: var(--red-dark); }
.log-line.is-info { color: var(--ink-2); }

/* ───────── 좁은 화면 ───────── */
@media (max-width: 1120px) {
  .ws-main { grid-template-columns: minmax(260px, 320px) 1fr; grid-template-rows: minmax(0, 1fr) 190px; }
  .ws-log { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .ws-main { grid-template-columns: 1fr; grid-template-rows: none; }
  .ws-inventory { height: 360px; }
  .ws-cauldron { min-height: 520px; }
  .ws-log { height: 240px; }
}

/* ───────── 2단계: 보관함 모드 · 오른쪽 탭 · 납품 상자 · 밤의 솥 ───────── */
.inv-modes { display: flex; align-items: center; gap: 6px; margin: -2px 0 10px; }
.inv-modes-label { font-size: 12.5px; color: var(--ink-soft); }
.inv-mode {
  flex: 1;
  padding: 4px 8px;
  border: 0;
  background: var(--paper-3);
  box-shadow: 0 0 0 2px var(--paper-edge);
  color: var(--ink-2);
  font-size: 13.5px;
  cursor: pointer;
}
.inv-mode:hover { background: var(--paper-2); }
.inv-mode.is-active { background: var(--red); box-shadow: 0 0 0 2px var(--red-dark); color: #fff4e2; }
.ws-inventory.is-ship-mode .slot-box { box-shadow: inset 3px 3px 0 rgba(94, 70, 48, 0.22), inset -3px -3px 0 rgba(255, 252, 240, 0.7), 0 0 0 3px #b58d3d; }
.ws-inventory.is-ship-mode .inv-name { color: #7d5a1e; font-weight: 700; }

.side-tabs { margin-bottom: 10px; }
.side-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.side-body[hidden] { display: none; }

.ship-guide { margin: 0 0 8px; font-size: 12.5px; line-height: 1.6; color: var(--ink-soft); }
.ship-scroll { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -6px; padding: 2px 6px; }
.ship-list { list-style: none; display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; }
.ship-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 4px 10px 4px 4px;
  border: 0;
  background: #fffaf0;
  box-shadow: 0 0 0 2px var(--paper-edge);
  text-align: left;
  cursor: pointer;
}
.ship-row:hover { background: #f7dccf; }
.ship-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ship-count { font-weight: 700; }
.ship-value { min-width: 64px; text-align: right; color: #7d5a1e; font-size: 13px; }
.ship-empty { padding: 20px 0; text-align: center; color: var(--ink-soft); }
.ship-total { margin-top: 8px; padding: 8px 10px; background: var(--gold-soft); box-shadow: 0 0 0 2px rgba(201, 154, 60, 0.6); font-weight: 700; text-align: center; }

.cauldron-night {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(45, 51, 96, 0.28);
  color: #fff8ec;
  text-align: center;
  text-shadow: 0 2px 0 rgba(20, 22, 50, 0.6);
}
.cauldron-night-moon { font-size: 40px; }
.cauldron-night-text { max-width: 340px; margin: 0; padding: 8px 16px; background: rgba(35, 38, 72, 0.78); box-shadow: 0 0 0 2px rgba(20, 22, 50, 0.6); font-size: 15px; line-height: 1.7; }
.cauldron-stage.is-night .cauldron-night { display: flex; }
.cauldron-stage.is-night .cauldron-sprite { filter: brightness(0.7) saturate(0.6); }

/* 보관함 원소 거르기 */
.inv-attrs { display: flex; gap: 3px; margin: 0 0 6px; flex-wrap: wrap; }
.inv-attr { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; min-height: 22px; padding: 1px 4px; border: 0; background: var(--paper-2, #efe4cc); box-shadow: 0 0 0 1.5px var(--paper-edge, #c9b48a); font: inherit; font-size: 13px; line-height: 20px; cursor: pointer; }
.inv-attr.is-active { background: #fffaf0; box-shadow: 0 0 0 2px var(--wood-dark, #5c3920); font-weight: 700; }
.inv-attr.is-special { background: #12302a; color: #8fe0c8; }
