:root {
  --bg: #ffffff;
  --bg-panel: #ffffff;
  --border: #4a5852;
  --ink: #000000;
  --text-body: #000000;
  --accent: #000000;
  --accent-dim: #000000;
  --success: #8fa878;
  --danger: #b5615a;
  --focus: #7c93a3;

  --font-display: 'Fraunces', Georgia, serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;
  --font-sans: 'IBM Plex Sans', -apple-system, sans-serif;
  --font-badge: 'Baloo 2', 'Trebuchet MS', sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-body);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
}

/* ---- 헤더 ---- */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
}

.wordmark {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.site-nav {
  display: flex;
  align-items: center;
}

.site-nav a {
  text-decoration: none;
  margin-left: 1.5rem;
  font-size: 0.9rem;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}

.nav-profile-link {
  display: inline-flex !important;
  align-items: center;
  gap: 0.4rem;
}

.nav-avatar {
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.nav-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.notif-bell-wrap {
  position: relative;
  margin-left: 1.5rem;
}

.notif-bell-btn {
  position: relative;
  background: transparent;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.1rem;
  line-height: 1;
}

.notif-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--danger);
  border: 1px solid var(--bg);
}

.notif-dot[hidden] {
  display: none;
}

.notif-panel {
  position: absolute;
  top: 130%;
  right: 0;
  width: 20rem;
  max-height: 24rem;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  z-index: 40;
}

.notif-panel[hidden] {
  display: none;
}

.notif-list {
  display: flex;
  flex-direction: column;
}

.notif-list .profile-empty {
  padding: 0.9rem;
}

.notif-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.7rem 2rem 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text-body);
  font-size: 0.82rem;
}

.notif-delete-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: transparent;
  border: none;
  color: var(--accent-dim);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.1rem 0.3rem;
}

.notif-claim-btn {
  display: block;
  margin-top: 0.4rem;
  background: var(--ink);
  color: var(--bg);
  border: none;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
}

.notif-claim-btn:disabled {
  background: var(--border);
  color: var(--accent-dim);
  cursor: default;
}

.notif-delete-btn:hover {
  color: var(--danger);
}

.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
}

.notif-panel-title {
  font-size: 0.82rem;
  font-weight: 600;
}

.notif-clear-all-btn {
  background: transparent;
  border: none;
  color: var(--accent-dim);
  font-size: 0.72rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.notif-clear-all-btn:hover {
  color: var(--danger);
}

.notif-item:last-child {
  border-bottom: none;
}

.notif-item-unread {
  background: rgba(154, 190, 226, 0.12);
}

.notif-time {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--accent-dim);
}

.site-nav a:hover,
.site-nav a:focus-visible {
  border-bottom-color: var(--accent-dim);
}

.nav-search {
  margin-left: 1.5rem;
}

.nav-search-input {
  width: 9rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-body);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.35rem 0.6rem;
  outline: none;
}

.nav-search-input:focus {
  border-color: var(--accent);
}

/* ---- 메인 ---- */
main {
  position: relative;
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem;
}

.play-layout {
  position: relative;
  width: 100%;
  max-width: 1160px;
}

.category-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 220px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.tools-panel {
  position: absolute;
  top: 0;
  left: 0;
  width: 180px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.tools-panel h2 {
  margin: 0 0 0.8rem;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
}

.tools-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.tools-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.tools-item-note {
  display: block;
  font-size: 0.68rem;
  color: var(--accent-dim);
  line-height: 1.3;
}

.tools-check {
  flex-shrink: 0;
  width: 1.2rem;
  height: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 0.75rem;
  color: transparent;
}

.tools-check.is-checked {
  border-color: var(--accent);
  color: var(--accent);
}

@media (max-width: 1020px) {
  .play-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 720px;
  }

  .category-panel {
    position: static;
    width: 100%;
    max-width: 420px;
    margin-top: 1.5rem;
  }

  .tools-panel {
    position: static;
    width: 100%;
    max-width: 420px;
    order: -1;
    margin-bottom: 1.5rem;
  }
}

@media (max-width: 980px) {
  .hero-layout {
    flex-direction: column;
    align-items: center;
  }

  .home-leaderboard-panel {
    position: static;
    width: 100%;
    max-width: 480px;
    margin: 0 auto 2rem;
  }
}

.category-panel h2 {
  margin: 0 0 0.8rem;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
}

.category-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.category-actions button {
  flex: 1;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-body);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.3rem;
  border-radius: 3px;
  cursor: pointer;
}

.category-actions button:hover,
.category-actions button:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.category-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 70vh;
  overflow-y: auto;
}

.category-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.category-item input {
  accent-color: var(--accent);
  cursor: pointer;
}

