/* Reset & 기본 */
* { margin:0; padding:0; box-sizing:border-box; }
html, body { width:100%; height:100%; overflow:hidden; font-family:'diphylleia', sans-serif; }

/* 전체 컨테이너 */
#game-container { position:relative; width:100%; height:100%; }

/* 배경: 전체 화면 radial + 그리드 */
#grid {
  position:relative; top:0; left:0;
  position: relative; width: 100%; height: 100%;
  background:
    radial-gradient(circle at center, rgba(130, 130, 130, 0.3) 40%, rgba(43, 43, 43, 0.9)),
    linear-gradient(to right, rgba(0,0,0,0.1) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0,0,0,0.1) 1px, transparent 1px);
  background-size: cover, 40px 40px, 40px 40px;
  background-repeat: no-repeat, repeat, repeat;
}

#intro-overlay {
  position: fixed; 

  top:50%;
  left:50%;
  margin: auto;
  transform: translate(-50%, -50%);
  width:900px; 
  height:700px; 
  background:rgba(158, 158, 158, 0.559);
  border: outset #5d5d5dae 3px;
z-index: 30000; 
display:flex; 
flex-direction:column; 
align-items:center; 
justify-content:center;
}

#intro-overlay h1 {
  font-family: "Jacquard 12", serif;
  color: #0f0;
  font-size: 4rem;
  margin-bottom: 20px;
}

#intro-overlay p {
  font-family: 'diphylleia', serif;
  color: #fff;
  font-size: 1.2rem;
  margin-bottom: 20px;
  padding: 30px;
}
input {
  font-family: 'diphylleia', serif;
  width: fit-content;
  min-width: 50px;
  max-width: 150px;
  padding: 8px;
  font-size: 1rem;
  border: inset #b5b5b5ae 3px;
  border-radius: 4px;
  background-color: rgba(230, 230, 230, 0.645);
  box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.3);
  color: #0f0;
  margin: 0 4px;
}

input:focus {
  outline: none;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.5);
  
}



#btn-start-game {
  font-family: 'diphylleia', serif;
  padding: 12px 24px;
  font-size: 1.2rem;
  color:#0f0;
  background-color:rgba(155, 155, 155, 0.6);
  border: outset #b4b4b4ae 3px;
  
  cursor: pointer;
  transition: background-color 0.3s, transform 0.2s;
}
 #controls-panel, #response-container, #cult-name, #ritual-container, #stats-panel {
  transition: filter 0.5s;
}

body.blurred #controls-panel,
body.blurred #response-container,
body.blurred #cult-name,
body.blurred #ritual-container,
body.blurred #stats-panel {
  filter: blur(4px);
  pointer-events: none;
  user-select: none;
}

    .mem-agent { 
      position: absolute; 
      border-radius: 50%; 
      width: 16px; height: 16px; 
      background: #0f0; border: 1px solid #222;}
/* 컬트 이름 */
#cult-name {
  position:fixed; top:40px; left:50%; transform:translateX(-50%);
  text-align:center; color:#0f0; pointer-events:none;
  font-size:1.6rem;
}
#cult-name hr {
  border:none; border-top:2px solid #0f0;
  width:200px; margin:6px auto;
}
/* 의식 타이머 */
#ritual-container {
  position:fixed; top:100px; left:50%; transform:translateX(-50%);
  text-align:center; pointer-events:none;
}

#ritual-timer {
  font-size:1.1rem; color:#ffffff; margin-top:6px;
}
.time-unit {

  font-family: "Jacquard 12", serif;
  font-size:2rem; /* 크게 표시 */

}
/* 의식 메시지 */



/* 통계 패널 */
#stats-panel {
  position:fixed; top:170px; left:40px;
  background-color: #ffffff1d;
  box-shadow: 0 0 6px #ffffff66;
  border: inset gray 3px;
  border-radius:4px; padding:16px; width:220px;
  display:flex; flex-direction:column;

}
.divider { height:1px; background:#444; margin:8px 0; }

/* stat-title/value */
.stat-title { font-size:0.95rem; color:#333; margin-bottom:6px; }
.stat-value {
  font-family: "Jacquard 12", serif;
  font-size:3rem; color:#111;
}
.stat-risk {
  font-family: "Jacquard 12", serif;
  font-size:3rem; color:#111;
}
.risk-kor {
  font-family: 'Diphylleia', serif;
  font-size: 1.2rem;
  color:#111
}
.group-count {
  padding:8px 0; font-size:0.9rem;
  display:flex; flex-direction:column; gap:4px;
}


/* 컨트롤 패널 */
#controls-panel {
  position:fixed; 
  top:140px; 
  right:40px;
  display:flex; 
  flex-direction:column; 
  font-family:'diphylleia', serif;
  
}

/* 공통 버튼 스타일 */
.control-btn {
  font-family:'diphylleia', serif;
  cursor:pointer;
  padding: 10px;
  display:flex; 
}
#group-deck-panel {
  margin: 30px 0 20px 0; 
  text-align: center;
  padding: 20px;
  background-color: #ffffff1d;
  box-shadow: 0 0 6px #ffffff66;
  border: inset gray 3px;
}

