:root {
  --bg: #0b0910;
  --panel: rgba(22, 19, 30, 0.88);
  --border: rgba(160, 138, 98, 0.5);
  --gold: #ddbe7a;
  --cream: #f6efe3;
  --muted: #b9afa3;
  --plum: #4a3a63;
  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--cream);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  min-height: 100vh;
  background: linear-gradient(180deg, rgba(0,0,0,.55), rgba(11,9,16,.95) 60%), url(bg.jpg) center top / cover fixed, var(--bg);
}

#app {
  max-width: 520px;
  margin: 0 auto;
  padding: calc(16px + var(--tg-content-safe-area-inset-top, 0px)) 16px calc(32px + var(--tg-content-safe-area-inset-bottom, 0px));
}

h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: normal; margin: 0; }
h1 { font-size: 28px; color: var(--gold); text-align: center; margin: 8px 0 4px; }
h2 { font-size: 22px; color: var(--gold); }
.sub { color: var(--muted); text-align: center; margin: 0 0 24px; }

.tile {
  display: flex; align-items: center; gap: 14px;
  width: 100%; margin: 0 0 12px; padding: 18px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.tile:active { transform: scale(.98); }
.tile .icon { font-size: 28px; width: 40px; text-align: center; color: var(--gold); }
.tile b { display: block; font-size: 18px; font-weight: 600; }
.tile span { color: var(--muted); font-size: 14px; }

.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin: 0 0 14px;
}

.board { display: flex; justify-content: center; gap: 10px; margin: 8px 0 20px; }
.board.one .card { width: min(62vw, 240px); }
.board.three .card { width: calc((100% - 20px) / 3); max-width: 150px; }

.card { aspect-ratio: 360 / 630; perspective: 900px; cursor: pointer; }
.card .inner {
  position: relative; width: 100%; height: 100%;
  transition: transform .7s cubic-bezier(.2,.7,.2,1); transform-style: preserve-3d;
}
.card.open .inner { transform: rotateY(180deg); }
.card .face {
  position: absolute; inset: 0; border-radius: 10px; overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border: 1px solid var(--border); box-shadow: 0 8px 24px rgba(0,0,0,.5);
  background: #16131e center / cover no-repeat;
}
.card .back { background-image: url(back.jpg); }
.card .front { transform: rotateY(180deg); }
.card.rev .front { transform: rotateY(180deg) rotate(180deg); }
.card .pos { text-align: center; color: var(--muted); font-size: 13px; margin-top: 6px; }
.hint-tap { text-align: center; color: var(--muted); margin: -8px 0 16px; }

.meaning h2 { margin-bottom: 2px; }
.meaning .orient { color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.meaning .label { color: var(--gold); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.meaning p { margin: 8px 0; }
.keywords { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.keywords span { border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; font-size: 13px; color: var(--muted); }

.cta { text-align: center; background: linear-gradient(160deg, rgba(74,58,99,.9), rgba(22,19,30,.92)); }
.cta p { margin: 0 0 14px; }
.btn {
  display: inline-block; width: 100%; padding: 14px; border: 0; border-radius: 12px;
  background: var(--gold); color: #16131e; font-family: inherit; font-size: 16px; font-weight: 600; line-height: 1.2; cursor: pointer;
}
.btn.ghost { background: transparent; color: var(--gold); border: 1px solid var(--border); margin-top: 10px; }
.soon { color: var(--muted); font-size: 14px; }

.fade { animation: fade .4s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