/* ---- 홈 화면 ---- */
.home-page {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

/* 첫 화면(스크롤 없이)에 타이틀/주간문제/모드버튼이 다 보이도록 하는 영역.
   헤더 높이를 대략 4rem으로 잡고 나머지 뷰포트 높이를 채우되, 너무 작은
   화면에서는 min-height를 풀어 내용이 잘리지 않게 한다. */
.hero-layout {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2.4rem;
}

.hero {
  width: 100%;
  max-width: 800px;
  min-height: min(88vh, 720px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 2.2rem;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 7vw, 4rem);
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.hero-letter {
  display: inline-block;
  min-width: 0.55em;
  text-align: center;
  opacity: 0;
  transform: translateY(-0.35em);
  transition: transform 0.25s ease-out, opacity 0.25s ease-out;
}

.hero-letter--drop {
  opacity: 1;
  transform: translateY(0);
}

.fade-rise-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-rise-in--visible {
  opacity: 1;
  transform: translateY(0);
}

.hero-tagline {
  margin: -1.2rem 0 0;
  color: var(--text-body);
  font-size: 1rem;
  opacity: 0.75;
}

.weekly-card {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  width: 100%;
  max-width: 560px;
  background: var(--bg);
  color: var(--text-body);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem 2.2rem;
  text-decoration: none;
  cursor: pointer;
}

.weekly-card--locked {
  border-style: dashed;
}

.weekly-card--locked .weekly-cta {
  color: var(--accent-dim);
}

.weekly-card:hover,
.weekly-card:focus-visible {
  border-color: var(--accent);
}

.home-leaderboard-panel {
  position: absolute;
  top: 0;
  right: 1.5rem;
  width: 260px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.2rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  text-align: left;
  z-index: 10;
}

@media (max-width: 1180px) {
  /* 화면이 좁아지면 우측에 고정할 자리가 없으니, 자연스러운 위치(hero
     아래)로 되돌려서 본문과 겹치지 않게 한다. */
  .home-leaderboard-panel {
    position: static;
    width: 100%;
    max-width: 420px;
    margin: 1.5rem auto 0;
  }
}

.home-left-panels {
  position: absolute;
  top: 0;
  left: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  z-index: 10;
}

.home-quest-panel {
  width: 240px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.2rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  text-align: left;
}

.home-calendar-panel {
  /* 퀘스트 패널보다 살짝 더 큰 정사각형에 가까운 카드 */
  width: 264px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.3rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  text-align: left;
}

.home-calendar-title {
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.home-calendar-weekdays,
.home-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.3rem;
  text-align: center;
}

.home-calendar-weekdays span {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--accent-dim);
}

.home-calendar-day {
  position: relative;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.3rem 0;
  border-radius: 5px;
}

.home-calendar-day--today {
  background: var(--ink);
  color: var(--bg);
  font-weight: 700;
}

.home-calendar-gift-icon {
  display: block;
  font-size: 0.65rem;
  line-height: 1;
  margin-top: 0.1rem;
  cursor: default;
}

.home-calendar-gift-tooltip {
  display: none;
  position: absolute;
  bottom: 105%;
  left: 0;
  width: 160px;
  background: var(--ink);
  color: var(--bg);
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  font-size: 0.65rem;
  line-height: 1.4;
  white-space: normal;
  text-align: left;
  z-index: 20;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.home-calendar-day--gift:hover .home-calendar-gift-tooltip {
  display: block;
}

@media (max-width: 1180px) {
  /* 화면이 좁아지면 좌측에 고정할 자리가 없으니, 자연스러운 위치(맨 위)로
     되돌려서 본문과 겹치지 않게 한다. */
  .home-left-panels {
    position: static;
    flex-direction: column;
    align-items: center;
    margin: 0 auto 1.5rem;
  }

  .home-quest-panel,
  .home-calendar-panel {
    width: 100%;
    max-width: 420px;
  }
}

.home-quest-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.home-quest-title {
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.home-quest-reset {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-dim);
}

.home-quest-desc {
  font-size: 0.85rem;
  color: var(--text-body);
  margin: 0;
}

.home-quest-progress-bar {
  width: 100%;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.home-quest-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.3s ease-out;
}

.home-quest-progress-text {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent-dim);
  margin: 0;
}

#home-quest-claim-btn {
  width: 100%;
}

.home-quest-reward-icons {
  gap: 0.5rem;
}

.home-quest-reward-icons .gp-inventory-card {
  width: 64px;
  height: 64px;
  font-size: 0.75rem;
}

.home-quest-reward-icons[hidden] {
  display: none;
}

.home-leaderboard-heading {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.home-leaderboard-week {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--border);
}

.weekly-leaderboard-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--accent-dim);
}

.weekly-leaderboard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.weekly-leaderboard-list li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
}

.weekly-leaderboard-more {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-dim);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.weekly-leaderboard-more:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.weekly-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  width: 100%;
}

.weekly-label {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent-dim);
}

.weekly-cta {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--accent-dim);
}

.weekly-equation {
  font-size: 1.75rem;
  overflow-x: hidden;
  white-space: nowrap;
  padding: 0.2rem 0 0.1rem;
}

.weekly-equation .katex {
  color: var(--ink);
}

.weekly-timer {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent-dim);
}

.hero-actions {
  display: flex;
  gap: 1.2rem;
  width: 100%;
  max-width: 560px;
}

.online-count {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.6rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent-dim);
}

.online-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #4caf6f;
  flex-shrink: 0;
}

.mode-cta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.4rem;
  text-decoration: none;
  color: inherit;
}

.mode-cta:hover,
.mode-cta:focus-visible {
  border-color: var(--accent);
}

.mode-cta--ranked {
  background: var(--ink);
  color: var(--bg);
}

.mode-cta--locked {
  background: var(--bg);
  color: var(--text-body);
  border-style: dashed;
}

