/* Up Trading 포털 전용 (templates/index.html) — 하부 프로젝트와 무관 */

@font-face {
  font-family: 'GMarketSans';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2001@1.1/GmarketSansLight.woff') format('woff');
  font-weight: 300;
  font-display: swap;
}

@font-face {
  font-family: 'GMarketSans';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2001@1.1/GmarketSansMedium.woff') format('woff');
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: 'GMarketSans';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2001@1.1/GmarketSansBold.woff') format('woff');
  font-weight: 700;
  font-display: swap;
}

:root {
  --ink: #ecf2ff;
  --muted: rgba(224, 233, 255, 0.72);
  --line: rgba(183, 205, 255, 0.22);
  --shadow: 0 20px 48px rgba(0, 0, 0, 0.48);
  --shadow2: 0 12px 28px rgba(0, 0, 0, 0.38);
}

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "GMarketSans", "Nunito", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 500;
  overflow-x: hidden;
  background: radial-gradient(1400px 900px at 50% -15%, #45596f 0%, #1f2731 45%, #181f28 100%);
  position: relative;
}

/* 배경 */
.bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1150px 760px at 14% 12%, rgba(120, 160, 220, 0.22), transparent 62%),
    radial-gradient(980px 680px at 85% 12%, rgba(170, 120, 220, 0.2), transparent 62%),
    radial-gradient(980px 720px at 50% 92%, rgba(120, 180, 130, 0.16), transparent 64%),
    linear-gradient(155deg, #344254 0%, #1d2733 48%, #1a222d 100%);
  z-index: 0;
  pointer-events: none;
}

.blob {
  position: absolute;
  filter: blur(32px);
  opacity: 0.65;
  transform: translateZ(0);
}

.blob-a {
  width: 520px;
  height: 520px;
  left: -140px;
  top: 90px;
  background: radial-gradient(circle at 30% 30%, rgba(85, 160, 250, 0.7), rgba(85, 160, 250, 0));
}

.blob-b {
  width: 640px;
  height: 520px;
  right: -180px;
  top: 40px;
  background: radial-gradient(circle at 40% 35%, rgba(136, 108, 222, 0.68), rgba(136, 108, 222, 0));
}

.blob-c {
  width: 760px;
  height: 520px;
  left: 25%;
  bottom: -220px;
  background: radial-gradient(circle at 55% 40%, rgba(95, 176, 125, 0.46), rgba(95, 176, 125, 0));
}

.grain {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='.22'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
  opacity: 0.14;
  z-index: -2;
}

.shell {
  width: min(980px, calc(100% - 44px));
  margin: 28px auto 34px;
  position: relative;
  z-index: 1;
}

.header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.brand {
  margin: 0;
  font-family: "GMarketSans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: clamp(40px, 5.2vw, 68px);
  letter-spacing: -0.02em;
  line-height: 1;
  color: rgba(240, 247, 255, 0.96);
  text-shadow: 0 12px 28px rgba(0, 0, 0, 0.42);
}

.brand-logo {
  display: block;
  height: clamp(72px, 10vw, 118px);
  width: auto;
  max-width: min(460px, 68vw);
  object-fit: contain;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.42));
}

.tagline {
  margin: 0 0 8px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* 카드: 데스크톱 2열 */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  width: 100%;
}

.grid > .card {
  width: 100%;
  min-width: 0;
}

@media (max-width: 900px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .shell {
    width: calc(100% - 28px);
    margin: 28px auto 28px;
  }
  .header {
    flex-direction: column;
    align-items: flex-start;
  }
  .tagline {
    margin-top: 6px;
  }
}

/* 카드 공통 */
.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  padding: 16px 16px 12px;
  border-radius: 18px;
  /* 기본 테두리를 카드 톤으로 유지 (환경별 흰 테두리 아티팩트 방지) */
  border: 1px solid var(--card-bd, rgba(150, 170, 210, 0.3));
  box-shadow: var(--shadow2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
  transform: translateZ(0);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  /* 기본 글래스 (키별 클래스가 덮어씀) */
  background: linear-gradient(170deg, rgba(17, 26, 36, 0.78), rgba(14, 20, 30, 0.68));
  background-clip: padding-box;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--card-hover-bd, rgba(28, 20, 60, 0.35));
}