#deck-slots { 
  display: flex; 
  gap: 10px; 
  justify-content: center; 
}

.deck-slot { 
  width: 80px; 
  height: 80px; 
  background: #eee; 
  border-radius: 12px; 
  cursor: pointer; 
  padding: 4px 0;
  position: relative;
  text-align: center;
  line-height: 42px;
  border: #8c8c8c79 2px inset;
}

.deck-dot { 
  position: absolute;
  width: 50px; 
  height: 50px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%); 
  border-radius: 50%; 
  margin: auto; 
  border: #111 2px solid;
 
}

#deck-info {
  margin-top: 10px;
  
}
.group-info-label {
  position: absolute;
  width: 110px;
margin:auto;
  transform: translateX(-50%, -50%);
  background: none;
  font-family: 'diphylleia' serif;
  font-size: 1rem;
  color: #fff9;
  padding: 1px 8px;
  border-radius: 1em;
  pointer-events: none;
  text-align: center;
}

.skill-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 0px;
  background-color: #ffffff1d;
  box-shadow: 0 0 6px #ffffff66;
  border: inset gray 3px;
  padding: 10px;
}

/* skill 버튼 공통 스타일 */
.control-btn.skill {
  background: rgba(200, 200, 200, 0.9);
  box-shadow: 0 0 6px #ffffff66;
  border: outset rgb(221, 221, 221) 3px;
  color: #111;
  /* width 대신 그리드 컨테이너에 맞춰 자동 크기 조절 */
  height: 120px;
  font-size: 1rem;
  border-radius: 25px;
  display: inline-block;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10000;
  white-space: normal;
  word-break: keep-all;
  width: 150px; /* 고정너비 (원하는 크기로) */

}
.control-btn.skill:disabled {
  opacity: 0.5;
  filter: grayscale(0.6);
  cursor: not-allowed;
  background-color: #575757;
}

.control-btn.skill.clicked {
  background: #0f0;
}
.skill-name {
  font-size: 1.1rem;
  text-align: center;
  margin-bottom: 4px;
}
.skill-effect {
  font-size: 1rem;
  color: rgb(130, 130, 130);
  text-align: center;
  margin-bottom: 4px;
}




/* response */
#response-container {
  position:fixed; bottom:50px; left:50%;
  transform:translateX(-50%);
  width:94vw; height:40px;
  display: flex;
  flex-direction: column;
  overflow-y: scroll;
  padding: 4px 10px;
  transition: color, 0.5s;
  background-color: #5d5d5d82;
  box-shadow: 0 0 6px #ffffff66;
  border: inset gray 3px;
}
#response-log p {
  display:block; 
  margin-right:24px;
  font-size:0.95rem; 
  color:#0f0;
  transition: color, 0.5s;
}



/* 의식 */
#ritual-overlay {
  position:fixed; left:0; top:0; width:100vw; height:100vh;
  background: radial-gradient(circle at center, #59ff98 0%, #10e3ff82 17%,rgba(27,255,120,0.15) 50%, rgba(57,49,255,0.13) 100%);
  opacity: 0;
  pointer-events: none;
  z-index: 999;
  transition: opacity 0.4s;

}

body.ritual-on #ritual-overlay {
  opacity: 1;
  pointer-events: auto;
}

/* 의식 중 response-container 색상 변화 */
body.ritual-on #response-container {
  background: #4cff52;
  transition: background 0.3s;
    transition: color 0.5s;
}
body.ritual-on #response-log p {
  color: #333;
    transition: color 0.5s;
  
}