.mode-cta--locked .mode-cta-desc {
  color: var(--accent-dim);
}

.mode-cta-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.3rem;
}

.mode-cta-desc {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  opacity: 0.75;
}

.home {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.home-section h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.8rem;
}

.section-credit {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--accent-dim);
  margin-left: 0.6rem;
}

.home-section p {
  margin: 0;
  min-height: 1.4em;
  line-height: 1.6;
}

.home-section + .home-section {
  border-top: 1px solid var(--border);
  padding-top: 2rem;
}

.resource-links {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-top: 1rem;
}

.resource-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem;
  text-decoration: none;
  color: inherit;
}

.resource-card:hover,
.resource-card:focus-visible {
  border-color: var(--accent);
}

.resource-thumb {
  width: 96px;
  height: 54px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--bg-panel);
}

.resource-thumb--icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  border: 1px solid var(--border);
}

.resource-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.resource-title {
  font-size: 0.95rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-domain {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-dim);
}

.discord-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #5865f2;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(88, 101, 242, 0.35);
  transition: background 0.15s ease, transform 0.15s ease;
}

.discord-badge:hover {
  background: #4752c4;
  transform: translateY(-1px);
}

.discord-icon {
  width: 1.2rem;
  height: 1.2rem;
  fill: #fff;
  flex-shrink: 0;
}

.discord-link {
  display: inline-block;
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border-radius: 3px;
  text-decoration: none;
}

.discord-link:hover,
.discord-link:focus-visible {
  border-color: var(--accent);
}

.terminal {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  flex-shrink: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2rem;
  font-family: var(--font-mono);
}

.auth-form {
  max-width: 420px;
}

.auth-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 1.2rem;
}

.auth-fields {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.auth-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-body);
}

.auth-checkbox input {
  accent-color: var(--accent);
}

.auth-label .prompt {
  color: var(--accent-dim);
  font-size: 0.85rem;
}

.auth-label .answer-input {
  width: 100%;
}

.auth-switch {
  margin-top: 1.2rem;
  font-size: 0.85rem;
  color: var(--text-body);
}

.profile-subhead {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  margin: 1.6rem 0 0.6rem;
}

.profile-empty {
  font-size: 0.85rem;
  color: var(--accent-dim);
  margin: 0;
}

.profile-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.inventory-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

/* 희귀도별 배경 - .inventory-item(프로필)과 .gp-inventory-card(Group
   Product) 둘 다에 적용된다. 너무 진하지 않은, 은은한 톤으로 맞췄다. */
.rarity-common {
  background: #f1f1ef;
}

.rarity-rare {
  background: #e3f2fb;
}

.rarity-epic {
  position: relative;
  background: linear-gradient(135deg, #f2eaf9, #ddc9ef, #f2eaf9);
  background-size: 220% 220%;
  animation: rarity-soft-shimmer 6s ease-in-out infinite;
}

.rarity-legendary {
  position: relative;
  background: linear-gradient(135deg, #fdf6d8, #f6e3a1, #fdf6d8);
  background-size: 220% 220%;
  animation: rarity-soft-shimmer 6s ease-in-out infinite;
}

.rarity-mythic {
  position: relative;
  background: linear-gradient(
    115deg,
    #c97a7a 0%, #c76464 20%, #b8506a 45%, #c76464 70%, #c97a7a 100%
  );
  background-size: 300% 300%;
  animation: rarity-mythic-shimmer 7s ease-in-out infinite;
}

@keyframes rarity-mythic-shimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes rarity-soft-shimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@media (prefers-reduced-motion: reduce) {
  .rarity-epic,
  .rarity-legendary,
  .rarity-mythic {
    animation: none;
  }
}

.gp-composite-card {
  border-style: dashed !important;
}

.gp-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.gp-modal[hidden] {
  display: none;
}

.gp-modal-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.4rem 1.6rem;
  max-width: 26rem;
  width: 90%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.rarity-galoique {
  position: relative;
  background: linear-gradient(
    115deg,
    #1c1c1e 0%, #1c1c1e 40%,
    rgba(255, 255, 255, 0.4) 50%,
    #1c1c1e 60%, #1c1c1e 100%
  );
  background-size: 250% 250%;
  animation: rarity-galoique-shimmer 5s ease-in-out infinite;
  color: #f5f5f5;
}

.rarity-galoique .inventory-count,
.rarity-galoique .gp-inventory-count {
  background: #f5f5f5;
  color: #1c1c1e;
}

@keyframes rarity-galoique-shimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@media (prefers-reduced-motion: reduce) {
  .rarity-galoique {
    animation: none;
  }
}

.inventory-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.7rem;
}

.inventory-delete-form {
  display: inline-block;
}

.inventory-grant-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.inventory-delete-btn {
  background: transparent;
  border: none;
  color: var(--danger);
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.2rem;
}

.inventory-delete-btn:hover {
  color: #fff;
  background: var(--danger);
  border-radius: 3px;
}

.inventory-group {
  font-size: 1rem;
}

.inventory-count {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent-dim);
}

.profile-list li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

/* ---- 프로필 페이지 새 레이아웃 ---- */
.group-product-page {
  max-width: 700px;
}

.gp-layout {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
}

.gp-layout > .terminal {
  width: auto;
  flex: 1 1 320px;
  flex-shrink: 1;
}

