/* Craftie Game V1 -- webVault-inspired theme (cream / Playfair / card grid) */
@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:wght@600;700&display=swap");

:root {
  --ink: #27242b;
  --muted: #99939b;
  --soft: #aaa4aa;
  --paper: #faf9f7;
  --panel: #f3eee8;
  --line: #ebe7e2;
  --line-strong: #e7e3df;
  --beige: #9a8c7e;
  --dark: #29262d;
  --card: #fff;
  --radius: 17px;
  font-family: "DM Sans", sans-serif;
  color: var(--ink);
  background: var(--paper);
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
a { color: inherit; text-decoration: none; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--paper); }
button, input { font: inherit; }
button { border: 0; }

.cg-shell { min-height: 100vh; }

.cg-header {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
}

.cg-brand { display: flex; align-items: center; gap: 12px; }
.cg-brand-mark {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 13px;
  background: var(--panel);
  color: var(--beige);
  font-size: 20px;
}
.cg-brand-title { font-size: 15px; font-weight: 700; letter-spacing: 0.08em; }
.cg-brand-subtitle { margin-top: 2px; font-size: 12px; color: var(--muted); }

.cg-search {
  width: 270px; height: 43px;
  display: flex; align-items: center; gap: 9px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: #fff;
  color: var(--soft);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.cg-search:focus-within { border-color: #cbc4bd; box-shadow: 0 4px 20px rgba(39, 36, 43, 0.05); }
.cg-search input {
  width: 100%; border: 0; outline: 0; background: transparent;
  color: var(--ink); font-size: 13px;
}
.cg-search input::placeholder { color: var(--soft); }
.cg-search-clear { padding: 0; cursor: pointer; background: transparent; color: var(--soft); font-size: 20px; line-height: 1; }

.cg-main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding-bottom: 80px; }

.cg-hero {
  margin-top: 55px; padding: 50px 55px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 40px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
}
.cg-eyebrow { margin: 0 0 15px; font-size: 11px; font-weight: 700; letter-spacing: 0.15em; color: #9a9189; }
.cg-hero h1 {
  margin: 0; font-family: "Playfair Display", serif;
  font-size: clamp(38px, 5vw, 62px); line-height: 1.02; letter-spacing: -0.035em; font-weight: 700;
}
.cg-hero h1 span { color: var(--beige); }
.cg-hero-desc { max-width: 570px; margin: 22px 0 0; color: #827b77; font-size: 14px; line-height: 1.7; }
.cg-hero-stats { display: flex; gap: 24px; flex-shrink: 0; }
.cg-stat { min-width: 110px; padding: 12px 16px; text-align: center; background: #fff; border-radius: 14px; border: 1px solid var(--line-strong); }
.cg-stat strong { display: block; font-family: "Playfair Display", serif; font-size: 24px; font-weight: 700; }
.cg-stat span { font-size: 11px; color: var(--muted); }

.cg-section { margin-top: 65px; }
.cg-section-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 24px; }
.cg-section-head h2 { margin: 0; font-family: "Playfair Display", serif; font-size: 30px; letter-spacing: -0.02em; }
.cg-section-head p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.cg-section-head .cg-count { display: inline-block; padding: 3px 9px; border-radius: 99px; background: #fff; border: 1px solid var(--line-strong); color: #5f595e; font-size: 11px; font-weight: 700; }

/* Card grid */
.cg-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.cg-card {
  position: relative; display: block; padding: 0; overflow: hidden; text-align: left;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--card); cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.cg-card:hover { transform: translateY(-4px); border-color: #d9d2ca; box-shadow: 0 15px 35px rgba(39, 36, 43, 0.08); }
.cg-card-preview { position: relative; height: 190px; display: grid; place-items: center; background: #f2eee9; overflow: hidden; }
.cg-card-preview.lg { height: 220px; }
.cg-card-glyph { font-size: 52px; filter: drop-shadow(0 6px 12px rgba(39, 36, 43, 0.12)); }
.cg-card-count {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  padding: 3px 9px; border-radius: 99px; background: rgba(255, 255, 255, 0.92);
  color: #5f595e; font-size: 11px; font-weight: 700; box-shadow: 0 2px 8px rgba(39, 36, 43, 0.1);
}
.cg-card-arrow {
  position: absolute; bottom: 10px; right: 10px; z-index: 2;
  color: rgba(255, 255, 255, 0.95); opacity: 0; transform: translateX(-4px);
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35)); transition: 0.2s;
  font-size: 15px; line-height: 1;
}
.cg-card:hover .cg-card-arrow { opacity: 1; transform: translateX(0); }
.cg-card-info { position: relative; z-index: 0; padding: 16px; }
.cg-card-info h3 {
  margin: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  color: #302c32; font-size: 13px; line-height: 1.45;
}
.cg-card-info p { margin: 8px 0 0; color: var(--soft); font-size: 11px; }
.cg-card-meta { margin: 0 0 6px !important; display: flex; align-items: baseline; gap: 5px; }
.cg-card-meta strong { font-family: "Playfair Display", serif; font-size: 22px; font-weight: 700; color: var(--ink); line-height: 1; }
.cg-card-meta span { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

.cg-back {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 11px;
  background: #fff; color: #5f595e; font-size: 13px; cursor: pointer; transition: 0.2s;
}
.cg-back:hover { background: var(--dark); color: #fff; border-color: var(--dark); }

.cg-cat-hero { margin-top: 35px; display: flex; align-items: center; gap: 20px; }
.cg-cat-icon { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 18px; background: var(--panel); color: var(--beige); font-size: 30px; }
.cg-cat-hero h1 { margin: 0; font-family: "Playfair Display", serif; font-size: clamp(34px, 5vw, 52px); line-height: 1; letter-spacing: -0.03em; }
.cg-cat-hero p:last-child { margin: 9px 0 0; color: var(--muted); font-size: 13px; }

.cg-empty { padding: 70px 20px; text-align: center; border: 1px dashed #ded9d4; border-radius: 20px; }
.cg-empty h3 { margin: 12px 0 5px; }
.cg-empty p { margin: 0; color: #999; font-size: 13px; }

.cg-footer { margin-top: 60px; padding: 26px 0 40px; text-align: center; color: var(--muted); font-size: 12px; }

@media (max-width: 1000px) { .cg-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 850px) {
  .cg-header { align-items: flex-start; flex-direction: column; gap: 16px; }
  .cg-search { width: 100%; }
  .cg-hero { padding: 35px; flex-direction: column; align-items: flex-start; }
}
@media (max-width: 700px) {
  .cg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cg-card-preview { height: 170px; }
}
@media (max-width: 600px) {
  .cg-header, .cg-main { width: min(100% - 24px, 1180px); }
  .cg-header { padding: 18px 0; flex-direction: column; gap: 18px; }
  .cg-hero { margin-top: 25px; padding: 28px; border-radius: 22px; }
  .cg-hero h1 { font-size: 39px; }
  .cg-hero-stats { gap: 10px; width: 100%; }
  .cg-hero-stats .cg-stat { flex: 1; min-width: 0; }
  .cg-section { margin-top: 45px; }
}
@media (max-width: 480px) { .cg-grid { grid-template-columns: 1fr; } .cg-card-preview { height: 210px; } }