.card.disabled {
  opacity: 0.55;
  filter: saturate(0.9);
  cursor: default;
  pointer-events: none;
}

.card.disabled:hover {
  transform: none;
  box-shadow: var(--shadow2);
  border-color: transparent;
}

/* 카드 배경/테두리/칩색은 index.html 인라인 CARD_SKIN + CSS 변수로 적용 */
/* 인라인 스타일이 캐시/프록시에서 누락돼도 카드 색이 유지되도록 클래스 기본값 보강 */
.card--vunus {
  background: linear-gradient(145deg, rgba(16, 103, 71, 0.92), rgba(13, 78, 55, 0.84));
  --card-bd: rgba(89, 196, 145, 0.46);
  --card-hover-bd: rgba(116, 230, 175, 0.88);
  --chip-bg: rgba(30, 160, 111, 0.72);
  --chip-bd: rgba(132, 255, 201, 0.52);
  --card-hdr-bg: rgba(24, 114, 80, 0.62);
  --card-table-bg: rgba(8, 52, 37, 0.38);
  --row-k-bg: rgba(19, 86, 62, 0.62);
  --row-v-bg: rgba(18, 78, 57, 0.4);
  --row-v-alt: rgba(14, 64, 47, 0.28);
}

.card--moon {
  background: linear-gradient(145deg, rgba(71, 26, 133, 0.92), rgba(55, 19, 112, 0.86));
  --card-bd: rgba(182, 136, 255, 0.4);
  --card-hover-bd: rgba(198, 157, 255, 0.82);
  --chip-bg: rgba(123, 69, 216, 0.68);
  --chip-bd: rgba(208, 179, 255, 0.5);
  --card-hdr-bg: rgba(97, 49, 173, 0.62);
  --card-table-bg: rgba(43, 18, 81, 0.4);
  --row-k-bg: rgba(80, 41, 145, 0.58);
  --row-v-bg: rgba(65, 31, 122, 0.4);
  --row-v-alt: rgba(53, 24, 101, 0.28);
}

.card--jun {
  background: linear-gradient(145deg, rgba(34, 38, 48, 0.94), rgba(25, 29, 40, 0.9));
  --card-bd: rgba(203, 169, 97, 0.4);
  --card-hover-bd: rgba(223, 189, 115, 0.82);
  --chip-bg: rgba(157, 123, 63, 0.74);
  --chip-bd: rgba(235, 210, 145, 0.48);
  --card-hdr-bg: rgba(121, 97, 57, 0.66);
  --card-table-bg: rgba(31, 27, 22, 0.44);
  --row-k-bg: rgba(83, 69, 41, 0.62);
  --row-v-bg: rgba(59, 49, 30, 0.4);
  --row-v-alt: rgba(48, 39, 25, 0.3);
}

.card--sun {
  background: linear-gradient(145deg, rgba(158, 70, 16, 0.92), rgba(130, 52, 10, 0.88));
  --card-bd: rgba(236, 170, 110, 0.44);
  --card-hover-bd: rgba(248, 189, 133, 0.86);
  --chip-bg: rgba(205, 123, 57, 0.74);
  --chip-bd: rgba(255, 214, 168, 0.48);
  --card-hdr-bg: rgba(176, 96, 34, 0.64);
  --card-table-bg: rgba(63, 32, 12, 0.44);
  --row-k-bg: rgba(116, 66, 28, 0.62);
  --row-v-bg: rgba(92, 51, 20, 0.42);
  --row-v-alt: rgba(76, 42, 16, 0.28);
}

/* 헤더 줄: 제목 중앙, LIVE 우측 */
.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  position: relative;
  min-height: 2.5rem;
}

.card-title {
  text-align: center;
  width: 100%;
  padding: 0 72px;
}

.card-title .name {
  font-family: "GMarketSans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 18px;
}

.card-title .sub {
  margin-top: 2px;
  font-weight: 800;
  color: rgba(239, 245, 255, 0.8);
  font-size: 12px;
}

.card-title .sub:first-child {
  margin-top: 0;
}

a.sub-link-go {
  color: #2563eb !important;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
}

a.sub-link-go:hover {
  color: #1d4ed8 !important;
}