.gp-compendium {
  max-width: 320px;
  margin: 0;
}

.gp-compendium-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 0.5rem;
}

.gp-compendium-card {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  cursor: default;
}

.achievement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 0.5rem;
}

.achievement-card {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem;
  cursor: default;
}

.achievement-card--locked {
  background: var(--bg);
  opacity: 0.55;
}

.achievement-card--locked .achievement-card-icon {
  color: var(--accent-dim);
}

.achievement-card-icon {
  font-size: 1.3rem;
  text-align: center;
  line-height: 1;
}

.achievement-card-icon--badge {
  font-family: var(--font-badge);
  font-weight: 700;
}

/* 오각형(quintic_solver) 업적만 아이콘이 도형이라 다른 것보다 작아
   보이므로, 상자의 대부분(약 75%)을 채우도록 키운다. 다만 아직 못 딴
   상태로 자물쇠가 떠 있을 때는(잠금 아이콘) 이 확대 규칙이 적용되면 안
   되므로 명시적으로 제외한다. */
.achievement-card[data-achievement-key="quintic_solver"] .achievement-card-icon:not(.achievement-card-icon--lock) {
  font-size: 3.3rem;
}

.achievement-card-icon--latex {
  font-size: 1rem;
}

.achievement-card-tooltip {
  display: none;
  position: absolute;
  bottom: 105%;
  left: 50%;
  transform: translateX(-50%);
  width: 160px;
  background: var(--ink);
  color: var(--bg);
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  font-size: 0.68rem;
  line-height: 1.4;
  white-space: normal;
  text-align: left;
  z-index: 20;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.achievement-card-tooltip-title {
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.achievement-card:hover .achievement-card-tooltip {
  display: block;
}

.gp-compendium-unknown {
  background: var(--bg);
  color: var(--border);
}

.gp-compendium-question {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--border);
}

.gp-compendium-tooltip {
  display: none;
  position: absolute;
  bottom: 105%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 0.5rem 0.7rem;
  border-radius: 6px;
  font-size: 0.7rem;
  white-space: nowrap;
  z-index: 30;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.gp-compendium-card:hover .gp-compendium-tooltip {
  display: block;
}

.gp-compendium-tooltip-title {
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
  text-align: center;
}

.gp-compendium-recipe {
  font-family: var(--font-mono);
}

.store-page {
  max-width: 700px;
}

.store-catalog-scroll {
  width: 100%;
  overflow-x: auto;
  margin: 0.8rem 0;
  padding-bottom: 0.5rem;
}

.store-catalog {
  display: flex;
  gap: 1rem;
  width: max-content;
}

.store-item-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 220px;
  min-height: 320px;
  flex-shrink: 0;
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 1rem;
}

.store-item-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
}

.store-item-desc {
  font-size: 0.78rem;
  color: var(--accent-dim);
  flex-grow: 1;
}

.store-item-materials-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-dim);
  margin-bottom: 0.3rem;
}

.store-item-materials-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.store-item-material-slot {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.15rem 0.35rem;
  font-size: 0.75rem;
}

.store-item-material-count {
  font-family: var(--font-mono);
  color: var(--accent-dim);
}

.store-item-level {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent-dim);
}

.store-item-feedback {
  font-size: 0.72rem;
  min-height: 1em;
  margin: 0.3rem 0 0;
}


.store-item-buy-btn {
  width: 100%;
}

.gp-operation-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.6rem;
  margin: 1.6rem 0 2.2rem;
}

.gp-slot {
  width: 130px;
  height: 130px;
  border: 2px dashed var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
}

.gp-slot[data-group]:not([data-group=""]) {
  border-style: solid;
  border-color: var(--accent);
}

.gp-hint {
  font-size: 0.82rem;
  color: var(--accent-dim);
  max-width: 34rem;
}

.gp-preview {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-body);
  min-height: 1.2em;
  margin: 0.5rem 0 0;
}

.gp-inventory-card {
  cursor: pointer;
}

.gp-inventory-card:hover {
  border-color: var(--accent);
}

/* 합성 진행 중에는 인벤토리를 눌러도 아무 반응이 없다는 걸 시각적으로도
   보여준다(클릭 자체는 JS에서 이미 무시하지만, 커서/톤으로도 알려준다). */
.gp-grid-locked {
  cursor: default;
}

.gp-grid-locked .gp-inventory-card {
  cursor: default;
  opacity: 0.6;
}

.gp-operator-symbol {
  font-family: var(--font-display);
  font-size: 2.2rem;
  color: var(--accent-dim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
}

/* 1단계: 연산이 정해지는 동안 후보 기호가 빠르게 바뀌며 흔들린다. */
.gp-operator-symbol.deciding {
  color: var(--accent);
  animation: gp-operator-jitter 0.15s linear infinite;
}

@keyframes gp-operator-jitter {
  0% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.35) rotate(12deg); }
  100% { transform: scale(1) rotate(-8deg); }
}

/* 2단계: 연산이 확정된 순간 한 번 반짝이며 자리를 잡는다. */
.gp-operator-symbol.settled {
  color: var(--ink);
  animation: gp-operator-settle 0.6s ease-out;
}

