/*
 * explore.css — 장소: 탐험 (코스 카드 · 육각형 지도 · 체력/정신력 막대 · 사건 창 · 전투 창)
 */

.explore { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); gap: 14px; height: 100%; min-height: 0; }
.explore > .explore-side:first-child { order: 2; }
.explore-main, .explore-mapbox { min-height: 0; }
.explore-side { overflow-y: auto; }
.explore-note { margin: 10px 0 0; font-size: 13px; line-height: 1.7; color: var(--ink-soft); }
.explore-home { margin-top: 16px; align-self: stretch; }

/* 체력 · 정신력 · 행동력 */
.vitals { display: flex; flex-direction: column; gap: 6px; }
.vital { display: grid; grid-template-columns: 72px 1fr 54px; align-items: center; gap: 8px; font-size: 13px; }
.vital-track { position: relative; display: block; height: 12px; background: var(--paper-3); box-shadow: 0 0 0 2px var(--ink); }
.vital-fill { display: block; height: 100%; transition: width 0.3s; }
.vital.is-hp .vital-fill { background: repeating-linear-gradient(90deg, #b8473a 0 6px, #cc5a4a 6px 12px); }
.vital.is-sanity .vital-fill { background: repeating-linear-gradient(90deg, #5b5a9e 0 6px, #7271b8 6px 12px); }
.vital-fill.is-enemy { background: repeating-linear-gradient(90deg, #6e7a3a 0 6px, #839044 6px 12px); }
.vital-num { text-align: right; }
.vital-ap { margin-top: 2px; font-size: 14px; }
.hud-vitals.is-low { color: var(--purple); font-weight: 700; }

/* 코스 카드 */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; overflow-y: auto; padding: 4px; align-content: start; }
.course-card { display: flex; flex-direction: column; gap: 6px; margin: 3px; padding: 14px 16px; background: #fffaf0; box-shadow: 0 -3px 0 0 var(--wood-dark), 0 3px 0 0 var(--wood-dark), -3px 0 0 0 var(--wood-dark), 3px 0 0 0 var(--wood-dark), 0 6px 0 0 rgba(58, 39, 24, 0.15); }
.course-head { display: flex; align-items: center; justify-content: space-between; }
.course-name { font-family: var(--font-title); font-size: 21px; }
.course-ap { padding: 0 10px; background: var(--gold-soft); box-shadow: 0 0 0 2px #8a6a22; font-weight: 700; }
.course-desc { margin: 0; font-size: 14px; line-height: 1.7; color: var(--ink-2); }
.course-meta { font-size: 12.5px; color: var(--ink-soft); }
.course-sub { margin-top: 4px; font-size: 12px; color: var(--ink-soft); }
.course-chips { display: flex; flex-wrap: wrap; gap: 6px 8px; }
.rep-chip.is-monster { background: #f3e3dd; box-shadow: 0 0 0 2px #c79b8d; }
.course-go { margin-top: 8px; align-self: flex-end; }

/* 육각형 지도 */
.hex-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background:
    radial-gradient(ellipse at center, rgba(255, 255, 255, 0.35), transparent 70%),
    repeating-linear-gradient(0deg, transparent 0 22px, rgba(139, 90, 52, 0.06) 22px 23px),
    #e7d7b4;
  background-size: cover;
  box-shadow: inset 0 0 0 3px rgba(139, 90, 52, 0.3), inset 0 0 40px rgba(58, 39, 24, 0.25);
}
.hex-map { max-width: 100%; max-height: 100%; height: auto; overflow: visible; }
.hex polygon { stroke: var(--wood-dark); stroke-width: 3; transition: fill 0.15s; }
.hex.is-done polygon { fill: #f5ead2; }
.hex.is-fog polygon { fill: #b9a788; stroke-dasharray: 6 4; }
.hex.type-battle.is-fog polygon { fill: #c4a08c; }
.hex.type-treasure.is-fog polygon { fill: #d9c27a; }
.hex.is-here polygon { fill: #fff3cf; stroke: var(--red); stroke-width: 4; }
.hex.can-move { cursor: pointer; }
.hex.can-move polygon { stroke: #2f7a6a; stroke-width: 4; stroke-dasharray: none; }
.hex.can-move:hover polygon { fill: #d8ecd0; }
.hex-icon { image-rendering: pixelated; pointer-events: none; }
.hex text { pointer-events: none; font-family: var(--font-title); }
.hex-mark { font-size: 26px; fill: var(--purple); }
.hex-me { font-size: 24px; }
.hex-start { font-size: 12px; fill: var(--ink-soft); }
.hex-count { font-size: 12px; fill: var(--red-dark); font-weight: 700; }

/* 사건 · 전투 창 (탐험 화면 위) */
.scene-explore { position: absolute; }
.explore-overlay { position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(40, 32, 48, 0.45); }
.explore-overlay[hidden] { display: none; }
.event-card { width: min(560px, 100%); padding: 22px 26px 18px; }
.event-text { margin: 6px 0 12px; font-size: 16px; line-height: 1.9; }
.event-delta { margin: 0 0 10px; font-weight: 700; color: var(--purple); }
.event-choices { display: flex; flex-direction: column; gap: 8px; }
.event-choices .btn { text-align: left; }

.battle {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(980px, 100%);
  max-height: 100%;
  overflow: visible;
  padding: 18px 22px;
  background: #f3ead6;
  box-shadow: 0 -3px 0 0 var(--ink), 0 3px 0 0 var(--ink), -3px 0 0 0 var(--ink), 3px 0 0 0 var(--ink), 0 8px 0 0 rgba(20, 14, 24, 0.3);
}
.battle-title { text-align: center; font-family: var(--font-title); font-size: 22px; color: var(--red-dark); }
.enemy-row { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; min-height: 190px; align-items: flex-end; }
.enemy {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 170px;
  padding: 10px 10px 8px;
  border: 0;
  background: #fffaf0;
  box-shadow: 0 0 0 3px var(--wood-dark);
  cursor: default;
}
.enemy.is-target { cursor: crosshair; box-shadow: 0 0 0 3px var(--red); animation: target-pulse 1s ease-in-out infinite; }
.enemy.is-target:hover { background: #fde7dc; }
.enemy.is-down { opacity: 0.35; filter: grayscale(1); }
.enemy.is-hit, .battle-me.is-hit { animation: hit-shake 0.35s steps(4); }
.enemy-pic .item-icon img { filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.25)); }
.enemy-name { font-family: var(--font-title); font-size: 16px; }
.enemy .vital-track { width: 100%; }
.enemy-hp { font-size: 12px; }
.enemy-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.tag { padding: 0 6px; font-size: 11px; box-shadow: 0 0 0 1px currentColor; }
.tag.is-weak { color: #b03a2e; }
.tag.is-resist { color: #4b5f7a; }
.tag.is-sleep { color: var(--purple); }
.battle-log { list-style: none; margin: 0; padding: 8px 12px; min-height: 92px; max-height: 120px; overflow: hidden; background: #fffaf0; box-shadow: inset 0 0 0 2px var(--paper-edge); font-size: 13.5px; line-height: 1.7; }
.battle-log li:first-child { font-weight: 700; }
.battle-log li:not(:first-child) { color: var(--ink-soft); }
.battle-bottom { display: grid; grid-template-columns: 260px 1fr; gap: 16px; align-items: start; }
.battle-me { padding: 10px 12px; background: #fffaf0; box-shadow: 0 0 0 3px var(--wood-dark); }
.battle-me-title { margin-bottom: 6px; font-family: var(--font-title); }
.battle-hint { font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.potion-row { display: flex; flex-wrap: wrap; gap: 8px; max-height: 150px; overflow-y: auto; padding: 4px; }
.potion { display: grid; grid-template-columns: 36px 1fr; grid-template-rows: auto auto; align-items: center; column-gap: 8px; width: 210px; padding: 4px 8px 4px 4px; border: 0; background: #fffaf0; box-shadow: 0 0 0 2px var(--paper-edge); text-align: left; cursor: pointer; }
.potion .item-icon { grid-row: span 2; }
.potion:hover { background: var(--gold-soft); }
.potion.is-selected { background: #fde7dc; box-shadow: 0 0 0 3px var(--red); }
.potion-name { font-size: 13.5px; font-weight: 700; }
.potion-stat { font-size: 11.5px; color: var(--ink-soft); }
.battle-buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.float-num { position: absolute; z-index: 6; transform: translateX(-50%); font-family: var(--font-title); font-size: 22px; color: #b03a2e; text-shadow: 0 2px 0 #fff6e0; pointer-events: none; animation: float-up 1.1s ease-out forwards; white-space: nowrap; }
.float-num.is-weak { font-size: 26px; color: #d9622b; }
.float-num.is-heal { color: var(--green); }
.float-num.is-sanity { color: var(--purple); }
.float-num.is-hurt { color: #8b2f22; }
@keyframes float-up { 0% { opacity: 0; transform: translate(-50%, 10px); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -36px); } }
@keyframes hit-shake { 0% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 100% { transform: translateX(0); } }
@keyframes target-pulse { 50% { box-shadow: 0 0 0 5px var(--red); } }

@media (max-width: 1000px) {
  .explore { grid-template-columns: 1fr; height: auto; }
  .battle-bottom { grid-template-columns: 1fr; }
}


/* ───────── 블록 맵 육각형 (맵 꾸미기로 그린 블록) ───────── */
.hex-wrap { overflow: auto; align-items: flex-start; justify-content: flex-start; }
.hex-board { position: relative; flex: none; margin: auto; }
.hex-cell {
  position: absolute;
  overflow: hidden;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: #b9a788;
}
.hex-cell canvas { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); image-rendering: pixelated; }
.hex-cell.is-fog canvas { filter: brightness(0.38) saturate(0.35) sepia(0.4) blur(0.6px); }
.hex-cell.is-fog .hex-plain { filter: brightness(0.5) saturate(0.4); }
.hex-cell.is-fog::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle, rgba(40, 30, 50, 0.1), rgba(40, 30, 50, 0.45)); pointer-events: none; }
.hex-cell .hex-unknown { z-index: 1; font-size: 34px; color: #f3e6c8; text-shadow: 0 2px 0 #3a2718, 0 0 8px rgba(30, 20, 40, 0.8); opacity: 0.85; }
.hex-cell.can-move .hex-unknown { opacity: 1; color: #fff4e2; text-shadow: 0 2px 0 #2f7a6a, 0 0 10px #2f7a6a; animation: hex-q 1.8s ease-in-out infinite; }
@keyframes hex-q { 50% { transform: translate(-50%, -58%); } }
.hex-cell.is-reveal canvas, .hex-cell.is-reveal .hex-plain { animation: hex-reveal 0.7s ease-out; }
@keyframes hex-reveal { from { filter: brightness(0.38) saturate(0.35) sepia(0.4) blur(0.6px); } 60% { filter: brightness(1.25) saturate(1.1); } to { filter: none; } }
.hex-cell.can-move { cursor: pointer; }
.hex-cell.can-move:hover canvas { filter: brightness(0.7) saturate(0.7); }
.hex-plain { position: absolute; inset: 0; background: repeating-linear-gradient(45deg, #cbb994 0 8px, #c2ae86 8px 16px); }
.hex-mark-img { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; transform: translate(-50%, -50%); image-rendering: pixelated; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.5)); pointer-events: none; }
.hex-cell .hex-mark { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-family: var(--font-title); font-size: 40px; color: #fff4e2; text-shadow: 0 2px 0 var(--purple), 0 0 6px var(--purple); pointer-events: none; }
.hex-cell .hex-count { position: absolute; left: 58%; top: 58%; padding: 0 4px; background: #fff4e2; color: var(--red-dark); font-weight: 700; font-size: 12px; pointer-events: none; }
.hex-cell .hex-me { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -55%); font-size: 30px; filter: drop-shadow(0 2px 0 #fff4e2); pointer-events: none; }
.hex-lines { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.hex-line { fill: none; stroke: rgba(58, 39, 24, 0.55); stroke-width: 2; }
.hex-line.is-fog { stroke-dasharray: 6 4; }
.hex-line.can-move { stroke: #2f7a6a; stroke-width: 4; }
.hex-line.is-here { stroke: var(--red); stroke-width: 4; }

.block-card { margin-top: 12px; padding: 8px 10px; background: var(--paper-2); box-shadow: 0 0 0 2px var(--paper-edge); }
.block-name { font-family: var(--font-title); font-size: 17px; }
.block-desc { margin: 4px 0 6px; font-size: 13px; line-height: 1.6; color: var(--ink-2); }
.course-blocks { display: flex; flex-wrap: wrap; gap: 8px; }
.block-thumb { position: relative; width: 96px; height: 72px; overflow: hidden; box-shadow: 0 0 0 2px var(--wood-dark); background: #b9a788; }
.block-thumb canvas { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(0.6); image-rendering: pixelated; }
.block-thumb-name { position: absolute; left: 0; right: 0; bottom: 0; padding: 1px 4px; background: rgba(58, 39, 24, 0.75); color: #fff4e2; font-size: 11px; text-align: center; }

/* 이야기로 잠긴 코스 */
.course-card.is-locked { opacity: 0.7; filter: grayscale(0.6); }
.course-lock { margin: auto 0 0; padding: 6px 8px; background: #efe4f5; box-shadow: 0 0 0 2px #b59ac7; color: #5b3f74; font-size: 13px; }