.chip {
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 6px 10px;
  border-radius: 999px;
  /* 카드 루트 인라인 --chip-bg / --chip-bd (없으면 기본) */
  background: var(--chip-bg, rgba(255, 255, 255, 0.45));
  border: 1px solid var(--chip-bd, rgba(28, 20, 60, 0.16));
}

.chip-group {
  position: absolute;
  right: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chip--live {
  animation: livePulse 1s ease-in-out infinite;
}

.chip--stop {
  background: rgba(35, 35, 45, 0.68) !important;
  border-color: rgba(10, 10, 14, 0.85) !important;
  color: rgba(245, 245, 245, 0.9);
}

.chip--entered {
  background: rgba(29, 179, 121, 0.78) !important;
  border-color: rgba(157, 252, 222, 0.62) !important;
  color: rgba(242, 255, 249, 0.96);
}

.chip--waiting {
  background: rgba(38, 58, 87, 0.72) !important;
  border-color: rgba(166, 194, 238, 0.36) !important;
  color: rgba(228, 239, 255, 0.95);
}

@keyframes livePulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(255, 40, 90, 0.35);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 6px rgba(255, 40, 90, 0.0);
    filter: brightness(1.08);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(255, 40, 90, 0.0);
    filter: brightness(1);
  }
}

.card.disabled .chip {
  opacity: 0.7;
}

@media (max-width: 520px) {
  .card-title {
    padding: 0;
    text-align: left;
  }
  .chip-group {
    position: static;
    margin-left: auto;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .card-top {
    flex-wrap: wrap;
    justify-content: space-between;
  }
}

/* 표 */
.card-table {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(192, 210, 255, 0.22);
  background: var(--card-table-bg, rgba(255, 255, 255, 0.18));
}

.card-table .hdr {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid rgba(190, 210, 255, 0.22);
  background: var(--card-hdr-bg, rgba(255, 255, 255, 0.28));
}

.card-table .th {
  padding: 10px;
  font-weight: 900;
  font-size: 12px;
  color: rgba(242, 247, 255, 0.9);
  border-right: 1px solid rgba(190, 210, 255, 0.2);
}

.card-table .th:last-child {
  border-right: none;
}

.row {
  display: grid;
  grid-template-columns: 78px 1fr 78px 1fr;
  gap: 0;
  border-bottom: 1px solid rgba(190, 210, 255, 0.16);
}

.row:last-child {
  border-bottom: none;
}

.k,
.v {
  padding: 10px;
  font-size: 12px;
  line-height: 1.1rem;
}

.k {
  font-weight: 900;
  color: rgba(236, 243, 255, 0.9);
  background: var(--row-k-bg, rgba(55, 70, 96, 0.44));
  border-right: 1px solid rgba(190, 210, 255, 0.16);
}

.v {
  font-weight: 800;
  color: rgba(247, 250, 255, 0.96);
  background: var(--row-v-bg, rgba(44, 56, 76, 0.36));
  border-right: 1px solid rgba(190, 210, 255, 0.14);
}

/* 짝수 행 값 셀: 카드별 --row-v-alt */
.row:nth-child(even) .v {
  background: var(--row-v-alt, transparent);
}

.row .v:nth-child(2) {
  border-right: 1px solid rgba(190, 210, 255, 0.2);
}

.row .v:last-child {
  border-right: none;
}

.strong {
  font-weight: 900;
}

.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px 0;
  color: rgba(236, 244, 255, 0.88);
  font-weight: 900;
}

.cta {
  font-size: 12px;
  letter-spacing: 0.02em;
}

.arrow {
  font-size: 16px;
  opacity: 0.8;
}

.footer {
  margin-top: 22px;
  /* 그리드–푸터 간격(margin-top)과 맞춰 AI 링크 블록 아래 여백 */
  padding-bottom: 22px;
  position: relative;
  z-index: 2;
}

.big {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  padding: 22px 18px;
  border-radius: 18px;
  font-family: "GMarketSans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 800;
  letter-spacing: 0.02em;
  font-size: 22px;
  color: rgba(240, 247, 255, 0.96);
  background: linear-gradient(160deg, rgba(34, 47, 66, 0.95), rgba(23, 31, 44, 0.92));
  border: 1px solid rgba(138, 166, 220, 0.32);
  box-shadow: var(--shadow2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.big:hover {
  filter: brightness(1.03);
}
