:root {
  --bg: #f6f1e7;
  --paper: #fffdfa;
  --ink: #232323;
  --muted: #5a564f;
  --accent: #c6512d;
  --accent-dark: #8f3318;
  --line: #dfd6c6;
  --radius: 18px;
  --shadow: 0 16px 40px rgba(35, 35, 35, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 10%, #ffe7c6 0%, transparent 40%),
    radial-gradient(circle at 88% 80%, #f7c9ad 0%, transparent 38%),
    var(--bg);
}

.bg-shape {
  position: fixed;
  border: 1px solid rgba(35, 35, 35, 0.08);
  pointer-events: none;
  z-index: 0;
}

.bg-shape-1 {
  width: 240px;
  height: 240px;
  border-radius: 34% 66% 47% 53% / 44% 37% 63% 56%;
  right: 3vw;
  top: 8vh;
}

.bg-shape-2 {
  width: 180px;
  height: 180px;
  border-radius: 70% 30% 51% 49% / 40% 56% 44% 60%;
  left: 5vw;
  bottom: 8vh;
}

.layout {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
  display: grid;
  gap: 1.2rem;
}

.hero {
  padding: 1rem 0.2rem;
  animation: fade-up 600ms ease;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-dark);
  font-weight: 800;
  margin: 0;
}

h1,
h2 {
  font-family: Georgia, "Times New Roman", serif;
  margin: 0.4rem 0;
  line-height: 1.2;
}

.hero p {
  max-width: 70ch;
  color: var(--muted);
}

.composer,
.deck {
  background: color-mix(in srgb, var(--paper) 86%, white 14%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem;
}

.hint,
.counter {
  margin: 0.2rem 0;
  color: var(--muted);
}

.card-preview-shell {
  position: relative;
  width: min(100%, 340px);
  margin-top: 0.8rem;
}

.card-preview {
  width: 100%;
  aspect-ratio: 63 / 93;
  border-radius: 0;
  border: 2px solid #101010;
  background: #fff;
  color: #0a0a0a;
  padding: 1rem 0.95rem 2.2rem;
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  line-height: 1.5;
  font-weight: 700;
  font-family: "Helvetica Neue", "Arial", sans-serif;
  resize: none;
  display: block;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.15);
  transition: transform 170ms ease, box-shadow 170ms ease;
}

.card-preview:focus {
  outline: none;
  transform: translateY(-2px);
  box-shadow:
    inset 0 0 0 2px rgba(0, 0, 0, 0.03),
    0 12px 22px rgba(0, 0, 0, 0.18);
}

.composer-footer,
.deck-topbar,
.actions {
  margin-top: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 0.65rem 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms ease, filter 140ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(115deg, var(--accent-dark), var(--accent));
  color: #fff;
}

.btn-secondary {
  background: #ece4d8;
  color: #322e28;
}

.cards-grid {
  margin-top: 0.8rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}

@media (max-width: 900px) {
  .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }
}

.saved-card {
  position: relative;
  aspect-ratio: 63 / 93;
  border-radius: 0;
  border: 2px solid #111;
  background: #fff;
  padding: 1rem 0.95rem 2.2rem;
  line-height: 1.5;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: "Helvetica Neue", "Arial", sans-serif;
  animation: fade-up 280ms ease;
}

.saved-card p {
  margin: 0;
  color: #0a0a0a;
  white-space: pre-wrap;
}

.card-logo {
  position: absolute;
  left: 1rem;
  bottom: 0.9rem;
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #313131;
  font-weight: 700;
  pointer-events: none;
}

.saved-card button {
  position: absolute;
  right: 0.4rem;
  top: 0.4rem;
  border: none;
  border-radius: 999px;
  background: #111;
  color: #fff;
  width: 1.5rem;
  height: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.empty-state {
  color: var(--muted);
  padding: 0.6rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #fffcf6;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: 1fr 1.1fr;
    grid-template-areas:
      "hero hero"
      "composer deck";
  }

  .hero {
    grid-area: hero;
  }

  .composer {
    grid-area: composer;
    align-self: start;
  }

  .deck {
    grid-area: deck;
  }
}
