* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #06070b; color: #cfd6e4; font-family: "Cormorant Garamond", "Iowan Old Style", Georgia, serif; }
canvas { display: block; position: fixed; inset: 0; cursor: grab; }
canvas:active { cursor: grabbing; }

#frame {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  z-index: 10; display: flex; gap: 10px; align-items: center;
  background: rgba(8, 10, 14, 0.78); padding: 10px 16px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.07); backdrop-filter: blur(8px);
  font-size: 14px; max-width: 92vw;
}
#frame button, #frame input {
  background: transparent; border: none; color: #cfd6e4;
  font-family: inherit; font-size: 14px; outline: none;
}
#frame input { border-bottom: 1px solid rgba(255,255,255,0.15); padding: 4px 6px; min-width: 80px; }
#frame input::placeholder { color: rgba(207, 214, 228, 0.35); font-style: italic; }
#frame button { cursor: pointer; padding: 4px 10px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.12); transition: all 0.2s; }
#frame button:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.25); }
#frame button:disabled { opacity: 0.4; cursor: wait; }

#hint {
  position: fixed; top: 22px; left: 50%; transform: translateX(-50%);
  z-index: 5; font-size: 13px; letter-spacing: 0.06em; color: rgba(207, 214, 228, 0.45);
  font-variant: small-caps; pointer-events: none; user-select: none;
}
#count { color: rgba(207, 214, 228, 0.55); }

#card {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 20; background: rgba(8, 10, 14, 0.92); padding: 28px 40px;
  border: 1px solid rgba(255,255,255,0.08); border-radius: 4px;
  max-width: min(420px, 86vw); text-align: center;
  font-size: 16px; line-height: 1.6;
  display: none;
}
#card h2 { font-weight: 400; font-size: 26px; letter-spacing: 0.04em; margin-bottom: 14px; font-style: italic; }
#card .meta { color: rgba(207, 214, 228, 0.5); font-size: 13px; font-variant: small-caps; letter-spacing: 0.08em; margin-top: 14px; }
#card .word { color: rgba(207, 214, 228, 0.8); font-style: italic; margin-top: 8px; }
#card .close { position: absolute; top: 6px; right: 12px; cursor: pointer; color: rgba(207, 214, 228, 0.4); font-size: 18px; }
#card .close:hover { color: rgba(207, 214, 228, 0.9); }
