:root {
  color-scheme: dark;
  --bg: #070a12;
  --bg-soft: #0d1220;
  --panel: rgba(17, 24, 39, 0.72);
  --panel-strong: rgba(17, 24, 39, 0.92);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.2);
  --text: #f8fafc;
  --muted: #a8b3c7;
  --muted-2: #7d89a3;
  --accent: #68e1fd;
  --accent-2: #9dffb7;
  --danger: #ff7b94;
  --warning: #ffd166;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background:
    radial-gradient(circle at 15% 10%, rgba(104, 225, 253, 0.18), transparent 26rem),
    radial-gradient(circle at 85% 0%, rgba(157, 255, 183, 0.14), transparent 28rem),
    linear-gradient(135deg, #070a12 0%, #0c1222 48%, #060810 100%);
  color: var(--text);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.55), transparent 75%);
}

button,
input,
select,
textarea {
  font: inherit;
}

a { color: inherit; }

.background-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  filter: blur(0.2px);
}

.orb {
  position: absolute;
  border-radius: 999px;
  opacity: 0.38;
  filter: blur(30px);
  animation: float 9s ease-in-out infinite;
}

.orb-a {
  width: 20rem;
  height: 20rem;
  left: -5rem;
  top: 8rem;
  background: rgba(104, 225, 253, 0.32);
}

.orb-b {
  width: 18rem;
  height: 18rem;
  right: 4rem;
  top: 7rem;
  background: rgba(157, 255, 183, 0.22);
  animation-delay: -3s;
}

.orb-c {
  width: 24rem;
  height: 24rem;
  right: -9rem;
  bottom: 0;
  background: rgba(158, 116, 255, 0.2);
  animation-delay: -5s;
}

@keyframes float {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(0, -18px, 0) scale(1.04); }
}

.shell {
  width: min(1160px, calc(100% - 32px));
  margin-inline: auto;
}

.header-shell { padding-top: 22px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(7, 10, 18, 0.52);
  backdrop-filter: blur(18px);
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  padding: 6px 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(104,225,253,0.22), rgba(157,255,183,0.2));
  border: 1px solid var(--line-strong);
}

.brand-text { font-size: 0.98rem; }

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ghost-button,
.primary-button,
.secondary-button,
.danger-button,
.tiny-button,
.filter-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255,255,255,0.06);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, opacity 0.16s ease;
  -webkit-tap-highlight-color: transparent;
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 15px;
  font-size: 0.9rem;
}

.ghost-button:hover,
.secondary-button:hover,
.tiny-button:hover,
.filter-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(104,225,253,0.42);
  background: rgba(255,255,255,0.1);
}

.hero {
  padding: 88px 0 46px;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 0 16px;
  padding: 7px 12px;
  color: #bff8ff;
  background: rgba(104,225,253,0.1);
  border: 1px solid rgba(104,225,253,0.22);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.7rem, 8vw, 6.4rem);
  line-height: 0.92;
  letter-spacing: -0.08em;
  text-shadow: 0 20px 80px rgba(104, 225, 253, 0.24);
}

.hero-subtitle {
  width: min(680px, 100%);
  margin: 24px auto 0;
  color: var(--muted);
  font-size: clamp(1.04rem, 2.4vw, 1.35rem);
  line-height: 1.75;
}

.notice {
  width: min(760px, 100%);
  margin: 24px auto 0;
  padding: 15px 18px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(157,255,183,0.2);
  background: rgba(157,255,183,0.08);
  color: #dbffe5;
  line-height: 1.55;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  width: min(720px, 100%);
  margin: 34px auto 0;
}

.stat-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(17,24,39,0.6);
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.16);
}

.stat-value {
  display: block;
  font-size: clamp(1.75rem, 4vw, 2.45rem);
  font-weight: 950;
  letter-spacing: -0.06em;
}

.stat-label {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.9rem;
}

.main-shell { padding-bottom: 36px; }