/* 의식 중 메시지 표시 */
#ritual-message {
  opacity: 0;
  transition: opacity 0.5s;
    display: inline-block;
    position: fixed;
    width: auto; height: 300px;
  top: 50%;
  left: 50%;
  color: #fff;
  font-size: 2rem;
    transform: translate(-50%, -50%);
  text-align: center;
  text-shadow: 0 0 12px #0f0, 0 0 4px #333;
  z-index: 10020;
  pointer-events: none;
  transition: opacity 0.4s;
}
body.ritual-on #ritual-message {
    opacity: 1;


}

/* 그리드 상호작용 */
#grid.propagating {
  cursor: crosshair;
  /* 필요시 전체에 반투명 highlight */
}



.target {
  position: absolute;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid #111;
  opacity: 0;
  pointer-events: auto;
  transition: opacity 1s;
  z-index: 1001;
}

.user {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #0077ff;
    border: 1px solid #111;
    z-index: 23;

}

.target, .mem {
  transition: background-color 0.5s, opacity 1s;
}
.mem {
  border: 1px solid #333;
}
.mem.normal {
  background-color: #4cff52 !important;
}

.mem-agent { 
  width: 16px; 
  height: 16px; 
  background: #4cff52;
  border: 2px solid #222;
  z-index: 1002;
  position: absolute;
}


.propagate-circle {
  position: absolute;
  border-radius: 50%;
  background: rgba(121, 121, 121, 0.25);
  border: 2px dashed #868686;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
}


.user {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid #333;
  background-color: #4cff52;
  position: absolute;
}

.branch-circle {
  position: absolute;
  width: 300px; height: 300px;
  justify-content: center;
  align-items: center;
  background: rgba(0, 230, 255, 0.1);
  border: 3px dashed #00eaff;
  z-index: 11;
  left: 0; top: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;

}
.branch-core {
  position: absolute;

  width: 20px; height: 20px;
  background: #00eaff;
  border-radius: 50%;
  left: 50%; top: 50%;
  transform: translate(450%, 450%);
  border: 2px solid #fff;

}

#event-popup {
  
  position:fixed; 
   width:100vw; height:100vh;
   background:#11111194; 
   z-index:200000; display:flex; 
   align-items:center; 
   justify-content:center;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: auto;
    border:outset #7f7f7f 3px;

   }
.event-popup-content { 
  border:inset #9f9f9f 7px;
  background:#b6b6b6;
  padding:40px 32px 32px 32px;
   min-width:320px; box-shadow:0 8px 40px #0005;
    text-align:center; 
    position:relative;
    margin: 30px;
  }
.event-popup-content h2 {
   margin-bottom: 0.7em; 
   font-size: 1.5em;
  }
#event-desc { 
  font-size: 1.1em; 
  color: #222; margin-bottom: 1.6em;
}
.event-choice-btn {
   display:block; width:100%; 
   margin:10px 0; padding:15px;
    border:outset #7f7f7f 3px;
    font-size:1.1em; 
    background:#868686;
    font-family: 'diphylleia', serif;
    color:#111; cursor:pointer; 
    box-shadow:0 2px 8px #0001; 
    transition:background 0.18s;}
.event-choice-btn:hover { background:#e7e7e7;}

#gameover-overlay { 
  display:none; 
  position:fixed;
  z-index:999999; 
  left:0; top:0; width:100vw; height:100vh;
   background:rgba(0, 0, 0, 0.6); 
   color:#fff; align-items:center; 
   justify-content:center;
    flex-direction:column; 
   text-align:center;}
#gameover-overlay.active { display:flex;}
#gameover-overlay h1 {
  font-family: "jacquard 12", serif;
   color:#f00; 
   text-shadow: 0 0 4px #000;
  font-size:5em; 
   margin-bottom:24px;
  }
#gameover-overlay .desc { 
  font-size:1.2em; 
  color:#ddd; 
  margin-bottom:28px;
}

#gameover-overlay button {
  padding:12px 24px; 
  font-size:1.2em; 
  font-family: 'diphylleia', serif;
  color:#fff; 
  background:#5c5c5c; 
  border: outset #7f7f7f 3px;
   cursor:pointer; 
   box-shadow:0 2px 8px #0003;
    transition:background 0.18s;}

#gameover-overlay button:hover {
  background:#7f7f7f;
}

#debug-panel { 
  position:fixed;
   right:14px; 
   bottom:16px;
   z-index: 999999;
  }
#debug-panel button { margin:4px; padding:7px 14px; border-radius:7px; font-size:1em;}