/* ===== 컬러 변수 정의 ===== */
:root {
  --color-bg: #0B1210;          /* 딥 녹흑 */
  --color-surface: #141C18;     /* 배경보다 살짝 밝은 카드 색 */
  --color-border: #3A4740;      /* 이끼 그레이그린 */

  --color-accent: #B83A4B;      /* 로즈 레드 악센트 (선택 시) */
  --color-accent-weak: #E0626A; /* 보조 포인트 */

  --color-disabled: #2A3530;

  --color-text-main: #F4F1E8;   /* 아이보리 본문 */
  --color-text-muted: #AEB6B0;
  --color-text-title: #EAD9B0;  /* 앤틱 골드 제목 */

  --color-increase: #4EB384;
  --color-decrease: #B9352F;
  --color-highlight: #C29A5A;

  --btn-max-w: 560px;
  --btn-aspect: 9 / 1.9;
}

@font-face {
    font-family: 'RIDIBatang';
    src: url('https://fastly.jsdelivr.net/gh/projectnoonnu/noonfonts_twelve@1.0/RIDIBatang.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 9999px;
  margin: 2px;
}

*::-webkit-scrollbar-thumb {
  background-color: var(--color-border);
  border-radius: 9999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover {
  background-color: var(--color-text-muted);
}

*::-webkit-scrollbar-button {
  height: 0;
  width: 0;
  display: block;
  background: transparent;
}

/* ===== 기본 공통 스타일 ===== */
body {
  font-family: "Gowun Batang", serif;
  font-weight: 400;
  background-color: var(--color-bg);
  background-image:
    radial-gradient(1200px 800px at 50% 0%, rgba(199,162,79,0.06), transparent 60%),
    radial-gradient(800px 600px at 10% 100%, rgba(228,201,130,0.05), transparent 60%),
    url('https://www.transparenttextures.com/patterns/low-contrast-linen.png');
  background-blend-mode: overlay, overlay, normal;
  background-repeat: repeat;
  background-size: auto;
  user-select: none;
  word-break: keep-all;
}


hr {
  border-color: var(--color-border);
}

b {
  color: var(--color-highlight);
}


.corner {
  position: absolute;
  font-size: 1.5rem;
  color: var(--color-text-title);
  pointer-events: none;
  opacity: 0.7;
}

.corner-tl { top: 0.5rem; left: 0.5rem; }
.corner-tr { top: 0.5rem; right: 0.5rem; }
.corner-bl { bottom: 0.5rem; left: 0.5rem; }
.corner-br { bottom: 0.5rem; right: 0.5rem; }


.fancy-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1rem 0;
  gap: 1rem;
}

.fancy-divider .line {
  flex: 1;
  height: 1px;
  background-color: var(--color-text-title);
  opacity: 0.6;
}

.fancy-divider .symbol {
  color: var(--color-text-title);
  font-size: 1.2rem;
  font-family: 'Playfair Display', serif;
}


/* ===== custom.html 전용 ===== */
.custom-container {
  width: 80%;
  margin: 0 auto;
  text-align: center;
  padding: 4rem 0 6rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
}

.block-element {
  /*margin: 0 auto;*/
  text-align: center;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: flex-start;
  box-sizing: border-box;
}

tag {
  font-size: 1rem;
  font-weight: bold;
  padding: 0 0.25em;
  background: none;
}

.info-box {
  position: relative;
  background-color: var(--color-surface);
  background-size: auto;
  border: 1px solid var(--color-border);
  border-radius: 2px;
  box-sizing: border-box;
  padding: 1.25rem 1.5rem;
  color: var(--color-text-main);
  transition: all 0.3s ease;
}

.info-box__title {
  margin:0.5rem;
  font-size: 2rem;
  font-weight: bold;
  color: var(--color-text-title);
}

.info-box__description {
  margin: 16px;
  text-align: left;
  font-size: 1rem;
  color: var(--color-text-main);
  line-height: 1.5;
}

.info-box__image {
  width: 100%;
  height: auto;
  border-radius: 8px;
  margin-bottom: 1rem;
  object-fit: cover;
}

.bg-text {
  margin-top: 2rem;
  text-align: center;
  background-size: auto;
  box-sizing: border-box;
  padding: 1.25rem 1.5rem;
  color: var(--color-text-main);
  transition: all 0.3s ease;
}

.bg-text__title {
  font-family: "Cinzel", serif;
  font-weight: 400;
  position: relative;
  margin: 1.5rem 0;
  font-size: 5rem;
  color: var(--color-text-title);
}
.bg-text__subtitle {
  font-weight: 400;
  position: relative;
  margin: -3rem 0 0 0;
  font-size: 2.5rem;
  color: var(--color-text-title);
}

.bg-text__description {
  font-size: 1.5rem;
  color: var(--color-text-main);
  line-height: 1.5;
}

.work-card {
  background-color: var(--color-surface);
  position: relative;
  border: 3px double var(--color-border);
  border-radius: 16px;
  padding: 1.5rem;
  box-sizing: border-box;
  transition: all 0.3s ease;
  cursor: pointer;
}

.work-card.disabled {
  background-color: var(--color-disabled);
  border: 3px dashed var(--color-border);
  opacity: 0.6;
  pointer-events: none;
  filter: grayscale(1) brightness(0.9);
}

.work-card:hover {
  background-color: var(--color-surface);
  box-shadow: inset 0 0 12px rgba(184, 58, 75, 0.45);
  transform: scale(1.03);
}

.work-card.selected {
  border: 3px solid var(--color-accent);
  box-shadow: inset 0 0 36px rgba(184, 58, 75, 0.55);
}

.work-card.emphasis {
  position: relative;
  z-index: 10;
  overflow: visible;
}

.work-card.emphasis::before,
.work-card.emphasis::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 160px;
  height: 160px;
  border: 2px solid var(--color-accent-weak);
  border-radius: 50%;
  pointer-events: none;
  z-index: 11;
  opacity: 0;
  transform: translate(-50%, -50%) scale(1);
  animation: border-pulse-circle 1.4s ease-out infinite;
}

