/* UzMind 공용 스타일 — 모든 페이지에서 사용합니다. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #04060f;                       /* 우주 배경색 (캔버스 로딩 전) */
  --text: #e8ecf5;                     /* 기본 글자색 */
  --dim: rgba(232, 236, 245, 0.45);    /* 흐린 글자색 */
  --line: rgba(255, 255, 255, 0.14);   /* 유리 카드 테두리 */
  --glass: rgba(255, 255, 255, 0.06);  /* 유리 카드 배경 */
  --accent: #9db4ff;                   /* 포인트 색 (별빛 푸른빛) */
}

html { background: var(--bg); }

body {
  min-height: 100dvh;
  color: var(--text);
  font-family: "Noto Serif KR", serif;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

/* 밤하늘 캔버스 — 항상 화면 전체, 콘텐츠 뒤 */
#sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  display: block;
}

a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

/* ── 메인 페이지 ───────────────────────────── */

.hero {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.5rem;
}

.title {
  font-family: "Outfit", sans-serif;
  font-weight: 200;
  font-size: clamp(2.6rem, 8vw, 4.2rem);
  letter-spacing: 0.32em;
  margin-left: 0.32em; /* letter-spacing 보정 */
  color: #fff;
  text-shadow: 0 0 30px rgba(157, 180, 255, 0.35);
}

.menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.7rem;
  margin-top: clamp(2.8rem, 8vh, 4.5rem);
}

.menu-item {
  font-size: 1.05rem;
  letter-spacing: 0.5em;
  margin-left: 0.5em;
  transition: text-shadow 0.3s, opacity 0.3s;
}

.menu-item.disabled { opacity: 0.28; cursor: default; }

a.menu-item:hover {
  text-shadow: 0 0 16px rgba(157, 180, 255, 0.9);
}

/* 하단 크레딧 영역 (메인 페이지) */
.site-foot {
  position: fixed;
  left: 0;
  right: 0;
  bottom: max(1.8rem, env(safe-area-inset-bottom));
  text-align: center;
}

.credit-link {
  background: none;
  border: none;
  cursor: pointer;
  font-family: "Outfit", sans-serif;
  font-weight: 300;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  margin-left: 0.2em;
  color: var(--dim);
  transition: color 0.3s;
}
.credit-link:hover { color: var(--text); }

