:root {
  --bg: #0c0f16;
  --surface: #141925;
  --border: rgba(255, 255, 255, 0.12);
  --text: #f3f1ec;
  --muted: #9ea4b4;
  --accent: #e6b87d;
  --accent-soft: rgba(230, 184, 125, 0.16);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: radial-gradient(circle at top left, #171d2d 0%, var(--bg) 60%);
  color: var(--text);
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
}

.hidden {
  display: none !important;
}

.lib-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 44px 24px 64px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.lib-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.lib-eyebrow {
  font-size: 0.76rem;
  letter-spacing: 0.24em;
  color: var(--accent);
  margin-bottom: 8px;
}

.lib-title {
  font-family: 'Noto Serif KR', Georgia, serif;
  font-size: clamp(1.6rem, 3.5vw, 2.3rem);
  font-weight: 700;
}

.lib-auth {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.cloud-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
}

.cloud-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8a92a4;
}

.cloud-badge.cloud {
  color: #dafae7;
}

.cloud-badge.cloud .dot {
  background: #5ee39a;
  box-shadow: 0 0 8px rgba(94, 227, 154, 0.7);
}

.btn-auth {
  padding: 7px 15px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-auth:hover {
  background: var(--accent);
  color: #151821;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 24px;
}

.game-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.game-card:not(.placeholder):hover {
  transform: translateY(-4px);
  border-color: rgba(230, 184, 125, 0.55);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.card-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  background-size: cover;
  background-position: center;
}

.card-cover-grad {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(20, 25, 37, 0.92) 0%, transparent 65%);
}

.card-tags {
  position: absolute;
  left: 14px;
  bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-size: 0.72rem;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(12, 15, 22, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--text);
}

.card-body {
  padding: 18px 20px 22px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-title {
  font-family: 'Noto Serif KR', Georgia, serif;
  font-size: 1.25rem;
  margin-bottom: 6px;
}

.card-sub {
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 16px;
  flex: 1;
}

.card-stats {
  display: flex;
  gap: 14px;
  font-size: 0.8rem;
  color: var(--accent);
  margin-bottom: 16px;
}

.btn-play {
  display: block;
  text-align: center;
  text-decoration: none;
  padding: 11px 16px;
  border-radius: 10px;
  background: linear-gradient(135deg, #e6b87d, #d19957);
  color: #151821;
  font-weight: 700;
  font-size: 0.92rem;
  transition: filter 0.18s ease;
}

.btn-play:hover {
  filter: brightness(1.07);
}

.game-card.placeholder {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.02);
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

.placeholder-inner {
  text-align: center;
  padding: 24px;
  color: var(--muted);
}

.placeholder-inner .plus {
  display: inline-block;
  font-size: 2rem;
  color: var(--accent);
  margin-bottom: 8px;
}

.placeholder-inner h3 {
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 8px;
}

.placeholder-inner p {
  font-size: 0.82rem;
  line-height: 1.6;
}

.lib-footer {
  margin-top: auto;
  padding-top: 48px;
  font-size: 0.8rem;
  color: var(--muted);
}

code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 5px;
  color: var(--accent);
  font-size: 0.85em;
}

/* Auth Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 8, 13, 0.78);
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  z-index: 2;
  width: min(430px, 94vw);
  background: #141925;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
}

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

.modal-header h2 {
  font-family: 'Noto Serif KR', Georgia, serif;
  font-size: 1.18rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.modal-desc {
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 16px;
}

.field-label {
  display: block;
  font-size: 0.8rem;
  color: var(--accent);
  margin-bottom: 6px;
}

.text-input {
  width: 100%;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-family: inherit;
  font-size: 0.94rem;
  margin-bottom: 14px;
  outline: none;
}

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

.auth-error {
  font-size: 0.8rem;
  color: #ff9c9c;
  margin-bottom: 12px;
  line-height: 1.45;
}

.auth-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.btn-secondary {
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  font-family: inherit;
  font-size: 0.84rem;
  cursor: pointer;
}
