:root{
  --bg:#ffffff;
  --card-bg:#f7fbff;
  --accent:#0b6cff;
  --muted:transparent; /* no grey text below names */
  --radius:14px;
  --card-width:320px;
  --gap:18px;
  font-family: "Inter", "Noto Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  color: var(--accent);
}

*{box-sizing:border-box}
html,body,#cards{height:100%}
body{
  margin:0;
  background:var(--bg);
  display:flex;
  min-height:100vh;
  align-items:flex-start;
  justify-content:center;
  padding:28px;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}

.wrap{
  width:100%;
  max-width:1100px;
}

.header{
  text-align:center;
  margin-bottom:14px;
}
.header .title{
  margin:0;
  font-family: "Space Mono", "Inter", monospace;
  font-size:1.65rem;
  font-weight:600;
  color:var(--accent);
  letter-spacing:0.6px;
}
.header .byline{
  margin-top:6px;
  font-size:0.85rem;
  color:rgba(11,108,255,0.85);
  font-weight:400;
}

/* Grid: two columns on wider screens and mobile portrait (always two columns) */
.cards-grid{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap:var(--gap);
  justify-items:center;
  margin-bottom:22px;
}

/* Card shell */
.card{
  width:100%;
  max-width:var(--card-width);
  perspective:1200px;
}
.card-inner{
  position:relative;
  width:100%;
  padding-top:60%; /* aspect ratio */
  transform-style:preserve-3d;
  transition: transform 600ms cubic-bezier(.2,.9,.3,1);
  border-radius:var(--radius);
  cursor:pointer;
  box-shadow: 0 8px 20px rgba(8,15,30,0.08);
}
.card.is-flipped .card-inner{ transform: rotateY(180deg); }

.face{
  position:absolute;
  inset:0;
  backface-visibility:hidden;
  border-radius:var(--radius);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:space-between;
  padding:18px;
  gap:12px;
  overflow:visible;
}

/* emoji badge in top-left of each face */
.face .emoji{
  position:absolute;
  /* moved further to the corner: slightly negative offsets so the glyph sits on the very edge */
  top:4px;
  left:4px;
  transform: translate(-12%, -18%); /* nudge diagonally up-left for a corner placement */
  font-size:1.35rem;
  line-height:1;
  z-index:20;
  pointer-events:none;
  user-select:none;
}

/* Front */
.face.front{
  background: linear-gradient(180deg, rgba(11,108,255,0.08), rgba(11,108,255,0.03));
  border: 1px solid rgba(11,108,255,0.09);
}

/* Back */
.face.back{
  transform:rotateY(180deg);
  background: linear-gradient(180deg, rgba(6,10,23,0.03), rgba(255,255,255,0));
  border:1px solid rgba(6,10,23,0.04);
}

/* Animal visual (simple illustrative circle) */
.art{
  width:100%;
  height:72%;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:12px;
  background:transparent;
  box-shadow:none;
  font-weight:600;
  font-size:1.65rem; /* slightly smaller so it doesn't touch edges */
  color:var(--accent);
  text-transform:capitalize;
  letter-spacing:0.4px;
  padding:6%;
  position:relative;
}

/* AI image behind the text */
.art .ai-img{
  /* removed AI image - no styles needed */
}

/* hide label area layout and use centered speaker below via .face */
.label{ display:none; }

/* the visible word, clickable */
.word{
  position:relative;
  z-index:10;
  color:var(--accent);
  font-size:1.65rem;
  text-align:center;
  cursor:pointer;
  user-select:none;
  background:transparent;
  padding:4px 8px;
  border-radius:8px;
}

/* place speaker centered at bottom of each face */
/* speakers removed: no button/icon styles needed */
.icon-wrap{ width:44px;height:44px;display:inline-grid;place-items:center; }

.footer{ text-align:center; color:var(--muted); font-size:0.85rem; margin-top:8px }
.footer-text{ 
    color:#000;         /* changed to black as requested */
    font-weight:700;    /* bold */
}

/* small accessibility focus */
.card-inner:focus-visible{ outline:3px solid rgba(11,108,255,0.16); border-radius:var(--radius); }

/* touch friendly: ensure enough spacing on mobile */
@media (max-width:520px){
  .cards-grid{ gap:12px; }
  .card-inner{ transition: transform 400ms cubic-bezier(.2,.9,.3,1); }
  .icon-wrap{ width:40px;height:40px; }
  .face .emoji{
    top:3px;
    left:3px;
    transform: translate(-14%, -20%);
    font-size:1.25rem;
  }
}

