:root {
  --bg: #0b1020;
  --bg2: #151c33;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --line: rgba(255, 255, 255, 0.12);
  --glass: rgba(255, 255, 255, 0.08);
  --accent: #60a5fa;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Pretendard", "Noto Sans KR", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 20% 15%, #1d4ed8 0%, transparent 40%),
    radial-gradient(circle at 80% 20%, #0ea5e9 0%, transparent 30%),
    linear-gradient(145deg, var(--bg), var(--bg2));
  min-height: 100vh;
}

.page {
  width: min(1100px, calc(100% - 24px));
  margin: 24px auto;
  display: grid;
  gap: 14px;
  position: relative;
  z-index: 2;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(80px);
  opacity: 0.22;
  pointer-events: none;
  z-index: 1;
}

.orb-a {
  width: 320px;
  height: 320px;
  background: #22d3ee;
  top: -40px;
  right: -80px;
}

.orb-b {
  width: 260px;
  height: 260px;
  background: #8b5cf6;
  bottom: 0;
  left: -60px;
}

.glass {
  background: linear-gradient(130deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04));
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  border-radius: 18px;
}

.topbar {
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
}

.controls {
  display: flex;
  gap: 8px;
}

.controls input,
.controls button,
.small-btn {
  border: 1px solid var(--line);
  background: rgba(17, 24, 39, 0.5);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
}

.controls button,
.small-btn {
  background: linear-gradient(120deg, #3b82f6, #6366f1);
  border: none;
  cursor: pointer;
}

.kpi-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.kpi-card {
  padding: 14px;
}

.kpi-card h3 {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.kpi-value {
  margin: 8px 0 0;
  font-size: 30px;
  font-weight: 800;
}

.layout-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 1.4fr 1fr;
}

.panel {
  padding: 16px;
}

.panel h2 {
  margin: 0;
  font-size: 20px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.donut-wrap {
  margin: 8px auto 0;
  width: 250px;
  height: 250px;
  position: relative;
}

.donut {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: conic-gradient(#334155 100%);
  position: relative;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 28%;
  border-radius: 999px;
  background: rgba(7, 11, 22, 0.9);
  border: 1px solid var(--line);
}

.donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 48px;
  font-weight: 800;
}

.legend,
.topic-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.legend li,
.topic-list li {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(15, 23, 42, 0.35);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
  margin-right: 8px;
}

.warning {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  margin: 10px 0;
}

.warning.active {
  border-color: rgba(239, 68, 68, 0.8);
  background: rgba(239, 68, 68, 0.18);
  color: #fee2e2;
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.bento-cell {
  border-radius: 10px;
  border: 1px solid var(--line);
  min-height: 60px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 11px;
  transition: transform 120ms ease;
}

.bento-cell.has-url {
  cursor: pointer;
}

.bento-cell.has-url:hover {
  transform: translateY(-2px);
}

.day-number {
  opacity: 0.9;
  font-weight: 700;
}

.topic-chip {
  margin-top: 2px;
  font-size: 10px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
}

.modal.hidden,
.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 16, 0.72);
}

.modal-card {
  position: relative;
  width: min(560px, calc(100% - 24px));
  margin: 44px auto;
  padding: 16px;
}

.close-btn {
  position: absolute;
  right: 12px;
  top: 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(17, 24, 39, 0.5);
  color: var(--text);
  padding: 6px 8px;
  cursor: pointer;
}

.preview-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.45);
}

.preview-card img {
  width: 100%;
  height: auto;
  display: block;
}

.preview-content {
  padding: 10px;
}

.preview-content h4 {
  margin: 0 0 6px;
}

.preview-content p {
  margin: 0 0 10px;
}

.preview-content a {
  color: #bfdbfe;
}

.skeleton {
  position: relative;
  overflow: hidden;
}

.skeleton::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.16), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

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

.error {
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #fecaca;
  background: rgba(127, 29, 29, 0.3);
  border-radius: 12px;
  padding: 10px;
}

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

  .layout-grid {
    grid-template-columns: 1fr;
  }

  .donut-wrap {
    width: 210px;
    height: 210px;
  }
}