@keyframes gp-operator-settle {
  0% { transform: scale(2); text-shadow: 0 0 14px var(--accent); color: var(--accent); }
  60% { transform: scale(0.9); }
  100% { transform: scale(1); text-shadow: none; }
}

/* 3단계: 재료 두 칸이 사라지면서... */
.gp-slot-consuming {
  animation: gp-slot-consume 0.6s ease-in forwards;
}

@keyframes gp-slot-consume {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.6) rotate(8deg); }
}

/* ...결과 칸이 빛나며 새 군을 맞이한다. */
.gp-result-synthesizing {
  animation: gp-result-flash 0.6s ease-out;
}

@keyframes gp-result-flash {
  0% { box-shadow: 0 0 0 rgba(0, 0, 0, 0); transform: scale(0.85); border-color: var(--border); }
  50% { box-shadow: 0 0 22px var(--accent); border-color: var(--accent); transform: scale(1.05); }
  100% { box-shadow: 0 0 0 rgba(0, 0, 0, 0); transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .gp-operator-symbol.deciding,
  .gp-operator-symbol.settled,
  .gp-slot-consuming,
  .gp-result-synthesizing {
    animation: none;
  }
}

.gp-operator {
  font-family: var(--font-display);
  font-size: 2.2rem;
  color: var(--accent-dim);
}

.gp-cong {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--accent-dim);
  margin: 0 0.2rem;
}

.gp-cong-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.gp-material-slot {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  border: 1px dashed var(--accent);
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
  font-size: 0.85rem;
  cursor: default;
}

.gp-material-slot.gp-material-insufficient {
  border-color: var(--danger);
}

.gp-material-slot.gp-material-insufficient .gp-material-count {
  color: var(--danger);
}

.gp-material-count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-dim);
}

.gp-result-slot {
  border-style: solid;
  border-color: var(--ink);
  background: rgba(143, 168, 120, 0.08);
}

.gp-result-slot[data-group]:not([data-group=""]) {
  border-color: var(--success);
}

.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.admin-rules-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  margin-top: 0.8rem;
}

.admin-rules-table th,
.admin-rules-table td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.6rem;
  text-align: left;
  max-width: 16rem;
  word-wrap: break-word;
}

.gp-debug-row {
  margin-bottom: 1rem;
  padding: 0.5rem 0.8rem;
  border: 1px dashed var(--border);
  border-radius: 6px;
  display: inline-block;
}

.gp-debug-label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent-dim);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.gp-debug-label select {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--bg);
  color: var(--text-body);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.2rem 0.4rem;
}

.gp-inventory-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
}

.earned-groups:not(:empty) {
  margin-top: 0.6rem;
}

.gp-inventory-card {
  position: relative;
  width: 84px;
  height: 84px;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.gp-inventory-count {
  position: absolute;
  top: -0.55rem;
  right: -0.55rem;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
  line-height: 1.3;
}

.leaderboard-page {
  max-width: 900px;
}

.leaderboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.6rem;
  margin-top: 1.2rem;
}

.leaderboard-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.leaderboard-col-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.8rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--ink);
}

.leaderboard-toggle {
  display: flex;
  gap: 0.4rem;
}

.lb-toggle-btn {
  flex: 1;
  text-align: center;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-body);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.3rem 0.4rem;
}

.lb-toggle-btn:hover {
  border-color: var(--accent);
}

.lb-toggle-btn.is-active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.leaderboard-sub-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--accent-dim);
  margin: 1rem 0 0.5rem;
}

.leaderboard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-height: 15rem;
}

.leaderboard-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  padding: 0.15rem 0.3rem;
  border-radius: 4px;
}

.leaderboard-list li.lb-gold {
  background: rgba(212, 175, 55, 0.16);
}

.leaderboard-list li.lb-silver {
  background: rgba(170, 170, 170, 0.16);
}

.leaderboard-list li.lb-bronze {
  background: rgba(184, 115, 51, 0.16);
}

.lb-gold .lb-name,
.lb-silver .lb-name,
.lb-bronze .lb-name {
  font-weight: 600;
  color: var(--ink);
}

.lb-rank {
  flex-shrink: 0;
  width: 1.4rem;
  font-family: var(--font-mono);
  color: var(--accent-dim);
}

.lb-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
  color: var(--text-body);
  border-bottom: 1px solid transparent;
}

.lb-name:hover {
  border-bottom-color: var(--accent);
}

.lb-value {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.8rem;
}

.leaderboard-pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.leaderboard-pager a {
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}

.leaderboard-pager a:hover {
  border-bottom-color: var(--accent);
}

.lb-pager-disabled {
  color: var(--border);
}

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

.profile-page {
  max-width: 720px;
}

.profile-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.4rem;
}

.profile-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.profile-avatar {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.profile-avatar-input {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  max-width: 9rem;
}

.profile-avatar-save {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-body);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
}

.profile-avatar-save:hover,
.profile-avatar-save:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.profile-identity {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.profile-username {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0;
}

.profile-joined {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent-dim);
}

.profile-header-right {
  display: flex;
  gap: 2rem;
}

.profile-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.profile-stat-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.2rem;
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rank-badge--inline {
  width: 1.7rem;
  height: 1.7rem;
  flex-shrink: 0;
}

.rank-badge--inline .profile-rank-value {
  font-size: 0.72rem;
}