.work-card.emphasis::after {
  animation-delay: 0.7s;
}

@keyframes border-pulse-circle {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0.9;
  }
  80% {
    transform: translate(-50%, -50%) scale(1.8);
    opacity: 0;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.8);
    opacity: 0;
  }
}

.work-card.disabled.selected {
  filter: grayscale(0.3) brightness(0.9);
}

.work-card .work-card__title {
  font-family: 'Cinzel', serif;
  font-weight: 400;
  font-size: 3rem;
  margin: 0;
  color: var(--color-text-title);
  text-shadow: 0 1px 2px rgba(0,0,0,.7);
}
.work-card .work-card__subtitle {
  font-weight: 400;
  font-size: 2rem;
  margin: -1rem 0 0 0;
  color: var(--color-text-title);
  text-shadow: 0 1px 2px rgba(0,0,0,.7);
}

.work-card__image {
  width: calc(100% - 1rem);
  height: auto;
  margin: 0.5rem;
  border-radius: 4rem;
  margin-bottom: 0.3rem;
  object-fit: cover;
  box-shadow: 0 0 6px rgba(0,0,0,.35);
}

.disabled .work-card__image {
  filter: grayscale(1) brightness(0.85);
}

.work-card__info {
  color: var(--color-text-muted);
  text-align: center;
  font-weight: bold;
  margin-bottom: 0.75rem;
}

.work-card__description {
  color: var(--color-text-main);
  text-align: left;
  margin-bottom: 0;
  line-height: 1.6;
}

.image-wrapper {
  position: relative;
  display: inline-block;
  box-sizing: border-box;
  width: 100%;
  transition: all 0.3s ease;
}

.image-box {
  object-fit: cover;
  border-radius: 12px;
  box-sizing: border-box;
  box-shadow:
    0 4px 10px rgba(100, 100, 100, 0.3),
    inset 0 0 8px rgba(255, 255, 255, 0.6);
  transition: all 0.3s ease;
  display: block;
  width: 100%;
}

/* 이미지와 아이콘을 같이 띄움 */
.image-wrapper:hover {
  transform: translateY(-5px);
}

.image-open-icon {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  background: #fff;
  color: #333;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s ease;
  user-select: none;
  pointer-events: auto;
}

.image-wrapper:hover .image-open-icon {
  opacity: 1;
}

.image-open-icon:hover {
  background: #DDD;
}