.toolbar {
  position: sticky;
  top: 12px;
  z-index: 5;
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(7, 10, 18, 0.64);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow);
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 18px;
  color: var(--muted-2);
  font-size: 1.2rem;
}

.search-wrap input {
  width: 100%;
  height: 58px;
  padding: 0 18px 0 48px;
  border: 1px solid var(--line);
  border-radius: 999px;
  outline: none;
  color: var(--text);
  background: rgba(255,255,255,0.055);
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.search-wrap input::placeholder { color: var(--muted-2); }

.search-wrap input:focus {
  border-color: rgba(104,225,253,0.58);
  background: rgba(255,255,255,0.09);
  box-shadow: 0 0 0 4px rgba(104,225,253,0.08);
}

.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.filter-chip {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 14px;
  color: var(--muted);
  white-space: nowrap;
}

.filter-chip.active {
  color: #061016;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 30px rgba(104,225,253,0.16);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  padding: 22px 0 0;
}

.portal-card {
  position: relative;
  overflow: hidden;
  min-height: 258px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(17,24,39,0.82), rgba(17,24,39,0.56));
  box-shadow: 0 18px 60px rgba(0,0,0,0.24);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  isolation: isolate;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.portal-card::before {
  content: "";
  position: absolute;
  inset: -2px;
  background:
    radial-gradient(circle at 20% 10%, rgba(104,225,253,0.16), transparent 32%),
    radial-gradient(circle at 90% 0%, rgba(157,255,183,0.12), transparent 28%);
  opacity: 0;
  transition: opacity 0.18s ease;
  z-index: -1;
}

.portal-card:hover {
  transform: translateY(-4px);
  border-color: rgba(104,225,253,0.35);
  background: linear-gradient(180deg, rgba(17,24,39,0.92), rgba(17,24,39,0.68));
}

.portal-card:hover::before { opacity: 1; }

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.card-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.08);
  font-size: 1.9rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  color: #dce7ff;
  background: rgba(255,255,255,0.07);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 18px var(--accent-2);
}

.status-testing::before { background: var(--warning); box-shadow: 0 0 18px var(--warning); }
.status-dev::before { background: #c4a8ff; box-shadow: 0 0 18px #c4a8ff; }
.status-off::before { background: var(--danger); box-shadow: 0 0 18px var(--danger); }

.card-title {
  margin: 18px 0 0;
  font-size: 1.26rem;
  line-height: 1.3;
  letter-spacing: -0.04em;
}

.card-desc {
  min-height: 54px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.58;
  font-size: 0.94rem;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 16px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--muted);
  background: rgba(255,255,255,0.045);
  font-size: 0.78rem;
}

.card-actions {
  display: flex;
  gap: 9px;
  margin-top: auto;
  padding-top: 20px;
}

.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 15px;
  font-weight: 850;
}

.primary-button {
  color: #061016;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 16px 40px rgba(104,225,253,0.16);
}

.primary-button:hover,
.danger-button:hover {
  transform: translateY(-1px);
  opacity: 0.92;
}

.secondary-button { background: rgba(255,255,255,0.065); }

.danger-button {
  color: #21070d;
  border-color: transparent;
  background: linear-gradient(135deg, #ff8fa3, #ffd1d9);
}

.empty-state,
.error-page {
  display: grid;
  place-items: center;
  min-height: 320px;
  text-align: center;
}

.empty-state {
  margin-top: 22px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-xl);
  background: rgba(255,255,255,0.035);
}

.empty-icon { font-size: 3rem; }
.empty-state h2 { margin: 10px 0 4px; }
.empty-state p { margin: 0; color: var(--muted); }

.footer-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 32px 0 44px;
  color: var(--muted);
  font-size: 0.92rem;
}