/* 크레딧 모달 */
.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(4, 6, 15, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-box {
  max-width: 340px;
  width: 100%;
  text-align: center;
  padding: 2.6rem 2rem;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 18px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.modal-box h2 {
  font-family: "Outfit", sans-serif;
  font-weight: 200;
  letter-spacing: 0.3em;
  margin-left: 0.3em;
  font-size: 1.3rem;
}

.modal-box p {
  margin-top: 1.3rem;
  font-size: 0.85rem;
  line-height: 2.1;
  color: var(--dim);
  letter-spacing: 0.08em;
}

.modal-close {
  margin-top: 1.8rem;
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.5rem 1.6rem;
  color: var(--dim);
  font-family: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  cursor: pointer;
  transition: color 0.3s, border-color 0.3s;
}
.modal-close:hover { color: var(--text); border-color: var(--accent); }

/* ── 서브 페이지 공통 (메모리 · 관리) ─────────── */

.page {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: clamp(2.2rem, 6vh, 4rem) 1.5rem 3rem;
}

/* 콘텐츠 페이지: 카드 그리드가 들어가므로 조금 더 넓게 */
.page.page-wide { max-width: 960px; }

/* 홈 버튼 — 눈에 띄는 알약 모양 */
.back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.55rem 1.2rem;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 0.88rem;
  letter-spacing: 0.18em;
  color: var(--text);
  transition: border-color 0.3s, text-shadow 0.3s;
}
.back:hover {
  border-color: var(--accent);
  text-shadow: 0 0 12px rgba(157, 180, 255, 0.8);
}

.page-title {
  margin-top: clamp(2.5rem, 7vh, 4.5rem);
  text-align: center;
  font-weight: 300;
  font-size: clamp(1.6rem, 5vw, 2.1rem);
  letter-spacing: 0.45em;
  margin-left: 0.45em;
}

.page-sub {
  margin-top: 1.1rem;
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.9;
  letter-spacing: 0.06em;
  color: var(--dim);
}

/* 등록된 앱 — 메인 메뉴와 같은 분위기의 글자 목록 */
.app-menu {
  margin-top: clamp(3rem, 8vh, 5rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.6rem;
}

/* 앱 한 항목: 이름 + 설명 + 첨부파일 */
.app-entry {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.app-desc {
  max-width: 30rem;
  text-align: center;
  font-size: 0.82rem;
  line-height: 1.9;
  letter-spacing: 0.04em;
  color: var(--dim);
  white-space: pre-line; /* 설명의 줄바꿈 유지 */
}

.app-files {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.6rem;
}

.file-link {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: rgba(232, 236, 245, 0.55);
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding-bottom: 2px;
  transition: color 0.3s, border-color 0.3s;
}
.file-link:hover { color: var(--text); border-color: var(--accent); }

.app-link {
  font-size: 1.05rem;
  letter-spacing: 0.4em;
  margin-left: 0.4em;
  transition: text-shadow 0.3s;
}

.app-link:hover {
  text-shadow: 0 0 16px rgba(157, 180, 255, 0.9);
}

.notice {
  text-align: center;
  font-size: 0.88rem;
  line-height: 2;
  color: var(--dim);
  letter-spacing: 0.08em;
}

/* 상단 고정 영역 (홈 버튼 + 탭) — 스크롤해도 화면 위에 남음 */
.page-head {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: calc(-1 * clamp(2.2rem, 6vh, 4rem)) -1.5rem 0;
  padding: 1.1rem 1.5rem 1rem;
  background: rgba(4, 6, 15, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
}

.page-head .tab-nav { margin-top: 0.9rem; }

/* 상단 탭 메뉴 — 홈 외의 페이지에서 전체 구조를 보고 이동 */
.tab-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem 1.7rem;
  margin-top: clamp(1.6rem, 4vh, 2.6rem);
}

.tab-link {
  font-size: 1rem;
  letter-spacing: 0.28em;
  margin-left: 0.28em;
  color: var(--dim);
  transition: color 0.3s, text-shadow 0.3s;
}
.tab-link:hover { color: var(--text); }
.tab-link.active {
  color: #fff;
  text-shadow: 0 0 12px rgba(157, 180, 255, 0.8);
}

/* ── 콘텐츠 카드 그리드 (우주·소요하다·마음·메모리 등) ──
   투명 유리 카드: 뒤로 별이 비치고 흐린 테두리만 보임.
   모든 카드는 같은 형식 — 사진 칸은 항상 있고, 사진이 없으면 비워둠 */
.card-grid {
  margin-top: clamp(2.2rem, 5vh, 3.5rem);
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), 1fr);
  gap: 1.1rem;
  align-items: stretch; /* 같은 줄의 카드는 높이를 맞춤 */
}
@media (max-width: 700px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 380px) { .card-grid { grid-template-columns: 1fr; } }

/* 카드는 투명하되 희미한 테두리로 존재만 보임 — 별하늘이 그대로 비침 */
.g-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  padding: 1rem 0.7rem;
  height: 100%;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  transition: border-color 0.3s;
}
.g-card:hover { border-color: rgba(157, 180, 255, 0.3); }

/* 사진 칸 — 항상 같은 크기로 자리만 차지. 사진이 없으면 완전히 투명 */
.g-media {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  margin-bottom: 0.25rem;
  overflow: hidden;
  flex-shrink: 0;
}

.g-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}

.g-name {
  font-size: 0.98rem;
  letter-spacing: 0.14em;
  text-align: center;
  line-height: 1.6;
  word-break: keep-all;
}
a.g-name:hover { text-shadow: 0 0 14px rgba(157, 180, 255, 0.9); }

.g-desc {
  font-size: 0.75rem;
  line-height: 1.75;
  color: var(--dim);
  text-align: center;
  white-space: pre-line;
  overflow-wrap: anywhere;
  max-width: 100%;
}

.g-files {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
}

/* ── 사진 크게 보기 (라이트박스) ── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.5rem;
  background: rgba(2, 3, 10, 0.93);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.lightbox img {
  max-width: 94vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
}

.lb-caption {
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  color: var(--dim);
  text-align: center;
}

.lb-close {
  position: absolute;
  top: 1.2rem;
  right: 1.4rem;
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  width: 2.4rem;
  height: 2.4rem;
  color: var(--dim);
  font-size: 1rem;
  cursor: pointer;
  transition: color 0.3s, border-color 0.3s;
}
.lb-close:hover { color: var(--text); border-color: var(--accent); }

.lb-prev, .lb-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(232, 236, 245, 0.4);
  font-size: 1.6rem;
  cursor: pointer;
  padding: 1rem;
  transition: color 0.3s;
}
.lb-prev { left: 0.4rem; }
.lb-next { right: 0.4rem; }
.lb-prev:hover, .lb-next:hover { color: var(--text); }

/* 하단 크레딧 영역 (서브 페이지) — 끝의 ✦가 관리 통로 */
.page-footer {
  margin-top: auto;
  padding-top: 3rem;
  text-align: center;
}