/* Splash screen */
.splash{
  position:fixed;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(255,255,255,0.98);
  z-index:60;
  padding:24px;
}
.splash-card{
  width:100%;
  max-width:520px;
  text-align:center;
  border-radius:14px;
  padding:24px;
  box-shadow:0 20px 50px rgba(8,15,30,0.12);
  background:var(--bg);
  color:var(--accent);
}
.splash-title{ font-size:1.8rem; margin:0 0 6px; font-weight:700; }
.splash-by{ font-size:0.9rem; color:rgba(11,108,255,0.85); margin-bottom:12px; }
.splash-tutorial{ font-size:0.95rem; color:rgba(0,0,0,0.7); margin:8px 0 18px; line-height:1.35; }
.splash-start{
  background:var(--accent);
  color:#fff;
  border:0;
  padding:10px 18px;
  border-radius:10px;
  font-weight:600;
  cursor:pointer;
}
.splash-hint{ margin-top:12px; font-size:0.85rem; color:rgba(0,0,0,0.55); font-weight:700; }

/* Splash demo visuals */
.splash-demo{ display:flex; flex-direction:column; align-items:center; gap:12px; margin:10px 0 18px; }
.demo-card{ width:160px; height:120px; perspective:800px; position:relative; }
.demo-inner{ width:100%; height:100%; border-radius:12px; transform-style:preserve-3d; transition: transform 600ms cubic-bezier(.2,.9,.3,1); box-shadow:0 8px 20px rgba(8,15,30,0.06); }
.demo-face{ position:absolute; inset:0; backface-visibility:hidden; border-radius:12px; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:10px; font-weight:700; color:var(--accent); }
.demo-front{ background: linear-gradient(180deg, rgba(11,108,255,0.08), rgba(11,108,255,0.03)); }
.demo-back{ background: linear-gradient(180deg, rgba(6,10,23,0.03), rgba(255,255,255,0)); transform:rotateY(180deg); color:rgba(0,0,0,0.85); }

/* hand animation */
.hand-wrap{ position:relative; width:220px; height:48px; pointer-events:none; margin-top:4px; overflow:visible; }
.hand-emoji{ position:absolute; left:0; top:6px; font-size:28px; transform:translateX(-8px); opacity:0.95; }
.hand-trail{ position:absolute; left:28px; top:20px; height:6px; width:160px; border-radius:6px; background:rgba(11,108,255,0.12); transform-origin:left center; opacity:0.0; }

.splash-hint-anim{ font-size:0.95rem; color:rgba(0,0,0,0.6); font-weight:700; }

/* keyframes: hand slides left->right and demo card flips in sequence */
@keyframes handSlide {
  0%{ transform: translateX(0); opacity:0; }
  8%{ opacity:1; }
  40%{ transform: translateX(130px); opacity:1; }
  70%{ opacity:1; }
  100%{ transform: translateX(160px); opacity:0; }
}
@keyframes trailGrow {
  0%{ transform: scaleX(0); opacity:0; }
  12%{ transform: scaleX(0.25); opacity:0.6; }
  40%{ transform: scaleX(1); opacity:0.9; }
  80%{ opacity:0.4; }
  100%{ opacity:0; transform: scaleX(1.1); }
}
@keyframes demoFlip {
  0%{ transform: rotateY(0deg); }
  35%{ transform: rotateY(0deg); }
  45%{ transform: rotateY(180deg); }
  85%{ transform: rotateY(180deg); }
  100%{ transform: rotateY(0deg); }
}

/* animation trigger classes */
.hand-anim .hand-emoji{ animation: handSlide 3.6s ease-in-out infinite; }
.hand-anim .hand-trail{ animation: trailGrow 3.6s ease-in-out infinite; transform-origin:left center; }
.hand-anim .demo-inner{ animation: demoFlip 3.6s ease-in-out infinite; }

/* keep demo responsive on small screens */
@media (max-width:520px){
  .demo-card{ width:130px; height:96px; }
  .hand-wrap{ width:180px; height:44px; }
  .hand-emoji{ font-size:24px; top:4px; }
  .hand-trail{ left:24px; width:120px; top:18px; height:5px; }
}

/* hide splash when dismissed */
.splash.hidden{ display:none; }