.rank-badge {
  position: relative;
  width: 3.6rem;
  height: 3.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 32% 28%, #ffffff, #d7dade 75%);
  border: 2px solid var(--ink);
  box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.7), 0 2px 4px rgba(0, 0, 0, 0.18);
}

.profile-rank-value {
  min-width: 1.2em;
  display: inline-block;
  font-size: 1.15rem;
  position: relative;
  z-index: 1;
}

.rank-badge .katex {
  color: var(--ink);
}

.rank-badge.rank-silver {
  background: radial-gradient(circle at 32% 28%, #f4f6f7, #9aa0a6 78%);
  border-color: #7d8388;
  box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.85), 0 2px 8px rgba(154, 160, 166, 0.6);
}

.rank-badge.rank-gold {
  background: radial-gradient(circle at 32% 28%, #fff6d8, #c9a227 78%);
  border-color: #a3811c;
  box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.85), 0 2px 10px rgba(201, 162, 39, 0.6);
}

.rank-badge.rank-platinum {
  background: radial-gradient(circle at 32% 28%, #edfbf7, #8fb8b0 78%);
  border-color: #6b968d;
  box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.85), 0 2px 10px rgba(143, 184, 176, 0.6);
}

.rank-badge.rank-silver .profile-rank-value,
.rank-badge.rank-gold .profile-rank-value,
.rank-badge.rank-platinum .profile-rank-value {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

/* 실버/골드/플래티넘 뱃지에만 은은하게 지나가는 광택 애니메이션을 준다. */
.rank-badge.rank-silver::after,
.rank-badge.rank-gold::after,
.rank-badge.rank-platinum::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.65) 50%, transparent 65%);
  background-size: 220% 220%;
  animation: rank-shine 3.2s ease-in-out infinite;
}

@keyframes rank-shine {
  0% { background-position: 200% 0%; }
  100% { background-position: -20% 0%; }
}

@media (prefers-reduced-motion: reduce) {
  .rank-badge.rank-silver::after,
  .rank-badge.rank-gold::after,
  .rank-badge.rank-platinum::after {
    animation: none;
  }
}

.profile-stat-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-dim);
  max-width: 8rem;
}

.profile-bio {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  margin-bottom: 1rem;
}

.profile-bio-text {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-body);
  white-space: pre-wrap;
}

.profile-bio-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.profile-bio-input {
  width: 100%;
  min-height: 4.5rem;
  resize: vertical;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-body);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  padding: 0.6rem;
  outline: none;
}

.profile-bio-input:focus {
  border-color: var(--accent);
}

.profile-bio-save {
  align-self: flex-end;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-body);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.35rem 0.9rem;
  border-radius: 4px;
  cursor: pointer;
}

.profile-bio-save:hover,
.profile-bio-save:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.profile-tabs {
  margin-bottom: 1rem;
}

.profile-tab-btn {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-body);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.6rem 1rem;
  cursor: pointer;
}

.profile-tab-btn:hover,
.profile-tab-btn:focus-visible {
  border-color: var(--accent);
}

.profile-tab-caret {
  transition: transform 0.2s ease;
}

.profile-tab-btn[aria-expanded="true"] .profile-tab-caret {
  transform: rotate(180deg);
}

.profile-tab-panel {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 6px 6px;
  padding: 0.8rem 1rem;
}

.profile-solve-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.profile-solve-item {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.8rem 1rem;
}

.profile-solve-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.6rem;
}

.profile-solve-header .profile-subhead {
  margin: 0;
}

.profile-sort {
  display: flex;
  gap: 0.9rem;
}

.profile-sort-link {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent-dim);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.profile-sort-link:hover {
  color: var(--text-body);
}

.profile-sort-link.is-active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.profile-solve-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.profile-solve-eq {
  font-size: 1.1rem;
  overflow-x: auto;
  flex: 1;
  min-width: 0;
}

.profile-solve-points {
  flex-shrink: 0;
  font-weight: 700;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.profile-solve-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
  color: var(--accent-dim);
  font-size: 0.78rem;
}

.profile-solve-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.profile-solve-toggle {
  margin-top: 0.6rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-body);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
}

.profile-solve-toggle:hover,
.profile-solve-toggle:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.profile-solve-delete-form {
  margin-top: 0.6rem;
}

.profile-solve-delete-btn {
  background: transparent;
  border: 1px solid var(--danger);
  border-radius: 4px;
  color: var(--danger);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
}

.profile-solve-delete-btn:hover,
.profile-solve-delete-btn:focus-visible {
  background: var(--danger);
  color: #fff;
}

.profile-solve-solution {
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.profile-solve-solution[hidden] {
  display: none;
}

.profile-solve-answer-line {
  font-size: 1rem;
  color: var(--text-body);
  overflow-x: auto;
}

.profile-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.2rem;
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.profile-pagination a {
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}

.profile-pagination a:hover {
  border-bottom-color: var(--accent);
}

.weekly-score-banner {
  text-align: center;
  margin-bottom: 1.4rem;
}

.weekly-number {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent-dim);
  margin-bottom: 0.2rem;
}

.weekly-score {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.8rem;
  color: var(--ink);
}

.terminal-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-size: 0.8rem;
  margin-bottom: 1.6rem;
}

.status-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.terminal-status .points {
  color: var(--accent-dim);
}