.foot-text {
  font-family: "Outfit", sans-serif;
  font-weight: 300;
  font-size: 0.72rem;
  letter-spacing: 0.35em;
  margin-left: 0.35em;
  color: rgba(232, 236, 245, 0.25);
}

.foot-admin {
  padding: 0 0.3em;
  color: inherit;
  transition: color 0.3s;
}
.foot-admin:hover { color: var(--dim); }

/* ── 관리 페이지 ──────────────────────────── */

.panel {
  margin-top: clamp(2rem, 5vh, 3rem);
  padding: 2rem 1.6rem;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 18px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.panel + .panel { margin-top: 1.2rem; }

.panel h2 {
  font-weight: 400;
  font-size: 0.95rem;
  letter-spacing: 0.25em;
  color: var(--dim);
  margin-bottom: 1.4rem;
}

.field { margin-bottom: 1rem; }

.field input {
  width: 100%;
  padding: 0.85rem 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.3s;
}
.field input::placeholder { color: rgba(232, 236, 245, 0.3); }
.field input:focus { border-color: var(--accent); }

.field textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  resize: vertical;
  transition: border-color 0.3s;
}
.field textarea::placeholder { color: rgba(232, 236, 245, 0.3); }
.field textarea:focus { border-color: var(--accent); }

.field-label {
  display: block;
  font-size: 0.78rem;
  color: var(--dim);
  margin-bottom: 0.5rem;
  letter-spacing: 0.04em;
}

.field select {
  width: 100%;
  padding: 0.85rem 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.3s;
}
.field select:focus { border-color: var(--accent); }
.field select option { background: #0a0f22; color: var(--text); }

.field input[type="file"] {
  padding: 0.6rem;
  font-size: 0.8rem;
  color: var(--dim);
}
.field input[type="file"]::file-selector-button {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 0.45rem 0.9rem;
  margin-right: 0.8rem;
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

/* 수정 모드의 기존 첨부 목록 */
.att-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: var(--dim);
  padding: 0.35rem 0.2rem;
  margin-bottom: 0.3rem;
}
.att-x {
  background: none;
  border: none;
  color: #ff9d9d;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.6rem;
  font-family: inherit;
  font-size: 0.88rem;
  letter-spacing: 0.15em;
  color: var(--text);
  background: rgba(157, 180, 255, 0.14);
  border: 1px solid rgba(157, 180, 255, 0.4);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.3s;
}
.btn:hover { background: rgba(157, 180, 255, 0.24); }
.btn.full { width: 100%; }

.btn-ghost {
  background: none;
  border: 1px solid var(--line);
  color: var(--dim);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }

.msg {
  margin-top: 1rem;
  font-size: 0.82rem;
  line-height: 1.8;
  color: var(--accent);
  letter-spacing: 0.05em;
}
.msg.error { color: #ff9d9d; }

/* 등록된 앱 목록 */
.app-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 0.2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.app-row:last-child { border-bottom: none; }

.app-row .info { flex: 1; min-width: 0; }
.app-row .name { font-size: 0.95rem; letter-spacing: 0.08em; }
.app-row .url {
  font-size: 0.75rem;
  color: var(--dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 0.2rem;
}

.row-btn {
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.4rem 0.9rem;
  font-family: inherit;
  font-size: 0.78rem;
  color: var(--dim);
  cursor: pointer;
  transition: color 0.3s, background 0.3s;
}
.row-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }

.badge {
  font-size: 0.68rem;
  color: rgba(232, 236, 245, 0.4);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  margin-left: 0.5rem;
  vertical-align: 1px;
}

.del-btn {
  flex-shrink: 0;
  background: none;
  border: 1px solid rgba(255, 157, 157, 0.35);
  border-radius: 8px;
  padding: 0.4rem 0.9rem;
  font-family: inherit;
  font-size: 0.78rem;
  color: #ff9d9d;
  cursor: pointer;
  transition: background 0.3s;
}
.del-btn:hover { background: rgba(255, 157, 157, 0.12); }

.signed-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.4rem;
  font-size: 0.8rem;
  color: var(--dim);
}