.line-box {
  background-color: var(--color-surface);
  position: relative;
  border: 1px dotted var(--color-border);
  border-radius: 16px;
  padding: 2rem 2.5rem 2.5rem 22rem; /* 왼쪽 공간 확보 (초상화) */
  box-sizing: border-box;
  margin: 2rem;
  transition: all 0.3s ease;
  min-height: 260px;
  box-sizing: border-box;
  overflow: visible; /* ✅ 초상화 삐져나오도록 */
  max-width: 100%;
}

.line-align-right {
  padding: 2rem 22rem 2.5rem 2.5rem;
  text-align: right;
}

.line-face {
  position: absolute;
  top: -2rem;
  left: -2rem;
  width: 20rem;
  height: 20rem;
  object-fit: cover;
  border: 2px solid var(--color-border);
  border-radius: 48px;
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.4);
  z-index: 1;
  transition: all 0.3s ease;
}
.line-face:hover {
  transform: translateY(-5px);
}

.line-align-right .line-face {
  left: auto;
  right: -2.5rem;
}

.line-content {
  position: relative;
  text-align: left;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.line-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-surface);
  background-color: var(--color-text-title);
  padding: 0.5rem 1.25rem;
  border-radius: 999px;
  border: 2px solid var(--color-border);
  align-self: flex-start;
  margin-top: 0.25rem;
  margin-bottom: 1rem;
  display: inline-block;
  backdrop-filter: blur(2px);
  transition: all 0.3s ease;
}

.line-name:hover {
  transform: translateY(-5px);
}

.line-text {
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--color-text-main);
}

.status-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--color-surface);
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: flex-start;
  padding: 0.5rem 1.5rem;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  gap: 1rem 1.5rem;
  box-sizing: border-box;
}

.status-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-right: 1rem;
}

.status-item {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 0.5rem 1rem;
  color: var(--color-text-main);
  font-size: 1rem;
  font-weight: bold;
  white-space: nowrap;
  pointer-events: auto;
  transition: all 0.3s ease;
}

.status-item .label {
  color: var(--color-highlight);
}

.muted {
  color: var(--color-text-muted);
}

.increase {
  color: var(--color-increase);
}

.decrease {
  color: var(--color-decrease);
}

.quote {
  background-color: var(--color-bg);
  border-left: 5px solid var(--color-border);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  color: var(--color-text-main);
  font-size: 0.95rem;
  line-height: 1.6;
  border-radius: 0.5rem;
}

.keyword {
  font-weight: bold;
  color: var(--color-highlight);
}

#keyword-popup {
  position: absolute;
  background: var(--color-bg);
  color: var(--color-text-main);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  z-index: 9999;
  pointer-events: none;
  transition: opacity 0.1s ease;
}
#keyword-popup strong {
  color: var(--color-highlight);
  font-size: 1rem;
}
#keyword-popup.hidden {
  display: none;
}

#bookmark-container {
  position: fixed;
  top: 0;
  right: 16px;
  width: 120px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  pointer-events: none;
  z-index: 900;
  padding: 8px 0;
  box-sizing: border-box;
}

.bookmark {
  background: var(--color-surface);
  color: var(--color-text-main);
  padding: 4px 8px;
  border: 3px double var(--color-border);
  border-radius: 6px;
  font-size: 1.5rem;
  white-space: nowrap;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.2s ease;
}

.bookmark:hover {
  background: var(--color-border);
  transform: scale(1.05);
}


/* 모달 전체 배경 */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(13, 13, 13, 0.85); /* var(--color-bg) 기반 반투명 */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal {
  background: var(--color-bg);
  border: 2px solid var(--color-border);
  border-radius: 16px;
  padding: 2rem 2.5rem;
  max-width: 90vw;
  max-height: 85vh;
  width: 100%;
  box-sizing: border-box;
  color: var(--color-text-main);
  position: relative;
  text-align: center;
  overflow: auto;
}

.modal.small {
  max-width: 400px;
}

.modal.large {
  max-width: 800px;
}

#modalTitle {
  font-size: 1.5rem;
  font-family: "Gowun Batang", serif;
  color: var(--color-text-title);
  margin-bottom: 1.5rem;
}

.modal-close-btn {
  position: fixed;
  top: 0.5rem;
  right: 0.75rem;
  font-size: 5rem;
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}
.modal-close-btn:hover {
  color: var(--color-text-main);
}