.ink-indicator {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-body);
  cursor: default;
}

.ink-icon {
  font-size: 0.9rem;
}

.ink-tooltip {
  display: none;
  position: absolute;
  top: 130%;
  right: 0;
  z-index: 5;
  width: max-content;
  max-width: 14rem;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.72rem;
  line-height: 1.4;
  padding: 0.5rem 0.7rem;
  border-radius: 6px;
  white-space: pre-line;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.ink-indicator:hover .ink-tooltip {
  display: block;
}

.admin-ink-form {
  display: inline-block;
}

.admin-ink-btn {
  background: transparent;
  border: 1px dashed var(--danger);
  border-radius: 4px;
  color: var(--danger);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 0.15rem 0.4rem;
  cursor: pointer;
}

.admin-ink-btn:hover {
  background: var(--danger);
  color: #fff;
}

.debug-category {
  display: none; /* JS가 토글 상태에 따라 inline으로 바꿔준다 */
  color: var(--danger);
  font-family: var(--font-mono);
  opacity: 0.8;
  margin-right: auto;
}

.category-display {
  display: none; /* JS가 casual 모드일 때만 inline으로 바꿔준다 */
  color: var(--accent-dim);
  font-family: var(--font-mono);
  margin-right: auto;
}

.debug-toggle-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--border);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  cursor: pointer;
}

.debug-toggle-btn:hover,
.debug-toggle-btn:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.debug-toggle-btn.active {
  border-color: var(--danger);
  color: var(--danger);
}

.mode-switcher {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.mode-btn {
  background: transparent;
  border: none;
  color: var(--text-body);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
}

.mode-btn + .mode-btn {
  border-left: 1px solid var(--border);
}

.mode-lock {
  font-size: 0.7rem;
  margin-left: 0.2rem;
}

.mode-btn--locked {
  opacity: 0.7;
}

.mode-btn[aria-selected="true"] {
  background: var(--accent);
  color: var(--bg);
}

.mode-btn:hover:not([aria-selected="true"]) {
  color: var(--accent);
}

.weekly-edit-link {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.2rem 0.5rem;
  text-decoration: none;
  color: var(--text-body);
}

.weekly-edit-link:hover,
.weekly-edit-link:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.equation-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  margin: 1.5rem 0 2.2rem;
}

.loading-spinner {
  display: none;
  flex-shrink: 0;
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.loading-spinner.active {
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .loading-spinner {
    animation: none;
  }
}

.weekly-photo-section {
  margin: 1rem 0;
  padding: 1rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.weekly-photo-upload-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.weekly-photo-upload-btn {
  display: inline-block;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
}

.weekly-photo-upload-btn:hover {
  opacity: 0.85;
}

.weekly-photo-hint {
  font-size: 0.75rem;
  color: var(--accent-dim);
}

.weekly-photo-warning {
  font-size: 0.75rem;
  color: var(--danger);
  margin: 0.5rem 0 0;
}

.weekly-photo-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.7rem;
}

.weekly-photo-thumb {
  position: relative;
  width: 90px;
  height: 90px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.weekly-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.weekly-photo-remove-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 1.3rem;
  height: 1.3rem;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
}

.equation {
  font-size: 1.3rem;
  color: var(--ink);
  text-align: center;
  overflow-x: auto;
  white-space: nowrap;
  padding-bottom: 0.2rem;
}

.tschirnhaus-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  margin: 0.6rem 0;
}

.tschirnhaus-btn-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
}

.tschirnhaus-hint {
  font-size: 0.75rem;
  color: var(--accent-dim);
}

.equation--small {
  font-size: 1.05rem;
}

.tschirnhaus-substitution {
  font-size: 0.85rem;
  color: var(--accent-dim);
  text-align: center;
}

.equation::-webkit-scrollbar {
  height: 4px;
}

.equation::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.equation .katex {
  color: var(--ink);
}

/* KaTeX 자체 스타일시트(katex.min.css)가 어떤 이유로든 못 불러와지면,
   화면에는 안 보이고 스크린리더용으로만 있어야 할 MathML 레이어가 그대로
   노출되면서 위의 color 규칙 때문에 어두운 사각형처럼 보이는 문제가 생길
   수 있다. katex.min.css의 로딩 여부와 무관하게 항상 숨겨지도록
   우리 스타일시트에서도 명시적으로 처리해둔다. */
.katex-mathml {
  position: absolute;
  clip: rect(1px, 1px, 1px, 1px);
  padding: 0;
  border: 0;
  height: 1px;
  width: 1px;
  overflow: hidden;
}

/* Windows 고대비 모드 등 "forced-colors" 환경에서는 브라우저가 배경/테두리
   색을 강제로 지정해버리는데, KaTeX는 분수선/근호 등을 투명한 테두리나
   보이지 않는 요소로 구현하는 경우가 많아서 그런 요소들이 갑자기 색이
   채워진 사각형처럼 보이는 문제가 생길 수 있다. KaTeX 자체 렌더링 색을
   그대로 쓰도록 명시해서 이 문제를 막는다. */
@media (forced-colors: active) {
  .katex, .katex * {
    forced-color-adjust: none;
  }
}

.answer-block {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  border-top: 1px solid var(--border);
  padding-top: 1.3rem;
}

#answer-groups {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.answer-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  transition: border-color 0.35s ease, background-color 0.35s ease;
}