.footer-shell p { margin: 0; }
.muted { color: var(--muted-2); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  pointer-events: none;
  min-width: min(420px, calc(100% - 32px));
  padding: 13px 16px;
  border: 1px solid rgba(104,225,253,0.24);
  border-radius: 999px;
  color: var(--text);
  background: rgba(7,10,18,0.92);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  text-align: center;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.error-card {
  width: min(560px, 100%);
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow);
}

/* Admin */
.admin-page .header-shell { padding-bottom: 18px; }
.admin-layout {
  display: grid;
  grid-template-columns: 0.92fr 1.08fr;
  gap: 18px;
  padding-bottom: 46px;
}

.admin-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(17,24,39,0.68);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.admin-panel-header {
  padding: 20px 20px 0;
}

.admin-panel-header h2 {
  margin: 0;
  letter-spacing: -0.04em;
}

.admin-panel-header p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.93rem;
}

.admin-form {
  display: grid;
  gap: 13px;
  padding: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.field {
  display: grid;
  gap: 7px;
}

.field.full { grid-column: 1 / -1; }

.field label,
.check-field span {
  color: #d8e2f3;
  font-size: 0.86rem;
  font-weight: 800;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  color: var(--text);
  background: rgba(255,255,255,0.055);
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.field input,
.field select {
  height: 44px;
  padding: 0 12px;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
  padding: 12px;
  line-height: 1.55;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: rgba(104,225,253,0.58);
  background: rgba(255,255,255,0.09);
  box-shadow: 0 0 0 4px rgba(104,225,253,0.08);
}

.check-field {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.045);
}

.check-field input {
  width: 18px;
  height: 18px;
  accent-color: #68e1fd;
}

.form-actions,
.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.admin-actions { padding: 0 20px 20px; }

.tiny-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
}

.login-card {
  width: min(460px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(17,24,39,0.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-card h1 { margin: 8px 0 8px; letter-spacing: -0.05em; }
.login-card p { color: var(--muted); line-height: 1.65; }

.admin-list {
  display: grid;
  gap: 10px;
  max-height: 820px;
  overflow: auto;
  padding: 20px;
}

.admin-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.045);
}

.admin-item.hidden-item { opacity: 0.52; }

.admin-item-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 15px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--line);
  font-size: 1.45rem;
}

.admin-item h3 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -0.03em;
}

.admin-item p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
  word-break: break-all;
}

.admin-item-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-note {
  margin: 0;
  padding: 13px 20px 20px;
  color: var(--muted-2);
  line-height: 1.55;
  font-size: 0.9rem;
}

.file-input {
  display: none;
}

@media (max-width: 980px) {
  .cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-layout { grid-template-columns: 1fr; }
  .toolbar { position: static; }
}

@media (max-width: 680px) {
  .shell { width: min(100% - 24px, 1160px); }
  .header-shell { padding-top: 12px; }
  .topbar {
    align-items: stretch;
    border-radius: 24px;
  }
  .brand-text { display: none; }
  .top-actions { width: auto; }
  .ghost-button { min-height: 38px; padding: 0 12px; font-size: 0.84rem; }
  .hero { padding: 58px 0 34px; }
  .hero h1 { letter-spacing: -0.075em; }
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { padding: 14px; }
  .toolbar { border-radius: 24px; padding: 12px; }
  .search-wrap input { height: 54px; }
  .cards-grid { grid-template-columns: 1fr; gap: 13px; }
  .portal-card { min-height: 242px; padding: 19px; border-radius: 24px; }
  .card-actions { flex-direction: column; }
  .primary-button, .secondary-button, .danger-button { width: 100%; }
  .footer-shell { display: grid; padding-bottom: 30px; }
  .form-grid { grid-template-columns: 1fr; }
  .admin-item { grid-template-columns: auto 1fr; }
  .admin-item-buttons { grid-column: 1 / -1; justify-content: stretch; }
  .admin-item-buttons .tiny-button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* hidden 속성 강제 적용: 카드가 있을 때 빈 화면 박스가 보이는 문제 수정 */
[hidden],
.empty-state[hidden] {
  display: none !important;
}
