:root {
  --bg: #f4efe7;
  --panel: #fffaf4;
  --panel-strong: #fff;
  --ink: #1e2430;
  --muted: #5d6575;
  --line: rgba(30, 36, 48, 0.12);
  --accent: #0d6d77;
  --accent-soft: rgba(13, 109, 119, 0.12);
  --warn: #9a5b00;
  --error: #a52424;
  --shadow: 0 24px 60px rgba(34, 42, 56, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans KR", "Noto Sans KR", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(13, 109, 119, 0.16), transparent 30%),
    linear-gradient(180deg, #f6f1ea 0%, #f0eadf 100%);
}

a {
  color: inherit;
}

.page-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 20px 72px;
}

.hero {
  display: grid;
  grid-template-columns: 1.6fr 0.8fr;
  gap: 24px;
  align-items: end;
  background: rgba(255, 250, 244, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
  border-radius: 28px;
  padding: 28px;
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1, h2, h3, h4 {
  font-family: "IBM Plex Serif", "Noto Serif KR", serif;
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 3.7rem);
  line-height: 0.98;
}

.hero-copy {
  max-width: 700px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
  justify-self: end;
  align-items: stretch;
  min-width: 260px;
}

.week-chip,
.primary-button,
.secondary-button,
.week-input,
.status-banner,
.paper-card,
.top-card,
.password-dialog {
  border-radius: 18px;
}

.week-chip {
  padding: 14px 18px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.week-range-label {
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
}

.control-label {
  font-size: 0.92rem;
  color: var(--muted);
  font-weight: 600;
}

.week-input,
.password-input {
  width: 100%;
  padding: 14px 18px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--ink);
  font: inherit;
}

.primary-button {
  border: 0;
  padding: 14px 18px;
  font: inherit;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #0a5260);
  cursor: pointer;
}

.secondary-button {
  border: 1px solid var(--line);
  padding: 14px 18px;
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.status-banner {
  margin-top: 18px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
}

.status-banner.info {
  color: var(--muted);
}

.status-banner.warn {
  color: var(--warn);
}

.status-banner.error {
  color: var(--error);
}

.hidden {
  display: none;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(30, 36, 48, 0.34);
  backdrop-filter: blur(8px);
}

.loading-overlay.hidden {
  display: none;
}

.loading-card {
  width: min(360px, 100%);
  padding: 24px 22px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  background: rgba(255, 250, 244, 0.95);
  box-shadow: 0 28px 80px rgba(18, 29, 38, 0.22);
  text-align: center;
}

.loading-card h3 {
  margin: 0 0 8px;
  font-size: 1.28rem;
}

.loading-week {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.loading-dots {
  display: inline-flex;
  gap: 8px;
  margin-top: 14px;
}

.loading-dots span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
  opacity: 0.2;
  animation: pulse-dot 1.2s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

.password-dialog {
  border: 1px solid var(--line);
  padding: 0;
  max-width: 420px;
  width: calc(100% - 24px);
  background: rgba(255, 251, 246, 0.98);
  box-shadow: var(--shadow);
}

.password-dialog::backdrop {
  background: rgba(30, 36, 48, 0.28);
}

.password-form {
  padding: 24px;
}

.password-form h3 {
  margin: 0 0 10px;
}

.password-form p {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.6;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.top-section,
.paper-list {
  margin-top: 30px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.6rem;
}

.section-heading a,
.meta-line {
  color: var(--muted);
}

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

.top-card,
.paper-card {
  background: rgba(255, 252, 247, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow);
}

.top-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 220px;
  padding: 20px;
  text-decoration: none;
}

.top-card h3 {
  margin: 0;
  font-size: 1.2rem;
}

.top-card p,
.summary-block p,
.summary-block li {
  color: var(--muted);
  line-height: 1.65;
}

.detailed-summary {
  white-space: pre-line;
}

.top-card-foot {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--muted);
}

.top-card-rank {
  width: fit-content;
  padding: 6px 10px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  font-weight: 700;
}

.paper-list {
  display: grid;
  gap: 18px;
}

.paper-card {
  padding: 22px;
}

.paper-figure-wrap {
  margin: -22px -22px 18px;
  padding: 16px;
  overflow: hidden;
  border-radius: 18px 18px 0 0;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(13, 109, 119, 0.1), rgba(255, 255, 255, 0.5));
}

.paper-figure {
  display: block;
  width: 100%;
  max-height: 440px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.paper-figure-caption {
  padding: 10px 2px 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.card-head,
.link-group,
.badge-row,
.summary-grid {
  display: flex;
  gap: 10px;
}

.card-head {
  justify-content: space-between;
  align-items: center;
}

.rank-pill,
.badge,
.link-group a {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
}

.rank-pill {
  padding: 8px 12px;
  background: var(--ink);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
}

.link-group {
  flex-wrap: wrap;
}

.link-group a {
  padding: 7px 12px;
  text-decoration: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
}

.paper-title {
  margin: 16px 0;
  font-size: clamp(1.25rem, 3vw, 1.8rem);
}

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

.meta-item {
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.meta-item span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.88rem;
}

.badge-row {
  flex-wrap: wrap;
  margin: 16px 0;
}

.tab-row {
  display: flex;
  gap: 10px;
  margin: 16px 0 0;
}

.tab-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  border-radius: 999px;
  padding: 9px 14px;
  font: inherit;
  cursor: pointer;
}

.tab-button.active {
  background: var(--ink);
  color: #fff;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.badge {
  padding: 8px 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 700;
}

.summary-block {
  margin-top: 18px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.summary-block h4 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.idea-list {
  margin: 0;
  padding-left: 18px;
}

.summary-grid {
  align-items: stretch;
}

.summary-grid .summary-block {
  flex: 1;
}

@media (max-width: 920px) {
  .hero,
  .top-grid,
  .summary-grid,
  .meta-grid {
    grid-template-columns: 1fr;
  }

  .hero-actions {
    justify-self: stretch;
    min-width: 0;
  }

  .top-grid {
    display: grid;
  }

  .summary-grid {
    display: block;
  }

  .summary-grid .summary-block + .summary-block {
    margin-top: 18px;
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 20px 14px 48px;
  }

  .hero,
  .paper-card,
  .top-card {
    padding: 18px;
  }

  .week-chip {
    font-size: 0.95rem;
    padding: 12px 14px;
  }

  .week-range-label {
    font-size: 0.84rem;
  }

  .week-input {
    font-size: 0.95rem;
  }

  .section-heading,
  .card-head,
  .dialog-actions {
    flex-direction: column;
    align-items: flex-start;
  }
}

@keyframes pulse-dot {
  0%, 100% {
    opacity: 0.18;
    transform: translateY(0);
  }

  50% {
    opacity: 1;
    transform: translateY(-3px);
  }
}