.answer-group.correct {
  border-color: var(--success);
  background-color: rgba(143, 168, 120, 0.16);
  animation: answer-reveal 0.4s ease;
}

.answer-group.wrong {
  border-color: var(--danger);
  background-color: rgba(181, 97, 90, 0.16);
  animation: answer-reveal 0.4s ease;
}

@keyframes answer-reveal {
  0% { transform: scale(0.96); }
  55% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .answer-group.correct,
  .answer-group.wrong {
    animation: none;
  }
}

.answer-line {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.answer-line .prompt {
  color: var(--accent-dim);
  min-width: 2.4rem;
  padding-top: 0.4rem;
}

.answer-input {
  flex: 1;
  min-width: 0;
  align-self: flex-start;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text-body);
  font-family: var(--font-mono);
  font-size: 1rem;
  padding: 0.4rem 0.2rem;
  outline: none;
}

.answer-input:focus {
  border-bottom-color: var(--accent);
}

.button-stack {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.root-btn-row,
.const-btn-row {
  display: flex;
  gap: 0.6rem;
}

.root-btn {
  flex-shrink: 0;
  width: 1.8rem;
  height: 1.8rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-body);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1;
  border-radius: 3px;
  cursor: pointer;
}

.root-btn sup {
  font-size: 0.65em;
}

.root-btn:hover,
.root-btn:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.const-btn {
  flex-shrink: 0;
  width: 1.8rem;
  height: 1.8rem;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--accent-dim);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1rem;
  line-height: 1;
  border-radius: 3px;
  cursor: pointer;
}

.const-btn:hover,
.const-btn:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

/* 근이 아주 길어질 수 있어서(사차식 등), 줄바꿈 대신 가로 스크롤로 처리한다.
   더 이상 클릭해서 커서를 옮기는 기능은 없다 - 순수하게 보기용 미리보기다. */
.answer-preview {
  min-height: 1.8em;
  font-size: 1.3rem;
  padding: 0.2rem 0.1rem 0.5rem;
  margin-bottom: 0.3rem;
  overflow-x: auto;
  white-space: nowrap;
  cursor: default;
  border-bottom: 1px solid var(--border);
}

.answer-preview:empty::before {
  content: 'type below';
  font-size: 0.85rem;
  font-family: var(--font-mono);
  color: var(--border);
}

.answer-group:focus-within .answer-preview {
  border-bottom-color: var(--accent);
}

.answer-preview .katex {
  color: var(--text-body);
}

.answer-preview::-webkit-scrollbar {
  height: 4px;
}

.answer-preview::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.side-quest {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.6rem;
  flex-wrap: wrap;
}

.side-quest-input {
  flex: 1;
  min-width: 12rem;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 4px;
  color: var(--text-body);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.3rem 0.5rem;
  outline: none;
}

.side-quest-input::placeholder {
  color: var(--border);
}

.side-quest-input:focus {
  border-color: var(--accent);
  border-style: solid;
}

.side-quest-input.correct {
  border-color: var(--success);
  border-style: solid;
}

.side-quest-input.wrong {
  border-color: var(--danger);
  border-style: solid;
}

.action-row {
  display: flex;
  gap: 0.7rem;
  margin-top: 0.4rem;
}

.next-btn-right {
  margin-left: auto;
}

.action-row button {
  background: transparent;
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border-radius: 3px;
  cursor: pointer;
}

.action-row button:hover,
.action-row button:focus-visible {
  border-color: var(--accent);
}

.action-row button:disabled {
  opacity: 0.5;
  cursor: default;
}

.feedback {
  margin: 1.2rem 0 0;
  min-height: 1.4em;
  font-size: 0.95rem;
}

.feedback.correct {
  color: var(--success);
}

.feedback.wrong {
  color: var(--danger);
}

/* ---- 푸터 ---- */
.announcement-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
  background: rgba(154, 190, 226, 0.15);
  border-bottom: 1px solid var(--border);
  padding: 0.7rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.announcement-banner[hidden] {
  display: none;
}

.announcement-message {
  flex: 1 1 auto;
  min-width: 200px;
}

.announcement-poll {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.announcement-poll-btn {
  background: var(--bg);
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.25rem 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  cursor: pointer;
}

.announcement-poll-btn:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.announcement-poll-result {
  font-size: 0.78rem;
  color: var(--accent-dim);
}

.announcement-poll-result--mine {
  color: var(--ink);
  font-weight: 600;
}

.announcement-actions {
  display: flex;
  gap: 0.6rem;
  flex-shrink: 0;
}

.announcement-actions button {
  background: transparent;
  border: none;
  color: var(--accent-dim);
  font-size: 0.72rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

.announcement-actions button:hover {
  color: var(--danger);
}

.site-footer {
  text-align: center;
  padding: 1.2rem;
  font-size: 0.8rem;
  color: var(--accent-dim);
  border-top: 1px solid var(--border);
}

/* ---- 반응형 ---- */
@media (max-width: 480px) {
  .site-header {
    padding: 1rem;
  }
  main {
    padding: 1rem;
  }
  .terminal {
    padding: 1.25rem;
  }
  .equation {
    font-size: 1.3rem;
  }
}

/* ---- 접근성: 키보드 포커스 표시 ---- */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