/* 슬롯 버튼 */
.slot-button {
  position: relative;
  padding-bottom: calc(1rem + 1.1em);
  background: var(--color-bg);
  color: var(--color-text-main);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  margin: 0.5rem 0;
  width: 100%;
  font-size: 1rem;
  font-family: "Cinzel", serif;
  text-align: left;
  cursor: pointer;
  transition: all 0.3s ease;
}

.slot-button:hover {
  background: var(--color-surface);
  color: var(--color-accent);
  transform: scale(1.02);
  box-shadow: 0 0 8px var(--color-accent-weak);
}

/* 저장 데이터가 없는 경우 */
.slot-button.disabled {
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: not-allowed;
  pointer-events: none;
  border: 1px dashed var(--color-border);
  filter: grayscale(0.7);
}

.slot-label {
  font-family: "Gowun Batang", serif;
  font-size: 1.5rem;
  color: var(--color-accent);
  flex-shrink: 0;
  text-align: left;
  min-width: 110px;
}

.slot-desc {
  text-align: right;
  flex-grow: 1;
}

.slot-date {
  position: absolute;
  left: 1.5rem;                       /* 기존 좌우 패딩과 정렬 */
  right: 1.5rem;
  bottom: 0.3rem;                    /* 살짝 띄워서 겹침 방지 */
  font-size: 0.75rem;
  line-height: 1;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;               /* 클릭 방해 방지 */
}

/* 값이 없을 때: 공간은 유지하되 보이지만 않음 */
.slot-date:empty {
  visibility: hidden;
}

/* 닫기 버튼 */
.close-btn {
  font-family: "Orbitron", sans-serif;
  margin-top: 2rem;
  font-size: 0.95rem;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.close-btn:hover {
  color: var(--color-highlight);
  transform: scale(1.05);
}


.save-slots {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.save-slot {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  padding: 1rem 1.5rem;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  color: var(--color-text-main);
}

.save-slot:hover {
  background: var(--color-surface);
  transform: scale(1.02);
  box-shadow: 0 0 8px var(--color-accent-weak);
}

.save-slot.empty {
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: not-allowed;
  filter: grayscale(0.8);
  pointer-events: none;
  border: 1px dashed var(--color-border);
}

.save-slot::after {
  content: attr(data-hover);
  position: absolute;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%);
  font-size: 0.8rem;
  color: var(--color-accent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.save-slot:hover::after {
  opacity: 1;
}

/* 상단 버튼 */
.save-button-container {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 900;
  display: flex;
  gap: 1rem;
}

.save-button {
  background: var(--color-surface);
  color: var(--color-text-title);
  font-family: "Orbitron", sans-serif;
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
  border: 2px solid var(--color-border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.save-button:hover {
  background: var(--color-surface);
  color: var(--color-accent);
  transform: translateY(-2px);
}

.gauge-bar {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 16px;
  width: 100%;
}

.gauge-track {
  position: relative;
  background: rgba(255, 255, 255, 0.05); /* 더 밝고 대비되는 트랙 배경 */
  border: 1px solid var(--color-border);
  border-radius: 10px;
  height: 18px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}

.gauge-fill {
  height: 100%;
  width: 0%;
  background: var(--color-accent);
  transition: width 0.4s ease, background 0.4s ease;
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
}

.gauge-text {
  position: absolute;
  width: 100%;
  text-align: center;
  top: 0;
  left: 0;
  height: 100%;
  line-height: 18px;
  color: var(--color-text-main);
  font-size: 0.85rem;
  font-weight: bold;
  pointer-events: none;
  text-shadow: 0 0 2px #000, 0 0 1px rgba(0,0,0,0.5);
}

.negative {
  filter: invert(1);
}


.hidden-on-create {
  opacity: 0;
  transform: translateY(8px);
}

.capture-btn{
  position: fixed;
  bottom: 1rem;
  left: 50%;
  width: 40vw;
  transform: translateX(-50%);
  z-index: 9999;
  padding: .5rem .7rem;
  border-radius: 10px;
  border: 1px solid var(--color-border, #444);
  background: var(--color-surface, #222);
  color: var(--color-text-main, #eee);
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
  cursor: pointer;
  font-size: 16px;
  transition: all 0.3s ease;
}
.capture-btn:hover{
  background: var(--color-surface);
  color: var(--color-accent);
  transform: translateX(-50%) translateY(-2px);
}